1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
llvm-mirror/test/MC/ARM/macho-word-reloc-thumb.s
Tim Northover 35c35dd4f1 ARM: by default don't set the Thumb bit on MachO relocated values.
Its existence is largely historical, apparently we tried to make ARM object
files look maybe-almost-possibly runnable by putting our best guess at the
actual value into relocated locations. Of course, the real linker then comes
along and can completely change things.

But it should only be there for word-sized and movw/movt relocations. It can't
be encoded in branch relocations, and I've seen it mess up validity
calculations twice in the last couple of weeks so the default is clearly problematic.

llvm-svn: 279773
2016-08-25 20:41:30 +00:00

30 lines
732 B
ArmAsm

@ RUN: llvm-mc -triple thumbv7-apple-ios %s -filetype=obj -o %t
@ RUN: llvm-objdump -macho -d %t -triple thumbv7-apple-ios | FileCheck %s
@ ARM relocatable object files try to look like they're pre-linked, so the
@ offsets in the instructions are a best-guess. I suspect the "-3" should b
@ CHECK: movw r1, :lower16:((_bar-8)-3)
@ [...]
@ CHECK: .long {{[0-9]*[13579]}}
.thumb
.thumb_func _foo
_foo:
movw r1, :lower16:(_bar-(LPC2_0+4))
movt r1, :upper16:(_bar-(LPC2_0+4))
LPC2_0:
add r1, pc
ldr r0, Lconstpool
bx lr
Lconstpool:
.data_region
.word _bar
.end_data_region
.thumb_func _bar
_bar:
bx lr
.subsections_via_symbols