Rui Ueyama via llvm-dev
2016-Oct-19 01:44 UTC
[llvm-dev] Embedding LLD version to executables
I'd like to make LLD embed version information so that we can determine if an executable was created by LLD and if that's the case which version of LLD. ld.bfd doesn't seem to embed any information, so we cannot tell whether an executable was linked by ld.bfd or not easily. ld.gold embeds a string "GNU gold <version>" as ".note.gnu.gold-version" section contents. I'm wondering what we should do for LLD. The gold's way seems almost right, but I think we don't want to use the same section name because it contains "gold" as part of the section name. However, at the same time, I don't believe we want to create ".note.gnu.lld-version", because if we do, all programs that determine linker version need to look at ".note.gnu.<linker-name>-version" for all known linkers. That's absurd. (Also, our product is not GNU, so ".gnu" part is probably irrelevant.) I'm leaning towards ".note.linker-version" in hope that other linkers follow it. Any opinions? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161018/865d08f6/attachment.html>
Mehdi Amini via llvm-dev
2016-Oct-19 03:22 UTC
[llvm-dev] Embedding LLD version to executables
> On Oct 18, 2016, at 6:44 PM, Rui Ueyama via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I'd like to make LLD embed version information so that we can determine if an executable was created by LLD and if that's the case which version of LLD.Pardon my ignorance, but what’s the motivation? We don’t embed the clang version in every binary clang generates for instance.> > ld.bfd doesn't seem to embed any information, so we cannot tell whether an executable was linked by ld.bfd or not easily. > > ld.gold embeds a string "GNU gold <version>" as ".note.gnu.gold-version" section contents. > > I'm wondering what we should do for LLD. The gold's way seems almost right, but I think we don't want to use the same section name because it contains "gold" as part of the section name. However, at the same time, I don't believe we want to create ".note.gnu.lld-version", because if we do, all programs that determine linker version need to look at ".note.gnu.<linker-name>-version" for all known linkers. That's absurd. (Also, our product is not GNU, so ".gnu" part is probably irrelevant.) > > I'm leaning towards ".note.linker-version" in hope that other linkers follow it.At least that would look much better than a .gnu.xxxx — Mehdi
Hal Finkel via llvm-dev
2016-Oct-19 03:30 UTC
[llvm-dev] Embedding LLD version to executables
----- Original Message -----> From: "Mehdi Amini via llvm-dev" <llvm-dev at lists.llvm.org> > To: "Rui Ueyama" <ruiu at google.com> > Cc: "llvm-dev" <llvm-dev at lists.llvm.org> > Sent: Tuesday, October 18, 2016 10:22:00 PM > Subject: Re: [llvm-dev] Embedding LLD version to executables > > > > On Oct 18, 2016, at 6:44 PM, Rui Ueyama via llvm-dev > > <llvm-dev at lists.llvm.org> wrote: > > > > I'd like to make LLD embed version information so that we can > > determine if an executable was created by LLD and if that's the > > case which version of LLD. > > Pardon my ignorance, but what’s the motivation? > > We don’t embed the clang version in every binary clang generates for > instance.We do. Clang outputs an "ident" comment with its version information, and that ends up in the object files (at least on Linux).> > > > > ld.bfd doesn't seem to embed any information, so we cannot tell > > whether an executable was linked by ld.bfd or not easily. > > > > ld.gold embeds a string "GNU gold <version>" as > > ".note.gnu.gold-version" section contents. > > > > I'm wondering what we should do for LLD. The gold's way seems > > almost right, but I think we don't want to use the same section > > name because it contains "gold" as part of the section name. > > However, at the same time, I don't believe we want to create > > ".note.gnu.lld-version", because if we do, all programs that > > determine linker version need to look at > > ".note.gnu.<linker-name>-version" for all known linkers. That's > > absurd. (Also, our product is not GNU, so ".gnu" part is probably > > irrelevant.) > > > > I'm leaning towards ".note.linker-version" in hope that other > > linkers follow it. > > At least that would look much better than a .gnu.xxxxI agree. -Hal> > — > Mehdi > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory
Rui Ueyama via llvm-dev
2016-Oct-19 03:41 UTC
[llvm-dev] Embedding LLD version to executables
On Tue, Oct 18, 2016 at 8:22 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:> > > On Oct 18, 2016, at 6:44 PM, Rui Ueyama via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > I'd like to make LLD embed version information so that we can determine > if an executable was created by LLD and if that's the case which version of > LLD. > > Pardon my ignorance, but what’s the motivation? >It should make trouble shooting linker issues easier. Here are a few scenarios. Scenario 1: you added -fuse-ld=lld to your command line, but you are suspecting that the option is ignored. Currently, it's actually surprisingly hard to tell if an output was created by LLD. Scenario 2: someone reported an issue about an executable linked by LLD, and we know that version X has a similar bug, then the first thing we want to do is to check if the executable was created with version X.> > We don’t embed the clang version in every binary clang generates for > instance. > > > > > ld.bfd doesn't seem to embed any information, so we cannot tell whether > an executable was linked by ld.bfd or not easily. > > > > ld.gold embeds a string "GNU gold <version>" as ".note.gnu.gold-version" > section contents. > > > > I'm wondering what we should do for LLD. The gold's way seems almost > right, but I think we don't want to use the same section name because it > contains "gold" as part of the section name. However, at the same time, I > don't believe we want to create ".note.gnu.lld-version", because if we do, > all programs that determine linker version need to look at > ".note.gnu.<linker-name>-version" for all known linkers. That's absurd. > (Also, our product is not GNU, so ".gnu" part is probably irrelevant.) > > > > I'm leaning towards ".note.linker-version" in hope that other linkers > follow it. > > At least that would look much better than a .gnu.xxxx > > — > Mehdi > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161018/861be71d/attachment.html>
Davide Italiano via llvm-dev
2016-Oct-19 03:42 UTC
[llvm-dev] Embedding LLD version to executables
On Tue, Oct 18, 2016 at 8:22 PM, Mehdi Amini via llvm-dev <llvm-dev at lists.llvm.org> wrote:> >> On Oct 18, 2016, at 6:44 PM, Rui Ueyama via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> I'd like to make LLD embed version information so that we can determine if an executable was created by LLD and if that's the case which version of LLD. > > Pardon my ignorance, but what’s the motivation? >I can see how it's useful during a switch (from a linker to another). Generally the linker is never invoked directly so there's still a certain amount of uncertainty (did I use the correct one or not?), in particular when lld is used as part of a bigger build system. YMMV. -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare
Rafael Espíndola via llvm-dev
2016-Oct-25 22:07 UTC
[llvm-dev] Embedding LLD version to executables
I am ok with both ".note.linker-version" and adding an entry to .comment. I guess I have a small preference for .comment if this is a free format string. Cheers, Rafael On 18 October 2016 at 21:44, Rui Ueyama via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I'd like to make LLD embed version information so that we can determine if > an executable was created by LLD and if that's the case which version of > LLD. > > ld.bfd doesn't seem to embed any information, so we cannot tell whether an > executable was linked by ld.bfd or not easily. > > ld.gold embeds a string "GNU gold <version>" as ".note.gnu.gold-version" > section contents. > > I'm wondering what we should do for LLD. The gold's way seems almost right, > but I think we don't want to use the same section name because it contains > "gold" as part of the section name. However, at the same time, I don't > believe we want to create ".note.gnu.lld-version", because if we do, all > programs that determine linker version need to look at > ".note.gnu.<linker-name>-version" for all known linkers. That's absurd. > (Also, our product is not GNU, so ".gnu" part is probably irrelevant.) > > I'm leaning towards ".note.linker-version" in hope that other linkers follow > it. > > Any opinions? > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >
Rui Ueyama via llvm-dev
2016-Oct-25 22:23 UTC
[llvm-dev] Embedding LLD version to executables
I'll rework on this after the linker-synthesized input section becomes a thing. Currently I cannot easily append a string piece into an exiting .comment section. On Tue, Oct 25, 2016 at 3:07 PM, Rafael Espíndola < rafael.espindola at gmail.com> wrote:> I am ok with both ".note.linker-version" and adding an entry to .comment. > > I guess I have a small preference for .comment if this is a free format > string. > > Cheers, > Rafael > > > On 18 October 2016 at 21:44, Rui Ueyama via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > I'd like to make LLD embed version information so that we can determine > if > > an executable was created by LLD and if that's the case which version of > > LLD. > > > > ld.bfd doesn't seem to embed any information, so we cannot tell whether > an > > executable was linked by ld.bfd or not easily. > > > > ld.gold embeds a string "GNU gold <version>" as ".note.gnu.gold-version" > > section contents. > > > > I'm wondering what we should do for LLD. The gold's way seems almost > right, > > but I think we don't want to use the same section name because it > contains > > "gold" as part of the section name. However, at the same time, I don't > > believe we want to create ".note.gnu.lld-version", because if we do, all > > programs that determine linker version need to look at > > ".note.gnu.<linker-name>-version" for all known linkers. That's absurd. > > (Also, our product is not GNU, so ".gnu" part is probably irrelevant.) > > > > I'm leaning towards ".note.linker-version" in hope that other linkers > follow > > it. > > > > Any opinions? > > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161025/1aaaddcb/attachment.html>
Joerg Sonnenberger via llvm-dev
2016-Oct-26 11:16 UTC
[llvm-dev] Embedding LLD version to executables
On Tue, Oct 25, 2016 at 06:07:09PM -0400, Rafael Espíndola via llvm-dev wrote:> I am ok with both ".note.linker-version" and adding an entry to .comment.There is one important different between the two -- strip normally has to preserve the former, but not the latter. As such, I'd quite a bit prefer using .comment. Joerg