[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / relative-dynamic-reloc.s
blob9f477f8594547943903a7401c10e7512a62ccab3
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 // RUN: ld.lld -shared %t.o -o %t.so
4 // RUN: llvm-readobj --symbols -r --dyn-syms %t.so | FileCheck %s
6 // Test that we create R_X86_64_RELATIVE relocations but don't put any
7 // symbols in the dynamic symbol table.
9 // CHECK: Relocations [
10 // CHECK-NEXT: Section ({{.*}}) .rela.dyn {
11 // CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
12 // CHECK-NEXT: 0x[[#%X,BAR_ADDR:]] R_X86_64_RELATIVE
13 // CHECK-SAME: - 0x[[#BAR_ADDR]]
14 // CHECK-NEXT: 0x[[#BAR_ADDR + 8]] R_X86_64_RELATIVE - 0x[[#BAR_ADDR + 1]]
15 // CHECK-NEXT: 0x[[#BAR_ADDR + 16]] R_X86_64_RELATIVE - 0x[[ZED_ADDR:.*]]
16 // CHECK-NEXT: 0x[[#BAR_ADDR + 24]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
17 // CHECK-NEXT: 0x[[#BAR_ADDR + 32]] R_X86_64_64 external 0x0
18 // CHECK-NEXT: }
19 // CHECK-NEXT: ]
21 // CHECK: Symbols [
22 // CHECK: Name: foo
23 // CHECK-NEXT: Value: 0x[[FOO_ADDR]]
24 // CHECK: Name: bar
25 // CHECK-NEXT: Value: 0x[[#BAR_ADDR]]
26 // CHECK: Name: zed
27 // CHECK-NEXT: Value: 0x[[ZED_ADDR]]
28 // CHECK: ]
30 // CHECK: DynamicSymbols [
31 // CHECK-NEXT: Symbol {
32 // CHECK-NEXT: Name:
33 // CHECK-NEXT: Value: 0x0
34 // CHECK-NEXT: Size: 0
35 // CHECK-NEXT: Binding: Local
36 // CHECK-NEXT: Type: None
37 // CHECK-NEXT: Other: 0
38 // CHECK-NEXT: Section: Undefined
39 // CHECK-NEXT: }
40 // CHECK-NEXT: Symbol {
41 // CHECK-NEXT: Name: external
42 // CHECK-NEXT: Value: 0x0
43 // CHECK-NEXT: Size: 0
44 // CHECK-NEXT: Binding: Global
45 // CHECK-NEXT: Type: None
46 // CHECK-NEXT: Other: 0
47 // CHECK-NEXT: Section: Undefined
48 // CHECK-NEXT: }
49 // CHECK-NEXT: ]
51 .data
52 foo:
53 .quad foo
55 .hidden bar
56 .global bar
57 bar:
58 .quad bar
59 .quad bar + 1
61 .hidden zed
62 .comm zed,1
63 .quad zed
65 .section abc,"aw"
66 .quad foo
68 .quad external
70 // This doesn't need a relocation.
71 callq localfunc@PLT
72 localfunc: