* [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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ 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; 9+ 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] 9+ messages in thread