svn commit: branches/uClibc_0_9_30: libnsl libresolv librt

aldot at uclibc.org aldot at uclibc.org
Thu Jan 22 09:50:30 UTC 2009


Author: aldot
Date: 2009-01-22 09:50:29 +0000 (Thu, 22 Jan 2009)
New Revision: 24956

Log:
- also link librt with --as-needed and do so unconditionally to work around
  bugs in gentoo's QA. (r24955 from trunk)
  Just add UCLIBC_HAS_SSP to the "and" of link.asneeded to properly take SSP
  into account, if you prefer.


Modified:
   branches/uClibc_0_9_30/Rules.mak
   branches/uClibc_0_9_30/libnsl/Makefile.in
   branches/uClibc_0_9_30/libresolv/Makefile.in
   branches/uClibc_0_9_30/librt/Makefile.in


Changeset:
Modified: branches/uClibc_0_9_30/Rules.mak
===================================================================
--- branches/uClibc_0_9_30/Rules.mak	2009-01-22 09:47:09 UTC (rev 24955)
+++ branches/uClibc_0_9_30/Rules.mak	2009-01-22 09:50:29 UTC (rev 24956)
@@ -427,6 +427,30 @@
 export LDPIEFLAG:=$(shell $(LD) --help 2>/dev/null | grep -q -- -pie && echo "-pie")
 endif
 
+# Check for --as-needed support in linker
+ifndef LD_FLAG_ASNEEDED
+_LD_FLAG_ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -- --as-needed)
+ifneq ($(_LD_FLAG_ASNEEDED),)
+export LD_FLAG_ASNEEDED:=--as-needed
+endif
+endif
+ifndef LD_FLAG_NO_ASNEEDED
+ifdef LD_FLAG_ASNEEDED
+export LD_FLAG_NO_ASNEEDED:=--no-as-needed
+endif
+endif
+ifndef CC_FLAG_ASNEEDED
+ifdef LD_FLAG_ASNEEDED
+export CC_FLAG_ASNEEDED:=-Wl,$(LD_FLAG_ASNEEDED)
+endif
+endif
+ifndef CC_FLAG_NO_ASNEEDED
+ifdef LD_FLAG_NO_ASNEEDED
+export CC_FLAG_NO_ASNEEDED:=-Wl,$(LD_FLAG_NO_ASNEEDED)
+endif
+endif
+link.asneeded = $(if $(and $(CC_FLAG_ASNEEDED),$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG_ASNEEDED) $(1) $(CC_FLAG_NO_ASNEEDED))
+
 # Check for AS_NEEDED support in linker script (binutils>=2.16.1 has it)
 ifndef ASNEEDED
 export ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UCLIBC_LDSO) )" || echo "$(UCLIBC_LDSO)")

Modified: branches/uClibc_0_9_30/libnsl/Makefile.in
===================================================================
--- branches/uClibc_0_9_30/libnsl/Makefile.in	2009-01-22 09:47:09 UTC (rev 24955)
+++ branches/uClibc_0_9_30/libnsl/Makefile.in	2009-01-22 09:50:29 UTC (rev 24956)
@@ -7,12 +7,7 @@
 
 CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl $(SSP_ALL_CFLAGS)
 
-LDFLAGS-libnsl.so := $(LDFLAGS)
-ifdef ASNEEDED
-ifeq ($(UCLIBC_HAS_SSP),y)
-LDFLAGS-libnsl.so += -Wl,--no-as-needed -lc -Wl,--as-needed
-endif
-endif
+LDFLAGS-libnsl.so := $(LDFLAGS) $(call link.asneeded,-lc)
 
 LIBS-libnsl.so := $(LIBS)
 

Modified: branches/uClibc_0_9_30/libresolv/Makefile.in
===================================================================
--- branches/uClibc_0_9_30/libresolv/Makefile.in	2009-01-22 09:47:09 UTC (rev 24955)
+++ branches/uClibc_0_9_30/libresolv/Makefile.in	2009-01-22 09:50:29 UTC (rev 24956)
@@ -7,12 +7,7 @@
 
 CFLAGS-libresolv := -DNOT_IN_libc -DIS_IN_libresolv $(SSP_ALL_CFLAGS)
 
-LDFLAGS-libresolv.so := $(LDFLAGS)
-ifdef ASNEEDED
-ifeq ($(UCLIBC_HAS_SSP),y)
-LDFLAGS-libresolv.so += -Wl,--no-as-needed -lc -Wl,--as-needed
-endif
-endif
+LDFLAGS-libresolv.so := $(LDFLAGS) $(call link.asneeded,-lc)
 
 LIBS-libresolv.so := $(LIBS)
 

Modified: branches/uClibc_0_9_30/librt/Makefile.in
===================================================================
--- branches/uClibc_0_9_30/librt/Makefile.in	2009-01-22 09:47:09 UTC (rev 24955)
+++ branches/uClibc_0_9_30/librt/Makefile.in	2009-01-22 09:50:29 UTC (rev 24956)
@@ -7,7 +7,7 @@
 
 CFLAGS-librt := -DNOT_IN_libc -DIS_IN_librt $(SSP_ALL_CFLAGS)
 
-LDFLAGS-librt.so := $(LDFLAGS)
+LDFLAGS-librt.so := $(LDFLAGS) $(call link.asneeded,-lc)
 
 LIBS-librt.so := $(LIBS)
 



More information about the uClibc-cvs mailing list