mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements
@ 2009-08-05 21:51 Andi Kleen
  2009-08-05 21:51 ` [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work Andi Kleen
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Andi Kleen @ 2009-08-05 21:51 UTC (permalink / raw)
  To: sam, linux-kbuild, linux-kernel


Some build system patches that accumulated in my tree:

- Fix mcount handling
- Fix gold linker support
- Add some gcc 4.5 support

One will address the problem Dave A. reported earlier today.

-Andi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work
  2009-08-05 21:51 [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements Andi Kleen
@ 2009-08-05 21:51 ` Andi Kleen
  2009-08-05 21:51 ` [PATCH] [2/5] kbuild: Check if linker supports the -X option Andi Kleen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2009-08-05 21:51 UTC (permalink / raw)
  To: sam, linux-kbuild, linux-kernel


Needed for the next patch

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 scripts/Kbuild.include |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.31-rc1-ak/scripts/Kbuild.include
===================================================================
--- linux-2.6.31-rc1-ak.orig/scripts/Kbuild.include
+++ linux-2.6.31-rc1-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,)
@@ -133,7 +134,7 @@ cc-ifversion = $(shell [ $(call cc-versi
 # ld-option
 # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
 ld-option = $(call try-run,\
-	$(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
+	$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
 
 ######
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [2/5] kbuild: Check if linker supports the -X option
  2009-08-05 21:51 [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements Andi Kleen
  2009-08-05 21:51 ` [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work Andi Kleen
@ 2009-08-05 21:51 ` Andi Kleen
  2009-08-05 21:51 ` [PATCH] [3/5] kbuild: Echo the record_mcount command Andi Kleen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2009-08-05 21:51 UTC (permalink / raw)
  To: sam, linux-kbuild, linux-kernel


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.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.31-rc1-ak/Makefile
===================================================================
--- linux-2.6.31-rc1-ak.orig/Makefile
+++ linux-2.6.31-rc1-ak/Makefile
@@ -599,7 +599,7 @@ LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
 LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
 
 ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
-LDFLAGS_vmlinux	+= -X
+LDFLAGS_vmlinux	+= $(call ld-option, -X,)
 endif
 
 # Default kernel image to build when no specific target is given.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [3/5] kbuild: Echo the record_mcount command
  2009-08-05 21:51 [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements Andi Kleen
  2009-08-05 21:51 ` [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work Andi Kleen
  2009-08-05 21:51 ` [PATCH] [2/5] kbuild: Check if linker supports the -X option Andi Kleen
@ 2009-08-05 21:51 ` Andi Kleen
  2009-08-05 21:51 ` [PATCH] [4/5] kbuild: Fail build if recordmcount.pl fails Andi Kleen
  2009-08-05 21:51 ` [PATCH] [5/5] kbuild: Set -fconserve-stack option for gcc 4.5 Andi Kleen
  4 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2009-08-05 21:51 UTC (permalink / raw)
  To: sam, linux-kbuild, linux-kernel


I had some problems with record_mcount in the Makefile and it was hard
to track down. Echo it by default to make it easier to diagnose.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 scripts/Makefile.build |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6.31-rc1-ak/scripts/Makefile.build
===================================================================
--- linux-2.6.31-rc1-ak.orig/scripts/Makefile.build
+++ linux-2.6.31-rc1-ak/scripts/Makefile.build
@@ -216,6 +216,7 @@ define rule_cc_o_c
 	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \
 	$(call echo-cmd,cc_o_c) $(cmd_cc_o_c);				  \
 	$(cmd_modversions)						  \
+	$(call echo-cmd,record_mcount)					  \
 	$(cmd_record_mcount)						  \
 	scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' >    \
 	                                              $(dot-target).tmp;  \

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [4/5] kbuild: Fail build if recordmcount.pl fails
  2009-08-05 21:51 [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements Andi Kleen
                   ` (2 preceding siblings ...)
  2009-08-05 21:51 ` [PATCH] [3/5] kbuild: Echo the record_mcount command Andi Kleen
@ 2009-08-05 21:51 ` Andi Kleen
  2009-08-05 21:51 ` [PATCH] [5/5] kbuild: Set -fconserve-stack option for gcc 4.5 Andi Kleen
  4 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2009-08-05 21:51 UTC (permalink / raw)
  To: sam, linux-kbuild, linux-kernel


When this script fails the build should fail too. Otherwise there
are mysterious build failures later.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 scripts/Makefile.build |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.31-rc1-ak/scripts/Makefile.build
===================================================================
--- linux-2.6.31-rc1-ak.orig/scripts/Makefile.build
+++ linux-2.6.31-rc1-ak/scripts/Makefile.build
@@ -206,7 +206,7 @@ cmd_modversions =							\
 endif
 
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
-cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
+cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
 	"$(if $(CONFIG_64BIT),64,32)" \
 	"$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
 	"$(if $(part-of-module),1,0)" "$(@)";

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [5/5] kbuild: Set -fconserve-stack option for gcc 4.5
  2009-08-05 21:51 [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements Andi Kleen
                   ` (3 preceding siblings ...)
  2009-08-05 21:51 ` [PATCH] [4/5] kbuild: Fail build if recordmcount.pl fails Andi Kleen
@ 2009-08-05 21:51 ` Andi Kleen
  4 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2009-08-05 21:51 UTC (permalink / raw)
  To: sam, linux-kbuild, linux-kernel


The upcomming gcc 4.5 has a new -fconserve-stack option 
that tells the inliner to take stack frame size in account.
Set it if the compiler supports it.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 Makefile |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6.31-rc3-ak/Makefile
===================================================================
--- linux-2.6.31-rc3-ak.orig/Makefile
+++ linux-2.6.31-rc3-ak/Makefile
@@ -575,6 +575,9 @@ KBUILD_CFLAGS	+= $(call cc-option,-fno-s
 # revert to pre-gcc-4.4 behaviour of .eh_frame
 KBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
 
+# conserve stack if available
+KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
+
 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
 # But warn user when we do so
 warn-assign = \

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work
  2009-09-15 13:01     ` Andi Kleen
@ 2009-09-15 15:32       ` Sam Ravnborg
  0 siblings, 0 replies; 10+ messages in thread
From: Sam Ravnborg @ 2009-09-15 15:32 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, akpm

On Tue, Sep 15, 2009 at 03:01:47PM +0200, Andi Kleen wrote:
> > So now we pass the option direct to the linker rather than via gcc -wl.
> > I assume this breaks the other 8 uses of ld-option in the kernel?
> > 
> > Or does ld understand the -wl,... syntax?
> 
> It does not. But -X is passed directly to the linker, not via gcc,
> so it needs to probe ld directly
> 
> The right fix is probably an new macro that works with ld (and
> ideally rename this one which is confusingly named) I'll
> send an updated patch.
Thanks.
Please do remember to update the documentation
in Documentation/kbuild/makefiles.txt.

	Sam

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work
  2009-09-14 21:47   ` Sam Ravnborg
@ 2009-09-15 13:01     ` Andi Kleen
  2009-09-15 15:32       ` Sam Ravnborg
  0 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2009-09-15 13:01 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Andi Kleen, linux-kernel, akpm

> So now we pass the option direct to the linker rather than via gcc -wl.
> I assume this breaks the other 8 uses of ld-option in the kernel?
> 
> Or does ld understand the -wl,... syntax?

It does not. But -X is passed directly to the linker, not via gcc,
so it needs to probe ld directly

The right fix is probably an new macro that works with ld (and
ideally rename this one which is confusingly named) I'll
send an updated patch.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work
  2009-09-14 20:18 ` [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work Andi Kleen
@ 2009-09-14 21:47   ` Sam Ravnborg
  2009-09-15 13:01     ` Andi Kleen
  0 siblings, 1 reply; 10+ messages in thread
From: Sam Ravnborg @ 2009-09-14 21:47 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, akpm

On Mon, Sep 14, 2009 at 10:18:06PM +0200, Andi Kleen wrote:
> 
> Needed for the next patch
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> 
> ---
>  scripts/Kbuild.include |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.31-rc1-ak/scripts/Kbuild.include
> ===================================================================
> --- linux-2.6.31-rc1-ak.orig/scripts/Kbuild.include
> +++ linux-2.6.31-rc1-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,)
> @@ -133,7 +134,7 @@ cc-ifversion = $(shell [ $(call cc-versi
>  # ld-option
>  # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
>  ld-option = $(call try-run,\
> -	$(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
> +	$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
>  
>  ######

So now we pass the option direct to the linker rather than via gcc -wl.
I assume this breaks the other 8 uses of ld-option in the kernel?

Or does ld understand the -wl,... syntax?

	Sam

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work
  2009-09-14 20:18 [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements Andi Kleen
@ 2009-09-14 20:18 ` Andi Kleen
  2009-09-14 21:47   ` Sam Ravnborg
  0 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2009-09-14 20:18 UTC (permalink / raw)
  To: linux-kernel, akpm, sam


Needed for the next patch

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 scripts/Kbuild.include |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.31-rc1-ak/scripts/Kbuild.include
===================================================================
--- linux-2.6.31-rc1-ak.orig/scripts/Kbuild.include
+++ linux-2.6.31-rc1-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,)
@@ -133,7 +134,7 @@ cc-ifversion = $(shell [ $(call cc-versi
 # ld-option
 # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
 ld-option = $(call try-run,\
-	$(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
+	$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
 
 ######
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-09-15 15:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-05 21:51 [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements Andi Kleen
2009-08-05 21:51 ` [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work Andi Kleen
2009-08-05 21:51 ` [PATCH] [2/5] kbuild: Check if linker supports the -X option Andi Kleen
2009-08-05 21:51 ` [PATCH] [3/5] kbuild: Echo the record_mcount command Andi Kleen
2009-08-05 21:51 ` [PATCH] [4/5] kbuild: Fail build if recordmcount.pl fails Andi Kleen
2009-08-05 21:51 ` [PATCH] [5/5] kbuild: Set -fconserve-stack option for gcc 4.5 Andi Kleen
2009-09-14 20:18 [PATCH] [0/5] kbuild: A couple of Kbuild fixes/improvements Andi Kleen
2009-09-14 20:18 ` [PATCH] [1/5] kbuild: Fix ld-option Makefile macro to really work Andi Kleen
2009-09-14 21:47   ` Sam Ravnborg
2009-09-15 13:01     ` Andi Kleen
2009-09-15 15:32       ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®