Maxime Chevalier-Boisvert via llvm-dev
2016-Oct-28 00:39 UTC
[llvm-dev] Compiler used to build LLVM
Hello, We’d like to keep track of which clang version was used to build our LLVM binaries. We use cmake and ninja with clang to build. What do you people think would be the cleanest way to know which version of clang is used, on a user’s machine, to build those binaries. I’m hoping to script this. I was thinking that getting cmake/ninja to spit out this information, if possible, would probably be best. Thank you for your help, - Maxime
>I'd like to make LLD embed version information so that we can determine ifan 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 anexecutable was linked by ld.bfd or not easily.>ld.gold embeds a string "GNU gold <version>" as ".note.gnu.gold-version"section contents. Echoing another thread, there seems to be a way to embed host compiler toolchain info in the assembly. -Kevin On Thu, Oct 27, 2016 at 5:39 PM, Maxime Chevalier-Boisvert via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > We’d like to keep track of which clang version was used to build our LLVM > binaries. We use cmake and ninja with clang to build. What do you people > think would be the cleanest way to know which version of clang is used, on > a user’s machine, to build those binaries. I’m hoping to script this. I was > thinking that getting cmake/ninja to spit out this information, if > possible, would probably be best. > > Thank you for your help, > > - Maxime > _______________________________________________ > 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/20161027/faa56890/attachment.html>
Isn't the information already available in .comment section? On Thu, Oct 27, 2016 at 6:21 PM, Flamedoge 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. > > Echoing another thread, there seems to be a way to embed host compiler > toolchain info in the assembly. > -Kevin > > On Thu, Oct 27, 2016 at 5:39 PM, Maxime Chevalier-Boisvert via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hello, >> >> We’d like to keep track of which clang version was used to build our LLVM >> binaries. We use cmake and ninja with clang to build. What do you people >> think would be the cleanest way to know which version of clang is used, on >> a user’s machine, to build those binaries. I’m hoping to script this. I was >> thinking that getting cmake/ninja to spit out this information, if >> possible, would probably be best. >> >> Thank you for your help, >> >> - Maxime >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > > > _______________________________________________ > 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/20161027/b9c44406/attachment.html>
On Thu, Oct 27, 2016 at 5:39 PM, Maxime Chevalier-Boisvert via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hello, > > We’d like to keep track of which clang version was used to build our LLVM binaries. We use cmake and ninja with clang to build. What do you people think would be the cleanest way to know which version of clang is used, on a user’s machine, to build those binaries. I’m hoping to script this. I was thinking that getting cmake/ninja to spit out this information, if possible, would probably be best. >This is working already: $ objdump -x -s -j .comment ./opt Contents of section .comment: 0000 4743433a 2028474e 55292036 2e312e31 GCC: (GNU) 6.1.1 0010 20323031 36303632 31202852 65642048 20160621 (Red H 0020 61742036 2e312e31 2d332900 636c616e at 6.1.1-3).clan 0030 67207665 7273696f 6e20342e 302e3020 g version 4.0.0 0040 28747275 6e6b2032 38353332 36292028 (trunk 285326) ( 0050 6c6c766d 2f747275 6e6b2032 38353331 llvm/trunk 28531 0060 38290063 6c616e67 20766572 73696f6e 8).clang version 0070 20342e30 2e302028 7472756e 6b203238 4.0.0 (trunk 28 0080 34323239 2920286c 6c766d2f 7472756e 4229) (llvm/trun 0090 6b203238 34323438 2900636c 616e6720 k 284248).clang 00a0 76657273 696f6e20 342e302e 30202874 version 4.0.0 (t 00b0 72756e6b 20323832 30383929 20286c6c runk 282089) (ll 00c0 766d2f74 72756e6b 20323832 30393829 vm/trunk 282098) 00d0 00636c61 6e672076 65727369 6f6e2034 .clang version 4 00e0 2e302e30 20287472 756e6b20 32383335 .0.0 (trunk 2835 00f0 37342920 286c6c76 6d2f7472 756e6b20 74) (llvm/trunk 0100 32383335 39392900 283599). It should be easy to enable for your platform if it's disabled/not there. -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare
> On Oct 27, 2016, at 6:38 PM, Davide Italiano via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > On Thu, Oct 27, 2016 at 5:39 PM, Maxime Chevalier-Boisvert via > llvm-dev <llvm-dev at lists.llvm.org> wrote: >> Hello, >> >> We’d like to keep track of which clang version was used to build our LLVM binaries. We use cmake and ninja with clang to build. What do you people think would be the cleanest way to know which version of clang is used, on a user’s machine, to build those binaries. I’m hoping to script this. I was thinking that getting cmake/ninja to spit out this information, if possible, would probably be best. >> > > This is working already: > > $ objdump -x -s -j .comment ./opt > > Contents of section .comment: > 0000 4743433a 2028474e 55292036 2e312e31 GCC: (GNU) 6.1.1 > 0010 20323031 36303632 31202852 65642048 20160621 (Red H > 0020 61742036 2e312e31 2d332900 636c616e at 6.1.1-3).clan > 0030 67207665 7273696f 6e20342e 302e3020 g version 4.0.0 > 0040 28747275 6e6b2032 38353332 36292028 (trunk 285326) ( > 0050 6c6c766d 2f747275 6e6b2032 38353331 llvm/trunk 28531 > 0060 38290063 6c616e67 20766572 73696f6e 8).clang version > 0070 20342e30 2e302028 7472756e 6b203238 4.0.0 (trunk 28 > 0080 34323239 2920286c 6c766d2f 7472756e 4229) (llvm/trun > 0090 6b203238 34323438 2900636c 616e6720 k 284248).clang > 00a0 76657273 696f6e20 342e302e 30202874 version 4.0.0 (t > 00b0 72756e6b 20323832 30383929 20286c6c runk 282089) (ll > 00c0 766d2f74 72756e6b 20323832 30393829 vm/trunk 282098) > 00d0 00636c61 6e672076 65727369 6f6e2034 .clang version 4 > 00e0 2e302e30 20287472 756e6b20 32383335 .0.0 (trunk 2835 > 00f0 37342920 286c6c76 6d2f7472 756e6b20 74) (llvm/trunk > 0100 32383335 39392900 283599). > > It should be easy to enable for your platform if it's disabled/not there.It is disabled on MachO / Darwin though. Maxime: please ping this <rdar://problem/28847727 <rdar://problem/28847727>> — Mehdi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161027/75aa8634/attachment.html>