aboutsummaryrefslogtreecommitdiff
path: root/test/elf/Mips/rel-dynamic-11.test
blob: 20295396cd083096e8c00378a2cf1e5a32e00a1a (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Conditions:
#   a) Linking a shared library.
#   b) Relocations' targets are symbols defined in the other shared object.
# Check:
#   a) Emitting R_MIPS_REL32 relocations for both symbols.
#   b) There should be no PLT entries.
#
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t1.so %t-so.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o
# RUN: lld -flavor gnu -target mipsel -shared -o %t2.so %t-o.o %t1.so
# RUN: llvm-readobj -dt -r -s %t2.so | FileCheck -check-prefix=PLT-SYM %s

# PLT-SYM:     Sections [
# PLT-SYM:       Section {
# PLT-SYM-NOT:     Name: .plt ({{[0-9]+}})
#
# PLT-SYM:      Relocations [
# PLT-SYM-NEXT:   Section (4) .rel.dyn {
# PLT-SYM-NEXT:     0x150 R_MIPS_REL32 T1 0x0
# PLT-SYM-NEXT:     0x2000 R_MIPS_REL32 T1 0x0
# PLT-SYM-NEXT:   }
# PLT-SYM-NEXT: ]
#
# PLT-SYM:      Name: T1@ (7)
# PLT-SYM-NEXT: Value: 0x0
# PLT-SYM-NEXT: Size: 0
# PLT-SYM-NEXT: Binding: Global (0x1)
# PLT-SYM-NEXT: Type: Function (0x2)
# PLT-SYM-NEXT: Other: 0
# PLT-SYM-NEXT: Section: Undefined (0x0)

# so.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_32]

Sections:
- Name:         .text
  Type:         SHT_PROGBITS
  Size:         0x0C
  AddressAlign: 16
  Flags:        [SHF_EXECINSTR, SHF_ALLOC]

Symbols:
  Global:
    - Name: T1
      Section: .text
      Type: STT_FUNC
      Value: 0x0
      Size: 4

# o.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_32]

Sections:
- Name: .text
  Type: SHT_PROGBITS
  Size: 0x08
  AddressAlign: 16
  Flags: [SHF_EXECINSTR, SHF_ALLOC]

- Name: .data
  Type: SHT_PROGBITS
  Size: 0x08
  AddressAlign: 16
  Flags: [SHF_WRITE, SHF_ALLOC]

- Name: .rel.text
  Type: SHT_REL
  Info: .text
  AddressAlign: 4
  Relocations:
    - Offset: 0x00
      Symbol: T1
      Type: R_MIPS_32

- Name: .rel.data
  Type: SHT_REL
  Info: .data
  AddressAlign: 4
  Relocations:
    - Offset: 0x00
      Symbol: T1
      Type: R_MIPS_32

Symbols:
  Global:
    - Name: T0
      Section: .text
      Type: STT_FUNC
      Value: 0x0
      Size: 4
    - Name: T1
    - Name: D0
      Section: .data
      Type: STT_OBJECT
      Value: 0x0
      Size: 8
...