aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@neptun.(none)>2007-10-15 15:59:31 -0400
committerSam Ravnborg <sam@neptun.(none)>2007-10-15 15:59:31 -0400
commit222d394d30e74bb7a2a65029fcea68107b0d0eb6 (patch)
tree1112c98d7edc51d1c6d5e9f3d826e29a42afd4da
parent714055ede4ffd60933397d4b61d285d0dfc9ecaf (diff)
kbuild: enable 'make AFLAGS=...' to add additional options to AS
The variable AFLAGS is a wellknown variable and the usage by kbuild may result in unexpected behaviour. On top of that several people over time has asked for a way to pass in additional flags to gcc. This patch replace use of AFLAGS with KBUILD_AFLAGS all over the tree. Patch was tested on following architectures: alpha, arm, i386, x86_64, mips, sparc, sparc64, ia64, m68k, s390 Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r--Documentation/kbuild/makefiles.txt5
-rw-r--r--Makefile8
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/vfp/Makefile2
-rw-r--r--arch/avr32/Makefile4
-rw-r--r--arch/blackfin/Makefile2
-rw-r--r--arch/cris/Makefile2
-rw-r--r--arch/frv/Makefile10
-rw-r--r--arch/h8300/Makefile2
-rw-r--r--arch/i386/Makefile6
-rw-r--r--arch/m32r/Makefile2
-rw-r--r--arch/m68knommu/Makefile2
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/powerpc/Makefile4
-rw-r--r--arch/ppc/Makefile4
-rw-r--r--arch/s390/Makefile6
-rw-r--r--arch/sh/Makefile2
-rw-r--r--arch/sparc/Makefile2
-rw-r--r--arch/sparc64/Makefile2
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/Makefile-i3862
-rw-r--r--arch/um/Makefile-x86_642
-rw-r--r--arch/um/sys-ppc/Makefile6
-rw-r--r--arch/x86/boot/Makefile2
-rw-r--r--arch/x86/boot/compressed/Makefile_642
-rw-r--r--arch/x86_64/Makefile6
-rw-r--r--scripts/Kbuild.include2
-rw-r--r--scripts/Makefile.lib2
28 files changed, 48 insertions, 47 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 1ca535bcc8c7..f4779cd1542f 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -424,6 +424,7 @@ more details, with real examples.
424 as-instr checks if the assembler reports a specific instruction 424 as-instr checks if the assembler reports a specific instruction
425 and then outputs either option1 or option2 425 and then outputs either option1 or option2
426 C escapes are supported in the test instruction 426 C escapes are supported in the test instruction
427 Note: as-instr-option uses KBUILD_AFLAGS for $(AS) options
427 428
428 cc-option 429 cc-option
429 cc-option is used to check if $(CC) supports a given option, and not 430 cc-option is used to check if $(CC) supports a given option, and not
@@ -819,14 +820,14 @@ When kbuild executes, the following steps are followed (roughly):
819 In this example, the binary $(obj)/image is a binary version of 820 In this example, the binary $(obj)/image is a binary version of
820 vmlinux. The usage of $(call if_changed,xxx) will be described later. 821 vmlinux. The usage of $(call if_changed,xxx) will be described later.
821 822
822 AFLAGS $(AS) assembler flags 823 KBUILD_AFLAGS $(AS) assembler flags
823 824
824 Default value - see top level Makefile 825 Default value - see top level Makefile
825 Append or modify as required per architecture. 826 Append or modify as required per architecture.
826 827
827 Example: 828 Example:
828 #arch/sparc64/Makefile 829 #arch/sparc64/Makefile
829 AFLAGS += -m64 -mcpu=ultrasparc 830 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc
830 831
831 KBUILD_CFLAGS $(CC) compiler flags 832 KBUILD_CFLAGS $(CC) compiler flags
832 833
diff --git a/Makefile b/Makefile
index 3bc86c698a4e..8d3f66441861 100644
--- a/Makefile
+++ b/Makefile
@@ -323,7 +323,7 @@ CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
323KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 323KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
324 -fno-strict-aliasing -fno-common \ 324 -fno-strict-aliasing -fno-common \
325 -Werror-implicit-function-declaration 325 -Werror-implicit-function-declaration
326AFLAGS := -D__ASSEMBLY__ 326KBUILD_AFLAGS := -D__ASSEMBLY__
327 327
328# Read KERNELRELEASE from include/config/kernel.release (if it exists) 328# Read KERNELRELEASE from include/config/kernel.release (if it exists)
329KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) 329KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
@@ -336,7 +336,7 @@ export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
336 336
337export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 337export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
338export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 338export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
339export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 339export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
340 340
341# When compiling out-of-tree modules, put MODVERDIR in the module 341# When compiling out-of-tree modules, put MODVERDIR in the module
342# tree rather than in the kernel tree. The kernel tree might 342# tree rather than in the kernel tree. The kernel tree might
@@ -507,7 +507,7 @@ endif
507 507
508ifdef CONFIG_DEBUG_INFO 508ifdef CONFIG_DEBUG_INFO
509KBUILD_CFLAGS += -g 509KBUILD_CFLAGS += -g
510AFLAGS += -gdwarf-2 510KBUILD_AFLAGS += -gdwarf-2
511endif 511endif
512 512
513# Force gcc to behave correct even for buggy distributions 513# Force gcc to behave correct even for buggy distributions
@@ -1502,7 +1502,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))
1502 cmd_rmfiles = rm -f $(rm-files) 1502 cmd_rmfiles = rm -f $(rm-files)
1503 1503
1504 1504
1505a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ 1505a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
1506 $(NOSTDINC_FLAGS) $(CPPFLAGS) \ 1506 $(NOSTDINC_FLAGS) $(CPPFLAGS) \
1507 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 1507 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
1508 1508
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0b82865ab506..b762d235b81a 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -86,7 +86,7 @@ endif
86 86
87# Need -Uarm for gcc < 3.x 87# Need -Uarm for gcc < 3.x
88KBUILD_CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm 88KBUILD_CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
89AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float 89KBUILD_AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float
90 90
91CHECKFLAGS += -D__arm__ 91CHECKFLAGS += -D__arm__
92 92
diff --git a/arch/arm/vfp/Makefile b/arch/arm/vfp/Makefile
index 7e136e77971a..39f6d8e1af73 100644
--- a/arch/arm/vfp/Makefile
+++ b/arch/arm/vfp/Makefile
@@ -7,7 +7,7 @@
7# EXTRA_CFLAGS := -DDEBUG 7# EXTRA_CFLAGS := -DDEBUG
8# EXTRA_AFLAGS := -DDEBUG 8# EXTRA_AFLAGS := -DDEBUG
9 9
10AFLAGS :=$(AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp) 10KBUILD_AFLAGS :=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp)
11LDFLAGS +=--no-warn-mismatch 11LDFLAGS +=--no-warn-mismatch
12 12
13obj-y += vfp.o 13obj-y += vfp.o
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
index 9883c8b55e1b..87918647be6d 100644
--- a/arch/avr32/Makefile
+++ b/arch/avr32/Makefile
@@ -12,14 +12,14 @@ all: uImage vmlinux.elf
12KBUILD_DEFCONFIG := atstk1002_defconfig 12KBUILD_DEFCONFIG := atstk1002_defconfig
13 13
14KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic 14KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic
15AFLAGS += -mrelax -mno-pic 15KBUILD_AFLAGS += -mrelax -mno-pic
16CFLAGS_MODULE += -mno-relax 16CFLAGS_MODULE += -mno-relax
17LDFLAGS_vmlinux += --relax 17LDFLAGS_vmlinux += --relax
18 18
19cpuflags-$(CONFIG_CPU_AT32AP7000) += -mcpu=ap7000 19cpuflags-$(CONFIG_CPU_AT32AP7000) += -mcpu=ap7000
20 20
21KBUILD_CFLAGS += $(cpuflags-y) 21KBUILD_CFLAGS += $(cpuflags-y)
22AFLAGS += $(cpuflags-y) 22KBUILD_AFLAGS += $(cpuflags-y)
23 23
24CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN 24CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN
25 25
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 52a6ac072851..368933760d28 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -54,7 +54,7 @@ rev-$(CONFIG_BF_REV_NONE) := none
54rev-$(CONFIG_BF_REV_ANY) := any 54rev-$(CONFIG_BF_REV_ANY) := any
55 55
56KBUILD_CFLAGS += -mcpu=$(cpu-y)-$(rev-y) 56KBUILD_CFLAGS += -mcpu=$(cpu-y)-$(rev-y)
57AFLAGS += -mcpu=$(cpu-y)-$(rev-y) 57KBUILD_AFLAGS += -mcpu=$(cpu-y)-$(rev-y)
58 58
59head-y := arch/$(ARCH)/mach-$(MACHINE)/head.o arch/$(ARCH)/kernel/init_task.o 59head-y := arch/$(ARCH)/mach-$(MACHINE)/head.o arch/$(ARCH)/kernel/init_task.o
60 60
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 32ef6f3cce06..e6bf00c262e0 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -29,7 +29,7 @@ LD = $(CROSS_COMPILE)ld -mcrislinux
29OBJCOPYFLAGS := -O binary -R .note -R .comment -S 29OBJCOPYFLAGS := -O binary -R .note -R .comment -S
30 30
31CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) 31CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
32AFLAGS += -mlinux 32KBUILD_AFLAGS += -mlinux
33 33
34KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe 34KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe
35 35
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index ec89886ed455..310c47a663f8 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -63,16 +63,16 @@ endif
63 63
64ifdef CONFIG_CPU_FR451_COMPILE 64ifdef CONFIG_CPU_FR451_COMPILE
65KBUILD_CFLAGS += -mcpu=fr450 65KBUILD_CFLAGS += -mcpu=fr450
66AFLAGS += -mcpu=fr450 66KBUILD_AFLAGS += -mcpu=fr450
67ASFLAGS += -mcpu=fr450 67ASFLAGS += -mcpu=fr450
68else 68else
69ifdef CONFIG_CPU_FR551_COMPILE 69ifdef CONFIG_CPU_FR551_COMPILE
70KBUILD_CFLAGS += -mcpu=fr550 70KBUILD_CFLAGS += -mcpu=fr550
71AFLAGS += -mcpu=fr550 71KBUILD_AFLAGS += -mcpu=fr550
72ASFLAGS += -mcpu=fr550 72ASFLAGS += -mcpu=fr550
73else 73else
74KBUILD_CFLAGS += -mcpu=fr400 74KBUILD_CFLAGS += -mcpu=fr400
75AFLAGS += -mcpu=fr400 75KBUILD_AFLAGS += -mcpu=fr400
76ASFLAGS += -mcpu=fr400 76ASFLAGS += -mcpu=fr400
77endif 77endif
78endif 78endif
@@ -82,14 +82,14 @@ endif
82# - all the extra registers are dealt with only at context switch time 82# - all the extra registers are dealt with only at context switch time
83KBUILD_CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media 83KBUILD_CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media
84KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2 84KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
85AFLAGS += -mno-fdpic 85KBUILD_AFLAGS += -mno-fdpic
86ASFLAGS += -mno-fdpic 86ASFLAGS += -mno-fdpic
87 87
88# make sure the .S files get compiled with debug info 88# make sure the .S files get compiled with debug info
89# and disable optimisations that are unhelpful whilst debugging 89# and disable optimisations that are unhelpful whilst debugging
90ifdef CONFIG_DEBUG_INFO 90ifdef CONFIG_DEBUG_INFO
91#KBUILD_CFLAGS += -O1 91#KBUILD_CFLAGS += -O1
92AFLAGS += -Wa,--gdwarf2 92KBUILD_AFLAGS += -Wa,--gdwarf2
93ASFLAGS += -Wa,--gdwarf2 93ASFLAGS += -Wa,--gdwarf2
94endif 94endif
95 95
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
index 330e05f28f90..a556447877b4 100644
--- a/arch/h8300/Makefile
+++ b/arch/h8300/Makefile
@@ -35,7 +35,7 @@ KBUILD_CFLAGS += -mint32 -fno-builtin
35KBUILD_CFLAGS += -g 35KBUILD_CFLAGS += -g
36KBUILD_CFLAGS += -D__linux__ 36KBUILD_CFLAGS += -D__linux__
37KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\" 37KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
38AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y) 38KBUILD_AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y)
39LDFLAGS += $(ldflags-y) 39LDFLAGS += $(ldflags-y)
40 40
41CROSS_COMPILE = h8300-elf- 41CROSS_COMPILE = h8300-elf-
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index fc3c8e88b744..f036d2dee3de 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -55,11 +55,11 @@ KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call c
55 55
56# do binutils support CFI? 56# do binutils support CFI?
57cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 57cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
58AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 58KBUILD_AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
59 59
60# is .cfi_signal_frame supported too? 60# is .cfi_signal_frame supported too?
61cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 61cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
62AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 62KBUILD_AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
63 63
64KBUILD_CFLAGS += $(cflags-y) 64KBUILD_CFLAGS += $(cflags-y)
65 65
@@ -117,7 +117,7 @@ drivers-$(CONFIG_PM) += arch/x86/power/
117drivers-$(CONFIG_FB) += arch/x86/video/ 117drivers-$(CONFIG_FB) += arch/x86/video/
118 118
119KBUILD_CFLAGS += $(mflags-y) 119KBUILD_CFLAGS += $(mflags-y)
120AFLAGS += $(mflags-y) 120KBUILD_AFLAGS += $(mflags-y)
121 121
122boot := arch/x86/boot 122boot := arch/x86/boot
123 123
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index c80618ab60ea..4072a07ebf8e 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -25,7 +25,7 @@ cflags-$(CONFIG_ISA_M32R) += -DNO_FPU
25aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst 25aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst
26 26
27KBUILD_CFLAGS += $(cflags-y) 27KBUILD_CFLAGS += $(cflags-y)
28AFLAGS += $(aflags-y) 28KBUILD_AFLAGS += $(aflags-y)
29 29
30CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 30CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1
31 31
diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index 1c1fbb69ff26..92227aaaa26e 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -102,7 +102,7 @@ cflags-$(CONFIG_M68EZ328) := -m68000
102cflags-$(CONFIG_M68VZ328) := -m68000 102cflags-$(CONFIG_M68VZ328) := -m68000
103cflags-$(CONFIG_M68360) := -m68332 103cflags-$(CONFIG_M68360) := -m68332
104 104
105AFLAGS += $(cflags-y) 105KBUILD_AFLAGS += $(cflags-y)
106 106
107KBUILD_CFLAGS += $(cflags-y) 107KBUILD_CFLAGS += $(cflags-y)
108KBUILD_CFLAGS += -D__linux__ 108KBUILD_CFLAGS += -D__linux__
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 64512abef61d..6b663bec4752 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -608,7 +608,7 @@ ifdef CONFIG_64BIT
608 endif 608 endif
609endif 609endif
610 610
611AFLAGS += $(cflags-y) 611KBUILD_AFLAGS += $(cflags-y)
612KBUILD_CFLAGS += $(cflags-y) \ 612KBUILD_CFLAGS += $(cflags-y) \
613 -D"VMLINUX_LOAD_ADDRESS=$(load-y)" 613 -D"VMLINUX_LOAD_ADDRESS=$(load-y)"
614 614
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 51309848c11d..462bb89b67e8 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -76,7 +76,7 @@ AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH)
76CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc 76CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc
77CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple 77CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple
78CPPFLAGS += $(CPPFLAGS-y) 78CPPFLAGS += $(CPPFLAGS-y)
79AFLAGS += $(AFLAGS-y) 79KBUILD_AFLAGS += $(AFLAGS-y)
80KBUILD_CFLAGS += -msoft-float -pipe $(CFLAGS-y) 80KBUILD_CFLAGS += -msoft-float -pipe $(CFLAGS-y)
81CPP = $(CC) -E $(KBUILD_CFLAGS) 81CPP = $(CC) -E $(KBUILD_CFLAGS)
82 82
@@ -125,7 +125,7 @@ cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
125cpu-as-$(CONFIG_E500) += -Wa,-me500 125cpu-as-$(CONFIG_E500) += -Wa,-me500
126cpu-as-$(CONFIG_E200) += -Wa,-me200 126cpu-as-$(CONFIG_E200) += -Wa,-me200
127 127
128AFLAGS += $(cpu-as-y) 128KBUILD_AFLAGS += $(cpu-as-y)
129KBUILD_CFLAGS += $(cpu-as-y) 129KBUILD_CFLAGS += $(cpu-as-y)
130 130
131head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o 131head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 43802e95c892..dd63ccb66732 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -23,7 +23,7 @@ endif
23LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic 23LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic
24# The -Iarch/$(ARCH)/include is temporary while we are merging 24# The -Iarch/$(ARCH)/include is temporary while we are merging
25CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include 25CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include
26AFLAGS += -Iarch/$(ARCH) 26KBUILD_AFLAGS += -Iarch/$(ARCH)
27KBUILD_CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ 27KBUILD_CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \
28 -ffixed-r2 -mmultiple 28 -ffixed-r2 -mmultiple
29 29
@@ -45,7 +45,7 @@ cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
45cpu-as-$(CONFIG_E500) += -Wa,-me500 45cpu-as-$(CONFIG_E500) += -Wa,-me500
46cpu-as-$(CONFIG_E200) += -Wa,-me200 46cpu-as-$(CONFIG_E200) += -Wa,-me200
47 47
48AFLAGS += $(cpu-as-y) 48KBUILD_AFLAGS += $(cpu-as-y)
49KBUILD_CFLAGS += $(cpu-as-y) 49KBUILD_CFLAGS += $(cpu-as-y)
50 50
51# Default to the common case. 51# Default to the common case.
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 62a0da42c7fd..f708be367b03 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -16,7 +16,7 @@
16ifndef CONFIG_64BIT 16ifndef CONFIG_64BIT
17LDFLAGS := -m elf_s390 17LDFLAGS := -m elf_s390
18KBUILD_CFLAGS += -m31 18KBUILD_CFLAGS += -m31
19AFLAGS += -m31 19KBUILD_AFLAGS += -m31
20UTS_MACHINE := s390 20UTS_MACHINE := s390
21STACK_SIZE := 8192 21STACK_SIZE := 8192
22CHECKFLAGS += -D__s390__ -msize-long 22CHECKFLAGS += -D__s390__ -msize-long
@@ -24,7 +24,7 @@ else
24LDFLAGS := -m elf64_s390 24LDFLAGS := -m elf64_s390
25MODFLAGS += -fpic -D__PIC__ 25MODFLAGS += -fpic -D__PIC__
26KBUILD_CFLAGS += -m64 26KBUILD_CFLAGS += -m64
27AFLAGS += -m64 27KBUILD_AFLAGS += -m64
28UTS_MACHINE := s390x 28UTS_MACHINE := s390x
29STACK_SIZE := 16384 29STACK_SIZE := 16384
30CHECKFLAGS += -D__s390__ -D__s390x__ 30CHECKFLAGS += -D__s390__ -D__s390x__
@@ -79,7 +79,7 @@ endif
79 79
80KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y) 80KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y)
81KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare 81KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
82AFLAGS += $(aflags-y) 82KBUILD_AFLAGS += $(aflags-y)
83 83
84OBJCOPYFLAGS := -O binary 84OBJCOPYFLAGS := -O binary
85LDFLAGS_vmlinux := -e start 85LDFLAGS_vmlinux := -e start
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index cd8a411acc95..0353296c2c93 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -92,7 +92,7 @@ LDFLAGS += -EB
92endif 92endif
93 93
94KBUILD_CFLAGS += -pipe $(cflags-y) 94KBUILD_CFLAGS += -pipe $(cflags-y)
95AFLAGS += $(cflags-y) 95KBUILD_AFLAGS += $(cflags-y)
96 96
97head-y := arch/sh/kernel/head.o arch/sh/kernel/init_task.o 97head-y := arch/sh/kernel/head.o arch/sh/kernel/init_task.o
98 98
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 2ce781a7cbf0..fef28e267a52 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -17,7 +17,7 @@ CHECKFLAGS += -D__sparc__
17 17
18#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 18#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
19KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 19KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
20AFLAGS := $(AFLAGS) -m32 20KBUILD_AFLAGS += -m32
21 21
22#LDFLAGS_vmlinux = -N -Ttext 0xf0004000 22#LDFLAGS_vmlinux = -N -Ttext 0xf0004000
23# Since 2.5.40, the first stage is left not btfix-ed. 23# Since 2.5.40, the first stage is left not btfix-ed.
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
index b083dc458ce9..6c92a42efe76 100644
--- a/arch/sparc64/Makefile
+++ b/arch/sparc64/Makefile
@@ -45,7 +45,7 @@ else
45 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ 45 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
46 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \ 46 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
47 $(CC_UNDECL) 47 $(CC_UNDECL)
48 AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL) 48 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL)
49endif 49endif
50 50
51ifeq ($(CONFIG_MCOUNT),y) 51ifeq ($(CONFIG_MCOUNT),y)
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 18123bf7b649..d08d3bc518e3 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -62,7 +62,7 @@ KBUILD_CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \
62 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ 62 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
63 -Din6addr_loopback=kernel_in6addr_loopback 63 -Din6addr_loopback=kernel_in6addr_loopback
64 64
65AFLAGS += $(ARCH_INCLUDE) 65KBUILD_AFLAGS += $(ARCH_INCLUDE)
66 66
67USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ 67USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
68 $(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \ 68 $(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 26bc786fc614..d10e4dc0dae8 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -16,7 +16,7 @@ OBJCOPYFLAGS := -O binary -R .note -R .comment -S
16ifeq ("$(origin SUBARCH)", "command line") 16ifeq ("$(origin SUBARCH)", "command line")
17ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") 17ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
18KBUILD_CFLAGS += $(call cc-option,-m32) 18KBUILD_CFLAGS += $(call cc-option,-m32)
19AFLAGS += $(call cc-option,-m32) 19KBUILD_AFLAGS += $(call cc-option,-m32)
20LINK-y += $(call cc-option,-m32) 20LINK-y += $(call cc-option,-m32)
21UML_OBJCOPYFLAGS += -F $(ELF_FORMAT) 21UML_OBJCOPYFLAGS += -F $(ELF_FORMAT)
22 22
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index 36d2bb5e4192..8836f0df36aa 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -12,7 +12,7 @@ ARCH_KERNEL_DEFINES = -U__$(SUBARCH)__
12KBUILD_CFLAGS += $(_extra_flags_) 12KBUILD_CFLAGS += $(_extra_flags_)
13 13
14CHECKFLAGS += -m64 14CHECKFLAGS += -m64
15AFLAGS += -m64 15KBUILD_AFLAGS += -m64
16LDFLAGS += -m elf_x86_64 16LDFLAGS += -m elf_x86_64
17CPPFLAGS += -m64 17CPPFLAGS += -m64
18 18
diff --git a/arch/um/sys-ppc/Makefile b/arch/um/sys-ppc/Makefile
index af200268fddb..a9814a7ae60e 100644
--- a/arch/um/sys-ppc/Makefile
+++ b/arch/um/sys-ppc/Makefile
@@ -1,7 +1,7 @@
1OBJ = built-in.o 1OBJ = built-in.o
2 2
3.S.o: 3.S.o:
4 $(CC) $(AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o 4 $(CC) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
5 5
6OBJS = ptrace.o sigcontext.o semaphore.o checksum.o miscthings.o misc.o \ 6OBJS = ptrace.o sigcontext.o semaphore.o checksum.o miscthings.o misc.o \
7 ptrace_user.o sysrq.o 7 ptrace_user.o sysrq.o
@@ -57,13 +57,13 @@ ppc_defs.h: mk_defs.c ppc_defs.head \
57checksum.o: checksum.S 57checksum.o: checksum.S
58 rm -f asm 58 rm -f asm
59 ln -s $(TOPDIR)/include/asm-ppc asm 59 ln -s $(TOPDIR)/include/asm-ppc asm
60 $(CC) $(EXTRA_AFLAGS) $(AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o 60 $(CC) $(EXTRA_AFLAGS) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
61 rm -f asm 61 rm -f asm
62 62
63misc.o: misc.S ppc_defs.h 63misc.o: misc.S ppc_defs.h
64 rm -f asm 64 rm -f asm
65 ln -s $(TOPDIR)/include/asm-ppc asm 65 ln -s $(TOPDIR)/include/asm-ppc asm
66 $(CC) $(EXTRA_AFLAGS) $(AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o 66 $(CC) $(EXTRA_AFLAGS) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
67 rm -f asm 67 rm -f asm
68 68
69clean-files := $(OBJS) ppc_defs.h checksum.S semaphore.c mk_defs.c 69clean-files := $(OBJS) ppc_defs.h checksum.S semaphore.c mk_defs.c
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 646292aaf1fc..d6ed8e5e1ccc 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -61,7 +61,7 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
61 $(call cc-option, -fno-unit-at-a-time)) \ 61 $(call cc-option, -fno-unit-at-a-time)) \
62 $(call cc-option, -fno-stack-protector) \ 62 $(call cc-option, -fno-stack-protector) \
63 $(call cc-option, -mpreferred-stack-boundary=2) 63 $(call cc-option, -mpreferred-stack-boundary=2)
64AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 64KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
65 65
66$(obj)/zImage: IMAGE_OFFSET := 0x1000 66$(obj)/zImage: IMAGE_OFFSET := 0x1000
67$(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) 67$(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK)
diff --git a/arch/x86/boot/compressed/Makefile_64 b/arch/x86/boot/compressed/Makefile_64
index 3013ad01fe69..7801e8dd90b2 100644
--- a/arch/x86/boot/compressed/Makefile_64
+++ b/arch/x86/boot/compressed/Makefile_64
@@ -10,7 +10,7 @@ KBUILD_CFLAGS := -m64 -D__KERNEL__ $(LINUXINCLUDE) -O2 \
10 -fno-strict-aliasing -fPIC -mcmodel=small \ 10 -fno-strict-aliasing -fPIC -mcmodel=small \
11 $(call cc-option, -ffreestanding) \ 11 $(call cc-option, -ffreestanding) \
12 $(call cc-option, -fno-stack-protector) 12 $(call cc-option, -fno-stack-protector)
13AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 13KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
14LDFLAGS := -m elf_x86_64 14LDFLAGS := -m elf_x86_64
15 15
16LDFLAGS_vmlinux := -T 16LDFLAGS_vmlinux := -T
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 3fc33004e8c6..9daa32d1d2a1 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -61,18 +61,18 @@ cflags-y += -maccumulate-outgoing-args
61 61
62# do binutils support CFI? 62# do binutils support CFI?
63cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 63cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
64AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 64KBUILD_AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
65 65
66# is .cfi_signal_frame supported too? 66# is .cfi_signal_frame supported too?
67cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 67cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
68AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 68KBUILD_AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
69 69
70cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector ) 70cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector )
71cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector-all ) 71cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector-all )
72 72
73KBUILD_CFLAGS += $(cflags-y) 73KBUILD_CFLAGS += $(cflags-y)
74CFLAGS_KERNEL += $(cflags-kernel-y) 74CFLAGS_KERNEL += $(cflags-kernel-y)
75AFLAGS += -m64 75KBUILD_AFLAGS += -m64
76 76
77head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task_64.o 77head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task_64.o
78 78
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index b1a7c7d42e15..de7bb284c611 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -81,7 +81,7 @@ as-option = $(call try-run,\
81# Usage: cflags-y += $(call as-instr,instr,option1,option2) 81# Usage: cflags-y += $(call as-instr,instr,option1,option2)
82 82
83as-instr = $(call try-run,\ 83as-instr = $(call try-run,\
84 echo -e "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) 84 echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))
85 85
86# cc-option 86# cc-option
87# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) 87# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 51ae412929a0..2837adaa9850 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -85,7 +85,7 @@ modname_flags = $(if $(filter 1,$(words $(modname))),\
85 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") 85 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
86 86
87_c_flags = $(KBUILD_CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o) 87_c_flags = $(KBUILD_CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o)
88_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 88_a_flags = $(KBUILD_AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
89_cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) 89_cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F))
90 90
91# If building the kernel in a separate objtree expand all occurrences 91# If building the kernel in a separate objtree expand all occurrences