[PATCH] D76482: [lld][ELF] Provide optional hidden symbols for build ID

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 05:50:31 PDT 2020


psmith added a comment.

It is a pity that the section name is not a valid C identifier otherwise __start_ and __stop_ would have been generated automatically.

Although less convenient to the programmer using LLD, using the section bounds at least allows someone to fake the symbols with a simple fragment of linker script, thus permitting deployment of the program on older versions of the linker and not needing custom support in ld.bfd:

  .note.gnu.build-id : {
    PROVIDE (__build_id_start = .);
    *(.note.gnu.build-id)
    PROVIDE (__build_id_end = .);
  }

>From the comments above I guess at least __build_id_start could be set to `PROVIDE (__build_id_start = . + 16);` but that isn't as intuitive.

One final suggestion if the symbols are going to surround the build id payload is to make that explicit in the name, for example `__build_id_payload_start`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76482/new/

https://reviews.llvm.org/D76482



More information about the llvm-commits mailing list