Skip to content
Snippets Groups Projects
Commit a9ee8d6e authored by Rui Ueyama's avatar Rui Ueyama
Browse files

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
parent 4ce3e0c3
No related branches found
No related tags found
No related merge requests found
...@@ -46,12 +46,16 @@ static ArrayRef<uint8_t> createInterp() { ...@@ -46,12 +46,16 @@ static ArrayRef<uint8_t> createInterp() {
template <class ELFT> template <class ELFT>
InterpSection<ELFT>::InterpSection() InterpSection<ELFT>::InterpSection()
: InputSection<ELFT>(SHF_ALLOC, SHT_PROGBITS, 1, createInterp(), : InputSection<ELFT>(SHF_ALLOC, SHT_PROGBITS, 1, createInterp(),
".interp") {} ".interp") {
this->Live = true;
}
template <class ELFT> template <class ELFT>
BuildIdSection<ELFT>::BuildIdSection(size_t HashSize) BuildIdSection<ELFT>::BuildIdSection(size_t HashSize)
: InputSection<ELFT>(SHF_ALLOC, SHT_NOTE, 1, ArrayRef<uint8_t>(), : InputSection<ELFT>(SHF_ALLOC, SHT_NOTE, 1, ArrayRef<uint8_t>(),
".note.gnu.build-id") { ".note.gnu.build-id") {
this->Live = true;
Buf.resize(16 + HashSize); Buf.resize(16 + HashSize);
const endianness E = ELFT::TargetEndianness; const endianness E = ELFT::TargetEndianness;
write32<E>(Buf.data(), 4); // Name size write32<E>(Buf.data(), 4); // Name size
......
# 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment