]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/elf/Mips/rel-pc19-s2.test
Vendor import of lld trunk r233088:
[FreeBSD/FreeBSD.git] / test / elf / Mips / rel-pc19-s2.test
1 # Check handling of R_MIPS_PC19_S2 relocation.
2
3 # RUN: yaml2obj -format=elf %s > %t.o
4 # RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t.o
5 # RUN: llvm-objdump -s -t %t.exe | FileCheck %s
6
7 # CHECK: Contents of section .text:
8 # CHECK-NEXT: 400110 01000000 00000000 00000000
9 #                    ^ V
10 #                    A = -1 << 2 = -4 =>
11 #                    V = (T1 - 4 - T0) >> 2 =>
12 #                    V => 4 >> 2 = 1
13
14 # CHECK: SYMBOL TABLE:
15 # CHECK: 00400110 g  F .text  00000008 T0
16 # CHECK: 00400118 g  F .text  00000004 T1
17
18 FileHeader:
19   Class:   ELFCLASS32
20   Data:    ELFDATA2LSB
21   Type:    ET_REL
22   Machine: EM_MIPS
23   Flags:   [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R6]
24
25 Sections:
26 - Name:         .text
27   Type:         SHT_PROGBITS
28   Content:      "ffff07000000000000000000"
29 #                                ^ T1
30 #                ^ T0 A := 0x7ffff == -1
31   AddressAlign: 16
32   Flags:        [ SHF_ALLOC, SHF_EXECINSTR ]
33
34 - Name:         .rel.text
35   Type:         SHT_REL
36   Info:         .text
37   AddressAlign: 4
38   Relocations:
39     - Offset: 0
40       Symbol: T1
41       Type:   R_MIPS_PC19_S2
42
43 Symbols:
44   Global:
45     - Name:    T0
46       Section: .text
47       Type:    STT_FUNC
48       Value:   0
49       Size:    8
50     - Name:    T1
51       Section: .text
52       Type:    STT_FUNC
53       Value:   8
54       Size:    4