forked from OSchip/llvm-project
ARM-MachO: don't add Thumb bit for addend to non-external relocation.
ld64 supplies its own Thumb bit for Thumb functions, and intentionally zeroes out that part of any addend in an object file. But it only does that for symbols marked N_EXT -- i.e. external symbols. So LLVM should avoid setting that extra bit in other cases. llvm-svn: 339007
This commit is contained in:
parent
2dbbd64cb7
commit
9956e4a24b
|
@ -373,6 +373,7 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCAssembler &Asm,
|
|||
// interfere with checking valid expressions.
|
||||
if (const MCSymbolRefExpr *A = Target.getSymA()) {
|
||||
if (A->hasSubsectionsViaSymbols() && Asm.isThumbFunc(&A->getSymbol()) &&
|
||||
A->getSymbol().isExternal() &&
|
||||
(Kind == FK_Data_4 || Kind == ARM::fixup_arm_movw_lo16 ||
|
||||
Kind == ARM::fixup_arm_movt_hi16 || Kind == ARM::fixup_t2_movw_lo16 ||
|
||||
Kind == ARM::fixup_t2_movt_hi16))
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
@ RUN: llvm-mc -triple thumbv6m-apple-macho %s -filetype=obj -o %t
|
||||
@ RUN: llvm-objdump -macho -section=__DATA,__data %t | FileCheck %s
|
||||
|
||||
@ CHECK: 00000000 00000003
|
||||
.data
|
||||
.align 2
|
||||
.global _foo
|
||||
_foo:
|
||||
.long _bar
|
||||
.long _baz
|
||||
|
||||
.text
|
||||
.thumb_func _bar
|
||||
.weak_definition _bar
|
||||
_bar:
|
||||
bx lr
|
||||
|
||||
.thumb_func _baz
|
||||
.global _baz
|
||||
_baz:
|
||||
bx lr
|
|
@ -23,6 +23,7 @@ Lconstpool:
|
|||
.end_data_region
|
||||
|
||||
.thumb_func _bar
|
||||
.global _bar
|
||||
_bar:
|
||||
bx lr
|
||||
|
||||
|
|
Loading…
Reference in New Issue