forked from OSchip/llvm-project
126 lines
3.2 KiB
Plaintext
126 lines
3.2 KiB
Plaintext
# Check handling of R_MIPS_TLS_GD relocation in case of -static linking.
|
|
|
|
# RUN: yaml2obj -format=elf -docnum 1 -o %t1.o %s
|
|
# RUN: yaml2obj -format=elf -docnum 2 -o %t2.o %s
|
|
# RUN: lld -flavor old-gnu -target mipsel -e T0 -static -o %t.exe %t1.o %t2.o
|
|
# RUN: llvm-objdump -s %t.exe | FileCheck %s
|
|
|
|
# CHECK: Contents of section .text:
|
|
# CHECK-NEXT: 4000b4 18800000 20800000 28800000 30800000
|
|
# ^ -32744 ^ -32736 ^ -32728 ^ -32720
|
|
# CHECK-NEXT: Contents of section .tdata:
|
|
# CHECK-NEXT: 401000 00000000 00000000 00000000 00000000
|
|
# CHECK-NEXT: Contents of section .got:
|
|
# CHECK-NEXT: 402000 00000000 00000080 01000000 0480ffff
|
|
# CHECK-NEXT: 402010 01000000 0c80ffff 01000000 0c80ffff
|
|
# CHECK-NEXT: 402020 01000000 1480ffff
|
|
# D1 0x401000 + 4 - (0x401000 + 0x8000) = 0xffff8004 => 0480ffff
|
|
# D2 0x401004 + 8 - (0x401000 + 0x8000) = 0xffff800c => 0c80ffff
|
|
# D3 0x401008 + 4 - (0x401000 + 0x8000) = 0xffff800c => 0c80ffff
|
|
# D4 0x40100c + 8 - (0x401000 + 0x8000) = 0xffff8014 => 1480ffff
|
|
|
|
# t1.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [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: 4
|
|
Content: "0400000008000000"
|
|
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
Info: .text
|
|
AddressAlign: 4
|
|
Relocations:
|
|
- Offset: 0
|
|
Symbol: D1
|
|
Type: R_MIPS_TLS_GD
|
|
- Offset: 4
|
|
Symbol: D2
|
|
Type: R_MIPS_TLS_GD
|
|
|
|
- Name: .tdata
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
|
|
AddressAlign: 4
|
|
Size: 8
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T0
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Size: 8
|
|
- Name: D1
|
|
Type: STT_TLS
|
|
Section: .tdata
|
|
Value: 0
|
|
Size: 4
|
|
- Name: D2
|
|
Type: STT_TLS
|
|
Section: .tdata
|
|
Value: 4
|
|
Size: 4
|
|
|
|
# t2.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [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: 4
|
|
Content: "0400000008000000"
|
|
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
Info: .text
|
|
AddressAlign: 4
|
|
Relocations:
|
|
- Offset: 0
|
|
Symbol: D3
|
|
Type: R_MIPS_TLS_GD
|
|
- Offset: 4
|
|
Symbol: D4
|
|
Type: R_MIPS_TLS_GD
|
|
|
|
- Name: .tdata
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
|
|
AddressAlign: 4
|
|
Size: 8
|
|
|
|
Symbols:
|
|
Global:
|
|
- Name: T1
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Size: 8
|
|
- Name: D3
|
|
Type: STT_TLS
|
|
Section: .tdata
|
|
Value: 0
|
|
Size: 4
|
|
- Name: D4
|
|
Type: STT_TLS
|
|
Section: .tdata
|
|
Value: 4
|
|
Size: 4
|
|
...
|