mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
Canonicalize the type of .eh_frame.
GNU as can give it type SHT_PROGBITS or SHT_X86_64_UNWIND depending on teh construct. MC gives it type SHT_X86_64_UNWIND. The linker has to canonicalize to one or the other so that there is only one .eh_frame in the end. llvm-svn: 252757
This commit is contained in:
@@ -489,8 +489,12 @@ template <class ELFT> void Writer<ELFT>::createSections() {
|
||||
// mapping from input to output.
|
||||
auto *IS = dyn_cast<InputSection<ELFT>>(C);
|
||||
uintX_t EntSize = IS ? 0 : H->sh_entsize;
|
||||
uint32_t OutType = H->sh_type;
|
||||
if (OutType == SHT_PROGBITS && C->getSectionName() == ".eh_frame" &&
|
||||
Config->EMachine == EM_X86_64)
|
||||
OutType = SHT_X86_64_UNWIND;
|
||||
SectionKey<ELFT::Is64Bits> Key{getOutputName(C->getSectionName()),
|
||||
H->sh_type, OutFlags, EntSize};
|
||||
OutType, OutFlags, EntSize};
|
||||
OutputSectionBase<ELFT> *&Sec = Map[Key];
|
||||
if (!Sec) {
|
||||
if (IS)
|
||||
|
||||
16
lld/test/elf2/eh-frame-type.test
Normal file
16
lld/test/elf2/eh-frame-type.test
Normal file
@@ -0,0 +1,16 @@
|
||||
# RUN: yaml2obj -format elf %s -o %t.o
|
||||
# RUN: ld.lld2 %t.o -o %t -shared
|
||||
# RUN: llvm-readobj -s %t | FileCheck %s
|
||||
|
||||
# CHECK: Name: .eh_frame
|
||||
# CHECK-NEXT: Type: SHT_X86_64_UNWIND
|
||||
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_X86_64
|
||||
Sections:
|
||||
- Name: .eh_frame
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_ALLOC ]
|
||||
Reference in New Issue
Block a user