[PATCH v2] elf: Add DL_ADDRESS_WITHOUT_RELOC [BZ #33088]

Andreas Schwab schwab@suse.de
Mon Jun 16 09:07:08 GMT 2025


On Jun 16 2025, H.J. Lu wrote:

> This works:
>
> /* Evaluate EXPR without run-time relocation for it.  EXPR should be an
>    array, an address of an object, or a string literal.  */
> #define DL_ADDRESS_WITHOUT_RELOC(expr) \
>   ({ __typeof (*expr) *_result = expr; asm ("" : "+r" (_result)); _result; })

With parens:

   ({ __typeof (*(expr)) *_result = (expr); asm ("" : "+r" (_result)); _result; })

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list