public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* request for enhancement in BFD and gold linkers in regards to .comment section
@ 2023-03-01 12:58 Tom Kacvinsky
  2023-03-01 13:41 ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Kacvinsky @ 2023-03-01 12:58 UTC (permalink / raw)
  To: Binutils

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

HI,

I have noticed that the LLVM linker will add something to the .comment
section of binaries it produces for the version of lld used to produce an
ELF executable or shared library.

For the gold liker, I see I can do a readelf -p .note.gnu.gold-version and
get the version of gold used to make an ELF file.  I see nothing similar
for the BFD linker.

So the request for enhancement is to add something to the .comment section
as to which version of the BFD or gold linker was used to produce the ELF.

I can file a BZ if that is the preferred way of receiving a request such as
this.

If this seems unreasonable to you, that's OK by me.  I am asking under the
guise of never ventured, nothing gained.

Thanks and regards,

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: request for enhancement in BFD and gold linkers in regards to .comment section
  2023-03-01 12:58 request for enhancement in BFD and gold linkers in regards to .comment section Tom Kacvinsky
@ 2023-03-01 13:41 ` Nick Clifton
  2023-03-01 14:53   ` Tom Kacvinsky
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Clifton @ 2023-03-01 13:41 UTC (permalink / raw)
  To: Tom Kacvinsky, Binutils

Hi Tom,

> I have noticed that the LLVM linker will add something to the .comment
> section of binaries it produces for the version of lld used to produce an
> ELF executable or shared library.

Does it ?  I do not see this:

    % clang hello.c
    % readelf -p.comment a.out

   String dump of section '.comment':
     [     0]  GCC: (GNU) 12.2.1 20221121 (Red Hat 12.2.1-4)
     [    2e]  GCC: (GNU) 12.0.1 20220413 (Red Hat 12.0.1-0)
     [    5c]  clang version 14.0.5 (Fedora 14.0.5-2.fc36)

So there is a note for the version of Clang, but not one for the version of lld.
Maybe this is a new feature ?  I am using  clang/llvm/lld version 14.0.5.


> For the gold liker, I see I can do a readelf -p .note.gnu.gold-version and
> get the version of gold used to make an ELF file.

Again I do not see this:

   % gcc hello.c -fuse-ld=gold
   % readelf -p.comment a.out

   String dump of section '.comment':
     [     1]  GCC: (GNU) 12.2.1 20221121 (Red Hat 12.2.1-4)
     [    2f]  GCC: (GNU) 12.0.1 20220413 (Red Hat 12.0.1-0)


>  I see nothing similar for the BFD linker.

True - this feature is not currently supported.


> So the request for enhancement is to add something to the .comment section
> as to which version of the BFD or gold linker was used to produce the ELF.
> 
> I can file a BZ if that is the preferred way of receiving a request such as
> this.

