[PATCH] D69296: [ARM] Uses "Sun Style" syntax for section switching

Jian Cai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 21:40:23 PDT 2019


jcai19 added a comment.



In D69296#1717731 <https://reviews.llvm.org/D69296#1717731>, @peter.smith wrote:

> I can see that this would allow "Sun Style" syntax for section switching that seems to be permitted for the Arm target. The question is why, and why just Arm? Looking at the GNU as code it looks like:
>
> - This syntax was supported for Solaris, it only has tests for Solaris
> - The syntax isn't gated by target, but it doesn't work on any target that uses # as the comment character (x86), it fails with a cryptic error message, this suggests it works on Arm and AArch64 by accident rather than by intention.
> - The comment in MCAsmInfo.h states "instead of the normal ELF syntax", looking at the implementation it seems like both can be used at once as there isn't a parsing difference, however this might not be by design.


I agree, and it seems GNU assembler supports both on arm so I have updated the comments on MCAsmInfo.h.

>   /// This is true if this target uses "Sun Style" syntax for section switching
>   /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
>   /// .section directives.  Defaults to false.
>   bool SunStyleELFSectionSwitchSyntax = false;
>    
> 
> So at the moment, I'm not convinced that doing this just for Arm and leaving the existing comment in MCAsmInfo.h in place is the right thing to do. If this is being done to be compatible with GNU, and for a good reason,  then it should work on all targets that it works in GNU as and not just Arm.

This is part of the effort to build Linux kernel with integrated assembler for 32-bit Arm (https://github.com/ClangBuiltLinux/linux/issues/744). Some assembly files are written with this syntax in the kernel, e.g. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mm/proc-v7.S?h=v5.4-rc4. I only ran into this issue on Arm so far and by grepping for #alloc I only found such syntax used for arm, sparc (SunStyleELFSectionSwitchSyntax already set to true), m68k and nds32 use such syntax. I am not sure if anyone is actually building m68k or nds32 with integrated assembler so  that is why I only tried to turn it on for Arm.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69296/new/

https://reviews.llvm.org/D69296





More information about the llvm-commits mailing list