Cleanup build system and configuration.

* Drop unused variables from build system that refer to the system
  libraries.
* Drop unused lists of libgcc objects.
* Drop no longer used variables from configuration script.
* Remove no longer needed building of kernel-libgcc and -libsupc++ from
  build_cross_tools_gcc4, only the boot-specific (32-bit) libs are
  built for a x86_64 target.
* Explicitly disable threads and TLS support when building the cross
  compiler, as the only libraries that are used by Haiku's build system
  is the 32-bit libgcc and libsupc++ for the bootloader on x86_64 (and
  for that neither is wanted).
This commit is contained in:
Oliver Tappe
2014-08-13 13:32:45 +02:00
parent 37f558d5a3
commit 11ae3c5fe7
4 changed files with 23 additions and 222 deletions
+6 -53
View File
@@ -59,7 +59,6 @@ rule ArchitectureSetup architecture
HAIKU_LINK_$(architecture) = $(HAIKU_CC_$(architecture)) ;
HAIKU_LINKFLAGS_$(architecture) = $(gccBaseFlags) ;
HAIKU_HDRS_$(architecture) = [ FStandardHeaders $(architecture) ] ;
HAIKU_CCFLAGS_$(architecture) += $(gccBaseFlags) -nostdinc ;
HAIKU_C++FLAGS_$(architecture) += $(gccBaseFlags) -nostdinc ;
@@ -155,48 +154,6 @@ rule ArchitectureSetup architecture
HAIKU_PRIVATE_SYSTEM_HEADERS_$(architecture)
= [ PrivateHeaders $(DOT) system system/arch/$(cpu) ] ;
# Add some grist to the libgcc objects
HAIKU_GCC_LIBGCC_OBJECTS_$(architecture)
= $(HAIKU_GCC_LIBGCC_OBJECTS_$(architecture):G=libgcc!$(architecture)) ;
# List of libgcc objects we don't want to keep
HAIKU_GCC_LIBGCC_OBJECTS_EXCLUDES_$(architecture)
= eabi.o ;
# the C++ standard library
HAIKU_BUILD_SHARED_LIBSTDC++_$(architecture) = ;
if $(HAIKU_SHARED_LIBSTDC++_$(architecture)) {
HAIKU_LIBSTDC++_$(architecture)
= $(HAIKU_SHARED_LIBSTDC++_$(architecture)) ;
} else {
# no shared library available with the compiler -- build it
if $(gccVersion[1]) = 2 {
HAIKU_LIBSTDC++_$(architecture) = libstdc++.r4.so ;
} else {
HAIKU_LIBSTDC++_$(architecture) = <$(architecture)>libstdc++.so ;
}
HAIKU_SHARED_LIBSTDC++_$(architecture)
= $(HAIKU_LIBSTDC++_$(architecture)) ;
HAIKU_BUILD_SHARED_LIBSTDC++_$(architecture) = 1 ;
}
# the C++ support (runtime) library
HAIKU_BUILD_SHARED_LIBSUPC++_$(architecture) = ;
if $(HAIKU_SHARED_LIBSUPC++_$(architecture)) {
HAIKU_LIBSUPC++_$(architecture)
= $(HAIKU_SHARED_LIBSUPC++_$(architecture)) ;
} else {
# no shared library available with the compiler -- build it for gcc 4
if $(gccVersion[1]) != 2 {
HAIKU_SHARED_LIBSUPC++_$(architecture)
= <$(architecture)>libsupc++.so ;
HAIKU_BUILD_SHARED_LIBSUPC++_$(architecture) = 1 ;
}
HAIKU_LIBSUPC++_$(architecture)
= $(HAIKU_SHARED_LIBSUPC++_$(architecture)) ;
}
# library and executable glue code
local commonGlueCode =
<src!system!glue!$(architecture)>init_term_dyn.o
@@ -237,10 +194,6 @@ rule ArchitectureSetup architecture
HAIKU_LIBRARY_NAME_MAP_$(architecture)_$(i)
= $(library:G=$(libraryGrist)) ;
}
HAIKU_LIBRARY_NAME_MAP_$(architecture)_libstdc++
= $(HAIKU_LIBSTDC++_$(architecture)) ;
HAIKU_LIBRARY_NAME_MAP_$(architecture)_libsupc++
= $(HAIKU_LIBSUPC++_$(architecture)) ;
HAIKU_LIBRARY_NAME_MAP_$(architecture)_localestub
= <$(architecture)>liblocalestub.a ;
if $(architecture) = $(HAIKU_PACKAGING_ARCHS[1]) {
@@ -752,11 +705,11 @@ rule MultiArchSubDirSetup architectures
# packaging architectures, if <architectures> is empty) an object is
# prepared that can be used for an "on ... { ... }" block to set up subdir
# variables for the respective packaging architecture. Most notably
# TARGET_PACKAGING_ARCH, TARGET_ARCH, TARGET_LIBSUPC++, and TARGET_LIBSTDC++
# are set to the values for the respective packaging architecture. The
# per-subdir variables SOURCE_GRIST, LOCATE_TARGET, LOCATE_SOURCE,
# SEARCH_SOURCE, *_LOCATE_TARGET, are reset. All SUBDIR* and config
# variables are set to the values they had when this rule was invoked.
# TARGET_PACKAGING_ARCH, TARGET_ARCH are set to the values for the
# respective packaging architecture. The per-subdir variables SOURCE_GRIST,
# LOCATE_TARGET, LOCATE_SOURCE, SEARCH_SOURCE, *_LOCATE_TARGET, are reset.
# All SUBDIR* and config variables are set to the values they had when this
# rule was invoked.
local result ;
architectures ?= $(TARGET_PACKAGING_ARCHS) ;
@@ -774,7 +727,7 @@ rule MultiArchSubDirSetup architectures
TARGET_PACKAGING_ARCH on $(architectureObject) = $(architecture) ;
local var ;
for var in TARGET_ARCH TARGET_LIBSUPC++ TARGET_LIBSTDC++ {
for var in TARGET_ARCH {
$(var) on $(architectureObject) = $($(var)_$(architecture)) ;
}
+4 -19
View File
@@ -132,9 +132,6 @@ if $(HAIKU_PACKAGING_ARCH) {
# define primary packaging architecture macro
HAIKU_DEFINES = __HAIKU_PRIMARY_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ;
HAIKU_LIBSUPC++ = $(HAIKU_LIBSUPC++_$(HAIKU_PACKAGING_ARCH)) ;
HAIKU_LIBSTDC++ = $(HAIKU_LIBSTDC++_$(HAIKU_PACKAGING_ARCH)) ;
# distro compatibility level defines
HAIKU_DISTRO_COMPATIBILITY ?= "default" ;
@@ -655,8 +652,6 @@ local buildVars =
PRIVATE_KERNEL_HEADERS
LIBSTDC++ LIBSUPC++
NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB
EXECUTABLE_MIME_TYPE
@@ -680,8 +675,6 @@ local archDependentBuildVars =
PRIVATE_SYSTEM_HEADERS
LIBSTDC++ LIBSUPC++
ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR
DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR
;
@@ -696,17 +689,11 @@ if $(TARGET_PLATFORM) = haiku {
TARGET_$(var) = $(HAIKU_$(var)) ;
}
TARGET_KERNEL_LIBGCC
= $(HAIKU_KERNEL_LIBGCC_$(TARGET_PACKAGING_ARCH)) ;
TARGET_KERNEL_LIBSUPC++
= $(HAIKU_KERNEL_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ;
TARGET_BOOT_LIBGCC
= $(HAIKU_BOOT_LIBGCC_$(TARGET_PACKAGING_ARCH)) ;
TARGET_BOOT_LIBSUPC++
= $(HAIKU_BOOT_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ;
TARGET_BOOT_LIBGCC = $(HAIKU_BOOT_LIBGCC_$(TARGET_PACKAGING_ARCH)) ;
TARGET_BOOT_LIBSUPC++ = $(HAIKU_BOOT_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ;
TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ;
TARGET_BOOT_BOARD ?= $(HAIKU_BOOT_BOARD) ;
TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ;
TARGET_BOOT_BOARD ?= $(HAIKU_BOOT_BOARD) ;
local architecture ;
for architecture in $(TARGET_PACKAGING_ARCHS) {
@@ -724,8 +711,6 @@ if $(TARGET_PLATFORM) = haiku {
TARGET_$(var)_$(TARGET_PACKAGING_ARCH) = $(HOST_$(var)) ;
}
TARGET_KERNEL_LIBGCC = ;
TARGET_KERNEL_LIBSUPC++ = ;
TARGET_BOOT_LIBGCC = ;
TARGET_BOOT_LIBSUPC++ = ;
+10 -43
View File
@@ -16,7 +16,6 @@ installDir=$4
shift 4
additionalMakeArgs=$*
kernelCcFlags="-D_KERNEL_MODE"
ccFlags="-O2"
cxxFlags="-O2"
case $haikuMachine in
@@ -25,7 +24,6 @@ x86_64-*)
# explicitly using --enable-multilib that causes a build
# failure
binutilsConfigureArgs=""
kernelCcFlags="$kernelCcFlags -mno-red-zone"
;;
m68k-*)
binutilsConfigureArgs="--enable-multilib"
@@ -212,7 +210,7 @@ CFLAGS="$ccFlags" CXXFLAGS="$cxxFlags" "$gccSourceDir/configure" \
--prefix="$installDir" $buildHostSpec --target=$haikuMachine \
--disable-nls --disable-shared --with-system-zlib \
--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
--with-sysroot="$sysrootDir" --enable-threads=posix --enable-tls \
--with-sysroot="$sysrootDir" --disable-threads --disable-tls \
$gccConfigureArgs \
|| exit 1
@@ -228,46 +226,15 @@ $MAKE $additionalMakeArgs install || {
exit 1
}
# build libraries for the kernel if the target arch requires it
if [ -n "$kernelCcFlags" ]; then
# switch threads config to single for libgcc
ln -sf "$gccSourceDir/libgcc/gthr-single.h" "$haikuMachine/libgcc/gthr-default.h"
$MAKE -C "$haikuMachine/libgcc" clean
$MAKE -C "$haikuMachine/libgcc" CFLAGS="-g -O2 $kernelCcFlags" || {
echo "Error: Building kernel libgcc failed." >&2
exit 1
}
cp "$haikuMachine/libgcc/libgcc.a" \
"$installDir/$haikuMachine/lib/libgcc-kernel.a" || exit 1
$MAKE -C "$haikuMachine/libstdc++-v3/libsupc++" clean
# switch threads config to single for libsupc++
[ -f "$haikuMachine/32/libstdc++-v3/include/$haikuMachine/bits/gthr-default.h" ] \
&& cp -f "$haikuMachine/32/libstdc++-v3/include/$haikuMachine/bits/gthr-single.h" \
"$haikuMachine/32/libstdc++-v3/include/$haikuMachine/bits/gthr-default.h"
cp -f "$haikuMachine/libstdc++-v3/include/$haikuMachine/bits/gthr-single.h" \
"$haikuMachine/libstdc++-v3/include/$haikuMachine/bits/gthr-default.h"
[ -f "$haikuMachine/32/libstdc++-v3/config.h" ] \
&& sed -i '/.*_GLIBCXX_HAS_GTHREADS.*/c\#undef _GLIBCXX_HAS_GTHREADS' \
"$haikuMachine/32/libstdc++-v3/config.h"
[ -f "$haikuMachine/32/libstdc++-v3/include/$haikuMachine/bits/c++config.h" ] \
&& sed -i '/.*_GLIBCXX_HAS_TLS.*/c\#undef _GLIBCXX_HAS_TLS' \
"$haikuMachine/32/libstdc++-v3/include/$haikuMachine/bits/c++config.h"
sed -i '/.*_GLIBCXX_HAS_GTHREADS.*/c\#undef _GLIBCXX_HAS_GTHREADS' \
"$haikuMachine/libstdc++-v3/config.h"
sed -i '/.*_GLIBCXX_HAVE_TLS.*/c\#undef _GLIBCXX_HAVE_TLS' \
"$haikuMachine/libstdc++-v3/include/$haikuMachine/bits/c++config.h"
$MAKE -C "$haikuMachine/libstdc++-v3/libsupc++" CFLAGS="-g -O2 $kernelCcFlags" \
CXXFLAGS="-g -O2 $kernelCcFlags" || {
echo "Error: Building kernel libsupc++ failed." >&2
exit 1
}
cp "$haikuMachine/libstdc++-v3/libsupc++/.libs/libsupc++.a" \
"$installDir/$haikuMachine/lib/libsupc++-kernel.a" || exit 1
fi
case $haikuMachine in
x86_64-*)
# pick up the 32-bit libraries for the bootloader
bootLibgcc=`$installDir/bin/$haikuMachine-gcc -m32 -print-file-name=libgcc.a`
$installDir/bin/$haikuMachine-strip --strip-debug $bootLibgcc
bootLibsupcxx=`$installDir/bin/$haikuMachine-gcc -m32 -print-file-name=libsupc++.a`
$installDir/bin/$haikuMachine-strip --strip-debug $bootLibsupcxx
;;
esac
# cleanup