aboutsummaryrefslogtreecommitdiff
path: root/test/elf/Mips/tls-2-micro.test
blob: 5a1fe2904ac96879e1cc0705d725cc4788edd015 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Check handling of R_MICROMIPS_TLS_GOTTPREL and R_MICROMIPS_TLS_GD relocations
# and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL32,
# R_MIPS_TLS_DTPMOD32 and R_MIPS_TLS_DTPREL32 in case of shared library.

# Create a shared library with thread symbol D1.
# RUN: yaml2obj -format=elf -o %t-so.o %s
# RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o

# Check dynamic relocations and GOT in the shared library.
# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=REL %s
# RUN: llvm-readobj -dynamic-table %t.so | FileCheck -check-prefix=DYN %s
# RUN: llvm-readobj -dt %t.so | FileCheck -check-prefix=SYM %s
# RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=GOT %s

# REL:      Section (4) .rel.dyn {
# REL-NEXT:   0x2008 R_MIPS_TLS_DTPMOD32 D1 0x0
# REL-NEXT:   0x200C R_MIPS_TLS_DTPREL32 D1 0x0
# REL-NEXT: }

# DYN: 0x7000000A MIPS_LOCAL_GOTNO 2
# DYN: 0x70000013 MIPS_GOTSYM      0x3

# SYM: Name: T1@ (1)
# SYM: Name: D1@ (4)

# GOT:      Contents of section .got:
# GOT-NEXT:  2000 00000000 00000080 00000000 00000000  ................

---
FileHeader:
  Class:           ELFCLASS32
  Data:            ELFDATA2LSB
  OSABI:           ELFOSABI_GNU
  Type:            ET_REL
  Machine:         EM_MIPS
  Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
                     EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ]
Sections:
  - Name:            .text
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
    AddressAlign:    0x04
    Size:            0x04
  - Name:            .rel.text
    Type:            SHT_REL
    Link:            .symtab
    Info:            .text
    AddressAlign:    0x04
    Relocations:
      - Offset:          0x00
        Symbol:          D1
        Type:            R_MICROMIPS_TLS_GD
  - Name:            .tdata
    Type:            SHT_PROGBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
    AddressAlign:    0x04
    Size:            0x04

Symbols:
  Global:
    - Name:            T1
      Type:            STT_FUNC
      Section:         .text
      Size:            0x04
      Other:           [ STO_MIPS_MICROMIPS ]
    - Name:            D1
      Type:            STT_TLS
      Section:         .tdata
      Size:            0x04
...