diff options
author | Palmer Dabbelt <palmer@rivosinc.com> | 2023-02-23 11:49:22 -0800 |
---|---|---|
committer | Palmer Dabbelt <palmer@rivosinc.com> | 2023-02-23 14:11:22 -0800 |
commit | 858affb61bd0d79d702fe73d9316fd32693aacc4 (patch) | |
tree | bef47074715653a72d9e166bdaed7745b3122f13 | |
parent | 51e24314e0a1f193799351c06af8727ab92fd4d2 (diff) | |
download | linux-riscv-no_attributes-v2.tar.gz |
RISC-V: Stop emitting attributesriscv-no_attributes-v2
The RISC-V ELF attributes don't contain any useful information. New
toolchains ignore them, but they frequently trip up various older/mixed
toolchains. So just turn them off.
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
Changes since v1 <20230223195112.10489-1-palmer@rivosinc.com/>:
* Add the attributes to both KBUILD_CFLAGS and KBUILD_AFLAGS, so
assembly files build without attributes.
* Set COMPAT_CFLAGS so the compat VDSO builds without attributes.
-rw-r--r-- | arch/riscv/Makefile | 7 | ||||
-rw-r--r-- | arch/riscv/kernel/compat_vdso/Makefile | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 76989561566bc7..7b53f0be56b247 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -81,6 +81,13 @@ ifeq ($(CONFIG_PERF_EVENTS),y) KBUILD_CFLAGS += -fno-omit-frame-pointer endif +# The RISC-V attributes frequently cause compatibility issues and provide no +# information, so just turn them off. +KBUILD_CFLAGS += $(call cc-option,-mno-riscv-attribute) +KBUILD_AFLAGS += $(call cc-option,-mno-riscv-attribute) +KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mno-arch-attr) +KBUILD_AFLAGS += $(call as-option,-Wa$(comma)-mno-arch-attr) + KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax) diff --git a/arch/riscv/kernel/compat_vdso/Makefile b/arch/riscv/kernel/compat_vdso/Makefile index 260daf3236d3a8..7f34f3c7c8827a 100644 --- a/arch/riscv/kernel/compat_vdso/Makefile +++ b/arch/riscv/kernel/compat_vdso/Makefile @@ -14,6 +14,10 @@ COMPAT_LD := $(LD) COMPAT_CC_FLAGS := -march=rv32g -mabi=ilp32 COMPAT_LD_FLAGS := -melf32lriscv +# Disable attributes, as they're useless and break the build. +COMPAT_CC_FLAGS += $(call cc-option,-mno-riscv-attribute) +COMPAT_CC_FLAGS += $(call as-option,-Wa$(comma)-mno-arch-attr) + # Files to link into the compat_vdso obj-compat_vdso = $(patsubst %, %.o, $(compat_vdso-syms)) note.o |