Skip to content

Commit 69114be

Browse files
koachanandreas-gaisler
authored andcommitted
sparc/build: Put usage of -fcall-used* flags behind cc-option
Place -fcall-used* flags behind cc-option so that clang (which doesn't support them) can still compile the kernel. This is a safe change, the reasoning is as follows: In the (normal) 32-bit ABI, %g5 and %g7 is normally reserved, and in the 64-bit ABI, %g7 is the reserved one. Linux turns them into volatile registers by the way of -fcall-used-*, but on the other hand, omitting the flags shouldn't be harmful; compilers will now simply refuse to touch them, and any assembly code that happens to touch them would still work like usual (because Linux' conventions already treats them as volatile anyway). Signed-off-by: Koakuma <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Reviewed-by: Andreas Larsson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andreas Larsson <[email protected]>
1 parent 9852d85 commit 69114be

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/sparc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ UTS_MACHINE := sparc
2929
# versions of gcc. Some gcc versions won't pass -Av8 to binutils when you
3030
# give -mcpu=v8. This silently worked with older bintutils versions but
3131
# does not any more.
32-
KBUILD_CFLAGS += -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
32+
KBUILD_CFLAGS += -m32 -mcpu=v8 -pipe -mno-fpu $(call cc-option,-fcall-used-g5) $(call cc-option,-fcall-used-g7)
3333
KBUILD_CFLAGS += -Wa,-Av8
3434

3535
KBUILD_AFLAGS += -m32 -Wa,-Av8
@@ -45,7 +45,7 @@ export BITS := 64
4545
UTS_MACHINE := sparc64
4646

4747
KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow
48-
KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare
48+
KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 $(call cc-option,-fcall-used-g7) -Wno-sign-compare
4949
KBUILD_CFLAGS += -Wa,--undeclared-regs
5050
KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
5151
KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs

arch/sparc/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ CFL := $(PROFILING) -mcmodel=medlow -fPIC -O2 -fasynchronous-unwind-tables -m64
4646
-fno-omit-frame-pointer -foptimize-sibling-calls \
4747
-DDISABLE_BRANCH_PROFILING -DBUILD_VDSO
4848

49-
SPARC_REG_CFLAGS = -ffixed-g4 -ffixed-g5 -fcall-used-g5 -fcall-used-g7
49+
SPARC_REG_CFLAGS = -ffixed-g4 -ffixed-g5 $(call cc-option,-fcall-used-g5) $(call cc-option,-fcall-used-g7)
5050

5151
$(vobjs): KBUILD_CFLAGS := $(filter-out $(RANDSTRUCT_CFLAGS) $(GCC_PLUGINS_CFLAGS) $(SPARC_REG_CFLAGS),$(KBUILD_CFLAGS)) $(CFL)
5252

0 commit comments

Comments
 (0)