Skip to content

attribute target syntax doesn't match -march options #42793

Closed
@nickdesaulniers

Description

@nickdesaulniers
Bugzilla Link 43448
Version trunk
OS Linux
Blocks #4440
CC @DougGregor,@echristo,@erichkeane,@fhahn,@kbeyls,@zygoloid,@stephenhines

Extended Description

When looking into an ISA-extension-assembler-directive related issue in assembling the Linux kernel w/ Clang (ClangBuiltLinux/linux#671, ClangBuiltLinux/linux#573), I ran into some issue with the ARMv8.1 lse extensions.

It seems that we can either:

  1. use an assembler .arch armv8-a+lse directive
  2. use a command line arg -march=armv8-a+lse
  3. use a function level attribute

Unfortunately, 3 gets a little complicated in terms of our "compatibility w/ GCC" which is a constraint for compiling the Linux kernel w/ Clang.

__attribute__((target("arch=armv8-a+lse")))
void foo (void){}

produces a warning in Clang, but is accepted by GCC.

__attribute__((target("lse")))
void foo (void){}

produces an error in GCC, but is accepted by Clang.

I find the current behavior in Clang for 3 inconsistent with 1+2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:AArch64bugzillaIssues migrated from bugzillacclangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions