bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/30187] ld.bfd and ld.gold versions in .comment section of ELF


From: nickc at redhat dot com
Subject: [Bug gold/30187] ld.bfd and ld.gold versions in .comment section of ELF files
Date: Fri, 03 Mar 2023 10:29:14 +0000

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

--- Comment #3 from Nick Clifton <nickc at redhat dot com> ---
Created attachment 14728
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14728&action=edit
Proposed patch

Hi Tom,

  What do you think of the this patch ?

  It adds a new linker script directive called LINKER_VERSION, which if used
  inserts the current linker version identity string at the current location.
  Then it enhances the default linker script for (most) ELF based targets so
  that this directive is added to the end of the .comment section.

  Using a linker script directive means that the string can be placed whever
  the user wishes (by creating their own linker scripts) or not at all (again
  with a custom script).

  Here is an example of it in use:

  % gcc -c hello.c
  % ld hello.o -e 0 --defsym printf=0 
  % readelf -p.comment a.out
  String dump of section '.comment':
    [     0]  GCC: (GNU) 12.0.1 20220413 (Red Hat 12.0.1-0)
    [    2e]  GNU ld (GNU Binutils) 2.40.50.20230303

  % ld --verbose | grep comment
  .comment       0 : { *(.comment); LINKER_VERSION; }

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]