libroot: Properly fix linking with libgcc without cmdline overflow

Instead of listing all the objects we want from the libgcc archive
we just make a copy of it and remove those we don't want, and link
to it.

This should allow returning MAXLINE in jam to a sane value.
This commit is contained in:
François Revol
2013-10-08 23:34:57 +02:00
parent 3ad66bf0d6
commit 4d5508263e
2 changed files with 43 additions and 29 deletions
+4
View File
@@ -154,6 +154,10 @@ rule ArchitectureSetup architecture
HAIKU_GCC_LIBGCC_OBJECTS_$(architecture) HAIKU_GCC_LIBGCC_OBJECTS_$(architecture)
= $(HAIKU_GCC_LIBGCC_OBJECTS_$(architecture):G=libgcc!$(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 # the C++ standard library
HAIKU_BUILD_SHARED_LIBSTDC++_$(architecture) = ; HAIKU_BUILD_SHARED_LIBSTDC++_$(architecture) = ;
if $(HAIKU_SHARED_LIBSTDC++_$(architecture)) { if $(HAIKU_SHARED_LIBSTDC++_$(architecture)) {
+39 -29
View File
@@ -2,6 +2,31 @@ SubDir HAIKU_TOP src system libroot ;
UsePrivateHeaders libroot runtime_loader ; UsePrivateHeaders libroot runtime_loader ;
rule FilterArchive {
# FilterArchive <target> : <source> : <members to remove>
# set the tools according to the platform
AR on $(1) = $(TARGET_AR_$(TARGET_PACKAGING_ARCH)) d ;
# TODO: use $(TARGET_DELARFLAGS_$(TARGET_PACKAGING_ARCH))
RANLIB on $(1) = $(TARGET_RANLIB_$(TARGET_PACKAGING_ARCH)) ;
MakeLocateArch $(1) ;
Depends $(1) : $(2) ;
File $(1) : $(2) ;
# we don't want the path
# XXX: is it done this way?
NotFile $(3) ;
# delete the unwanted members
FilterArchive1 $(1) : $(3) ;
if $(RANLIB) { Ranlib $(1) ; }
}
actions FilterArchive1 {
$(AR) $(<) $(>)
}
local architectureObject ; local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] { for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) { on $(architectureObject) {
@@ -9,38 +34,25 @@ for architectureObject in [ MultiArchSubDirSetup ] {
UsePrivateSystemHeaders ; UsePrivateSystemHeaders ;
UnarchiveObjects $(HAIKU_GCC_LIBGCC_OBJECTS_$(architecture)) # Make a copy of libgcc without the objects we don't need
: $(HAIKU_GCC_LIBGCC_$(architecture)) ; FilterArchive <$(architecture)>libroot_libgcc_$(TARGET_ARCH).a
# we need to link against libgcc.a objects and make : $(HAIKU_GCC_LIBGCC_$(architecture))
# it available to other applications as in BeOS : $(HAIKU_GCC_LIBGCC_OBJECTS_EXCLUDES_$(architecture)) ;
# workaround for ARM having waaaaay too many objects in libgcc # One object to link them all...
# which fails execve() with too large argument list TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH) on
# when linking them directly into libroot. <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o =
local libgccObjects1 = [ on <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o
$(HAIKU_GCC_LIBGCC_OBJECTS_$(architecture)[1-800]) ; return $(TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH)) ]
local libgccObjects2 = --whole-archive ;
$(HAIKU_GCC_LIBGCC_OBJECTS_$(architecture)[801-]) ;
local librootLibgccObjects = MergeObject <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o
<$(architecture)>libgcc_part1_$(TARGET_ARCH).o ;
MergeObject <$(architecture)>libgcc_part1_$(TARGET_ARCH).o :
: :
$(libgccObjects1) : <$(architecture)>libroot_libgcc_$(TARGET_ARCH).a ;
;
if $(libgccObjects2) {
librootLibgccObjects +=
<$(architecture)>libgcc_part2_$(TARGET_ARCH).o ;
MergeObject <$(architecture)>libgcc_part2_$(TARGET_ARCH).o :
:
$(libgccObjects2)
;
}
local librootObjects = local librootObjects =
libroot_libgcc_$(TARGET_ARCH).o
os_main.o os_main.o
os_arch_$(TARGET_ARCH).o os_arch_$(TARGET_ARCH).o
@@ -96,7 +108,6 @@ for architectureObject in [ MultiArchSubDirSetup ] {
: :
libroot_init.c libroot_init.c
: :
$(librootLibgccObjects)
$(librootObjects) $(librootObjects)
$(librootNoDebugObjects) $(librootNoDebugObjects)
$(HAIKU_STATIC_LIBSUPC++_$(architecture)) $(HAIKU_STATIC_LIBSUPC++_$(architecture))
@@ -110,7 +121,6 @@ for architectureObject in [ MultiArchSubDirSetup ] {
: :
libroot_init.c libroot_init.c
: :
$(librootLibgccObjects)
$(librootObjects) $(librootObjects)
$(librootDebugObjects) $(librootDebugObjects)
$(HAIKU_STATIC_LIBSUPC++_$(architecture)) $(HAIKU_STATIC_LIBSUPC++_$(architecture))