aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2009-09-20 06:28:22 -0400
committerSam Ravnborg <sam@ravnborg.org>2009-09-20 06:28:22 -0400
commit51b563fc93c8cb5bff1d67a0a71c374e4a4ea049 (patch)
tree38c6a6d185183b30b8dbe59d5b8fa78815a1fdd4 /arch
parent4356f4890792a678936c93c9196e8f7742e04535 (diff)
arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash 4.0
Albin Tonnerre <albin.tonnerre@free-electrons.com> reported: Bash 4 filters out variables which contain a dot in them. This happends to be the case of CPPFLAGS_vmlinux.lds. This is rather unfortunate, as it now causes build failures when using SHELL=/bin/bash to compile, or when bash happens to be used by make (eg when it's /bin/sh) Remove the common definition of CPPFLAGS_vmlinux.lds by pushing relevant stuff to either Makefile.build or the arch specific kernel/Makefile where we build the linker script. This is also nice cleanup as we move the information out where it is used. Notes for the different architectures touched: arm - we use an already exported symbol cris - we use a config symbol aleady available [Not build tested] mips - the jiffies complexity has moved to vmlinux.lds.S where we need it. Added a few variables to CPPFLAGS - they are only used by the linker script. [Not build tested] powerpc - removed assignment that is not needed [not build tested] sparc - simplified it using $(BITS) um - introduced a few new exported variables to deal with this xtensa - added options to CPP invocation [not build tested] Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Mikael Starvik <starvik@axis.com> Cc: Jesper Nilsson <jesper.nilsson@axis.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Dike <jdike@addtoit.com> Cc: Chris Zankel <chris@zankel.net> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/kernel/Makefile3
-rw-r--r--arch/cris/Makefile2
-rw-r--r--arch/cris/kernel/Makefile1
-rw-r--r--arch/mips/Makefile27
-rw-r--r--arch/mips/kernel/vmlinux.lds.S13
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/sparc/Makefile4
-rw-r--r--arch/sparc/kernel/Makefile6
-rw-r--r--arch/um/Makefile9
-rw-r--r--arch/um/kernel/Makefile3
-rw-r--r--arch/um/kernel/vmlinux.lds.S3
-rw-r--r--arch/xtensa/kernel/Makefile3
13 files changed, 35 insertions, 43 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 68c6ab0749da..c695fdac5b30 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -14,7 +14,7 @@ LDFLAGS_vmlinux :=-p --no-undefined -X
14ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) 14ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
15LDFLAGS_vmlinux += --be8 15LDFLAGS_vmlinux += --be8
16endif 16endif
17CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 17
18OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S 18OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
19GZFLAGS :=-9 19GZFLAGS :=-9
20#KBUILD_CFLAGS +=-pipe 20#KBUILD_CFLAGS +=-pipe
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 3213c9382b17..c446aeff7b89 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -2,7 +2,8 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 5CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET)
6AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
6 7
7ifdef CONFIG_DYNAMIC_FTRACE 8ifdef CONFIG_DYNAMIC_FTRACE
8CFLAGS_REMOVE_ftrace.o = -pg 9CFLAGS_REMOVE_ftrace.o = -pg
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 71e17d3eeddb..29c2ceb38a76 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -42,8 +42,6 @@ LD = $(CROSS_COMPILE)ld -mcrislinux
42 42
43OBJCOPYFLAGS := -O binary -R .note -R .comment -S 43OBJCOPYFLAGS := -O binary -R .note -R .comment -S
44 44
45CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
46
47KBUILD_AFLAGS += -mlinux -march=$(arch-y) $(inc) 45KBUILD_AFLAGS += -mlinux -march=$(arch-y) $(inc)
48KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe $(inc) 46KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe $(inc)
49KBUILD_CPPFLAGS += $(inc) 47KBUILD_CPPFLAGS += $(inc)
diff --git a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile
index ee7bcd4d20b2..b45640b3e600 100644
--- a/arch/cris/kernel/Makefile
+++ b/arch/cris/kernel/Makefile
@@ -3,6 +3,7 @@
3# Makefile for the linux kernel. 3# Makefile for the linux kernel.
4# 4#
5 5
6CPPFLAGS_vmlinux.lds := -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
6extra-y := vmlinux.lds 7extra-y := vmlinux.lds
7 8
8obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o 9obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index c825b14b4ed0..77f5021218d3 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -627,16 +627,6 @@ endif
627cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic 627cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
628drivers-$(CONFIG_PCI) += arch/mips/pci/ 628drivers-$(CONFIG_PCI) += arch/mips/pci/
629 629
630ifdef CONFIG_32BIT
631ifdef CONFIG_CPU_LITTLE_ENDIAN
632JIFFIES = jiffies_64
633else
634JIFFIES = jiffies_64 + 4
635endif
636else
637JIFFIES = jiffies_64
638endif
639
640# 630#
641# Automatically detect the build format. By default we choose 631# Automatically detect the build format. By default we choose
642# the elf format according to the load address. 632# the elf format according to the load address.
@@ -660,8 +650,9 @@ ifdef CONFIG_64BIT
660endif 650endif
661 651
662KBUILD_AFLAGS += $(cflags-y) 652KBUILD_AFLAGS += $(cflags-y)
663KBUILD_CFLAGS += $(cflags-y) \ 653KBUILD_CFLAGS += $(cflags-y)
664 -D"VMLINUX_LOAD_ADDRESS=$(load-y)" 654KBUILD_CPPFLAGS += -D"VMLINUX_LOAD_ADDRESS=$(load-y)"
655KBUILD_CPPFLAGS += -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
665 656
666LDFLAGS += -m $(ld-emul) 657LDFLAGS += -m $(ld-emul)
667 658
@@ -676,18 +667,6 @@ endif
676 667
677OBJCOPYFLAGS += --remove-section=.reginfo 668OBJCOPYFLAGS += --remove-section=.reginfo
678 669
679#
680# Choosing incompatible machines durings configuration will result in
681# error messages during linking. Select a default linkscript if
682# none has been choosen above.
683#
684
685CPPFLAGS_vmlinux.lds := \
686 $(KBUILD_CFLAGS) \
687 -D"LOADADDR=$(load-y)" \
688 -D"JIFFIES=$(JIFFIES)" \
689 -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
690
691head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o 670head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
692 671
693libs-y += arch/mips/lib/ 672libs-y += arch/mips/lib/
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 2769bed3d2af..9bf0e3df7c5a 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -10,7 +10,16 @@ PHDRS {
10 text PT_LOAD FLAGS(7); /* RWX */ 10 text PT_LOAD FLAGS(7); /* RWX */
11 note PT_NOTE FLAGS(4); /* R__ */ 11 note PT_NOTE FLAGS(4); /* R__ */
12} 12}
13jiffies = JIFFIES; 13
14ifdef CONFIG_32BIT
15 ifdef CONFIG_CPU_LITTLE_ENDIAN
16 jiffies = jiffies_64;
17 else
18 jiffies = jiffies_64 + 4;
19 endif
20else
21 jiffies = jiffies_64;
22endif
14 23
15SECTIONS 24SECTIONS
16{ 25{
@@ -29,7 +38,7 @@ SECTIONS
29 /* . = 0xa800000000300000; */ 38 /* . = 0xa800000000300000; */
30 . = 0xffffffff80300000; 39 . = 0xffffffff80300000;
31#endif 40#endif
32 . = LOADADDR; 41 . = VMLINUX_LOAD_ADDRESS;
33 /* read-only */ 42 /* read-only */
34 _text = .; /* Text and read-only data */ 43 _text = .; /* Text and read-only data */
35 .text : { 44 .text : {
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 13e3fd852d63..aacf629c1a9f 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -158,8 +158,6 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
158# Default to zImage, override when needed 158# Default to zImage, override when needed
159all: zImage 159all: zImage
160 160
161CPPFLAGS_vmlinux.lds := -Upowerpc
162
163BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.% 161BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
164 162
165PHONY += $(BOOT_TARGETS) 163PHONY += $(BOOT_TARGETS)
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 467221dd5702..dfe272d14465 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -31,7 +31,6 @@ export BITS := 32
31#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 31#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
32KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 32KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
33KBUILD_AFLAGS += -m32 33KBUILD_AFLAGS += -m32
34CPPFLAGS_vmlinux.lds += -m32
35 34
36#LDFLAGS_vmlinux = -N -Ttext 0xf0004000 35#LDFLAGS_vmlinux = -N -Ttext 0xf0004000
37# Since 2.5.40, the first stage is left not btfix-ed. 36# Since 2.5.40, the first stage is left not btfix-ed.
@@ -45,9 +44,6 @@ else
45 44
46CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 45CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
47 46
48# Undefine sparc when processing vmlinux.lds - it is used
49# And teach CPP we are doing 64 bit builds (for this case)
50CPPFLAGS_vmlinux.lds += -m64 -Usparc
51LDFLAGS := -m elf64_sparc 47LDFLAGS := -m elf64_sparc
52export BITS := 64 48export BITS := 64
53 49
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 247cc620cee5..96aad394cd30 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -7,7 +7,11 @@ ccflags-y := -Werror
7 7
8extra-y := head_$(BITS).o 8extra-y := head_$(BITS).o
9extra-y += init_task.o 9extra-y += init_task.o
10extra-y += vmlinux.lds 10
11# Undefine sparc when processing vmlinux.lds - it is used
12# And teach CPP we are doing $(BITS) builds (for this case)
13CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS)
14extra-y += vmlinux.lds
11 15
12obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o 16obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o
13obj-$(CONFIG_SPARC32) += etrap_32.o 17obj-$(CONFIG_SPARC32) += etrap_32.o
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 0728def32234..fc633dbacf84 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -96,11 +96,10 @@ CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,)
96 $(call cc-option, -fno-stack-protector,) \ 96 $(call cc-option, -fno-stack-protector,) \
97 $(call cc-option, -fno-stack-protector-all,) 97 $(call cc-option, -fno-stack-protector-all,)
98 98
99CONFIG_KERNEL_STACK_ORDER ?= 2 99# Options used by linker script
100STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) 100export LDS_START := $(START)
101 101export LDS_ELF_ARCH := $(ELF_ARCH)
102CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ 102export LDS_ELF_FORMAT := $(ELF_FORMAT)
103 -DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)
104 103
105# The wrappers will select whether using "malloc" or the kernel allocator. 104# The wrappers will select whether using "malloc" or the kernel allocator.
106LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc 105LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 388ec0a3ea9b..1119233597a1 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -3,6 +3,9 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6CPPFLAGS_vmlinux.lds := -U$(SUBARCH) -DSTART=$(LDS_START) \
7 -DELF_ARCH=$(LDS_ELF_ARCH) \
8 -DELF_FORMAT=$(LDS_ELF_FORMAT)
6extra-y := vmlinux.lds 9extra-y := vmlinux.lds
7clean-files := 10clean-files :=
8 11
diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S
index f8aeb448aab6..16e49bfa2b42 100644
--- a/arch/um/kernel/vmlinux.lds.S
+++ b/arch/um/kernel/vmlinux.lds.S
@@ -1,3 +1,6 @@
1
2KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER);
3
1#ifdef CONFIG_LD_SCRIPT_STATIC 4#ifdef CONFIG_LD_SCRIPT_STATIC
2#include "uml.lds.S" 5#include "uml.lds.S"
3#else 6#else
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index fe3186de6a33..6f56d95f2c1e 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -27,7 +27,8 @@ sed-y = -e 's/(\(\.[a-z]*it\|\.ref\|\)\.text)/(\1.literal \1.text)/g' \
27 -e 's/(\(\.text\.[a-z]*\))/(\1.literal \1)/g' 27 -e 's/(\(\.text\.[a-z]*\))/(\1.literal \1)/g'
28 28
29quiet_cmd__cpp_lds_S = LDS $@ 29quiet_cmd__cpp_lds_S = LDS $@
30 cmd__cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ $< | sed $(sed-y) >$@ 30 cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \
31 | sed $(sed-y) >$@
31 32
32$(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE 33$(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE
33 $(call if_changed_dep,_cpp_lds_S) 34 $(call if_changed_dep,_cpp_lds_S)