Skip to content

Commit e18048d

Browse files
RISC-V: Stop emitting attributes
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. Tested-by: Conor Dooley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent fe15c26 commit e18048d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

arch/riscv/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ endif
8484
# Avoid generating .eh_frame sections.
8585
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables
8686

87+
# The RISC-V attributes frequently cause compatibility issues and provide no
88+
# information, so just turn them off.
89+
KBUILD_CFLAGS += $(call cc-option,-mno-riscv-attribute)
90+
KBUILD_AFLAGS += $(call cc-option,-mno-riscv-attribute)
91+
KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mno-arch-attr)
92+
KBUILD_AFLAGS += $(call as-option,-Wa$(comma)-mno-arch-attr)
93+
8794
KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax)
8895
KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax)
8996

arch/riscv/kernel/compat_vdso/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ COMPAT_LD := $(LD)
1414
COMPAT_CC_FLAGS := -march=rv32g -mabi=ilp32
1515
COMPAT_LD_FLAGS := -melf32lriscv
1616

17+
# Disable attributes, as they're useless and break the build.
18+
COMPAT_CC_FLAGS += $(call cc-option,-mno-riscv-attribute)
19+
COMPAT_CC_FLAGS += $(call as-option,-Wa$(comma)-mno-arch-attr)
20+
1721
# Files to link into the compat_vdso
1822
obj-compat_vdso = $(patsubst %, %.o, $(compat_vdso-syms)) note.o
1923

0 commit comments

Comments
 (0)