[PATCH] D55728: ELF: Handle R_ARM_V4BX correctly in PIC output files.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 14 15:59:40 PST 2018
pcc created this revision.
pcc added reviewers: ruiu, peter.smith, MaskRay.
Herald added subscribers: kristof.beyls, arichardson, javed.absar, emaste.
Herald added a reviewer: espindola.
Previously we considered R_ARM_V4BX to be an absolute relocation,
which meant that we rejected it in read-only sections in PIC output
files. Instead, treat it as a hint relocation so that relocation
processing ignores it entirely.
Also fix a problem with the test case where it was never being run
because it has a .yaml extension and we don't run tests with that
extension.
Repository:
rL LLVM
https://reviews.llvm.org/D55728
Files:
lld/ELF/Arch/ARM.cpp
lld/test/ELF/arm-v4bx.test
lld/test/ELF/v4bx.yaml
Index: lld/test/ELF/arm-v4bx.test
===================================================================
--- lld/test/ELF/arm-v4bx.test
+++ lld/test/ELF/arm-v4bx.test
@@ -2,6 +2,8 @@
# RUN: yaml2obj %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readelf -sections %t | FileCheck %s
+# RUN: ld.lld -shared %t.o -o %t
+# RUN: llvm-readelf -sections %t | FileCheck %s
# CHECK: .text
Index: lld/ELF/Arch/ARM.cpp
===================================================================
--- lld/ELF/Arch/ARM.cpp
+++ lld/ELF/Arch/ARM.cpp
@@ -134,6 +134,12 @@
return R_NONE;
case R_ARM_TLS_LE32:
return R_TLS;
+ case R_ARM_V4BX:
+ // V4BX is just a marker to indicate there's a "bx rN" instruction at the
+ // given address. It can be used to implement a special linker mode which
+ // rewrites ARMv4T inputs to ARMv4. Since we support only ARMv4 input and
+ // not ARMv4 output, we can just ignore it.
+ return R_HINT;
default:
return R_ABS;
}
@@ -514,12 +520,6 @@
((Val << 4) & 0x7000) | // imm3
(Val & 0x00ff)); // imm8
break;
- case R_ARM_V4BX:
- // V4BX is just a marker to indicate there's a "bx rN" instruction at the
- // given address. It can be used to implement a special linker mode which
- // rewrites ARMv4T inputs to ARMv4. Since we support only ARMv4 input and
- // not ARMv4 output, we can just ignore it.
- break;
default:
error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55728.178313.patch
Type: text/x-patch
Size: 1527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181214/0749cfa4/attachment.bin>
More information about the llvm-commits
mailing list