Skip to contentSkip to conversation

Updated patches for gold -X probing

PATCH In review Andi Kleen 3 participants 5 messages Sep 16, 2009 – Sep 19, 2009 Kbuild

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

cover Updated patches for gold -X probing

based on Sam's feedback using a new macro.

gold build doesn't work currently for some other reasons, but I haven't investigated that yet. It seems to be new though, wasn't there a few rc*s ago.

-Andi

author
#1 lore raw

PATCH 1/2 kbuild: Add a really-ld-option macro

Different from the existing ld macro by checking $(LD)

Needed for the next patch

---
 scripts/Kbuild.include |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
scripts/Kbuild.include +8 -1
Index: linux-2.6.31-ak/scripts/Kbuild.include
===================================================================
@@ -83,11 +83,12 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstw
 # is automatically cleaned up.
 try-run = $(shell set -e;		\
 	TMP="$(TMPOUT).$$$$.tmp";	\
+	TMPO="$(TMPOUT).$$$$.o";	\
 	if ($(1)) >/dev/null 2>&1;	\
 	then echo "$(2)";		\
 	else echo "$(3)";		\
 	fi;				\
-	rm -f "$$TMP")
+	rm -f "$$TMP" "$$TMPO")
 
 # as-option
 # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
@@ -135,6 +136,12 @@ cc-ifversion = $(shell [ $(call cc-versi
 ld-option = $(call try-run,\
 	$(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
 
+# really-ld-option
+# checks $(LD) unlike ld-option
+# Usage: LDFLAGS += $(call really-ld-option, -X)
+really-ld-option = $(call try-run,\
+	$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
+
 ######
 
 ###
author
#3 lore raw

PATCH 2/2 kbuild: Check if linker supports the -X option

In reply to Andi Kleen

The new alternative `gold' linker in recent binutils doesn't support the -X option. This breaks allyesconfig builds that have CONFIG_STRIP_ASM_SYMS enabled. Check if the linker really supports the option using ld-option.

This requires fixes in earlier patches.

---
 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
Index: linux-2.6.31-rc3-ak/Makefile
===================================================================
@@ -600,7 +600,7 @@ LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
 LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
 
 ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
-LDFLAGS_vmlinux	+= -X
+LDFLAGS_vmlinux	+= $(call really-ld-option, -X,)
 endif
 
 # Default kernel image to build when no specific target is given.
#4 lore raw
In reply to Andi Kleen
Quoted 6 lines · Andi Kleen

based on Sam's feedback using a new macro.

gold build doesn't work currently for some other reasons, but I haven't investigated that yet. It seems to be new though, wasn't there a few rc*s ago.

Ack for these 2 patches.

Thanks!

#2 lore raw

Re: [PATCH] [1/2] kbuild: Add a really-ld-option macro

In reply to Andi Kleen
Quoted 30 lines · Andi Kleen

Different from the existing ld macro by checking $(LD)

Needed for the next patch

---
 scripts/Kbuild.include |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux-2.6.31-ak/scripts/Kbuild.include
===================================================================

scripts/Kbuild.include +2 -1
@@ -83,11 +83,12 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstw
 # is automatically cleaned up.
 try-run = $(shell set -e;		\
 	TMP="$(TMPOUT).$$$$.tmp";	\
+	TMPO="$(TMPOUT).$$$$.o";	\
 	if ($(1)) >/dev/null 2>&1;	\
 	then echo "$(2)";		\
 	else echo "$(3)";		\
 	fi;				\
-	rm -f "$$TMP")
+	rm -f "$$TMP" "$$TMPO")
 
 # as-option
 # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)

scripts/Kbuild.include cc-ifversion = $(shell [ $(call cc-versi · line 144

Quoted 9 lines
scripts/Kbuild.include +6 -0
@@ -135,6 +136,12 @@ cc-ifversion = $(shell [ $(call cc-versi
 ld-option = $(call try-run,\
 	$(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
 
+# really-ld-option
+# checks $(LD) unlike ld-option
+# Usage: LDFLAGS += $(call really-ld-option, -X)
+really-ld-option = $(call try-run,\
+	$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
+

kbuild has some strange marcro names - but adding more is no good. I will:
1) rename ld-option to cc-ldoption
2) add ld-option, and _document_ it in makefiles.txt
3) use ld-option for the -X option

I had preferred your patchset did so.

Sam