Do not propagate section name and attributes to .eh_frame.

.eh_frame is always ".eh_frame" and its attribute is fixed.
No need to copy from inputs to outputs. GNU gold also sets
SHT_PROGBITS.

llvm-svn: 270443
This commit is contained in:
Rui Ueyama 2016-05-23 15:12:41 +00:00
parent 1e479c23aa
commit f86cb90a2d
7 changed files with 10 additions and 10 deletions

View File

@ -921,9 +921,8 @@ template <class ELFT> void OutputSection<ELFT>::writeTo(uint8_t *Buf) {
}
template <class ELFT>
EhOutputSection<ELFT>::EhOutputSection(StringRef Name, uint32_t Type,
uintX_t Flags)
: OutputSectionBase<ELFT>(Name, Type, Flags) {
EhOutputSection<ELFT>::EhOutputSection()
: OutputSectionBase<ELFT>(".eh_frame", SHT_PROGBITS, SHF_ALLOC) {
Out<ELFT>::EhFrameHdr->add(this);
}

View File

@ -334,12 +334,13 @@ struct CieRecord {
// Output section for .eh_frame.
template <class ELFT>
class EhOutputSection final : public OutputSectionBase<ELFT> {
public:
typedef typename ELFT::uint uintX_t;
typedef typename ELFT::Shdr Elf_Shdr;
typedef typename ELFT::Rel Elf_Rel;
typedef typename ELFT::Rela Elf_Rela;
EhOutputSection(StringRef Name, uint32_t Type, uintX_t Flags);
public:
EhOutputSection();
void writeTo(uint8_t *Buf) override;
void finalize() override;
void

View File

@ -1174,7 +1174,7 @@ OutputSectionFactory<ELFT>::create(InputSectionBase<ELFT> *C,
Sec = new OutputSection<ELFT>(Key.Name, Key.Type, Key.Flags);
break;
case InputSectionBase<ELFT>::EHFrame:
Sec = new EhOutputSection<ELFT>(Key.Name, Key.Type, Key.Flags);
Sec = new EhOutputSection<ELFT>;
break;
case InputSectionBase<ELFT>::Merge:
Sec = new MergeOutputSection<ELFT>(Key.Name, Key.Type, Key.Flags,

View File

@ -44,7 +44,7 @@ _start:
// HDR: Section {
// HDR: Index: 1
// HDR-NEXT: Name: .eh_frame
// HDR-NEXT: Type: SHT_X86_64_UNWIND
// HDR-NEXT: Type: SHT_PROGBITS
// HDR-NEXT: Flags [
// HDR-NEXT: SHF_ALLOC
// HDR-NEXT: ]

View File

@ -21,7 +21,7 @@
// * There is only one copy of the second FDE
// CHECK: Name: .eh_frame
// CHECK-NEXT: Type: SHT_X86_64_UNWIND
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: ]

View File

@ -3,7 +3,7 @@
# RUN: llvm-readobj -s %t | FileCheck %s
# CHECK: Name: .eh_frame
# CHECK-NEXT: Type: SHT_X86_64_UNWIND
# CHECK-NEXT: Type: SHT_PROGBITS
FileHeader:
Class: ELFCLASS64

View File

@ -6,7 +6,7 @@
// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
// CHECK: Name: .eh_frame
// CHECK-NEXT: Type: SHT_X86_64_UNWIND
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: ]