[PATCH] D63778: [ARM] Handle fixup_arm_pcrel_9 correctly on big-endian targets

Mikhail Maltsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 10:23:27 PDT 2019


miyuki created this revision.
miyuki added reviewers: ostannard, simon_tatham.
Herald added subscribers: hiraditya, kristof.beyls, javed.absar.
Herald added a project: LLVM.

The getFixupKindContainerSizeBytes function returns the size of the
instruction containing a given fixup. Currently fixup_arm_pcrel_9 is
not handled in this function, this causes an assertion failure in
the debug build and incorrect codegen in the release build.

This patch fixes the problem.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63778

Files:
  llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
  llvm/test/MC/ARM/fixup-pcrel9.s


Index: llvm/test/MC/ARM/fixup-pcrel9.s
===================================================================
--- /dev/null
+++ llvm/test/MC/ARM/fixup-pcrel9.s
@@ -0,0 +1,18 @@
+// RUN: llvm-mc -triple=armebv8.2a-eabi -filetype=obj < %s | llvm-objdump -s - | FileCheck %s --check-prefix=CHECK-BE
+// RUN: llvm-mc -triple=armv8.2a-eabi -filetype=obj < %s | llvm-objdump -s - | FileCheck %s --check-prefix=CHECK-LE
+
+	.text
+	.fpu	crypto-neon-fp-armv8
+        .arch_extension fp16
+
+.section s_pcrel_9,"ax",%progbits
+// CHECK-BE-LABEL: Contents of section s_pcrel_9
+// CHECK-LE-LABEL: Contents of section s_pcrel_9
+// CHECK-BE: 0000 ed9f0902
+// CHECK-LE: 0000 02099fed
+	vldr.16	s0, .LCPI0_0
+        nop
+        bx lr
+.LCPI0_0:
+	.short	28012
+
Index: llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
===================================================================
--- llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
+++ llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
@@ -1000,6 +1000,7 @@
   case ARM::fixup_arm_pcrel_10_unscaled:
   case ARM::fixup_arm_ldst_pcrel_12:
   case ARM::fixup_arm_pcrel_10:
+  case ARM::fixup_arm_pcrel_9:
   case ARM::fixup_arm_adr_pcrel_12:
   case ARM::fixup_arm_uncondbl:
   case ARM::fixup_arm_condbl:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63778.206480.patch
Type: text/x-patch
Size: 1254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190625/4ec808f4/attachment.bin>


More information about the llvm-commits mailing list