[PATCH] D118490: [lld][ELF] add .note sections from linker scripts as SHT_NOTE

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 11:51:59 PST 2022


MaskRay added a comment.

In D118490#3302079 <https://reviews.llvm.org/D118490#3302079>, @keszybz wrote:

>>> No, I already explained in the sentence you quoted, compiled objecs are not a realistic option.
>>
>> I do not see why it is a complication.
>
> If we couldn't use a linker script, we could probably try to make a compiled object work.
> But a linker script is certainly a lot easier. In particular, we don't know if we have any particular
> compiler installed (a package might pull in one of the C or C++ compilers, or ocaml/fortran/ada/…),
> and we don't have a good place to do compilation. It's one thing to write a hundred bytes of text for
> the linker note, and quite another to generate some sources and then then call a compiler on that.
>
> I guess that if we can't make the linker script work, we could fall back to a compiled object for lld
> and/or gold. But it's require a lot more scaffolding.

Thanks (assuming you are another Fedora developer) for weighing in.
A compiled object will help gold, ld.lld, and mold.
It only needs an assembler (GNU assembler, shipped as part of binutils). A compiler is not needed.

If a linker script is still needed in some circumstances, perhaps you may contact Nick Clifton to add this TYPE= syntax to binutils 2.38? https://sourceware.org/pipermail/binutils/2022-February/119600.html
Once the syntax is finalized, I can continue on D118840 <https://reviews.llvm.org/D118840>.
If this is necessary for Fedora, I'll port this to release/14.x branch.

>> Does .note.package need to follow .note.gnu.build-id?
>
> There is is a benefit in having things in the *some* predictable order.
> But no, in general the order shouldn't matter.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118490/new/

https://reviews.llvm.org/D118490



More information about the llvm-commits mailing list