[llvm] r206391 - AArch64/ARM64: produce correct relocation for conditional branches.
Tim Northover
tnorthover at apple.com
Wed Apr 16 08:27:53 PDT 2014
Author: tnorthover
Date: Wed Apr 16 10:27:52 2014
New Revision: 206391
URL: http://llvm.org/viewvc/llvm-project?rev=206391&view=rev
Log:
AArch64/ARM64: produce correct relocation for conditional branches.
Modified:
llvm/trunk/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp
llvm/trunk/test/MC/AArch64/elf-reloc-condbr.s
Modified: llvm/trunk/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp?rev=206391&r1=206390&r2=206391&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp Wed Apr 16 10:27:52 2014
@@ -83,7 +83,11 @@ unsigned ARM64ELFObjectWriter::GetRelocT
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");
}
Modified: llvm/trunk/test/MC/AArch64/elf-reloc-condbr.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/elf-reloc-condbr.s?rev=206391&r1=206390&r2=206391&view=diff
==============================================================================
--- llvm/trunk/test/MC/AArch64/elf-reloc-condbr.s (original)
+++ llvm/trunk/test/MC/AArch64/elf-reloc-condbr.s Wed Apr 16 10:27:52 2014
@@ -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
More information about the llvm-commits
mailing list