ARM: Support relative references using the PREL31 symbol variant.

Differential Revision: http://reviews.llvm.org/D17937

llvm-svn: 263156
This commit is contained in:
Peter Collingbourne 2016-03-10 19:30:18 +00:00
parent 4d3d785e3f
commit aba16fca5d
2 changed files with 13 additions and 4 deletions

View File

@ -98,6 +98,9 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
case MCSymbolRefExpr::VK_ARM_GOT_PREL: case MCSymbolRefExpr::VK_ARM_GOT_PREL:
Type = ELF::R_ARM_GOT_PREL; Type = ELF::R_ARM_GOT_PREL;
break; break;
case MCSymbolRefExpr::VK_ARM_PREL31:
Type = ELF::R_ARM_PREL31;
break;
} }
break; break;
case ARM::fixup_arm_blx: case ARM::fixup_arm_blx:

View File

@ -84,8 +84,14 @@ bl f05(plt)
@ CHECK: 60 R_ARM_TLS_GOTDESC f24 @ CHECK: 60 R_ARM_TLS_GOTDESC f24
@ CHECK: 64 R_ARM_TLS_GOTDESC f25 @ CHECK: 64 R_ARM_TLS_GOTDESC f25
@ prel31 (relative)
.word f26(PREL31)-.
.word f27(prel31)-.
@CHECK: 68 R_ARM_PREL31 f26
@CHECK: 6c R_ARM_PREL31 f27
@ got_prel @ got_prel
.word f26(GOT_PREL) + (. - .Lsym) .word f28(GOT_PREL) + (. - .Lsym)
ldr r3, =f27(GOT_PREL) ldr r3, =f29(GOT_PREL)
@ CHECK: 68 R_ARM_GOT_PREL f26 @ CHECK: 70 R_ARM_GOT_PREL f28
@ CHECK: 70 R_ARM_GOT_PREL f27 @ CHECK: 78 R_ARM_GOT_PREL f29