Do a separate libgcc build for the kernel as well.
Turns out that libgcc is needed, for some reason building the kernel with -O0 does not end up referencing libgcc but -O2 does. A separate build of it is done with -mno-red-zone, same reason as for libsupc++. Ended up being easy to rebuild with different CFLAGS: previously I'd tried doing `CFLAGS="-mno-red-zone" make` in the libgcc dir which didn't override, the correct way is `make CFLAGS="-mno-red-zone"`
This commit is contained in:
@@ -33,7 +33,7 @@ x86_64-*)
|
|||||||
# failure
|
# failure
|
||||||
binutilsConfigureArgs=""
|
binutilsConfigureArgs=""
|
||||||
gccConfigureArgs=""
|
gccConfigureArgs=""
|
||||||
kernelSupcxxFlags="-mno-red-zone"
|
kernelCcFlags="-mno-red-zone"
|
||||||
;;
|
;;
|
||||||
m68k-*)
|
m68k-*)
|
||||||
binutilsConfigureArgs="--enable-multilib"
|
binutilsConfigureArgs="--enable-multilib"
|
||||||
@@ -46,7 +46,7 @@ arm-*)
|
|||||||
*)
|
*)
|
||||||
binutilsConfigureArgs="--disable-multilib"
|
binutilsConfigureArgs="--disable-multilib"
|
||||||
gccConfigureArgs="--disable-multilib"
|
gccConfigureArgs="--disable-multilib"
|
||||||
kernelSupcxxFlags=
|
kernelCcFlags=
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -166,18 +166,26 @@ $MAKE $additionalMakeArgs install || {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# build libsupc++ for the kernel if the target arch requires it
|
# build libraries for the kernel if the target arch requires it
|
||||||
if [ -n "$kernelSupcxxFlags" ]; then
|
if [ -n "$kernelCcFlags" ]; then
|
||||||
cd $stdcxxObjDir
|
$MAKE -C $haikuMachine/libgcc clean
|
||||||
CFLAGS="-O2 $kernelSupcxxFlags" CXXFLAGS="-O2 $kernelSupcxxFlags" \
|
$MAKE -C $haikuMachine/libgcc CFLAGS="-g -O2 $kernelCcFlags" || {
|
||||||
$gccSourceDir/libstdc++-v3/configure --prefix=$installDir \
|
echo "Error: Building kernel libgcc failed." >&2
|
||||||
--target=$haikuMachine --host=$haikuMachine --disable-shared \
|
exit 1
|
||||||
--disable-multilib || exit 1
|
}
|
||||||
$MAKE $additionalMakeArgs -C libsupc++ || {
|
|
||||||
|
cp $haikuMachine/libgcc/libgcc.a \
|
||||||
|
$installDir/$haikuMachine/lib/libgcc-kernel.a || exit 1
|
||||||
|
|
||||||
|
$MAKE -C $haikuMachine/libstdc++-v3/libsupc++ clean
|
||||||
|
$MAKE -C $haikuMachine/libstdc++-v3/libsupc++ CFLAGS="-g -O2 $kernelCcFlags" \
|
||||||
|
CXXFLAGS="-g -O2 $kernelCcFlags" || {
|
||||||
echo "Error: Building kernel libsupc++ failed." >&2
|
echo "Error: Building kernel libsupc++ failed." >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
cp libsupc++/.libs/libsupc++.a $installDir/$haikuMachine/lib/libsupc++-kernel.a
|
|
||||||
|
cp $haikuMachine/libstdc++-v3/libsupc++/.libs/libsupc++.a \
|
||||||
|
$installDir/$haikuMachine/lib/libsupc++-kernel.a || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
|
|||||||
@@ -188,6 +188,17 @@ standard_gcc_settings()
|
|||||||
HAIKU_STATIC_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.a`
|
HAIKU_STATIC_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.a`
|
||||||
HAIKU_SHARED_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.so`
|
HAIKU_SHARED_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++.so`
|
||||||
|
|
||||||
|
# If the architecture has separate runtime libraries for the
|
||||||
|
# kernel, use them.
|
||||||
|
HAIKU_KERNEL_LIBGCC=`$HAIKU_CC -print-file-name=libgcc-kernel.a`
|
||||||
|
if [ $HAIKU_KERNEL_LIBGCC = libgcc-kernel.a ]; then
|
||||||
|
HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
|
||||||
|
fi
|
||||||
|
HAIKU_KERNEL_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++-kernel.a`
|
||||||
|
if [ $HAIKU_KERNEL_LIBSUPCXX = libsupc++-kernel.a ]; then
|
||||||
|
HAIKU_KERNEL_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
|
||||||
|
fi
|
||||||
|
|
||||||
local headers
|
local headers
|
||||||
if [ -d $gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION ]; then
|
if [ -d $gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION ]; then
|
||||||
headers=$gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION
|
headers=$gccdir/../../../../$HAIKU_GCC_MACHINE/include/c++/$HAIKU_GCC_RAW_VERSION
|
||||||
@@ -240,23 +251,17 @@ standard_gcc_settings()
|
|||||||
echo "Please download it from www.haiku-os.org...";
|
echo "Please download it from www.haiku-os.org...";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
|
||||||
|
HAIKU_KERNEL_LIBSUPCXX=
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$targetArch" = "x86_64" ]; then
|
if [ "$targetArch" = "x86_64" ]; then
|
||||||
# Kernel doesn't need libgcc, and has a special version of libsupc++
|
|
||||||
# built with the correct flags. Note: Should libgcc ever be needed for
|
|
||||||
# the x86_64 kernel, a separate build of it will be needed with
|
|
||||||
# -mno-red-zone, like for libsupc++.
|
|
||||||
HAIKU_KERNEL_LIBGCC=
|
|
||||||
HAIKU_KERNEL_LIBSUPCXX=`$HAIKU_CC -print-file-name=libsupc++-kernel.a`
|
|
||||||
|
|
||||||
# Boot loader is 32-bit, need the 32-bit libs.
|
# Boot loader is 32-bit, need the 32-bit libs.
|
||||||
HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 -print-libgcc-file-name`
|
HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 -print-libgcc-file-name`
|
||||||
HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 -print-file-name=libsupc++.a`
|
HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 -print-file-name=libsupc++.a`
|
||||||
else
|
else
|
||||||
HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
|
|
||||||
HAIKU_KERNEL_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
|
|
||||||
HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC
|
HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC
|
||||||
HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
|
HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user