From 9a8aff0062024427c6f53482abbe3a43d9b5f174 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Wed, 16 Apr 2014 15:27:52 +0000 Subject: [PATCH] AArch64/ARM64: produce correct relocation for conditional branches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206391 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp | 6 +++++- test/MC/AArch64/elf-reloc-condbr.s | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp b/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp index 1a132a17ffc..7779b824e0c 100644 --- a/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp +++ b/lib/Target/ARM64/MCTargetDesc/ARM64ELFObjectWriter.cpp @@ -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"); } diff --git a/test/MC/AArch64/elf-reloc-condbr.s b/test/MC/AArch64/elf-reloc-condbr.s index b70dfa70fb8..9b70a20e1bc 100644 --- a/test/MC/AArch64/elf-reloc-condbr.s +++ b/test/MC/AArch64/elf-reloc-condbr.s @@ -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