forked from OSchip/llvm-project
Don't gc .interp section.
This change fixes a bug that was introduced by r285851. r285851 converted .interp section as an output section to an input section. But I forgot to make it a "Live" section, so if -gc-section is given, it was garbage collected. llvm-svn: 286025
This commit is contained in:
parent
4ce3e0c31a
commit
a9ee8d6ecc
|
@ -46,12 +46,16 @@ static ArrayRef<uint8_t> createInterp() {
|
|||
template <class ELFT>
|
||||
InterpSection<ELFT>::InterpSection()
|
||||
: InputSection<ELFT>(SHF_ALLOC, SHT_PROGBITS, 1, createInterp(),
|
||||
".interp") {}
|
||||
".interp") {
|
||||
this->Live = true;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
BuildIdSection<ELFT>::BuildIdSection(size_t HashSize)
|
||||
: InputSection<ELFT>(SHF_ALLOC, SHT_NOTE, 1, ArrayRef<uint8_t>(),
|
||||
".note.gnu.build-id") {
|
||||
this->Live = true;
|
||||
|
||||
Buf.resize(16 + HashSize);
|
||||
const endianness E = ELFT::TargetEndianness;
|
||||
write32<E>(Buf.data(), 4); // Name size
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# REQUIRES: x86
|
||||
|
||||
# Linker-synthesized sections shouldn't be gc'ed.
|
||||
|
||||
# RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared.s -o %t.o
|
||||
# RUN: ld.lld %t2 -shared -o %t.so
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2
|
||||
# RUN: ld.lld %t2 %t.so -build-id -dynamic-linker /foo/bar -o %t.out
|
||||
# RUN: llvm-readobj -sections %t.out | FileCheck %s
|
||||
|
||||
# CHECK: Name: .interp
|
||||
# CHECK: Name: .note.gnu.build-id
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
ret
|
Loading…
Reference in New Issue