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
15 .section .sec1,"aM",@progbits,16
18 .section bar,"ax",@progbits
21 // Section 4 is "sec1"
23 // CHECK-NEXT: (('sh_name', 18) # '.sec1'
25 // Symbol number 1 is .Lfoo
27 // CHECK-NEXT: (('st_name', 1) # '.Lfoo'
29 // Symbol number 2 is foo
31 // CHECK-NEXT: (('st_name', 7) # 'foo'
33 // Symbol number 6 is section 4
35 // CHECK-NEXT: (('st_name', 0) # ''
36 // CHECK-NEXT: ('st_bind', 0)
37 // CHECK-NEXT: ('st_type', 3)
38 // CHECK-NEXT: ('st_other', 0)
39 // CHECK-NEXT: ('st_shndx', 4)
41 // Relocation 0 refers to symbol 1
42 // CHECK: ('_relocations', [
43 // CHECK-NEXT: # Relocation 0
44 // CHECK-NEXT: (('r_offset',
45 // CHECK-NEXT: ('r_sym', 1)
46 // CHECK-NEXT: ('r_type', 2
47 // CHECK-NEXT: ('r_addend',
50 // Relocation 1 refers to symbol 6
51 // CHECK-NEXT: # Relocation 1
52 // CHECK-NEXT: (('r_offset',
53 // CHECK-NEXT: ('r_sym', 6)
54 // CHECK-NEXT: ('r_type', 10)
55 // CHECK-NEXT: ('r_addend',
58 // Relocation 2 refers to symbol 1
59 // CHECK-NEXT: # Relocation 2
60 // CHECK-NEXT: (('r_offset',
61 // CHECK-NEXT: ('r_sym', 1)
62 // CHECK-NEXT: ('r_type', 10
63 // CHECK-NEXT: ('r_addend',
66 // Relocation 3 refers to symbol 2
67 // CHECK-NEXT: # Relocation 3
68 // CHECK-NEXT: (('r_offset',
69 // CHECK-NEXT: ('r_sym', 2)
70 // CHECK-NEXT: ('r_type', 4
71 // CHECK-NEXT: ('r_addend',