Fixed version of 121434 with no new memory leaks.
[oota-llvm.git] / test / MC / ELF / relax.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 we do a relaxation for foo but not for bar or zed. Relaxing foo is
4 // probably not necessary, but matches what gnu as does.
5
6 // Also test that the relaxation done for foo uses the symbol, not section and
7 // offset.
8
9 bar:
10 .globl foo
11 foo:
12         .set    zed,foo
13
14         jmp bar
15         jmp foo
16         jmp zed
17
18 // CHECK: ('sh_name', 0x00000001) # '.text'
19 // CHECK-NEXT: ('sh_type', 0x00000001)
20 // CHECK-NEXT: ('sh_flags', 0x00000006)
21 // CHECK-NEXT: ('sh_addr', 0x00000000)
22 // CHECK-NEXT: ('sh_offset', 0x00000040)
23 // CHECK-NEXT: ('sh_size', 0x00000009)
24 // CHECK-NEXT: ('sh_link', 0x00000000)
25 // CHECK-NEXT: ('sh_info', 0x00000000)
26 // CHECK-NEXT: ('sh_addralign', 0x00000004)
27 // CHECK-NEXT: ('sh_entsize', 0x00000000)
28 // CHECK-NEXT: ('_section_data', 'ebfee900 000000eb f7')
29
30 // CHECK:       # Symbol 0x00000006
31 // CHECK-NEXT: (('st_name', 0x00000005) # 'foo'
32
33 // CHECK: .rela.text
34 // CHECK: ('_relocations', [
35 // CHECK-NEXT: Relocation 0x00000000
36 // CHECK-NEXT:  (('r_offset', 0x00000003)
37 // CHECK-NEXT:   ('r_sym', 0x00000006)
38 // CHECK-NEXT:   ('r_type', 0x00000002)
39 // CHECK-NEXT:   ('r_addend', 0xfffffffc)
40 // CHECK-NEXT:  ),
41 // CHECK-NEXT: ])