Re: compiler info in kernel identification string

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 14 Nov 2012 10:42:18 +0100
On 2012-11-14 08:01, Daniel Braniss wrote:
> in the old days (I'm talking before C :-) I remmeber one compiler
> putting such info in the code it produced, I wonder if that's the case
> with gcc/clang, and if so it would be nice if file(1) could show it.
> my 3c,

As far as I know, gcc has always included such information:

   $ touch empty.c
   $ gcc -c empty.c
   $ objdump -j .comment -s empty.o

   empty.o:     file format elf32-i386-freebsd

   Contents of section .comment:
    0000 00474343 3a202847 4e552920 342e322e  .GCC: (GNU) 4.2.
    0010 31203230 30373038 33312070 61746368  1 20070831 patch
    0020 6564205b 46726565 4253445d 00        ed [FreeBSD].
   $ gcc47 -c empty.c
   $ objdump -j .comment -s empty.o

   empty.o:     file format elf32-i386-freebsd

   Contents of section .comment:
    0000 00474343 3a202846 72656542 53442050  .GCC: (FreeBSD P
    0010 6f727473 20436f6c 6c656374 696f6e29  orts Collection)
    0020 20342e37 2e332032 30313230 39323920   4.7.3 20120929
    0030 28707265 72656c65 61736529 00        (prerelease).

There is an old LLVM PR to get the same supported for clang, but it
ended up at the bottom of the pile:

   http://llvm.org/bugs/show_bug.cgi?id=7292

I should probably just make a patch for it, and submit it. :-)
Received on Wed Nov 14 2012 - 08:42:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:32 UTC