public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] RISC-V: Stop emitting attributes
@ 2023-02-23 22:46 Palmer Dabbelt
  2023-02-23 22:57 ` Conor Dooley
  2023-03-07 21:00 ` patchwork-bot+linux-riscv
  0 siblings, 2 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2023-02-23 22:46 UTC (permalink / raw)
  To: Conor Dooley, linux-riscv; +Cc: Palmer Dabbelt

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.
---
 arch/riscv/Makefile                    | 7 +++++++
 arch/riscv/kernel/compat_vdso/Makefile | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 76989561566b..7b53f0be56b2 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 260daf3236d3..7f34f3c7c882 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
 
-- 
2.39.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Stop emitting attributes
  2023-02-23 22:46 [PATCH v2] RISC-V: Stop emitting attributes Palmer Dabbelt
@ 2023-02-23 22:57 ` Conor Dooley
  2023-03-07 18:50   ` Palmer Dabbelt
  2023-03-07 21:00 ` patchwork-bot+linux-riscv
  1 sibling, 1 reply; 4+ messages in thread
From: Conor Dooley @ 2023-02-23 22:57 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: linux-riscv


[-- Attachment #1.1: Type: text/plain, Size: 3865 bytes --]

On Thu, Feb 23, 2023 at 02:46:05PM -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.

+cc: stable, yeah?

> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

Fixes the build for me w/ my awful config w/ gcc-13 + 2 different
binutils versions:
Tested-by: Conor Dooley <conor.dooley@microchip.com>

I still see issues with llvm-17, LLVM=1 & ld-2.35 in both purgatory and
regular modules:
  LD      arch/riscv/purgatory/purgatory.ro
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/sha256.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/string.o
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
/stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/ctype.o
make[6]: *** [/stuff/linux/arch/riscv/purgatory/Makefile:95: arch/riscv/purgatory/purgatory.ro] Error 1

So probably still need to pick up some variant of my series I posted
earlier unfortunately:
https://lore.kernel.org/linux-riscv/20230223220546.52879-1-conor@kernel.org/

Thanks!

> ---
> 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.
> ---
>  arch/riscv/Makefile                    | 7 +++++++
>  arch/riscv/kernel/compat_vdso/Makefile | 4 ++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index 76989561566b..7b53f0be56b2 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 260daf3236d3..7f34f3c7c882 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
>  
> -- 
> 2.39.1
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Stop emitting attributes
  2023-02-23 22:57 ` Conor Dooley
@ 2023-03-07 18:50   ` Palmer Dabbelt
  0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2023-03-07 18:50 UTC (permalink / raw)
  To: Conor Dooley; +Cc: linux-riscv

On Thu, 23 Feb 2023 14:57:08 PST (-0800), Conor Dooley wrote:
> On Thu, Feb 23, 2023 at 02:46:05PM -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.
>
> +cc: stable, yeah?

Ya, seems reasonable.  I'm putting it on fixes as well, so it gets 
backported ASAP.

>
>> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>
> Fixes the build for me w/ my awful config w/ gcc-13 + 2 different
> binutils versions:
> Tested-by: Conor Dooley <conor.dooley@microchip.com>
>
> I still see issues with llvm-17, LLVM=1 & ld-2.35 in both purgatory and
> regular modules:
>   LD      arch/riscv/purgatory/purgatory.ro
> /stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
> /stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/sha256.o
> /stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
> /stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/string.o
> /stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
> /stuff/toolchains/binutils-2.35/bin/riscv64-linux-gnu-ld: failed to merge target specific data of file arch/riscv/purgatory/ctype.o
> make[6]: *** [/stuff/linux/arch/riscv/purgatory/Makefile:95: arch/riscv/purgatory/purgatory.ro] Error 1
>
> So probably still need to pick up some variant of my series I posted
> earlier unfortunately:
> https://lore.kernel.org/linux-riscv/20230223220546.52879-1-conor@kernel.org/
>
> Thanks!
>
>> ---
>> 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.
>> ---
>>  arch/riscv/Makefile                    | 7 +++++++
>>  arch/riscv/kernel/compat_vdso/Makefile | 4 ++++
>>  2 files changed, 11 insertions(+)
>>
>> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
>> index 76989561566b..7b53f0be56b2 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 260daf3236d3..7f34f3c7c882 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
>>
>> --
>> 2.39.1
>>
>>
>> _______________________________________________
>> linux-riscv mailing list
>> linux-riscv@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-riscv
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] RISC-V: Stop emitting attributes
  2023-02-23 22:46 [PATCH v2] RISC-V: Stop emitting attributes Palmer Dabbelt
  2023-02-23 22:57 ` Conor Dooley
@ 2023-03-07 21:00 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-03-07 21:00 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: linux-riscv, conor

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Thu, 23 Feb 2023 14:46:05 -0800 you 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@rivosinc.com>
> ---
> Changes since v1 <20230223195112.10489-1-palmer@rivosinc.com/>:
> 
> [...]

Here is the summary with links:
  - [v2] RISC-V: Stop emitting attributes
    https://git.kernel.org/riscv/c/e18048da9bc3

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-07 21:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-23 22:46 [PATCH v2] RISC-V: Stop emitting attributes Palmer Dabbelt
2023-02-23 22:57 ` Conor Dooley
2023-03-07 18:50   ` Palmer Dabbelt
2023-03-07 21:00 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox