Commit b1e0d8b70fa31821ebca3965f2ef8619d7c5e316
Committed by
Michal Marek
1 parent
fe04ddf7c2
Exists in
master
and in
20 other branches
kbuild: Fix gcc -x syntax
The correct syntax for gcc -x is "gcc -x assembler", not "gcc -xassembler". Even though the latter happens to work, the former is what is documented in the manual page and thus what gcc wrappers such as icecream do expect. This isn't a cosmetic change. The missing space prevents icecream from recognizing compilation tasks it can't handle, leading to silent kernel miscompilations. Besides me, credits go to Michael Matz and Dirk Mueller for investigating the miscompilation issue and tracking it down to this incorrect -x parameter syntax. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: Ingo Molnar <mingo@kernel.org> Cc: stable@vger.kernel.org Cc: Bernhard Walle <bernhard@bwalle.de> Cc: Michal Marek <mmarek@suse.cz> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
Showing 11 changed files with 18 additions and 18 deletions Side-by-side Diff
- arch/mips/Makefile
- arch/mips/kernel/Makefile
- arch/x86/Makefile
- scripts/Kbuild.include
- scripts/gcc-version.sh
- scripts/gcc-x86_32-has-stack-protector.sh
- scripts/gcc-x86_64-has-stack-protector.sh
- scripts/kconfig/check.sh
- scripts/kconfig/lxdialog/check-lxdialog.sh
- tools/perf/Makefile
- tools/power/cpupower/Makefile
arch/mips/Makefile
... | ... | @@ -225,7 +225,7 @@ |
225 | 225 | LDFLAGS += -m $(ld-emul) |
226 | 226 | |
227 | 227 | ifdef CONFIG_MIPS |
228 | -CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -xc /dev/null | \ | |
228 | +CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ | |
229 | 229 | egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ |
230 | 230 | sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/") |
231 | 231 | ifdef CONFIG_64BIT |
arch/mips/kernel/Makefile
... | ... | @@ -104,7 +104,7 @@ |
104 | 104 | |
105 | 105 | obj-$(CONFIG_OF) += prom.o |
106 | 106 | |
107 | -CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) | |
107 | +CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -x c /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) | |
108 | 108 | |
109 | 109 | obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o |
110 | 110 |
arch/x86/Makefile
... | ... | @@ -88,7 +88,7 @@ |
88 | 88 | ifdef CONFIG_X86_X32 |
89 | 89 | x32_ld_ok := $(call try-run,\ |
90 | 90 | /bin/echo -e '1: .quad 1b' | \ |
91 | - $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" - && \ | |
91 | + $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" - && \ | |
92 | 92 | $(OBJCOPY) -O elf32-x86-64 "$$TMP" "$$TMPO" && \ |
93 | 93 | $(LD) -m elf32_x86_64 "$$TMPO" -o "$$TMP",y,n) |
94 | 94 | ifeq ($(x32_ld_ok),y) |
scripts/Kbuild.include
... | ... | @@ -98,24 +98,24 @@ |
98 | 98 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) |
99 | 99 | |
100 | 100 | as-option = $(call try-run,\ |
101 | - $(CC) $(KBUILD_CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2)) | |
101 | + $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) | |
102 | 102 | |
103 | 103 | # as-instr |
104 | 104 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
105 | 105 | |
106 | 106 | as-instr = $(call try-run,\ |
107 | - printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) | |
107 | + printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) | |
108 | 108 | |
109 | 109 | # cc-option |
110 | 110 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
111 | 111 | |
112 | 112 | cc-option = $(call try-run,\ |
113 | - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",$(1),$(2)) | |
113 | + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2)) | |
114 | 114 | |
115 | 115 | # cc-option-yn |
116 | 116 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
117 | 117 | cc-option-yn = $(call try-run,\ |
118 | - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP",y,n) | |
118 | + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) | |
119 | 119 | |
120 | 120 | # cc-option-align |
121 | 121 | # Prefix align with either -falign or -malign |
... | ... | @@ -125,7 +125,7 @@ |
125 | 125 | # cc-disable-warning |
126 | 126 | # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) |
127 | 127 | cc-disable-warning = $(call try-run,\ |
128 | - $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1))) | |
128 | + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) | |
129 | 129 | |
130 | 130 | # cc-version |
131 | 131 | # Usage gcc-ver := $(call cc-version) |
... | ... | @@ -143,7 +143,7 @@ |
143 | 143 | # cc-ldoption |
144 | 144 | # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) |
145 | 145 | cc-ldoption = $(call try-run,\ |
146 | - $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) | |
146 | + $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) | |
147 | 147 | |
148 | 148 | # ld-option |
149 | 149 | # Usage: LDFLAGS += $(call ld-option, -X) |
scripts/gcc-version.sh
... | ... | @@ -22,10 +22,10 @@ |
22 | 22 | exit 1 |
23 | 23 | fi |
24 | 24 | |
25 | -MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1) | |
26 | -MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) | |
25 | +MAJOR=$(echo __GNUC__ | $compiler -E -x c - | tail -n 1) | |
26 | +MINOR=$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1) | |
27 | 27 | if [ "x$with_patchlevel" != "x" ] ; then |
28 | - PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1) | |
28 | + PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1) | |
29 | 29 | printf "%02d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL |
30 | 30 | else |
31 | 31 | printf "%02d%02d\\n" $MAJOR $MINOR |
scripts/gcc-x86_32-has-stack-protector.sh
1 | 1 | #!/bin/sh |
2 | 2 | |
3 | -echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -fstack-protector - -o - 2> /dev/null | grep -q "%gs" | |
3 | +echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -fstack-protector - -o - 2> /dev/null | grep -q "%gs" | |
4 | 4 | if [ "$?" -eq "0" ] ; then |
5 | 5 | echo y |
6 | 6 | else |
scripts/gcc-x86_64-has-stack-protector.sh
1 | 1 | #!/bin/sh |
2 | 2 | |
3 | -echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" | |
3 | +echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" | |
4 | 4 | if [ "$?" -eq "0" ] ; then |
5 | 5 | echo y |
6 | 6 | else |
scripts/kconfig/check.sh
scripts/kconfig/lxdialog/check-lxdialog.sh
tools/perf/Makefile
... | ... | @@ -62,7 +62,7 @@ |
62 | 62 | ARCH := x86 |
63 | 63 | IS_X86_64 := 0 |
64 | 64 | ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) |
65 | - IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1) | |
65 | + IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) | |
66 | 66 | endif |
67 | 67 | ifeq (${IS_X86_64}, 1) |
68 | 68 | RAW_ARCH := x86_64 |
tools/power/cpupower/Makefile
... | ... | @@ -111,7 +111,7 @@ |
111 | 111 | export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS |
112 | 112 | |
113 | 113 | # check if compiler option is supported |
114 | -cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} | |
114 | +cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} | |
115 | 115 | |
116 | 116 | # use '-Os' optimization if available, else use -O2 |
117 | 117 | OPTIMIZATION := $(call cc-supports,-Os,-O2) |