diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2009-09-20 06:28:22 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2009-09-20 06:28:22 -0400 |
commit | 51b563fc93c8cb5bff1d67a0a71c374e4a4ea049 (patch) | |
tree | 38c6a6d185183b30b8dbe59d5b8fa78815a1fdd4 | |
parent | 4356f4890792a678936c93c9196e8f7742e04535 (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>
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | arch/arm/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/kernel/Makefile | 3 | ||||
-rw-r--r-- | arch/cris/Makefile | 2 | ||||
-rw-r--r-- | arch/cris/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/Makefile | 27 | ||||
-rw-r--r-- | arch/mips/kernel/vmlinux.lds.S | 13 | ||||
-rw-r--r-- | arch/powerpc/Makefile | 2 | ||||
-rw-r--r-- | arch/sparc/Makefile | 4 | ||||
-rw-r--r-- | arch/sparc/kernel/Makefile | 6 | ||||
-rw-r--r-- | arch/um/Makefile | 9 | ||||
-rw-r--r-- | arch/um/kernel/Makefile | 3 | ||||
-rw-r--r-- | arch/um/kernel/vmlinux.lds.S | 3 | ||||
-rw-r--r-- | arch/xtensa/kernel/Makefile | 3 | ||||
-rw-r--r-- | scripts/Makefile.build | 3 |
15 files changed, 37 insertions, 49 deletions
@@ -1027,11 +1027,6 @@ prepare0: archprepare FORCE | |||
1027 | # All the preparing.. | 1027 | # All the preparing.. |
1028 | prepare: prepare0 | 1028 | prepare: prepare0 |
1029 | 1029 | ||
1030 | # Leave this as default for preprocessing vmlinux.lds.S, which is now | ||
1031 | # done in arch/$(ARCH)/kernel/Makefile | ||
1032 | |||
1033 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | ||
1034 | |||
1035 | # The asm symlink changes when $(ARCH) changes. | 1030 | # The asm symlink changes when $(ARCH) changes. |
1036 | # Detect this and ask user to run make mrproper | 1031 | # Detect this and ask user to run make mrproper |
1037 | # If asm is a stale symlink (point to dir that does not exist) remove it | 1032 | # If asm is a stale symlink (point to dir that does not exist) remove it |
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 | |||
14 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) | 14 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) |
15 | LDFLAGS_vmlinux += --be8 | 15 | LDFLAGS_vmlinux += --be8 |
16 | endif | 16 | endif |
17 | CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) | 17 | |
18 | OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S | 18 | OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S |
19 | GZFLAGS :=-9 | 19 | GZFLAGS :=-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 | ||
5 | AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) | 5 | CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) |
6 | AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) | ||
6 | 7 | ||
7 | ifdef CONFIG_DYNAMIC_FTRACE | 8 | ifdef CONFIG_DYNAMIC_FTRACE |
8 | CFLAGS_REMOVE_ftrace.o = -pg | 9 | CFLAGS_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 | ||
43 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | 43 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S |
44 | 44 | ||
45 | CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) | ||
46 | |||
47 | KBUILD_AFLAGS += -mlinux -march=$(arch-y) $(inc) | 45 | KBUILD_AFLAGS += -mlinux -march=$(arch-y) $(inc) |
48 | KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe $(inc) | 46 | KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe $(inc) |
49 | KBUILD_CPPFLAGS += $(inc) | 47 | KBUILD_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 | ||
6 | CPPFLAGS_vmlinux.lds := -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) | ||
6 | extra-y := vmlinux.lds | 7 | extra-y := vmlinux.lds |
7 | 8 | ||
8 | obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o | 9 | obj-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 | |||
627 | cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic | 627 | cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic |
628 | drivers-$(CONFIG_PCI) += arch/mips/pci/ | 628 | drivers-$(CONFIG_PCI) += arch/mips/pci/ |
629 | 629 | ||
630 | ifdef CONFIG_32BIT | ||
631 | ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
632 | JIFFIES = jiffies_64 | ||
633 | else | ||
634 | JIFFIES = jiffies_64 + 4 | ||
635 | endif | ||
636 | else | ||
637 | JIFFIES = jiffies_64 | ||
638 | endif | ||
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 | |||
660 | endif | 650 | endif |
661 | 651 | ||
662 | KBUILD_AFLAGS += $(cflags-y) | 652 | KBUILD_AFLAGS += $(cflags-y) |
663 | KBUILD_CFLAGS += $(cflags-y) \ | 653 | KBUILD_CFLAGS += $(cflags-y) |
664 | -D"VMLINUX_LOAD_ADDRESS=$(load-y)" | 654 | KBUILD_CPPFLAGS += -D"VMLINUX_LOAD_ADDRESS=$(load-y)" |
655 | KBUILD_CPPFLAGS += -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)" | ||
665 | 656 | ||
666 | LDFLAGS += -m $(ld-emul) | 657 | LDFLAGS += -m $(ld-emul) |
667 | 658 | ||
@@ -676,18 +667,6 @@ endif | |||
676 | 667 | ||
677 | OBJCOPYFLAGS += --remove-section=.reginfo | 668 | OBJCOPYFLAGS += --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 | |||
685 | CPPFLAGS_vmlinux.lds := \ | ||
686 | $(KBUILD_CFLAGS) \ | ||
687 | -D"LOADADDR=$(load-y)" \ | ||
688 | -D"JIFFIES=$(JIFFIES)" \ | ||
689 | -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)" | ||
690 | |||
691 | head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o | 670 | head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o |
692 | 671 | ||
693 | libs-y += arch/mips/lib/ | 672 | libs-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 | } |
13 | jiffies = JIFFIES; | 13 | |
14 | ifdef CONFIG_32BIT | ||
15 | ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
16 | jiffies = jiffies_64; | ||
17 | else | ||
18 | jiffies = jiffies_64 + 4; | ||
19 | endif | ||
20 | else | ||
21 | jiffies = jiffies_64; | ||
22 | endif | ||
14 | 23 | ||
15 | SECTIONS | 24 | SECTIONS |
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 |
159 | all: zImage | 159 | all: zImage |
160 | 160 | ||
161 | CPPFLAGS_vmlinux.lds := -Upowerpc | ||
162 | |||
163 | BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.% | 161 | BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.% |
164 | 162 | ||
165 | PHONY += $(BOOT_TARGETS) | 163 | PHONY += $(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 |
32 | KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 | 32 | KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 |
33 | KBUILD_AFLAGS += -m32 | 33 | KBUILD_AFLAGS += -m32 |
34 | CPPFLAGS_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 | ||
46 | CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 | 45 | CHECKFLAGS += -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) | ||
50 | CPPFLAGS_vmlinux.lds += -m64 -Usparc | ||
51 | LDFLAGS := -m elf64_sparc | 47 | LDFLAGS := -m elf64_sparc |
52 | export BITS := 64 | 48 | export 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 | ||
8 | extra-y := head_$(BITS).o | 8 | extra-y := head_$(BITS).o |
9 | extra-y += init_task.o | 9 | extra-y += init_task.o |
10 | extra-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) | ||
13 | CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS) | ||
14 | extra-y += vmlinux.lds | ||
11 | 15 | ||
12 | obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o | 16 | obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o |
13 | obj-$(CONFIG_SPARC32) += etrap_32.o | 17 | obj-$(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 | ||
99 | CONFIG_KERNEL_STACK_ORDER ?= 2 | 99 | # Options used by linker script |
100 | STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] ) | 100 | export LDS_START := $(START) |
101 | 101 | export LDS_ELF_ARCH := $(ELF_ARCH) | |
102 | CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \ | 102 | export 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. |
106 | LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc | 105 | LINK_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 | ||
6 | CPPFLAGS_vmlinux.lds := -U$(SUBARCH) -DSTART=$(LDS_START) \ | ||
7 | -DELF_ARCH=$(LDS_ELF_ARCH) \ | ||
8 | -DELF_FORMAT=$(LDS_ELF_FORMAT) | ||
6 | extra-y := vmlinux.lds | 9 | extra-y := vmlinux.lds |
7 | clean-files := | 10 | clean-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 | |||
2 | KERNEL_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 | ||
29 | quiet_cmd__cpp_lds_S = LDS $@ | 29 | quiet_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) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 6e41b3b6b154..d5425660a3df 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -270,7 +270,8 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always) | |||
270 | # Linker scripts preprocessor (.lds.S -> .lds) | 270 | # Linker scripts preprocessor (.lds.S -> .lds) |
271 | # --------------------------------------------------------------------------- | 271 | # --------------------------------------------------------------------------- |
272 | quiet_cmd_cpp_lds_S = LDS $@ | 272 | quiet_cmd_cpp_lds_S = LDS $@ |
273 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $< | 273 | cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \ |
274 | -D__ASSEMBLY__ -o $@ $< | ||
274 | 275 | ||
275 | $(obj)/%.lds: $(src)/%.lds.S FORCE | 276 | $(obj)/%.lds: $(src)/%.lds.S FORCE |
276 | $(call if_changed_dep,cpp_lds_S) | 277 | $(call if_changed_dep,cpp_lds_S) |