[PATCH] arm64: jump_label: use constraints "Si" instead of "i"
Dave Martin
Dave.Martin at arm.com
Mon Feb 5 07:19:47 PST 2024
On Sat, Feb 03, 2024 at 10:50:44AM +0100, Ard Biesheuvel wrote:
> On Fri, 2 Feb 2024 at 23:51, Fangrui Song <maskray at google.com> wrote:
[...]
> > "Si" is fine for GCC and Clang.
> > "i" is fine for Clang but not for GCC PIC.
> >
> > https://maskray.me/blog/2024-01-30-raw-symbol-names-in-inline-assembly#aarch64
> >
> > In gcc/config/aarch64, LEGITIMATE_PIC_OPERAND_P(X) disallows any symbol
> > reference, which means that "i" and "s" cannot be used for PIC. Instead,
> > the constraint "S" has been supported since the initial port (2012) to
> > reference a symbol or label.
> >
> > I am also not familiar with
> > https://gcc.gnu.org/onlinedocs/gcc/Multi-Alternative.html (comma in a
> > constraint string). Thankfully we don't need this powerful construct:)
Ack, I had thought that this was relevant, but it is not,
and "Si" seems right.
[...]
> > I am convinced by Ard' argument that two inputs (key, branch) deserve
> > two operands.
> > The existing "i"(&((char *)key)[branch]) is kinda ugly and also longer:)
>
> If it helps clarify things, we might do something like
>
> ".quad (%[key] - .) + %[bit0]"
>
> : : [key]"Si"(key), [bit0]"i"(branch) : : l_yes);
I don't have a strong opinion on the naming, but something like this
seems fine.
Cheers
---Dave
More information about the linux-arm-kernel
mailing list