* [PATCH] ARM: warn if pre-UAL assembler syntax is used
@ 2020-02-28 0:19 Stefan Agner
2020-03-17 0:00 ` Nick Desaulniers
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Agner @ 2020-02-28 0:19 UTC (permalink / raw)
To: linux
Cc: arnd, yamada.masahiro, manojgupta, jiancai, linux-arm-kernel,
linux-kernel, clang-built-linux, Stefan Agner
Remove the -mno-warn-deprecated assembler flag for GCC versions newer
than 5.1 to make sure the GNU assembler warns in case non-unified
syntax is used.
This also prevents a warning when building with Clang and enabling
its integrated assembler:
clang-10: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'
This is a second attempt of commit e8c24bbda7d5 ("ARM: 8846/1: warn if
divided syntax assembler is used").
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
arch/arm/Makefile | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index db857d07114f..a6c8c9f39185 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -119,21 +119,25 @@ ifeq ($(CONFIG_CC_IS_CLANG),y)
CFLAGS_ABI += -meabi gnu
endif
-# Accept old syntax despite ".syntax unified"
-AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
-
ifeq ($(CONFIG_THUMB2_KERNEL),y)
-CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
+CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always
AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
# Work around buggy relocation from gas if requested:
ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
KBUILD_CFLAGS_MODULE +=-fno-optimize-sibling-calls
endif
else
-CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
+CFLAGS_ISA :=$(call cc-option,-marm,)
AFLAGS_ISA :=$(CFLAGS_ISA)
endif
+ifeq ($(CONFIG_CC_IS_GCC),y)
+ifeq ($(call cc-ifversion, -lt, 0501, y), y)
+# GCC <5.1 emits pre-UAL code and causes assembler warnings, suppress them
+CFLAGS_ISA +=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
+endif
+endif
+
# Need -Uarm for gcc < 3.x
KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: warn if pre-UAL assembler syntax is used
2020-02-28 0:19 [PATCH] ARM: warn if pre-UAL assembler syntax is used Stefan Agner
@ 2020-03-17 0:00 ` Nick Desaulniers
2020-03-17 7:55 ` Stefan Agner
0 siblings, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2020-03-17 0:00 UTC (permalink / raw)
To: Stefan Agner
Cc: Russell King, Arnd Bergmann, Masahiro Yamada, Manoj Gupta,
Jian Cai, Linux ARM, LKML, clang-built-linux
Revert "ARM: 8846/1: warn if divided syntax assembler is used"On Thu,
Feb 27, 2020 at 4:19 PM Stefan Agner <stefan@agner.ch> wrote:
>
> Remove the -mno-warn-deprecated assembler flag for GCC versions newer
> than 5.1 to make sure the GNU assembler warns in case non-unified
> syntax is used.
Hi Stefan, sorry for the late reply from me; digging out my backlog.
Do you happen to have a godbolt link perhaps that demonstrates this?
It sounds like GCC itself is emitting pre-UAL?
>
> This also prevents a warning when building with Clang and enabling
> its integrated assembler:
> clang-10: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'
>
> This is a second attempt of commit e8c24bbda7d5 ("ARM: 8846/1: warn if
> divided syntax assembler is used").
Would it be helpful to also make note of
commit b752bb405a13 ("Revert "ARM: 8846/1: warn if divided syntax
assembler is used"")?
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> arch/arm/Makefile | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index db857d07114f..a6c8c9f39185 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -119,21 +119,25 @@ ifeq ($(CONFIG_CC_IS_CLANG),y)
> CFLAGS_ABI += -meabi gnu
> endif
>
> -# Accept old syntax despite ".syntax unified"
> -AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
This existing code is quite bad for Clang, which doesn't support
`-Wa,-mno-warn-deprecated`, so this falls back to `-Wa,-W`, which
disables all warnings from the assembler, which we definitely do not
want. That alone is worth putting in the GCC guard. But I would like
more info about GCC above before signing off.
> -
> ifeq ($(CONFIG_THUMB2_KERNEL),y)
> -CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
> +CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always
> AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
> # Work around buggy relocation from gas if requested:
> ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
> KBUILD_CFLAGS_MODULE +=-fno-optimize-sibling-calls
> endif
> else
> -CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
> +CFLAGS_ISA :=$(call cc-option,-marm,)
> AFLAGS_ISA :=$(CFLAGS_ISA)
> endif
>
> +ifeq ($(CONFIG_CC_IS_GCC),y)
> +ifeq ($(call cc-ifversion, -lt, 0501, y), y)
> +# GCC <5.1 emits pre-UAL code and causes assembler warnings, suppress them
> +CFLAGS_ISA +=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
> +endif
> +endif
> +
> # Need -Uarm for gcc < 3.x
> KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
> KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
> --
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: warn if pre-UAL assembler syntax is used
2020-03-17 0:00 ` Nick Desaulniers
@ 2020-03-17 7:55 ` Stefan Agner
2020-03-29 18:02 ` Stefan Agner
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Agner @ 2020-03-17 7:55 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Russell King, Arnd Bergmann, Masahiro Yamada, Manoj Gupta,
Jian Cai, Linux ARM, LKML, clang-built-linux
On 2020-03-17 01:00, Nick Desaulniers wrote:
> Revert "ARM: 8846/1: warn if divided syntax assembler is used"On Thu,
> Feb 27, 2020 at 4:19 PM Stefan Agner <stefan@agner.ch> wrote:
>>
>> Remove the -mno-warn-deprecated assembler flag for GCC versions newer
>> than 5.1 to make sure the GNU assembler warns in case non-unified
>> syntax is used.
>
> Hi Stefan, sorry for the late reply from me; digging out my backlog.
> Do you happen to have a godbolt link perhaps that demonstrates this?
> It sounds like GCC itself is emitting pre-UAL?
Yes, that is what Russell observed and caused the revert:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b752bb405a13
I do not have a godbolt link at hand, I just built the complete kernel
using some GCC toolchains I had locally available and noticed that the
problem persists up to and including GCC 5.0. I did not track down what
exactly is causing GCC to emit pre-UAL.
>
>>
>> This also prevents a warning when building with Clang and enabling
>> its integrated assembler:
>> clang-10: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'
>>
>> This is a second attempt of commit e8c24bbda7d5 ("ARM: 8846/1: warn if
>> divided syntax assembler is used").
>
> Would it be helpful to also make note of
> commit b752bb405a13 ("Revert "ARM: 8846/1: warn if divided syntax
> assembler is used"")?
Sure, I can do that.
>
>
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>> ---
>> arch/arm/Makefile | 14 +++++++++-----
>> 1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
>> index db857d07114f..a6c8c9f39185 100644
>> --- a/arch/arm/Makefile
>> +++ b/arch/arm/Makefile
>> @@ -119,21 +119,25 @@ ifeq ($(CONFIG_CC_IS_CLANG),y)
>> CFLAGS_ABI += -meabi gnu
>> endif
>>
>> -# Accept old syntax despite ".syntax unified"
>> -AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
>
> This existing code is quite bad for Clang, which doesn't support
> `-Wa,-mno-warn-deprecated`, so this falls back to `-Wa,-W`, which
> disables all warnings from the assembler, which we definitely do not
> want. That alone is worth putting in the GCC guard. But I would like
> more info about GCC above before signing off.
FWIW, I submitted this to the patch tracker already, but I don't think
it got merged already.
--
Stefan
>
>> -
>> ifeq ($(CONFIG_THUMB2_KERNEL),y)
>> -CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
>> +CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always
>> AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
>> # Work around buggy relocation from gas if requested:
>> ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
>> KBUILD_CFLAGS_MODULE +=-fno-optimize-sibling-calls
>> endif
>> else
>> -CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
>> +CFLAGS_ISA :=$(call cc-option,-marm,)
>> AFLAGS_ISA :=$(CFLAGS_ISA)
>> endif
>>
>> +ifeq ($(CONFIG_CC_IS_GCC),y)
>> +ifeq ($(call cc-ifversion, -lt, 0501, y), y)
>> +# GCC <5.1 emits pre-UAL code and causes assembler warnings, suppress them
>> +CFLAGS_ISA +=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
>> +endif
>> +endif
>> +
>> # Need -Uarm for gcc < 3.x
>> KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
>> KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
>> --
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: warn if pre-UAL assembler syntax is used
2020-03-17 7:55 ` Stefan Agner
@ 2020-03-29 18:02 ` Stefan Agner
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Agner @ 2020-03-29 18:02 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Russell King, Arnd Bergmann, Masahiro Yamada, Manoj Gupta,
Jian Cai, Linux ARM, LKML, clang-built-linux
On 2020-03-17 08:55, Stefan Agner wrote:
> On 2020-03-17 01:00, Nick Desaulniers wrote:
>> Revert "ARM: 8846/1: warn if divided syntax assembler is used"On Thu,
>> Feb 27, 2020 at 4:19 PM Stefan Agner <stefan@agner.ch> wrote:
>>>
>>> Remove the -mno-warn-deprecated assembler flag for GCC versions newer
>>> than 5.1 to make sure the GNU assembler warns in case non-unified
>>> syntax is used.
>>
>> Hi Stefan, sorry for the late reply from me; digging out my backlog.
>> Do you happen to have a godbolt link perhaps that demonstrates this?
>> It sounds like GCC itself is emitting pre-UAL?
>
> Yes, that is what Russell observed and caused the revert:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b752bb405a13
>
> I do not have a godbolt link at hand, I just built the complete kernel
> using some GCC toolchains I had locally available and noticed that the
> problem persists up to and including GCC 5.0. I did not track down what
> exactly is causing GCC to emit pre-UAL.
Godbolt link:
https://godbolt.org/z/fxYq_s
However, the warning does not appear on godbolt.org, presumably because
the compiler is started such that it does not invoke the assembler (at
least that is what I understand when using -v). However, on my end this
leads to:
$ arm-linux-gnueabihf-gcc -marm -march=armv7-a -O2 -c test.c -o test
--save-temps
test.s: Assembler messages:
test.s:33: Warning: conditional infixes are deprecated in unified syntax
$ arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Linaro GCC 4.9-2016.02) 4.9.4 20151028
(prerelease)
And line 33 contains a non-unified assembler mnemonic:
strneb r2, [r3]
Note: I do have to explicitly use .syntax unified. It seems that gcc is
not explicitly doing this, but if any inline assembly is changing the
assembler mode (e.g. what including arch/arm/include/asm/unified.h is
doing) then the assembler warnings start to appear.
--
Stefan
>
>>
>>>
>>> This also prevents a warning when building with Clang and enabling
>>> its integrated assembler:
>>> clang-10: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'
>>>
>>> This is a second attempt of commit e8c24bbda7d5 ("ARM: 8846/1: warn if
>>> divided syntax assembler is used").
>>
>> Would it be helpful to also make note of
>> commit b752bb405a13 ("Revert "ARM: 8846/1: warn if divided syntax
>> assembler is used"")?
>
> Sure, I can do that.
>
>>
>>
>>>
>>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>>> ---
>>> arch/arm/Makefile | 14 +++++++++-----
>>> 1 file changed, 9 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
>>> index db857d07114f..a6c8c9f39185 100644
>>> --- a/arch/arm/Makefile
>>> +++ b/arch/arm/Makefile
>>> @@ -119,21 +119,25 @@ ifeq ($(CONFIG_CC_IS_CLANG),y)
>>> CFLAGS_ABI += -meabi gnu
>>> endif
>>>
>>> -# Accept old syntax despite ".syntax unified"
>>> -AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
>>
>> This existing code is quite bad for Clang, which doesn't support
>> `-Wa,-mno-warn-deprecated`, so this falls back to `-Wa,-W`, which
>> disables all warnings from the assembler, which we definitely do not
>> want. That alone is worth putting in the GCC guard. But I would like
>> more info about GCC above before signing off.
>
> FWIW, I submitted this to the patch tracker already, but I don't think
> it got merged already.
>
> --
> Stefan
>
>>
>>> -
>>> ifeq ($(CONFIG_THUMB2_KERNEL),y)
>>> -CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
>>> +CFLAGS_ISA :=-mthumb -Wa,-mimplicit-it=always
>>> AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
>>> # Work around buggy relocation from gas if requested:
>>> ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
>>> KBUILD_CFLAGS_MODULE +=-fno-optimize-sibling-calls
>>> endif
>>> else
>>> -CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
>>> +CFLAGS_ISA :=$(call cc-option,-marm,)
>>> AFLAGS_ISA :=$(CFLAGS_ISA)
>>> endif
>>>
>>> +ifeq ($(CONFIG_CC_IS_GCC),y)
>>> +ifeq ($(call cc-ifversion, -lt, 0501, y), y)
>>> +# GCC <5.1 emits pre-UAL code and causes assembler warnings, suppress them
>>> +CFLAGS_ISA +=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
>>> +endif
>>> +endif
>>> +
>>> # Need -Uarm for gcc < 3.x
>>> KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
>>> KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
>>> --
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-29 18:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28 0:19 [PATCH] ARM: warn if pre-UAL assembler syntax is used Stefan Agner
2020-03-17 0:00 ` Nick Desaulniers
2020-03-17 7:55 ` Stefan Agner
2020-03-29 18:02 ` Stefan Agner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).