[llvm-nm] - Fix a bug and unbreak ASan BB.
[llvm-complete.git] / test / Object / objdump-relocations.test
bloba916a0fb9977c6b74ff11311452214d72a99af55
1 # RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-i386 \
2 # RUN:              | FileCheck %s -check-prefix COFF-i386
3 # RUN: llvm-objdump -r %p/Inputs/trivial-object-test.coff-x86-64 \
4 # RUN:              | FileCheck %s -check-prefix COFF-x86-64
6 # RUN: yaml2obj -docnum=1 %s > %t-i386
7 # RUN: llvm-objdump -r %t-i386 | FileCheck %s -check-prefix ELF-i386
9 # ELF-i386: .text
10 # ELF-i386: R_386_32 .section
11 # ELF-i386: R_386_PC32 symbol
13 --- !ELF
14 FileHeader:
15   Class:   ELFCLASS32
16   Data:    ELFDATA2LSB
17   Type:    ET_REL
18   Machine: EM_386
19 Sections:
20   - Name: .text
21     Type: SHT_PROGBITS
22   - Name: .section
23     Type: SHT_PROGBITS
24   - Name: .rel.text
25     Type: SHT_REL
26     Link: .symtab
27     Info: .text
28     Relocations:
29       - Offset: 0x0
30         Symbol: .section
31         Type:   R_386_32
32       - Offset: 0x1
33         Symbol: symbol
34         Type:   R_386_PC32
35 Symbols:
36   - Name:    .section
37     Type:    STT_SECTION
38     Section: .section
39   - Name:    symbol
40     Binding: STB_GLOBAL
42 # RUN: yaml2obj -docnum=2 %s > %t-x86-64
43 # RUN: llvm-objdump -r %t-x86-64 | FileCheck %s -check-prefix ELF-x86-64
45 # ELF-x86-64: .text
46 # ELF-x86-64: R_X86_64_32S .section
47 # ELF-x86-64: R_X86_64_PC32 symbol
49 --- !ELF
50 FileHeader:
51   Class:   ELFCLASS32
52   Data:    ELFDATA2LSB
53   Type:    ET_REL
54   Machine: EM_X86_64
55 Sections:
56   - Name: .text
57     Type: SHT_PROGBITS
58   - Name: .section
59     Type: SHT_PROGBITS
60   - Name: .rel.text
61     Type: SHT_REL
62     Link: .symtab
63     Info: .text
64     Relocations:
65       - Offset: 0x0
66         Symbol: .section
67         Type:   R_X86_64_32S
68       - Offset: 0x1
69         Symbol: symbol
70         Type:   R_X86_64_PC32
71 Symbols:
72   - Name:    .section
73     Type:    STT_SECTION
74     Section: .section
75   - Name:    symbol
76     Binding: STB_GLOBAL
78 # RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-hexagon \
79 # RUN:              | FileCheck %s -check-prefix ELF-hexagon
80 # RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mips64el \
81 # RUN:              | FileCheck %s -check-prefix ELF-MIPS64EL
82 # RUN: llvm-objdump -r %p/Inputs/trivial-object-test.elf-mipsel \
83 # RUN:              | FileCheck %s -check-prefix ELF-MIPSEL
84 # RUN: llvm-objdump -r %p/Inputs/trivial-object-test.wasm \
85 # RUN:              | FileCheck %s -check-prefix WASM
87 # RUN: llvm-objdump -r %p/Inputs/relocations.elf-x86-64 \
88 # RUN:              | FileCheck %s -check-prefix ELF-complex-x86-64
90 # COFF-i386: .text
91 # COFF-i386: IMAGE_REL_I386_DIR32 L_.str
92 # COFF-i386: IMAGE_REL_I386_REL32 _puts
93 # COFF-i386: IMAGE_REL_I386_REL32 _SomeOtherFunction
95 # COFF-x86-64: .text
96 # COFF-x86-64: IMAGE_REL_AMD64_REL32 L.str
97 # COFF-x86-64: IMAGE_REL_AMD64_REL32 puts
98 # COFF-x86-64: IMAGE_REL_AMD64_REL32 SomeOtherFunction
100 # ELF-hexagon: .text
101 # ELF-hexagon: R_HEX_GOTREL_HI16 .main
102 # ELF-hexagon: R_HEX_GOTREL_LO16 .main
103 # ELF-hexagon: R_HEX_HI16 puts
104 # ELF-hexagon: R_HEX_LO16 puts
105 # ELF-hexagon: R_HEX_B15_PCREL testf
106 # ELF-hexagon: R_HEX_B22_PCREL puts
108 ## Note: this file was produced with gas to make sure we don't end up in a
109 ## situation where LLVM produces and accepts a broken file.
110 # ELF-MIPS64EL: .data
111 # ELF-MIPS64EL: R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE zed
113 # ELF-MIPSEL: .text
114 # ELF-MIPSEL: R_MIPS_HI16 _gp_disp
115 # ELF-MIPSEL: R_MIPS_LO16 _gp_disp
116 # ELF-MIPSEL: R_MIPS_GOT16 $.str
117 # ELF-MIPSEL: R_MIPS_LO16 $.str
118 # ELF-MIPSEL: R_MIPS_CALL16 puts
119 # ELF-MIPSEL: R_MIPS_CALL16 SomeOtherFunction
121 # WASM:      CODE
122 # WASM-NEXT: R_WASM_MEMORY_ADDR_SLEB .L.str
123 # WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB puts
124 # WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB .LSomeOtherFunction_bitcast
125 # WASM-NEXT: R_WASM_FUNCTION_INDEX_LEB SomeOtherFunction
127 # ELF-complex-x86-64: .text
128 # ELF-complex-x86-64-NEXT: R_X86_64_8 .data-4
129 # ELF-complex-x86-64-NEXT: R_X86_64_16 .data-4
130 # ELF-complex-x86-64-NEXT: R_X86_64_32 .data-4
131 # ELF-complex-x86-64-NEXT: R_X86_64_32S .data-4
132 # ELF-complex-x86-64-NEXT: R_X86_64_64 .data-4
133 # ELF-complex-x86-64-NEXT: R_X86_64_PC32 .data-4
134 # ELF-complex-x86-64-NEXT: R_X86_64_32 .data
135 # ELF-complex-x86-64-NEXT: R_X86_64_32 .data+4