blob: 00ffd5ee9a82a2c07ccdaf1f2e202f1010b4a248 [file] [log] [blame]
Rafael Espindola75d65b92010-09-25 05:42:19 +00001// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
2
Rafael Espindola259bcda2010-10-05 15:43:32 +00003// Test that PIC relocations with local symbols in a mergeable section are done
Rafael Espindola75d65b92010-09-25 05:42:19 +00004// with a reference to the symbol. Not sure if this is a linker limitation,
5// but this matches the behavior of gas.
6
Rafael Espindola259bcda2010-10-05 15:43:32 +00007// Non-PIC relocations with 0 offset don't use the symbol.
8
9
10 movsd .Lfoo(%rip), %xmm1
11 movl $.Lfoo, %edi
12 movl $.Lfoo+2, %edi
13
Rafael Espindola75d65b92010-09-25 05:42:19 +000014 .section .sec1,"aM",@progbits,16
15.Lfoo:
Rafael Espindola259bcda2010-10-05 15:43:32 +000016
17// Section 4 is "sec1"
18// CHECK: # Section 4
19// CHECK-NEXT: (('sh_name', 18) # '.sec1'
Rafael Espindola75d65b92010-09-25 05:42:19 +000020
Rafael Espindola96bfb502010-09-27 22:04:54 +000021// Symbol number 1 is .Lfoo
Rafael Espindola96bfb502010-09-27 22:04:54 +000022// CHECK: # Symbol 1
23// CHECK-NEXT: (('st_name', 1) # '.Lfoo'
24
Rafael Espindola259bcda2010-10-05 15:43:32 +000025// Symbol number 5 is section 4
26// CHECK: # Symbol 5
27// CHECK-NEXT: (('st_name', 0) # ''
28// CHECK-NEXT: ('st_bind', 0)
29// CHECK-NEXT: ('st_type', 3)
30// CHECK-NEXT: ('st_other', 0)
31// CHECK-NEXT: ('st_shndx', 4)
Rafael Espindola75d65b92010-09-25 05:42:19 +000032
Rafael Espindola259bcda2010-10-05 15:43:32 +000033// Relocation 0 refers to symbol 1
Rafael Espindola75d65b92010-09-25 05:42:19 +000034// CHECK: ('_relocations', [
35// CHECK-NEXT: # Relocation 0
36// CHECK-NEXT: (('r_offset',
37// CHECK-NEXT: ('r_sym', 1)
Rafael Espindola259bcda2010-10-05 15:43:32 +000038// CHECK-NEXT: ('r_type', 2
39// CHECK-NEXT: ('r_addend',
40// CHECK-NEXT: ),
41
42// Relocation 1 refers to symbol 5
43// CHECK-NEXT: # Relocation 1
44// CHECK-NEXT: (('r_offset',
45// CHECK-NEXT: ('r_sym', 5)
46// CHECK-NEXT: ('r_type', 10)
47// CHECK-NEXT: ('r_addend',
48// CHECK-NEXT: ),
49
50// Relocation 2 refers to symbol 1
51// CHECK-NEXT: # Relocation 2
52// CHECK-NEXT: (('r_offset',
53// CHECK-NEXT: ('r_sym', 1)
54// CHECK-NEXT: ('r_type', 10
Rafael Espindola75d65b92010-09-25 05:42:19 +000055// CHECK-NEXT: ('r_addend',
56// CHECK-NEXT: ),
57// CHECK-NEXT: ])