From da44acc091d1179faca022ace02c84e634af4fb7 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Mon, 23 Dec 2019 18:06:59 +0100 Subject: [PATCH 1/5] mksh: use cross/wrappers --- cross/pkgs/mksh/build.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cross/pkgs/mksh/build.sh b/cross/pkgs/mksh/build.sh index c195f58..068d153 100755 --- a/cross/pkgs/mksh/build.sh +++ b/cross/pkgs/mksh/build.sh @@ -27,9 +27,10 @@ export MKSH=$CROSS_DIR/pkgs/mksh/ export MKSH_SRC=$MKSH/src/ export MKSH_BUILD=$MKSH/out/ export MKSHRC_PATH='~/lib/mkshrc' -export LIBS="-L$JEHANNE/posix/lib -lnewlibc -lnewlibm -lnewlibg -lposix" -export CPPFLAGS="-I$JEHANNE/posix/include '-DMKSHRC_PATH=\"$MKSHRC_PATH\"' '-DARCH=\"$ARCH\"'" +export LIBS=" -lm -lg" +export CPPFLAGS="'-DMKSHRC_PATH=\"$MKSHRC_PATH\"' '-DARCH=\"$ARCH\"'" +export PATH="$JEHANNE/hacking/cross/wrappers:$PATH" export LD_PRELOAD= echo -n Building mksh. From 5697f4bc7ffe5150f15043e5435543fbcb97aad5 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Fri, 27 Dec 2019 17:34:05 +0100 Subject: [PATCH 2/5] gcc native: explicit --build --- cross/native.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cross/native.sh b/cross/native.sh index f178765..64689a3 100755 --- a/cross/native.sh +++ b/cross/native.sh @@ -153,12 +153,13 @@ echo done. cp -pfr $JEHANNE/pkgs/binutils/2.33.1/posix/* $JEHANNE/posix rm $JEHANNE/posix/lib/*.la -echo -n Building gcc (and libgcc)... | tee -a $LOG +echo -n "Building gcc (and libgcc)..." | tee -a $LOG ( export GCC_BUILD_DIR=$JEHANNE_TOOLCHAIN/build/gcc-native && mkdir -p $GCC_BUILD_DIR && cd $GCC_BUILD_DIR && - $JEHANNE_TOOLCHAIN/src/gcc/configure --host=x86_64-jehanne \ + $JEHANNE_TOOLCHAIN/src/gcc/configure \ + --build=x86_64-pc-linux-gnu --host=x86_64-jehanne --target=x86_64-jehanne \ --enable-languages=c,c++ \ --prefix=/posix --with-sysroot=/ --with-build-sysroot=$JEHANNE \ --without-isl --with-gmp=$JEHANNE/posix --with-mpfr=$JEHANNE/posix --with-mpc=$JEHANNE/posix \ From 90272aea5ad9104d26974676af57642672d44578 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Fri, 27 Dec 2019 17:34:51 +0100 Subject: [PATCH 3/5] newlib: fix includes in CFLAGS_FOR_TARGET --- cross/pkgs/newlib/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cross/pkgs/newlib/build.sh b/cross/pkgs/newlib/build.sh index 75b1bbd..82aabd8 100755 --- a/cross/pkgs/newlib/build.sh +++ b/cross/pkgs/newlib/build.sh @@ -68,7 +68,7 @@ if [ "$NEWLIB_OPTIMIZATION" = "" ]; then fi export CC=gcc -export CFLAGS_FOR_TARGET="-g -gdwarf-2 -ggdb -O$NEWLIB_OPTIMIZATION -std=gnu11 -I$JEHANNE_TOOLCHAIN/cross/posix/lib/gcc/x86_64-jehanne/9.2.0/include -Lposix" +export CFLAGS_FOR_TARGET="-g -gdwarf-2 -ggdb -O$NEWLIB_OPTIMIZATION -std=gnu11 -isystem$JEHANNE_TOOLCHAIN/cross/posix/lib/gcc/x86_64-jehanne/9.2.0/include -lposix" ( rm -fr $NEWLIB_BUILD && From 18f33da3ddf2d9da70aad04de67bdcc8f0270975 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Fri, 27 Dec 2019 17:53:12 +0100 Subject: [PATCH 4/5] gcc native: wrap __application_newlib_init inside `extern "C" { }` --- cross/patch/gcc/gcc/config/jehanne.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cross/patch/gcc/gcc/config/jehanne.c b/cross/patch/gcc/gcc/config/jehanne.c index 9573a88..95ea4f9 100644 --- a/cross/patch/gcc/gcc/config/jehanne.c +++ b/cross/patch/gcc/gcc/config/jehanne.c @@ -21,9 +21,11 @@ extern "C" { #include #include +void __application_newlib_init(int argc, char *argv[]); + } -void +__attribute__((__used__)) void __application_newlib_init(int argc, char *argv[]) { sys_rfork(RFFDG | RFREND | RFNOTEG); From 540a07726fb140fbac28877ab53b9b222e46e5c4 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Fri, 27 Dec 2019 18:04:11 +0100 Subject: [PATCH 5/5] gcc native: include jehanne.o in extra_gcc_objs (do we need this?) --- cross/patch/gcc.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cross/patch/gcc.patch b/cross/patch/gcc.patch index 1b63c2f..f4aa37a 100644 --- a/cross/patch/gcc.patch +++ b/cross/patch/gcc.patch @@ -2,7 +2,7 @@ diff --git a/src/gcc/gcc/config.gcc b/src/gcc/gcc/config.gcc index ddd3b8f..702aa59 100644 --- a/src/gcc/gcc/config.gcc +++ b/src/gcc/gcc/config.gcc -@@ -947,6 +947,17 @@ case ${target} in +@@ -947,6 +947,18 @@ case ${target} in tmake_file="$tmake_file vms/t-vmsnative" fi ;; @@ -10,6 +10,7 @@ index ddd3b8f..702aa59 100644 + gas=yes + gnu_ld=yes + extra_objs="${extra_objs} jehanne.o" ++ extra_gcc_objs="${extra_gcc_objs} jehanne.o" + default_use_cxa_atexit=yes + case $target in + x86_64-*)