https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105576

--- Comment #14 from Fangrui Song <i at maskray dot me> ---
> Is there a way to capture a method address in inline asm that works in
> -fPIC mode? Specifically I want to capture the address of a static
> method that's in a class that's local to a function. I'm able to do it
> in non-PIC mode but not PIC mode.

I have a write up how to support raw symbol names for different architectures
https://maskray.me/blog/2024-01-30-raw-symbol-names-in-inline-assembly

Summary:

AArch32: "US" (for symbol reference without an offset)
AArch64: "S"
x86: "Ws", GCC 14+, Clang 18+
MIPS/PowerPC/RISC-V: "s"

I hope that newer ports all define LEGITIMATE_PIC_OPERAND_P so that "s" can be
used.

Reply via email to