[PATCH 2/4] gas: Add support for LLVM addrsig and addrsig_sym directives on ELF.

Fangrui Song i@maskray.me
Wed May 25 08:07:41 GMT 2022


On Wed, May 25, 2022 at 12:58 AM Tatsuyuki Ishi via Binutils
<binutils@sourceware.org> wrote:
>
> > Why two directives? IOW what's the point of silently ignoring
> > .addrsig_sym when there's no .addrsig anywhere?
>
> Because addrsig is an opt-in mechanism. A file with only .addrsig means that
> none of the symbols are address significant, while a file without is treated
> as if all symbols were.
>
> The silent ignore behavior is not ideal, but it could be added later. The
> primary target of this patch is compiler generated output.

The idea is that if no symbol is address significant, clang -S just
emits `.addrsig` with no `.addrsig_sym $sym`.
The .llvm_addrsig section is empty but it conveys information to
ld.lld --icf=safe.

In llvm-mc, `.addrsig_sym` accepts exactly one symbol. Technically, if
the directive were designed to support zero or any number of symbols,
`.addrsig` could be removed.

> > And such a toggle-on
> > directive likely would want to allow expressing also (or even only)
> > via a command line option.
>
> How would that work? That leads to two kind of end results, 1. mark *all*
> symbols as address-insignificant (if there's no addrsig_sym directives)
> or maybe 2. toggle off llvm_addrsig support (but why?).


More information about the Binutils mailing list