# Check handling of R_MIPS_TLS_GD relocation in case of -static linking. # RUN: yaml2obj -format=elf -o %t.o %s # RUN: lld -flavor old-gnu -target mips64el -e T0 -static -o %t.exe %t.o # RUN: llvm-objdump -s %t.exe | FileCheck %s # CHECK: Contents of section .text: # CHECK-NEXT: 120000120 20800000 30800000 # ^ -32736 ^ -32720 # CHECK-NEXT: Contents of section .tdata: # CHECK-NEXT: 120001000 00000000 00000000 # CHECK-NEXT: Contents of section .got: # CHECK-NEXT: 120002000 00000000 00000000 00000000 00000080 # CHECK-NEXT: 120002010 01000000 00000000 0480ffff ffffffff # CHECK-NEXT: 120002020 01000000 00000000 0c80ffff ffffffff # D1 0x120001000 + 4 - (0x120001000 + 0x8000) = 0xffff8004 => 0480ffff # D2 0x120001040 + 8 - (0x120001000 + 0x8000) = 0xffff800c => 0c80ffff --- FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB Type: ET_REL Machine: EM_MIPS Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64] Sections: - Name: .text Type: SHT_PROGBITS Flags: [ SHF_ALLOC, SHF_EXECINSTR ] AddressAlign: 4 Size: 8 - Name: .rel.text Type: SHT_RELA Link: .symtab Info: .text AddressAlign: 4 Relocations: - Offset: 0 Symbol: D1 Type: R_MIPS_TLS_GD Addend: 4 - Offset: 4 Symbol: D2 Type: R_MIPS_TLS_GD Addend: 8 - 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 ...