Skip to content

Commit

Permalink
feat: add support for gdb and shared objects
Browse files Browse the repository at this point in the history
  • Loading branch information
johnyob committed Aug 3, 2024
1 parent d36c559 commit 2cfec7a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ FROM rust:buster as toolchain
RUN set -eux
COPY --from=builder /root/prefix /root/prefix
ENV PATH=/root/prefix/bin:$PATH \
LD_LIBRARY_PATH=/root/prefix/lib:$LD_LIBRARY_PATH
LD_LIBRARY_PATH=/root/prefix/riscv64-hermit/lib:/root/prefix/lib:$LD_LIBRARY_PATH
2 changes: 1 addition & 1 deletion newlib
18 changes: 6 additions & 12 deletions toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ export CFLAGS="-w"
export CXXFLAGS="-w"

# -O3 to enable optimizations
# -fPIE to enable position-independent code
# -fPIC to enable position-independent code
# -fpermissive to downgrade the implicit declaration errors to warnings (occurs when compiling newlib with GCC 14)
export CFLAGS_FOR_TARGET="-O3 -fPIE -fpermissive"
export CXXFLAGS_FOR_TARGET="-O3 -fPIE -fpermissive"
# -ggdb to enable debugging information
export CFLAGS_FOR_TARGET="-ggdb -O3 -fPIC -fpermissive"
export CXXFLAGS_FOR_TARGET="-ggdb -O3 -fPIC -fpermissive"

case "$TARGET" in
x86_64-*)
Expand Down Expand Up @@ -81,11 +82,7 @@ pushd "$BUILDDIR/binutils"
--with-sysroot \
--disable-werror \
--disable-multilib \
--disable-shared \
--disable-nls \
--disable-gdb \
--disable-libdecnumber \
--disable-readline \
--disable-sim \
--enable-tls \
--enable-lto \
Expand All @@ -112,7 +109,6 @@ pushd "$BUILDDIR/gcc-1"
--with-isl \
--enable-languages=c,c++,lto \
--disable-nls \
--disable-shared \
--disable-libssp \
--disable-libgomp \
--enable-threads=posix \
Expand All @@ -133,11 +129,11 @@ echo
mkdir -p "$BUILDDIR/hermit"

pushd "$HERE/hermit"
cargo run --package=xtask build --arch "$ARCH" --release --no-default-features --features pci,smp,acpi,newlib,tcp,dhcpv4 --target-dir "$BUILDDIR/hermit"
HERMIT_LOG_LEVEL_FILTER=Debug cargo run --package=xtask build --arch "$ARCH" --no-default-features --features pci,smp,acpi,newlib,tcp,dhcpv4 --target-dir "$BUILDDIR/hermit"
popd

mkdir -p "$PREFIX/$TARGET/lib"
cp "$BUILDDIR/hermit/$ARCH/release/libhermit.a" "$PREFIX/$TARGET/lib/libhermit.a"
cp "$BUILDDIR/hermit/$ARCH/debug/libhermit.a" "$PREFIX/$TARGET/lib/libhermit.a"

echo
echo "*****************************"
Expand All @@ -151,7 +147,6 @@ pushd "$BUILDDIR/newlib"
"$HERE/newlib/configure" \
--target="$TARGET" \
--prefix="$PREFIX" \
--disable-shared \
--disable-multilib \
--enable-lto \
--enable-newlib-io-c99-formats \
Expand Down Expand Up @@ -199,7 +194,6 @@ pushd "$BUILDDIR/gcc-2"
--without-libatomic \
--enable-languages=c,c++,lto \
--disable-nls \
--disable-shared \
--enable-libssp \
--enable-threads=posix \
--enable-libgomp \
Expand Down

0 comments on commit 2cfec7a

Please sign in to comment.