# Check handling of R_MIPS_TLS_GOTTPREL relocation in case of -static linking. # RUN: yaml2obj -format=elf -o %t.o %s # RUN: lld -flavor old-gnu -target mipsel -e T0 -static -o %t.exe %t.o # RUN: llvm-objdump -s %t.exe | FileCheck %s # CHECK: Contents of section .text: # CHECK-NEXT: 4000b4 18800000 1c800000 # ^ -32744 ^ -32740 # CHECK-NEXT: Contents of section .tdata: # CHECK-NEXT: 401000 00000000 00000000 # CHECK-NEXT: Contents of section .got: # CHECK-NEXT: 402000 00000000 00000080 0490ffff 0c90ffff # D1 0x401000 + 4 - (0x401000 + 0x7000) = 0xffff9004 => 0490ffff # D2 0x401004 + 8 - (0x401000 + 0x7000) = 0xffff900c => 0c90ffff --- FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MIPS Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32] 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_GOTTPREL - Offset: 4 Symbol: D2 Type: R_MIPS_TLS_GOTTPREL - Name: .tdata Type: SHT_PROGBITS Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ] AddressAlign: 4 Size: 8 Symbols: Global: - Name: D1 Type: STT_TLS Section: .tdata Value: 0 Size: 4 - Name: D2 Type: STT_TLS Section: .tdata Value: 4 Size: 4 - Name: T0 Type: STT_FUNC Section: .text Size: 8 ...