From 19faf1fa1f5aff4854377824e6d4a8b9c0c09032 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Wed, 10 Jan 2024 12:09:51 +0100 Subject: Introduce and honor BOOTSTRAP_CFLAGS ... and drop rule-injected LDFLAGS for all bootstrap targets in stage-0, as those flags might not be supported by the unknown bootstrap compiler. --- src/bootstrap/stage-0-binutils.TARGETS | 7 ++++--- src/bootstrap/stage-0-busybox.TARGETS | 1 + src/bootstrap/stage-0-gcc.TARGETS | 2 +- src/bootstrap/stage-0-make.TARGETS | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/bootstrap/stage-0-binutils.TARGETS b/src/bootstrap/stage-0-binutils.TARGETS index 3a42b4a..f1a8fb1 100644 --- a/src/bootstrap/stage-0-binutils.TARGETS +++ b/src/bootstrap/stage-0-binutils.TARGETS @@ -13,7 +13,7 @@ { "type": ["@", "rules", "CC/foreign/shell", "data"] , "cmds": [ "echo 'int main() {int i=1; return *((char*)&i) == 1;}' > endian_test.c" - , "${CC} -o endian_test endian_test.c" + , "${CC} ${CFLAGS} -o endian_test endian_test.c" , "CFLAGS=\"-D__$(./endian_test && echo BIG || echo LITTLE)_ENDIAN__=1\"" , "echo \"${CFLAGS}\" > ${DESTDIR}/cflags" ] @@ -36,7 +36,8 @@ [ "export LD=${CC}" , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=${LOCALBASE}/bin:$PATH" - , "export CFLAGS=\"$(cat flags/cflags)\"" + , "export CFLAGS=\"${CFLAGS} $(cat flags/cflags)\"" + , "unset LDFLAGS" , "./bootstrap-ar.sh src >build.log 2>&1 || (cat build.log && exit 1)" , "mv ar ${DESTDIR}/bin/" ] @@ -56,7 +57,7 @@ , "export AR=${LOCALBASE}/bin/ar" , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=${LOCALBASE}/bin:$PATH" - , "export CFLAGS=\"$(cat flags/cflags)\"" + , "export CFLAGS=\"${CFLAGS} $(cat flags/cflags)\"" , "unset LDFLAGS" , "if [ -f /lib/ld-musl-$(uname -m).so.1 ]; then" , " ln -s /lib/ld-musl-$(uname -m).so.1 ${TMPDIR}/ldd" diff --git a/src/bootstrap/stage-0-busybox.TARGETS b/src/bootstrap/stage-0-busybox.TARGETS index a6964e1..dff331d 100644 --- a/src/bootstrap/stage-0-busybox.TARGETS +++ b/src/bootstrap/stage-0-busybox.TARGETS @@ -54,6 +54,7 @@ , "export MAKE=${LOCALBASE}/bin/make" , "export CC=${LOCALBASE}/gcc/bin/gcc" , "export CXX=${LOCALBASE}/gcc/bin/g++" + , "unset CFLAGS LDFLAGS" , "${MAKE} HOSTCC=${CC} HOSTCXX=${CXX} CONFIG_EXTRA_LDLIBS=\"m resolv\" defconfig >configure.log 2>&1 || (cat configure.log && exit 1)" , "${MAKE} -j${NJOBS} HOSTCC=${CC} HOSTCXX=${CXX} CONFIG_EXTRA_LDLIBS=\"m resolv\" >build.log 2>&1 || (cat configure.log build.log && exit 1)" , "${MAKE} -j${NJOBS} HOSTCC=${CC} HOSTCXX=${CXX} CONFIG_EXTRA_LDLIBS=\"m resolv\" CONFIG_PREFIX=${DESTDIR} install >>build.log 2>&1 || (cat configure.log build.log && exit 1)" diff --git a/src/bootstrap/stage-0-gcc.TARGETS b/src/bootstrap/stage-0-gcc.TARGETS index 777b947..33812ef 100644 --- a/src/bootstrap/stage-0-gcc.TARGETS +++ b/src/bootstrap/stage-0-gcc.TARGETS @@ -103,7 +103,7 @@ , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=$(pwd)/binutils/bin:${LOCALBASE}/bin:$PATH" , "export BUILD_ROOT_DIR=${ACTION_DIR}" - , "unset CFLAGS LDFLAGS" + , "unset LDFLAGS" , "CONF_ARGS=" , "if [ -n \"$HOST_SYSTEM_HDR_DIR\" ]; then" , " CONF_ARGS=\"$CONF_ARGS --with-sysroot=/ --with-native-system-header-dir=$HOST_SYSTEM_HDR_DIR\"" diff --git a/src/bootstrap/stage-0-make.TARGETS b/src/bootstrap/stage-0-make.TARGETS index 3a38240..3dcefb3 100644 --- a/src/bootstrap/stage-0-make.TARGETS +++ b/src/bootstrap/stage-0-make.TARGETS @@ -18,6 +18,7 @@ , "export LD=${CC}" , "export AR=true" , "export RANLIB=true" + , "unset LDFLAGS" , "cd ${TMPDIR}" , "${WORKDIR}/configure --prefix=/ --disable-nls --disable-rpath --disable-load --disable-dependency-tracking >configure.log 2>&1 || (cat configure.log && exit 1)" , "./build.sh >build.log 2>&1 || true" -- cgit v1.2.3