AArch64/ARM64: produce correct relocation for conditional branches.

llvm-svn: 206391
This commit is contained in:
Tim Northover 2014-04-16 15:27:52 +00:00
parent af1975547a
commit 3eb27f781b
2 changed files with 6 additions and 2 deletions

View File

@ -83,7 +83,11 @@ unsigned ARM64ELFObjectWriter::GetRelocType(const MCValue &Target,
case ARM64::fixup_arm64_pcrel_call26:
return ELF::R_AARCH64_CALL26;
case ARM64::fixup_arm64_pcrel_imm19:
return ELF::R_AARCH64_TLSIE_LD_GOTTPREL_PREL19;
// A bit of an oddity here: shared by both "ldr x0, :gottprel:var" and
// "b.eq var".
if (SymLoc == ARM64MCExpr::VK_GOTTPREL)
return ELF::R_AARCH64_TLSIE_LD_GOTTPREL_PREL19;
return ELF::R_AARCH64_CONDBR19;
default:
llvm_unreachable("Unsupported pc-relative fixup kind");
}

View File

@ -1,4 +1,4 @@
// RUN: llvm-mc -triple=aarch64-none-linux-gnu -filetype=obj %s -o - | \
// RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj %s -o - | \
// RUN: llvm-readobj -r | FileCheck -check-prefix=OBJ %s
b.eq somewhere