Parse and create GOT_PREL relocations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207526 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joerg Sonnenberger 2014-04-29 13:42:02 +00:00
parent 285c5693b8
commit edc4595472
3 changed files with 14 additions and 0 deletions

View File

@ -285,6 +285,8 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("gotoff", VK_GOTOFF)
.Case("GOTPCREL", VK_GOTPCREL)
.Case("gotpcrel", VK_GOTPCREL)
.Case("GOT_PREL", VK_GOTPCREL)
.Case("got_prel", VK_GOTPCREL)
.Case("GOTTPOFF", VK_GOTTPOFF)
.Case("gottpoff", VK_GOTTPOFF)
.Case("INDNTPOFF", VK_INDNTPOFF)

View File

@ -91,6 +91,9 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
case MCSymbolRefExpr::VK_GOTTPOFF:
Type = ELF::R_ARM_TLS_IE32;
break;
case MCSymbolRefExpr::VK_GOTPCREL:
Type = ELF::R_ARM_GOT_PREL;
break;
}
break;
case ARM::fixup_arm_blx:
@ -167,6 +170,9 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
case MCSymbolRefExpr::VK_GOTOFF:
Type = ELF::R_ARM_GOTOFF32;
break;
case MCSymbolRefExpr::VK_GOTPCREL:
Type = ELF::R_ARM_GOT_PREL;
break;
case MCSymbolRefExpr::VK_ARM_TARGET1:
Type = ELF::R_ARM_TARGET1;
break;

View File

@ -2,6 +2,7 @@
@ RUN: llvm-mc < %s -triple thumbv7-none-linux-gnueabi -filetype=obj | llvm-objdump -triple thumbv7-none-linux-gnueabi -r - | FileCheck %s --check-prefix=CHECK --check-prefix=THUMB
@ CHECK-LABEL: RELOCATION RECORDS FOR [.rel.text]
.Lsym:
@ empty
.word f00
@ -83,3 +84,8 @@ bl f05(plt)
@ CHECK: 60 R_ARM_TLS_GOTDESC f24
@ CHECK: 64 R_ARM_TLS_GOTDESC f25
@ got_prel
.word f26(GOT_PREL) + (. - .Lsym)
ldr r3, =f27(GOT_PREL)
@ CHECK: 68 R_ARM_GOT_PREL f26
@ CHECK: 70 R_ARM_GOT_PREL f27