]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/elf/Mips/ctors-order.test
Vendor import of lld trunk r233088:
[FreeBSD/FreeBSD.git] / test / elf / Mips / ctors-order.test
1 # Check ordering of .ctors.* sections.
2
3 # RUN: yaml2obj -format=elf -docnum 1 %s > %t-crtbeginS.o
4 # RUN: yaml2obj -format=elf -docnum 2 %s > %t-crtendS.o
5 # RUN: yaml2obj -format=elf -docnum 3 %s > %t-obj.o
6 # RUN: lld -flavor gnu -target mipsel -shared --output-filetype=yaml \
7 # RUN:     %t-crtbeginS.o %t-obj.o %t-crtendS.o | FileCheck %s
8 # RUN: lld -flavor gnu -target mipsel -shared -o %t.so \
9 # RUN:     %t-crtbeginS.o %t-obj.o %t-crtendS.o
10 # RUN: llvm-objdump -s %t.so | FileCheck -check-prefix=RAW %s
11
12 # CHECK:      defined-atoms:
13 # CHECK-NEXT:   - type:            data
14 # CHECK-NEXT:     alignment:       2^2
15 # CHECK-NEXT:     section-choice:  custom-required
16 # CHECK-NEXT:     section-name:    .ctors
17 # CHECK-NEXT:     references:
18 # CHECK-NEXT:       - kind:            layout-after
19 # CHECK-NEXT:         offset:          0
20 # CHECK-NEXT:         target:          __CTOR_LIST__
21 # CHECK-NEXT:   - name:            __CTOR_LIST__
22 # CHECK-NEXT:     type:            data
23 # CHECK-NEXT:     content:         [ FF, FF, FF, FF ]
24 # CHECK-NEXT:     alignment:       2^2
25 # CHECK-NEXT:     section-choice:  custom-required
26 # CHECK-NEXT:     section-name:    .ctors
27 # CHECK-NEXT:   - type:            data
28 # CHECK-NEXT:     content:         [ 11, 11, 11, 11 ]
29 # CHECK-NEXT:     alignment:       2^2
30 # CHECK-NEXT:     section-choice:  custom-required
31 # CHECK-NEXT:     section-name:    .ctors.1
32 # CHECK-NEXT:   - type:            data
33 # CHECK-NEXT:     content:         [ 22, 22, 22, 22 ]
34 # CHECK-NEXT:     alignment:       2^2
35 # CHECK-NEXT:     section-choice:  custom-required
36 # CHECK-NEXT:     section-name:    .ctors.2
37 # CHECK-NEXT:   - ref-name:        L003
38 # CHECK-NEXT:     type:            data
39 # CHECK-NEXT:     alignment:       2^2
40 # CHECK-NEXT:     section-choice:  custom-required
41 # CHECK-NEXT:     section-name:    .ctors
42 # CHECK-NEXT:     references:
43 # CHECK-NEXT:       - kind:            layout-after
44 # CHECK-NEXT:         offset:          0
45 # CHECK-NEXT:         target:          __CTOR_END__
46 # CHECK-NEXT:   - name:            __CTOR_END__
47 # CHECK-NEXT:     type:            data
48 # CHECK-NEXT:     content:         [ 00, 00, 00, 00 ]
49 # CHECK-NEXT:     alignment:       2^2
50 # CHECK-NEXT:     section-choice:  custom-required
51 # CHECK-NEXT:     section-name:    .ctors
52
53 # RAW:      Contents of section .ctors:
54 # RAW-NEXT: 1000 ffffffff 11111111 22222222 00000000
55 # crtbeginS.o
56 ---
57 FileHeader:
58   Class:           ELFCLASS32
59   Data:            ELFDATA2LSB
60   Type:            ET_REL
61   Machine:         EM_MIPS
62   Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_CPIC,
63                      EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ]
64 Sections:
65   - Name:            .ctors
66     Type:            SHT_PROGBITS
67     Flags:           [ SHF_WRITE, SHF_ALLOC ]
68     AddressAlign:    0x04
69     Content:         'FFFFFFFF'
70
71 Symbols:
72   Local:
73     - Name:            .ctors
74       Type:            STT_SECTION
75       Section:         .ctors
76     - Name:            __CTOR_LIST__
77       Type:            STT_OBJECT
78       Section:         .ctors
79
80 # crtendS.o
81 ---
82 FileHeader:
83   Class:           ELFCLASS32
84   Data:            ELFDATA2LSB
85   Type:            ET_REL
86   Machine:         EM_MIPS
87   Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_CPIC,
88                      EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2 ]
89 Sections:
90   - Name:            .text
91     Type:            SHT_PROGBITS
92     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
93     AddressAlign:    0x04
94     Size:            0x0F
95   - Name:            .rel.text
96     Type:            SHT_REL
97     Link:            .symtab
98     Info:            .text
99     AddressAlign:    0x04
100     Relocations:
101       - Offset:          0x00
102         Symbol:          .ctors
103         Type:            R_MIPS_HI16
104       - Offset:          0x04
105         Symbol:          .ctors
106         Type:            R_MIPS_LO16
107       - Offset:          0x08
108         Symbol:          .ctors
109         Type:            R_MIPS_HI16
110       - Offset:          0x0C
111         Symbol:          .ctors
112         Type:            R_MIPS_LO16
113   - Name:            .ctors
114     Type:            SHT_PROGBITS
115     Flags:           [ SHF_WRITE, SHF_ALLOC ]
116     AddressAlign:    0x04
117     Size:            0x04
118
119 Symbols:
120   Local:
121     - Name:            .text
122       Type:            STT_SECTION
123       Section:         .text
124     - Name:            .ctors
125       Type:            STT_SECTION
126       Section:         .ctors
127     - Name:            __CTOR_END__
128       Type:            STT_OBJECT
129       Section:         .ctors
130     - Name:            __do_global_ctors_aux
131       Type:            STT_FUNC
132       Section:         .text
133
134 # obj.o
135 ---
136 FileHeader:
137   Class:           ELFCLASS32
138   Data:            ELFDATA2LSB
139   Type:            ET_REL
140   Machine:         EM_MIPS
141   Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_CPIC,
142                      EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
143 Sections:
144   - Name:            .ctors.2
145     Type:            SHT_PROGBITS
146     Flags:           [ SHF_WRITE, SHF_ALLOC ]
147     AddressAlign:    0x04
148     Content:         '22222222'
149   - Name:            .ctors.1
150     Type:            SHT_PROGBITS
151     Flags:           [ SHF_WRITE, SHF_ALLOC ]
152     AddressAlign:    0x04
153     Content:         '11111111'
154
155 Symbols:
156   Local:
157     - Name:            .ctors.2
158       Type:            STT_SECTION
159       Section:         .ctors.2
160     - Name:            .ctors.1
161       Type:            STT_SECTION
162       Section:         .ctors.1
163 ...