[PATCH] D76482: [lld][ELF] Provide optional hidden symbol for build ID
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 20 08:38:29 PDT 2020
MaskRay added a comment.
I think we should be a bit more careful proposing a new reserved symbol (symbol assignment even in the absence of a SECTIONS command) and think whether it will be useful after 5 years.
In FreeBSD, their linker script defines:
.note.gnu.build-id : {
PROVIDE (__build_id_start = .);
*(.note.gnu.build-id)
PROVIDE (__build_id_end = .);
}
We need `__build_id_end` because the size of .build-id can evolve. While I think sha1 is good enough for many use cases, I can imagine someone may want more bits.
OK, I can imagine there are use cases that an external linker script is not desired. There is another perfect alternative: parse PT_NOTE and extract NT_GNU_BUILD_ID.
================
Comment at: lld/test/ELF/build-id.s:8
+# RUN: ld.lld --build-id %t -o %t2
+# RUN: llvm-objdump -t -h %t2 | FileCheck --check-prefix=SYMBOL %s
----------------
Don't repeat lld command.
================
Comment at: lld/test/ELF/build-id.s:9
+# RUN: ld.lld --build-id %t -o %t2
+# RUN: llvm-objdump -t -h %t2 | FileCheck --check-prefix=SYMBOL %s
+
----------------
llvm-objdump -h output does not match GNU objdump. This has been a headache for many projects. llvm-readelf -S -s is usually a bette replacement.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76482/new/
https://reviews.llvm.org/D76482
More information about the llvm-commits
mailing list