Use a relocation against the symbol if it is a PLT and the symbol is in another
[oota-llvm.git] / test / MC / ELF / merge.s
1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump  --dump-section-data | FileCheck  %s
2
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.
6
7 // 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         jmp     foo@PLT
14
15         .section        .sec1,"aM",@progbits,16
16 .Lfoo:
17
18         .section        bar,"ax",@progbits
19 foo:
20
21 // Section 4 is "sec1"
22 // CHECK: # Section 4
23 // CHECK-NEXT:  (('sh_name', 18) # '.sec1'
24
25 // Symbol number 1 is .Lfoo
26 // CHECK:      # Symbol 1
27 // CHECK-NEXT: (('st_name', 1) # '.Lfoo'
28
29 // Symbol number 2 is foo
30 // CHECK:      # Symbol 2
31 // CHECK-NEXT: (('st_name', 7) # 'foo'
32
33 // Symbol number 6 is section 4
34 // CHECK:        # Symbol 6
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)
40
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',
48 // CHECK-NEXT:   ),
49
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',
56 // CHECK-NEXT: ),
57
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',
64 // CHECK-NEXT:   ),
65
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',
72 // CHECK-NEXT:   ),
73 // CHECK-NEXT:  ])