Skip to content

Commit

Permalink
buildsys: pass correct linker to compiler driver
Browse files Browse the repository at this point in the history
Testing linker features has to be done against the correct linker.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
  • Loading branch information
aldot committed Feb 15, 2014
1 parent 79c0857 commit 19f21a1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Rules.mak
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ check_gcc=$(shell \
check_as=$(shell \
if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
then echo "-Wa,$(1)"; fi)
# FIXME: filter -fuse-ld=% and pass that, too!!
check_ld=$(shell \
if $(CC) -Wl,$(1) $(CFLAG_-nostdlib) -o /dev/null -Wl,-b,binary /dev/null > /dev/null 2>&1; \
if $(CC) $(LDFLAG-fuse-ld) -Wl,$(1) $(CFLAG_-nostdlib) -o /dev/null -Wl,-b,binary /dev/null > /dev/null 2>&1; \
then echo "$(1)"; fi)

# Use variable indirection here so that we can have variable
Expand Down Expand Up @@ -255,6 +254,8 @@ ARFLAGS:=cr

# Note: The check for -nostdlib has to be before all calls to check_ld
$(eval $(call check-gcc-var,-nostdlib))
LDFLAG-fuse-ld := $(filter -fuse-ld=%,$(EXTRA_UCLIBC_FLAGS))
# deliberately not named CFLAG-fuse-ld since unchecked and from user

# Flags in OPTIMIZATION are used only for non-debug builds

Expand Down Expand Up @@ -672,7 +673,7 @@ endif
$(eval $(call check-ld-var,--warn-once))
$(eval $(call check-ld-var,--sort-common))
$(eval $(call check-ld-var,--discard-all))
LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -shared \
LDFLAGS_NOSTRIP:=$(LDFLAG-fuse-ld) $(CPU_LDFLAGS-y) -shared \
-Wl,--warn-common $(CFLAG_-Wl--warn-once) -Wl,-z,combreloc
# binutils-2.16.1 warns about ignored sections, 2.16.91.0.3 and newer are ok
#$(eval $(call check-ld-var,--gc-sections))
Expand Down

0 comments on commit 19f21a1

Please sign in to comment.