forked from OSchip/llvm-project
Ignone SHF_INFO_LINK.
Some elf producers (dtrace) put this flag in relocation sections and some (MC) don't. If we don't ignore the flag we end up with multiple relocation sections poiting to the same section, which we don't support. llvm-svn: 288585
This commit is contained in:
parent
b7f8cb698c
commit
27004d336f
|
@ -92,9 +92,10 @@ template <class ELFT>
|
|||
InputSectionBase<ELFT>::InputSectionBase(elf::ObjectFile<ELFT> *File,
|
||||
const Elf_Shdr *Hdr, StringRef Name,
|
||||
Kind SectionKind)
|
||||
: InputSectionBase(File, Hdr->sh_flags, Hdr->sh_type, Hdr->sh_entsize,
|
||||
Hdr->sh_link, Hdr->sh_info, Hdr->sh_addralign,
|
||||
getSectionContents(File, Hdr), Name, SectionKind) {
|
||||
: InputSectionBase(File, Hdr->sh_flags & ~SHF_INFO_LINK, Hdr->sh_type,
|
||||
Hdr->sh_entsize, Hdr->sh_link, Hdr->sh_info,
|
||||
Hdr->sh_addralign, getSectionContents(File, Hdr), Name,
|
||||
SectionKind) {
|
||||
this->Offset = Hdr->sh_offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_X86_64
|
||||
Sections:
|
||||
- Name: .text
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
||||
- Name: .rela.text
|
||||
Type: SHT_RELA
|
||||
Link: .symtab
|
||||
Info: .text
|
||||
Relocations:
|
||||
- Offset: 0x0000000000000000
|
||||
Symbol: foo
|
||||
Type: R_X86_64_64
|
||||
Symbols:
|
||||
Global:
|
||||
- Name: foo
|
|
@ -0,0 +1,32 @@
|
|||
# RUN: yaml2obj %s -o %t.o
|
||||
# RUN: yaml2obj %S/Inputs/shf-info-link.test -o %t2.o
|
||||
# RUN: ld.lld %t.o %t2.o -o %t3.o -r
|
||||
# RUN: llvm-readobj -s %t3.o | FileCheck %s
|
||||
|
||||
# CHECK-NOT: Name: .rela.text
|
||||
# CHECK: Name: .rela.text
|
||||
# CHECK-NOT: Name: .rela.text
|
||||
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_X86_64
|
||||
Sections:
|
||||
- Name: .text
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
||||
- Name: .rela.text
|
||||
Type: SHT_RELA
|
||||
Flags: [ SHF_INFO_LINK ]
|
||||
Link: .symtab
|
||||
Info: .text
|
||||
Relocations:
|
||||
- Offset: 0x0000000000000000
|
||||
Symbol: foo
|
||||
Type: R_X86_64_64
|
||||
Symbols:
|
||||
Global:
|
||||
- Name: foo
|
Loading…
Reference in New Issue