diff options
Diffstat (limited to 'test/MC/MachO')
-rw-r--r-- | test/MC/MachO/darwin-x86_64-nobase-relocs.s | 58 | ||||
-rw-r--r-- | test/MC/MachO/debug_frame.s | 15 | ||||
-rw-r--r-- | test/MC/MachO/x86_64-reloc-arithmetic.s | 21 |
3 files changed, 91 insertions, 3 deletions
diff --git a/test/MC/MachO/darwin-x86_64-nobase-relocs.s b/test/MC/MachO/darwin-x86_64-nobase-relocs.s new file mode 100644 index 0000000..a90b3e4 --- /dev/null +++ b/test/MC/MachO/darwin-x86_64-nobase-relocs.s @@ -0,0 +1,58 @@ +// RUN: llvm-mc -n -triple x86_64-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s + +// Test case for rdar://10062261 + +// Must be no base, non-temporary, symbol before the reference to Lbar at the +// start of the section. What we are testing for is that the reference does not +// create a relocation entry. +.text +Ladd: + nop + jmp Lbar + .byte 0x0f,0x1f,0x40,0x00 + .byte 0x0f,0x1f,0x40,0x00 +Lbar: + mov $1, %eax + ret + +// CHECK: ('cputype', 16777223) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 152) +// CHECK: ('flag', 0) +// CHECK: ('reserved', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 25) +// CHECK: ('size', 152) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 17) +// CHECK: ('file_offset', 184) +// CHECK: ('file_size', 17) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 1) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 17) +// CHECK: ('offset', 184) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000400) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ('reserved3', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: ('_section_data', '90eb080f 1f40000f 1f4000b8 01000000 c3') +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/test/MC/MachO/debug_frame.s b/test/MC/MachO/debug_frame.s index 47264ef..20bfd8d 100644 --- a/test/MC/MachO/debug_frame.s +++ b/test/MC/MachO/debug_frame.s @@ -1,5 +1,11 @@ // RUN: llvm-mc -triple i386-apple-darwin %s -filetype=obj -o - | macho-dump | FileCheck %s +// Make sure MC can handle file level .cfi_startproc and .cfi_endproc that creates +// an empty frame. +// rdar://10017184 +.cfi_startproc +.cfi_endproc + // Check that we don't produce a relocation for the CIE pointer and therefore // we have only one relocation in __debug_frame. @@ -22,17 +28,20 @@ Ltext_end: // CHECK: (('section_name', '__debug_frame\x00\x00\x00') // CHECK-NEXT: ('segment_name', '__DWARF\x00\x00\x00\x00\x00\x00\x00\x00\x00') // CHECK-NEXT: ('address', 8) -// CHECK-NEXT: ('size', 36) +// CHECK-NEXT: ('size', 52) // CHECK-NEXT: ('offset', 332) // CHECK-NEXT: ('alignment', 2) -// CHECK-NEXT: ('reloc_offset', 368) -// CHECK-NEXT: ('num_reloc', 1) +// CHECK-NEXT: ('reloc_offset', 384) +// CHECK-NEXT: ('num_reloc', 2) // CHECK-NEXT: ('flags', 0x2000000) // CHECK-NEXT: ('reserved1', 0) // CHECK-NEXT: ('reserved2', 0) // CHECK-NEXT: ), // CHECK-NEXT: ('_relocations', [ // CHECK-NEXT: # Relocation 0 +// CHECK-NEXT: (('word-0', 0x2c), +// CHECK-NEXT: ('word-1', 0x4000001)), +// CHECK-NEXT: # Relocation 1 // CHECK-NEXT: (('word-0', 0x1c), // CHECK-NEXT: ('word-1', 0x4000001)), // CHECK-NEXT: ]) diff --git a/test/MC/MachO/x86_64-reloc-arithmetic.s b/test/MC/MachO/x86_64-reloc-arithmetic.s new file mode 100644 index 0000000..e82f69b --- /dev/null +++ b/test/MC/MachO/x86_64-reloc-arithmetic.s @@ -0,0 +1,21 @@ +// RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - | macho-dump | FileCheck %s + +// rdar://9906375 +.org 0x100 +_foo: +_bar = _foo + 2 +_baz: + leaq _bar(%rip), %rcx + +// CHECK: ('_relocations', [ +// CHECK-NEXT: # Relocation 0 +// CHECK-NEXT: (('word-0', 0x103), +// CHECK-NEXT: ('word-1', 0x1d000001)) + +// CHECK: # Symbol 1 +// CHECK-NEXT: (('n_strx', 6) +// CHECK-NEXT: ('n_type', 0xe) +// CHECK-NEXT: ('n_sect', 1) +// CHECK-NEXT: ('n_desc', 0) +// CHECK-NEXT: ('n_value', 258) +// CHECK-NEXT: ('_string', '_bar') |