summaryrefslogtreecommitdiff
path: root/Rules.mak
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-01-22 09:47:09 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2009-01-22 09:47:09 +0000
commitdb5c5752566147689063340a87531ca4ac626a98 (patch)
treec1dcf4d95d5a3768b9cbf144e499202d9a6123b0 /Rules.mak
parentc5edfea211a5bc72002f027f82dba8c9d86c95e8 (diff)
- also link librt with --as-needed and do so unconditionally to work around
bugs in gentoo's QA. Just add UCLIBC_HAS_SSP to the "and" of link.asneeded to properly take SSP into account, if you prefer.
Diffstat (limited to 'Rules.mak')
-rw-r--r--Rules.mak24
1 files changed, 24 insertions, 0 deletions
diff --git a/Rules.mak b/Rules.mak
index 802ee99bb..1e6271804 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -433,6 +433,30 @@ ifndef LDPIEFLAG
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)")