mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-25 04:51:38 +00:00
[ELF] Discard input .note.gnu.build-id even with default --build-id=none
binutils 2.38 will adopt this behavior https://sourceware.org/bugzilla/show_bug.cgi?id=28639 Reviewed By: ikudrin Differential Revision: https://reviews.llvm.org/D114910
This commit is contained in:
parent
0496edad49
commit
c5bfffed48
@ -1025,12 +1025,11 @@ InputSectionBase *ObjFile<ELFT>::createInputSection(uint32_t idx,
|
||||
name == ".gnu.linkonce.t.__i686.get_pc_thunk.bx")
|
||||
return &InputSection::discarded;
|
||||
|
||||
// If we are creating a new .build-id section, strip existing .build-id
|
||||
// sections so that the output won't have more than one .build-id.
|
||||
// This is not usually a problem because input object files normally don't
|
||||
// have .build-id sections, but you can create such files by
|
||||
// "ld.{bfd,gold,lld} -r --build-id", and we want to guard against it.
|
||||
if (name == ".note.gnu.build-id" && config->buildId != BuildIdKind::None)
|
||||
// Strip existing .note.gnu.build-id sections so that the output won't have
|
||||
// more than one build-id. This is not usually a problem because input object
|
||||
// files normally don't have .build-id sections, but you can create such files
|
||||
// by "ld.{bfd,gold,lld} -r --build-id", and we want to guard against it.
|
||||
if (name == ".note.gnu.build-id")
|
||||
return &InputSection::discarded;
|
||||
|
||||
// The linker merges EH (exception handling) frames and creates a
|
||||
|
@ -4,9 +4,19 @@
|
||||
# RUN: ld.lld --build-id=0xdeadbeef -o %t.exe %t2.o
|
||||
# RUN: llvm-objdump -s %t.exe | FileCheck %s
|
||||
|
||||
## The default --build-id=none removes .note.gnu.build-id input sections.
|
||||
# RUN: ld.lld %t2.o -o %t.none
|
||||
# RUN: llvm-readelf -S %t.none | FileCheck %s --check-prefix=NO
|
||||
# RUN: ld.lld --build-id=none %t2.o -o %t.none2
|
||||
# RUN: cmp %t.none %t.none2
|
||||
|
||||
# CHECK: Contents of section .note.gnu.build-id:
|
||||
# CHECK-NOT: cafebabe
|
||||
# CHECK: deadbeef
|
||||
|
||||
# NO: Section Headers:
|
||||
# NO-NOT: .note.gnu.build-id
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
ret
|
||||
|
Loading…
x
Reference in New Issue
Block a user