It is, so please do file a BZ.  If you can include a reproducer that would help.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: request for enhancement in BFD and gold linkers in regards to .comment section
  2023-03-01 13:41 ` Nick Clifton
@ 2023-03-01 14:53   ` Tom Kacvinsky
  2023-03-01 15:15     ` Tom Kacvinsky
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Kacvinsky @ 2023-03-01 14:53 UTC (permalink / raw)
  To: Binutils

[-- Attachment #1: Type: text/plain, Size: 2487 bytes --]

Hi Nick,

On Wed, Mar 1, 2023 at 8:41 AM Nick Clifton <nickc@redhat.com> wrote:

> Hi Tom,
>
> > I have noticed that the LLVM linker will add something to the .comment
> > section of binaries it produces for the version of lld used to produce an
> > ELF executable or shared library.
>
> Does it ?  I do not see this:
>
>     % clang hello.c
>     % readelf -p.comment a.out
>
>    String dump of section '.comment':
>      [     0]  GCC: (GNU) 12.2.1 20221121 (Red Hat 12.2.1-4)
>      [    2e]  GCC: (GNU) 12.0.1 20220413 (Red Hat 12.0.1-0)
>      [    5c]  clang version 14.0.5 (Fedora 14.0.5-2.fc36)
>

Ahh, sorry for the confusion.  I am using GCC forcing the use of LLD

 $ /opt/gcc-12.1.0/bin/gcc -B /opt/lld-14.0.6/bin -fuse-ld=lld -o wchar
wchar.c



$ /opt/binutils-2.39/bin/readelf -p .comment wchar



String dump of section '.comment':

  [     0]  GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-39)

  [    2d]  Linker: LLD 14.0.6

  [    40]  GCC: (GNU) 12.1.0



>
> So there is a note for the version of Clang, but not one for the version
> of lld.
> Maybe this is a new feature ?  I am using  clang/llvm/lld version 14.0.5.
>
>
> > For the gold liker, I see I can do a readelf -p .note.gnu.gold-version
> and
> > get the version of gold used to make an ELF file.
>
> Again I do not see this:
>
>    % gcc hello.c -fuse-ld=gold
>    % readelf -p.comment a.out
>
>
The gold version is in a different section

$ /opt/gcc-12.1.0/bin/gcc -B /opt/binutils-2.39/bin -fuse-ld=gold -o wchar
wchar.c



$ /opt/binutils-2.39/bin/readelf -p .note.gnu.gold-version wchar



String dump of section '.note.gnu.gold-version':

  [     c]  GNU

  [    10]  gold 1.16

    String dump of section '.comment':

>      [     1]  GCC: (GNU) 12.2.1 20221121 (Red Hat 12.2.1-4)
>      [    2f]  GCC: (GNU) 12.0.1 20220413 (Red Hat 12.0.1-0)
>
> >  I see nothing similar for the BFD linker.
>
> True - this feature is not currently supported.
>
> > So the request for enhancement is to add something to the .comment
> section
> > as to which version of the BFD or gold linker was used to produce the
> ELF.
> >
> > I can file a BZ if that is the preferred way of receiving a request such
> as
> > this.
>
> It is, so please do file a BZ.  If you can include a reproducer that would
> help.
>

OK, I'll do so, with simple "hello world!" code and the commands I am
using, as
above.

Thanks,

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: request for enhancement in BFD and gold linkers in regards to .comment section
  2023-03-01 14:53   ` Tom Kacvinsky
@ 2023-03-01 15:15     ` Tom Kacvinsky
  2023-03-19 20:36       ` Tom Kacvinsky
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Kacvinsky @ 2023-03-01 15:15 UTC (permalink / raw)
  To: Binutils

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

>
> I can file a BZ if that is the preferred way of receiving a request such as
>> this.
>>
>> It is, so please do file a BZ.  If you can include a reproducer that
>> would help.
>>
>
> OK, I'll do so, with simple "hello world!" code and the commands I am
> using, as
> above.
>

https://sourceware.org/bugzilla/show_bug.cgi?id=30187

>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: request for enhancement in BFD and gold linkers in regards to .comment section
  2023-03-01 15:15     ` Tom Kacvinsky
@ 2023-03-19 20:36       ` Tom Kacvinsky
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Kacvinsky @ 2023-03-19 20:36 UTC (permalink / raw)
  To: Binutils

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

On Wed, Mar 1, 2023 at 10:15 AM Tom Kacvinsky <tkacvins@gmail.com> wrote:

> I can file a BZ if that is the preferred way of receiving a request such as
>>> this.
>>>
>>> It is, so please do file a BZ.  If you can include a reproducer that
>>> would help.
>>>
>>
>> OK, I'll do so, with simple "hello world!" code and the commands I am
>> using, as
>> above.
>>
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=30187
>

I see that the work has been done for this and I am _super_ appreciative of
the efforts.
However, I thought of something after the work went in, something I should
have thought
of beforehand - the new linker option is not recognized by ld.gold.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-19 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 12:58 request for enhancement in BFD and gold linkers in regards to .comment section Tom Kacvinsky
2023-03-01 13:41 ` Nick Clifton
2023-03-01 14:53   ` Tom Kacvinsky
2023-03-01 15:15     ` Tom Kacvinsky
2023-03-19 20:36       ` Tom Kacvinsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).