Messages in this thread | | | From | Ard Biesheuvel <> | Date | Wed, 31 Jan 2024 08:16:04 +0100 | Subject | Re: [PATCH] arm64: jump_label: use constraint "S" instead of "i" |
| |
Hello Fangrui,
On Wed, 31 Jan 2024 at 07:53, Fangrui Song <maskray@google.com> wrote: > > The constraint "i" seems to be copied from x86 (and with a redundant > modifier "c"). It works with -fno-PIE but not with -fPIE/-fPIC in GCC's > aarch64 port. > > The constraint "S", which denotes a symbol reference (e.g. function, > global variable) or label reference, is more appropriate, and has been > available in GCC since 2012 and in Clang since 7.0. > > Signed-off-by: Fangrui Song <maskray@google.com> > Link: https://maskray.me/blog/2024-01-30-raw-symbol-names-in-inline-assembly > --- > arch/arm64/include/asm/jump_label.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h > index 48ddc0f45d22..31862b3bb33d 100644 > --- a/arch/arm64/include/asm/jump_label.h > +++ b/arch/arm64/include/asm/jump_label.h > @@ -23,9 +23,9 @@ static __always_inline bool arch_static_branch(struct static_key * const key, > " .pushsection __jump_table, \"aw\" \n\t" > " .align 3 \n\t" > " .long 1b - ., %l[l_yes] - . \n\t" > - " .quad %c0 - . \n\t" > + " .quad %0 - . \n\t" > " .popsection \n\t" > - : : "i"(&((char *)key)[branch]) : : l_yes); > + : : "S"(&((char *)key)[branch]) : : l_yes);
'key' is not used as a raw symbol name. We should make this
" .quad %0 + %1 - ."
and
:: "S"(key), "i"(branch) :: l_yes);
if we want to really clean this up.
> > return false; > l_yes: > @@ -40,9 +40,9 @@ static __always_inline bool arch_static_branch_jump(struct static_key * const ke > " .pushsection __jump_table, \"aw\" \n\t" > " .align 3 \n\t" > " .long 1b - ., %l[l_yes] - . \n\t" > - " .quad %c0 - . \n\t" > + " .quad %0 - . \n\t" > " .popsection \n\t" > - : : "i"(&((char *)key)[branch]) : : l_yes); > + : : "S"(&((char *)key)[branch]) : : l_yes); > > return false; > l_yes: > -- > 2.43.0.429.g432eaa2c6b-goog >
| |