1 // RUN
: llvm-mc
-filetype
=obj
-triple x86_64-pc-linux-gnu
%s
-o
- | elf-dump
--dump-section-data | FileCheck
%s
3 // Test that PIC relocations with local symbols in
a mergeable section are done
4 // with
a reference to the symbol.
Not sure if this is
a linker limitation
,
5 // but this matches the behavior of gas.
7 // Non-PIC relocations with
0 offset don
't use the symbol.
10 movsd .Lfoo(%rip), %xmm1
14 movq foo@GOTPCREL, %rax
17 .section .sec1,"aM",@progbits,16
22 .section bar,"ax",@progbits
25 // Section 4 is "sec1"
26 // CHECK: # Section 0x00000004
27 // CHECK-NEXT: (('sh_name
', 0x00000012) # '.sec1'
29 // Symbol number 1 is .Lfoo
30 // CHECK: # Symbol 0x00000001
31 // CHECK-NEXT: (('st_name', 0x00000001) # '.Lfoo'
33 // Symbol number 2 is foo
34 // CHECK: # Symbol 0x00000002
35 // CHECK-NEXT: (('st_name', 0x00000007) # 'foo'
37 // Symbol number 6 is section 4
38 // CHECK: # Symbol 0x00000006
39 // CHECK-NEXT: (('st_name', 0x00000000) # ''
40 // CHECK-NEXT: ('st_bind', 0x00000000)
41 // CHECK-NEXT: ('st_type', 0x00000003)
42 // CHECK-NEXT: ('st_other', 0x00000000)
43 // CHECK-NEXT: ('st_shndx', 0x00000004)
45 // Symbol number 8 is zed
46 // CHECK: # Symbol 0x00000008
47 // CHECK-NEXT: (('st_name', 0x0000000b) # 'zed'
49 // Relocation 0 refers to symbol 1
50 // CHECK: ('_relocations', [
51 // CHECK-NEXT: # Relocation 0
52 // CHECK-NEXT: (('r_offset',
53 // CHECK-NEXT: ('r_sym', 0x00000001)
54 // CHECK-NEXT: ('r_type', 0x00000002
55 // CHECK-NEXT: ('r_addend',
58 // Relocation 1 refers to symbol 6
59 // CHECK-NEXT: # Relocation 0x00000001
60 // CHECK-NEXT: (('r_offset',
61 // CHECK-NEXT: ('r_sym', 0x00000006)
62 // CHECK-NEXT: ('r_type', 0x0000000a)
63 // CHECK-NEXT: ('r_addend',
66 // Relocation 2 refers to symbol 1
67 // CHECK-NEXT: # Relocation 0x00000002
68 // CHECK-NEXT: (('r_offset',
69 // CHECK-NEXT: ('r_sym', 0x00000001)
70 // CHECK-NEXT: ('r_type', 0x0000000a
71 // CHECK-NEXT: ('r_addend',
74 // Relocation 3 refers to symbol 2
75 // CHECK-NEXT: # Relocation 0x00000003
76 // CHECK-NEXT: (('r_offset',
77 // CHECK-NEXT: ('r_sym', 0x00000002)
78 // CHECK-NEXT: ('r_type', 0x00000004
79 // CHECK-NEXT: ('r_addend',
82 // Relocation 4 refers to symbol 2
83 // CHECK-NEXT: # Relocation 0x00000004
84 // CHECK-NEXT: (('r_offset',
85 // CHECK-NEXT: ('r_sym', 0x00000002)
86 // CHECK-NEXT: ('r_type', 0x00000009
87 // CHECK-NEXT: ('r_addend',
90 // Relocation 5 refers to symbol 8
91 // CHECK-NEXT: # Relocation 0x00000005
92 // CHECK-NEXT: (('r_offset', 0x00000023)
93 // CHECK-NEXT: ('r_sym', 0x00000008)
94 // CHECK-NEXT: ('r_type', 0x0000000b)
95 // CHECK-NEXT: ('r_addend', 0x00000000)