[PATCH] RISC-V: Stop emitting attributes

Conor Dooley conor at kernel.org
Thu Feb 23 13:18:01 PST 2023


On Thu, Feb 23, 2023 at 11:51:12AM -0800, Palmer Dabbelt wrote:
> 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 at rivosinc.com>
> ---
>  arch/riscv/Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index 76989561566b..1fc504e2b85e 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -81,6 +81,11 @@ 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_CFLAGS += $(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)

As requested, the build issues I see w/ this patch applied & ld 2.35:
  LD      arch/riscv/purgatory/purgatory.ro
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/memcpy.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/memset.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/strcmp.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/strlen.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/strncmp.o
  CHECK   /stuff/linux/ipc/ipc_sysctl.c
make[6]: *** [/stuff/linux/arch/riscv/purgatory/Makefile:95: arch/riscv/purgatory/purgatory.ro] Error 1
make[6]: Target 'arch/riscv/purgatory/' not remade because of errors.
make[5]: *** [/stuff/linux/scripts/Makefile.build:504: arch/riscv/purgatory] Error 2
  CC      arch/riscv/mm/dma-noncoherent.o
  AR      arch/riscv/kernel/probes/built-in.a
  CHECK   /stuff/linux/lib/zlib_inflate/inffast.c
  VDSOLD  arch/riscv/kernel/vdso/vdso.so.dbg
  VDSOLD  arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/kernel/vdso/getcpu.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/kernel/vdso/flush_icache.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/kernel/vdso/note.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv32i2p0_m2p0_a2p0_f2p0_d2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/kernel/compat_vdso/getcpu.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv32i2p0_m2p0_a2p0_f2p0_d2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/kernel/compat_vdso/flush_icache.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv32i2p0_m2p0_a2p0_f2p0_d2p0_zmmul1p0: Invalid or unknown z ISA extension: 'zmmul'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/kernel/compat_vdso/note.o
  OBJCOPY arch/riscv/kernel/compat_vdso/compat_vdso.so
  OBJCOPY arch/riscv/kernel/vdso/vdso.so
riscv64-unknown-linux-gnu-objcopy: 'arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg': No such file
riscv64-unknown-linux-gnu-objcopy: 'arch/riscv/kernel/vdso/vdso.so.dbg': No such file
make[7]: *** [/stuff/linux/arch/riscv/kernel/compat_vdso/Makefile:48: arch/riscv/kernel/compat_vdso/compat_vdso.so] Error 1

Specifically this is what I am running:
CONFIG_CC_VERSION_TEXT="riscv64-unknown-linux-gnu-gcc (ge4703bd0e15-dirty) 13.0.1 20230122 (experimental)"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=130001
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=24050
CONFIG_LD_IS_BFD=y
CONFIG_LD_VERSION=23500

Cheers,
Conor.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20230223/3669ae9d/attachment.sig>


More information about the linux-riscv mailing list