[PATCH] D53444: Support ARM_V4BX relocation

Yin Ma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 19 11:30:36 PDT 2018


yinma created this revision.
Herald added subscribers: llvm-commits, chrib, kristof.beyls, arichardson, javed.absar, emaste.
Herald added a reviewer: espindola.

This patch implementation the handler for ARM_V4BX. This relocation is used by GNU runtime files and other armv4 applications.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53444

Files:
  ELF/Arch/ARM.cpp
  test/ELF/Inputs/v4bx.yaml
  test/ELF/v4bx.s


Index: test/ELF/v4bx.s
===================================================================
--- /dev/null
+++ test/ELF/v4bx.s
@@ -0,0 +1,10 @@
+// REQUIRES: arm
+// RUN: yaml2obj %p/Inputs/v4bx.yaml -o %tv4bx.o
+// RUN: llvm-mc -filetype=obj -triple=arm-arm-none-eabi %s -o %t.o
+// RUN: ld.lld %t.o %tv4bx.o -o %t.out
+// RUN: llvm-readelf -e %t.out | FileCheck %s
+.global _start
+_start:
+
+// CHECK: .text
+
Index: test/ELF/Inputs/v4bx.yaml
===================================================================
--- /dev/null
+++ test/ELF/Inputs/v4bx.yaml
@@ -0,0 +1,29 @@
+--- !ELF
+FileHeader:
+  Class:           ELFCLASS32
+  Data:            ELFDATA2LSB
+  Type:            ET_REL
+  Machine:         EM_ARM
+  Flags:           [ EF_ARM_EABI_VER5 ]
+Sections:
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign:    0x0000000000000004
+    Content:         1EFF2F01
+  - Name:            .rel.text
+    Type:            SHT_REL
+    Link:            .symtab
+    AddressAlign:    0x0000000000000004
+    Info:            .text
+    Relocations:
+      - Offset:          0x0000000000000000
+        Symbol:          ''
+        Type:            R_ARM_V4BX
+Symbols:
+  Local:
+    - Name:            .text
+      Type:            STT_SECTION
+      Section:         .text
+DynamicSymbols:
+...
Index: ELF/Arch/ARM.cpp
===================================================================
--- ELF/Arch/ARM.cpp
+++ ELF/Arch/ARM.cpp
@@ -516,6 +516,10 @@
                   ((Val << 4) & 0x7000) |    // imm3
                   (Val & 0x00ff));           // imm8
     break;
+  case R_ARM_V4BX:
+    // V4BX records the location of an ARMv4t BX Instruction
+    // No computation is needed.
+    break;
   default:
     error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53444.170224.patch
Type: text/x-patch
Size: 1872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181019/57a84aaf/attachment.bin>


More information about the llvm-commits mailing list