[PATCH] D76482: [lld][ELF] Provide optional hidden symbols for build ID
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 14:47:57 PDT 2020
phosek added a comment.
In D76482#2185903 <https://reviews.llvm.org/D76482#2185903>, @MaskRay wrote:
> In D76482#2185833 <https://reviews.llvm.org/D76482#2185833>, @mcgrathr wrote:
>
>> The proposed solution with an input linker script is a clever kludge, but it's a kludge. There's no way to make that actually general, since there is no particular named section that you can correctly assume is present in all kinds of binaries you might be linking. The kludge could be locally tailored for different cases, but that is even worse. Since the section and layout we're talking about here is entirely synthesized by the linker, it makes a lot more sense to have the linker support convenience features for using that format directly than to require users to build detailed kludges baking in the details of the linker's built-in synthesizing behavior.
>
> This may worth a discussion on binutils. There can be several alternative syntax which may meet your needs.
One concrete use case we have is in runtimes. We would like for the runtime to use the build ID as the name of the output file because everything in our infrastructure is based on build ID as a way to uniquely identify modules. These runtimes are typically static libraries that are inserted onto the link line by the driver, e.g. if you set `-fprofile-instr-generate` driver will automatically put `libclang_rt.profile.a` onto your link line. With your suggested solution, this is going to fail at link time unless the user manually adds the linker script as link input. We could also ship that linker script with the compiler and modify the driver to always add it for you just like it does for the runtime itself. We would need to repeat this for every runtime like profile, XRay, sanitizers, etc. That seems like a worse solution that this patch and I don't think alternative syntaxes are going to help here, the linker script solution is just inconvenient.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76482/new/
https://reviews.llvm.org/D76482
More information about the llvm-commits
mailing list