1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/test/MC/MachO/x86_64-reloc-arithmetic.s
Lang Hames e025323d29 [MachO] Add MachO alt-entry directive support.
This patch adds support for the MachO .alt_entry assembly directive, and uses
it for global aliases with non-zero GEP offsets. The alt_entry flag indicates
that a symbol should be layed out immediately after the preceding symbol.
Conceptually it introduces an alternate entry point for a function or data
structure. E.g.:

safe_foo:
  // check preconditions for foo
.alt_entry fast_foo
fast_foo:
  // body of foo, can assume preconditions.

The .alt_entry flag is also implicitly set on assembly aliases of the form:

a = b + C

where C is a non-zero constant, since these have the same effect as an
alt_entry symbol: they introduce a label that cannot be moved relative to the
preceding one. Setting the alt_entry flag on aliases of this form fixes
http://llvm.org/PR25381.

llvm-svn: 263521
2016-03-15 01:43:05 +00:00

39 lines
1.1 KiB
ArmAsm

// RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -r -t | FileCheck %s
// rdar://9906375
.org 0x100
_foo:
_bar = _foo + 2
_baz:
leaq _bar(%rip), %rcx
// CHECK: File: <stdin>
// CHECK-NEXT: Format: Mach-O 64-bit x86-64
// CHECK-NEXT: Arch: x86_64
// CHECK-NEXT: AddressSize: 64bit
// CHECK-NEXT: Relocations [
// CHECK-NEXT: Section __text {
// CHECK-NEXT: 0x103 1 2 1 X86_64_RELOC_SIGNED 0 _bar
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: Symbols [
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: _foo (11)
// CHECK-NEXT: Type: Section (0xE)
// CHECK-NEXT: Section: __text (0x1)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x100
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: _bar (6)
// CHECK-NEXT: Type: Section (0xE)
// CHECK-NEXT: Section: __text (0x1)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x200)
// CHECK-NEXT: AltEntry (0x200)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x102
// CHECK-NEXT: }