s390: only build for new CPUs with clang
PATCH 1/2 s390: only build for new CPUs with clang
llvm does does not understand -march=z9-109 and older target specifiers, so disable the respective Kconfig settings and the logic to make the boot code work on old systems when building with clang.
--- arch/s390/Kconfig | 6 ++++++ arch/s390/boot/Makefile | 2 ++ 2 files changed, 8 insertions(+)
arch/s390/Kconfig +6 -0
@@ -240,6 +240,7 @@ choice config MARCH_Z900 bool "IBM zSeries model z800 and z900" + depends on !CC_IS_CLANG select HAVE_MARCH_Z900_FEATURES help Select this to enable optimizations for model z800/z900 (2064 and
@@ -248,6 +249,7 @@ config MARCH_Z900 config MARCH_Z990 bool "IBM zSeries model z890 and z990" + depends on !CC_IS_CLANG select HAVE_MARCH_Z990_FEATURES help Select this to enable optimizations for model z890/z990 (2084 and
@@ -256,6 +258,7 @@ config MARCH_Z990 config MARCH_Z9_109 bool "IBM System z9" + depends on !CC_IS_CLANG select HAVE_MARCH_Z9_109_FEATURES help Select this to enable optimizations for IBM System z9 (2094 and
@@ -347,12 +350,15 @@ config TUNE_DEFAULT config TUNE_Z900 bool "IBM zSeries model z800 and z900" + depends on !CC_IS_CLANG config TUNE_Z990 bool "IBM zSeries model z890 and z990" + depends on !CC_IS_CLANG config TUNE_Z9_109 bool "IBM System z9" + depends on !CC_IS_CLANG config TUNE_Z10 bool "IBM System z10"
arch/s390/boot/Makefile +2 -0
@@ -11,6 +11,7 @@ KASAN_SANITIZE := n KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR) +ifndef CONFIG_CC_IS_CLANG # # Use -march=z900 for als.c to be able to print an error # message if the kernel is started on a machine which is too old
@@ -25,6 +26,7 @@ CFLAGS_als.o += -march=z900 CFLAGS_REMOVE_sclp_early_core.o += $(CC_FLAGS_MARCH) CFLAGS_sclp_early_core.o += -march=z900 endif +endif CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
Signature · 1 line
2.20.0
PATCH 2/2 s390: boot, purgatory: pass $(CLANG_FLAGS) where needed
The purgatory and boot Makefiles do not inherit the original cflags, so clang falls back to the default target architecture when building it, typically this would be x86 when cross-compiling.
Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux option when cross-compiling.
--- arch/s390/Makefile | 5 +++-- arch/s390/purgatory/Makefile | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
arch/s390/Makefile +3 -2
@@ -17,12 +17,13 @@ KBUILD_CFLAGS_MODULE += -fPIC KBUILD_AFLAGS += -m64 KBUILD_CFLAGS += -m64 aflags_dwarf := -Wa,-gdwarf-2 -KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__ +KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__ KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) -KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2 +KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables +KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning,pointer-sign) KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
arch/s390/purgatory/Makefile +1 -0
@@ -22,6 +22,7 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common +KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_CFLAGS += $(call cc-option,-fno-PIE) KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
Signature · 1 line
2.20.0
Re: [PATCH 2/2] s390: boot, purgatory: pass $(CLANG_FLAGS) where needed
Quoted 20 lines · Arnd Bergmann
The purgatory and boot Makefiles do not inherit the original cflags, so clang falls back to the default target architecture when building it, typically this would be x86 when cross-compiling.
Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux option when cross-compiling.
Signed-off-by Arnd Bergmann <[email protected]>--- arch/s390/Makefile | 5 +++-- arch/s390/purgatory/Makefile | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)arch/s390/Makefile +0
-0@@ -17,12 +17,13 @@ KBUILD_CFLAGS_MODULE += -fPIC KBUILD_AFLAGS += -m64
arch/s390/Makefile KBUILD_CFLAGS_MODULE += -fPIC · line 25
Quoted 10 lines
arch/s390/Makefile +2
-2KBUILD_CFLAGS += -m64 aflags_dwarf := -Wa,-gdwarf-2 -KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__ +KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__ KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) -KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2 +KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
Thanks for the respin with Nathan's suggestion.
arch/s390/Makefile KBUILD_CFLAGS_MODULE += -fPIC · line 26
Quoted 1 line
arch/s390/Makefile +1
-0+KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning,pointer-sign)
What's up with this ^ ? Seems like the top level sets it (without cc-disable-warning :( ), but then KBUILD_CFLAGS_DECOMPRESSOR discards it. Does Clang actually flag code in this arch (that GCC doesn't)?
Quoted 18 lines
arch/s390/Makefile +0
-0KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))arch/s390/purgatory/Makefile +1
-1@@ -22,6 +22,7 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common +KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_CFLAGS += $(call cc-option,-fno-PIE) KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS)) --2.20.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Re: [PATCH 2/2] s390: boot, purgatory: pass $(CLANG_FLAGS) where needed
Quoted 34 lines · Nick Desaulniers' via Clang Built Linux
Quoted 20 lines · Arnd Bergmann
The purgatory and boot Makefiles do not inherit the original cflags, so clang falls back to the default target architecture when building it, typically this would be x86 when cross-compiling.
Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux option when cross-compiling.
Signed-off-by Arnd Bergmann <[email protected]>--- arch/s390/Makefile | 5 +++-- arch/s390/purgatory/Makefile | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)arch/s390/Makefile +0
-0@@ -17,12 +17,13 @@ KBUILD_CFLAGS_MODULE += -fPIC KBUILD_AFLAGS += -m64arch/s390/Makefile KBUILD_CFLAGS_MODULE += -fPIC · line 25
Quoted 10 lines
arch/s390/Makefile +2
-2KBUILD_CFLAGS += -m64 aflags_dwarf := -Wa,-gdwarf-2 -KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__ +KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__ KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) -KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2 +KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tablesThanks for the respin with Nathan's suggestion.
Quoted 5 lines
arch/s390/Makefile KBUILD_CFLAGS_MODULE += -fPIC · line 26
Quoted 1 line
arch/s390/Makefile +1
-0+KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning,pointer-sign)What's up with this ^ ? Seems like the top level sets it (without cc-disable-warning :( ), but then
KBUILD_CFLAGS_DECOMPRESSORdiscards it. Does Clang actually flag code in this arch (that GCC doesn't)?
Oops, that should have been a separate patch.
I think what happens is that clang warns more aggressively about pointer sign bugs than gcc in some cases, and some of those cases happen in s390 header files that are included by both the kernel and the decompressor.
The full warning log without this change is rather long, see
https://pastebin.com/KG9xaTNB
I also tried patching the code to avoid the warnings, but I'm not entirely happy with that result either, see
https://pastebin.com/pSMz5eZA
Arnd
Re: [PATCH 2/2] s390: boot, purgatory: pass $(CLANG_FLAGS) where needed
Quoted 43 lines · Arnd Bergmann
Quoted 34 lines · Nick Desaulniers' via Clang Built Linux
Quoted 20 lines · Arnd Bergmann
The purgatory and boot Makefiles do not inherit the original cflags, so clang falls back to the default target architecture when building it, typically this would be x86 when cross-compiling.
Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux option when cross-compiling.
Signed-off-by Arnd Bergmann <[email protected]>--- arch/s390/Makefile | 5 +++-- arch/s390/purgatory/Makefile | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)arch/s390/Makefile +0
-0@@ -17,12 +17,13 @@ KBUILD_CFLAGS_MODULE += -fPIC KBUILD_AFLAGS += -m64arch/s390/Makefile KBUILD_CFLAGS_MODULE += -fPIC · line 25
Quoted 10 lines
arch/s390/Makefile +2
-2KBUILD_CFLAGS += -m64 aflags_dwarf := -Wa,-gdwarf-2 -KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__ +KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__ KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) -KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2 +KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tablesThanks for the respin with Nathan's suggestion.
Quoted 5 lines
arch/s390/Makefile KBUILD_CFLAGS_MODULE += -fPIC · line 26
Quoted 1 line
arch/s390/Makefile +1
-0+KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning,pointer-sign)What's up with this ^ ? Seems like the top level sets it (without cc-disable-warning :( ), but then
KBUILD_CFLAGS_DECOMPRESSORdiscards it. Does Clang actually flag code in this arch (that GCC doesn't)?
Quoted 8 lines
Oops, that should have been a separate patch.
I think what happens is that clang warns more aggressively about pointer sign bugs than gcc in some cases, and some of those cases happen in s390 header files that are included by both the kernel and the decompressor.
The full warning log without this change is rather long, see
https://pastebin.com/KG9xaTNB
From this link, it looks like the definitions of:__atomic64_or__atomic64_and__atomic64_xor
and their *_barrier variants are problematic. I think converting those to use unsigned long is the way to go. Shouldn't you be doing bitwise ops on unsigned types anyways?
The warnings with __atomic64_add are tougher to read/understand since at that point the log lines look like they start to mix together.
Quoted 4 lines
I also tried patching the code to avoid the warnings, but I'm not entirely happy with that result either, see
https://pastebin.com/pSMz5eZA
That's no terrible, IMO, particularly with the change I suggest above.
Signature · 2 lines
Thanks, ~Nick Desaulniers
Re: [PATCH 2/2] s390: boot, purgatory: pass $(CLANG_FLAGS) where needed
Quoted 53 lines · On Thu, 11 Apr 2019 11:08:31 -0700 Nick Desaulniers <[email protected]>…
Quoted 43 lines · Arnd Bergmann
Quoted 34 lines · Nick Desaulniers' via Clang Built Linux
Quoted 20 lines · Arnd Bergmann
The purgatory and boot Makefiles do not inherit the original cflags, so clang falls back to the default target architecture when building it, typically this would be x86 when cross-compiling.
Add $(CLANG_FLAGS) everywhere so we pass the correct --target=s390x-linux option when cross-compiling.
Signed-off-by Arnd Bergmann <[email protected]>--- arch/s390/Makefile | 5 +++-- arch/s390/purgatory/Makefile | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)arch/s390/Makefile +0
-0@@ -17,12 +17,13 @@ KBUILD_CFLAGS_MODULE += -fPIC KBUILD_AFLAGS += -m64arch/s390/Makefile KBUILD_CFLAGS_MODULE += -fPIC · line 25
Quoted 10 lines
arch/s390/Makefile +2
-2KBUILD_CFLAGS += -m64 aflags_dwarf := -Wa,-gdwarf-2 -KBUILD_AFLAGS_DECOMPRESSOR := -m64 -D__ASSEMBLY__ +KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__ KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) -KBUILD_CFLAGS_DECOMPRESSOR := -m64 -O2 +KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tablesThanks for the respin with Nathan's suggestion.
Quoted 5 lines
arch/s390/Makefile KBUILD_CFLAGS_MODULE += -fPIC · line 26
Quoted 1 line
arch/s390/Makefile +1
-0+KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning,pointer-sign)What's up with this ^ ? Seems like the top level sets it (without cc-disable-warning :( ), but then
KBUILD_CFLAGS_DECOMPRESSORdiscards it. Does Clang actually flag code in this arch (that GCC doesn't)?Quoted 8 lines
Oops, that should have been a separate patch.
I think what happens is that clang warns more aggressively about pointer sign bugs than gcc in some cases, and some of those cases happen in s390 header files that are included by both the kernel and the decompressor.
The full warning log without this change is rather long, see
https://pastebin.com/KG9xaTNB
Quoted 7 lines
From this link, it looks like the definitions of:
__atomic64_or__atomic64_and__atomic64_xor
and their*_barriervariants are problematic. I think converting those to use unsigned long is the way to go. Shouldn't you be doing bitwise ops on unsigned types anyways?
These functions follow the type of atomic64_t which is a "long" wrapped in a structure. We do not want to change that to unsigned long, are we? Then having some of the functions operate on "long" and others on "unsigned long" seem odd.
Quoted 9 lines
The warnings with
__atomic64_addare tougher to read/understand since at that point the log lines look like they start to mix together.Quoted 4 lines
I also tried patching the code to avoid the warnings, but I'm not entirely happy with that result either, see
https://pastebin.com/pSMz5eZAThat's no terrible, IMO, particularly with the change I suggest above.
That is not too bad, the only change I do not like is the s/u8/char/ in struct ipl_block_fcp.
Signature · 4 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin.
Quoted 2 lines · Arnd Bergmann
llvm does does not understand -march=z9-109 and older target
Please file bugs for these in LLVM's issue tracker. It might be possible to enable these additional architecture variants if they're similar to existing ones and simply unrecognized. IIRC, we had this issue with armv7 variants.
Quoted 77 lines
specifiers, so disable the respective
Kconfigsettings and the logic to make the boot code work on old systems when building with clang.Signed-off-by Arnd Bergmann <[email protected]>--- arch/s390/Kconfig | 6 ++++++ arch/s390/boot/Makefile | 2 ++ 2 files changed, 8 insertions(+)arch/s390/Kconfig +6
-0@@ -240,6 +240,7 @@ choice config MARCH_Z900 bool "IBM zSeries model z800 and z900" + depends on !CC_IS_CLANG select HAVE_MARCH_Z900_FEATURES help Select this to enable optimizations for model z800/z900 (2064 and@@ -248,6 +249,7 @@ config MARCH_Z900 config MARCH_Z990 bool "IBM zSeries model z890 and z990" + depends on !CC_IS_CLANG select HAVE_MARCH_Z990_FEATURES help Select this to enable optimizations for model z890/z990 (2084 and@@ -256,6 +258,7 @@ config MARCH_Z990 config MARCH_Z9_109 bool "IBM System z9" + depends on !CC_IS_CLANG select HAVE_MARCH_Z9_109_FEATURES help Select this to enable optimizations for IBM System z9 (2094 and@@ -347,12 +350,15 @@ config TUNE_DEFAULT config TUNE_Z900 bool "IBM zSeries model z800 and z900" + depends on !CC_IS_CLANG config TUNE_Z990 bool "IBM zSeries model z890 and z990" + depends on !CC_IS_CLANG config TUNE_Z9_109 bool "IBM System z9" + depends on !CC_IS_CLANG config TUNE_Z10 bool "IBM System z10"arch/s390/boot/Makefile +2
-1@@ -11,6 +11,7 @@ KASAN_SANITIZE := n KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR) +ifndef CONFIG_CC_IS_CLANG # # Use -march=z900 for als.c to be able to print an error # message if the kernel is started on a machine which is too old@@ -25,6 +26,7 @@ CFLAGS_als.o += -march=z900 CFLAGS_REMOVE_sclp_early_core.o += $(CC_FLAGS_MARCH) CFLAGS_sclp_early_core.o += -march=z900 endif +endif CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char --2.20.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 9 lines · Nick Desaulniers' via Clang Built Linux
Quoted 2 lines · Arnd Bergmann
llvm does does not understand -march=z9-109 and older target
Please file bugs for these in LLVM's issue tracker. It might be possible to enable these additional architecture variants if they're similar to existing ones and simply unrecognized. IIRC, we had this issue with armv7 variants.
I really don't see that as necessary here. While generally speaking, it would be nice to support the widest possible range of hardware, and it would not be hard to add this support, it seems highly unlikely that anyone would actually want to use that in case of s390.
The last enterprise distros to support z9 were SLES11 (end of life as of last month) and RHEL6 (ending its 10 year life next year). Anyone who is still on those releases will probably not install a brand new compiler, and anyone who is on newer releases won't run on prehistoric hardware.
Debian still runs on very old hardware in theory, but even there you'd have a hard time finding someone to test the output of the compiler on an old machine.
Arnd
Quoted 18 lines · Arnd Bergmann
Quoted 9 lines · Nick Desaulniers' via Clang Built Linux
Quoted 2 lines · Arnd Bergmann
llvm does does not understand -march=z9-109 and older target
Please file bugs for these in LLVM's issue tracker. It might be possible to enable these additional architecture variants if they're similar to existing ones and simply unrecognized. IIRC, we had this issue with armv7 variants.
I really don't see that as necessary here. While generally speaking, it would be nice to support the widest possible range of hardware, and it would not be hard to add this support, it seems highly unlikely that anyone would actually want to use that in case of s390.
Quoted 5 lines
The last enterprise distros to support z9 were SLES11 (end of life as of last month) and RHEL6 (ending its 10 year life next year). Anyone who is still on those releases will probably not install a brand new compiler, and anyone who is on newer releases won't run on prehistoric hardware.
Are those machine variants worth dropping kernel support for then?
Quoted 6 lines
Debian still runs on very old hardware in theory, but even there you'd have a hard time finding someone to test the output of the compiler on an old machine.
Arnd
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 10 lines · Arnd Bergmann
llvm does does not understand -march=z9-109 and older target specifiers, so disable the respective
Kconfigsettings and the logic to make the boot code work on old systems when building with clang.Signed-off-by Arnd Bergmann <[email protected]>--- arch/s390/Kconfig | 6 ++++++ arch/s390/boot/Makefile | 2 ++ 2 files changed, 8 insertions(+)
...
Quoted 13 lines
arch/s390/boot/Makefile +1
-0@@ -11,6 +11,7 @@ KASAN_SANITIZE := n KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR) +ifndef CONFIG_CC_IS_CLANG # # Use -march=z900 for als.c to be able to print an error # message if the kernel is started on a machine which is too old
arch/s390/boot/Makefile CFLAGS_als.o += -march=z900 · line 29
Quoted 4 lines
arch/s390/boot/Makefile +1
-0@@ -25,6 +26,7 @@ CFLAGS_als.o += -march=z900 CFLAGS_REMOVE_sclp_early_core.o += $(CC_FLAGS_MARCH) CFLAGS_sclp_early_core.o += -march=z900 endif +endif
This contradicts the whole purpose of als.c - printing an error message to the console if the kernel is compiled for a newer architecture than it is running on (and therefore uses instructions unknown to the current system).
If this can't be fixed/changed in clang, then it should be at least changed to the lowest possible architecture.
Quoted 21 lines · Heiko Carstens
Quoted 10 lines · Arnd Bergmann
llvm does does not understand -march=z9-109 and older target specifiers, so disable the respective
Kconfigsettings and the logic to make the boot code work on old systems when building with clang.Signed-off-by Arnd Bergmann <[email protected]>--- arch/s390/Kconfig | 6 ++++++ arch/s390/boot/Makefile | 2 ++ 2 files changed, 8 insertions(+)...
Quoted 8 lines
arch/s390/boot/Makefile +0
-0@@ -11,6 +11,7 @@ KASAN_SANITIZE := n KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
Quoted 16 lines
arch/s390/boot/Makefile CFLAGS_als.o += -march=z900 · line 29
Quoted 9 lines
arch/s390/boot/Makefile +2
-0+ifndef CONFIG_CC_IS_CLANG # # Use -march=z900 for als.c to be able to print an error # message if the kernel is started on a machine which is too old@@ -25,6 +26,7 @@ CFLAGS_als.o += -march=z900 CFLAGS_REMOVE_sclp_early_core.o += $(CC_FLAGS_MARCH) CFLAGS_sclp_early_core.o += -march=z900 endif +endifThis contradicts the whole purpose of
als.c- printing an error message to the console if the kernel is compiled for a newer architecture than it is running on (and therefore uses instructions unknown to the current system).
If this can't be fixed/changed in clang, then it should be at least changed to the lowest possible architecture.
Ok, I'll do that. I originally did something like it, but then went back to the simpler workaround to just make it compile.
Arnd