[Mips] Fix the bug -- symbol referred by the R_MIPS_TLS_GD relocation

does not get an entry in the dynamic symbol table.

llvm-svn: 210648
This commit is contained in:
Simon Atanasyan 2014-06-11 10:08:08 +00:00
parent 46fa9f2d9e
commit 87a06716e6
2 changed files with 70 additions and 1 deletions

View File

@ -68,7 +68,7 @@ public:
return AtomSection<ELFType>::appendAtom(atom);
case R_MIPS_TLS_DTPMOD32:
_hasNonLocal = true;
return AtomSection<ELFType>::appendAtom(atom);
break;
}
}

View File

@ -0,0 +1,69 @@
# Check that in case of an executable file linking symbol referred
# by the R_MIPS_TLS_GD relocation gets an entry in the dynamic symbol table.
# RUN: yaml2obj -format=elf -o %t-o.o %s
# RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t-o.o
# Check dynamic relocations:
# RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s
# Check dynamic symbol table:
# RUN: llvm-readobj -dt %t.exe | FileCheck -check-prefix=SYM %s
# REL: Relocations [
# REL-NEXT: Section (5) .rel.dyn {
# REL-NEXT: 0x402008 R_MIPS_TLS_DTPMOD32 T1 0x0
# REL-NEXT: 0x40200C R_MIPS_TLS_DTPREL32 T1 0x0
# REL-NEXT: }
# REL-NEXT: ]
# SYM: Symbol {
# SYM: Name: T1@ (1)
# SYM-NEXT: Value: 0x0
# SYM-NEXT: Size: 4
# SYM-NEXT: Binding: Global (0x1)
# SYM-NEXT: Type: TLS (0x6)
# SYM-NEXT: Other: 0
# SYM-NEXT: Section: .tdata (0x7)
# SYM-NEXT: }
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x10
Size: 0x04
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 0x04
Info: .text
Relocations:
- Offset: 0x00
Symbol: T1
Type: R_MIPS_TLS_GD
- Name: .tdata
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
AddressAlign: 0x04
Size: 0x04
Symbols:
Global:
- Name: T0
Type: STT_FUNC
Section: .text
Size: 0x04
- Name: T1
Type: STT_TLS
Section: .tdata
Value: 0x00
Size: 0x04
...