[PATCH] D73100: [LLD][ELF][ARM] Don't apply --fix-cortex-a8 to relocatable links.
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 06:13:17 PST 2020
peter.smith created this revision.
peter.smith added reviewers: MaskRay, efriedma, grimar, ruiu.
Herald added subscribers: kristof.beyls, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
The --fix-cortex-a8 is sensitive to alignment and the precise destination of branch instructions. These are not knowable at relocatable link time. We follow GNU ld and the --fix-cortex-a53-843419 (D72968 <https://reviews.llvm.org/D72968>) by not patching the code when there is a relocatable link.
https://reviews.llvm.org/D73100
Files:
lld/ELF/Driver.cpp
lld/test/ELF/arm-fix-cortex-a8-recognize.s
Index: lld/test/ELF/arm-fix-cortex-a8-recognize.s
===================================================================
--- lld/test/ELF/arm-fix-cortex-a8-recognize.s
+++ lld/test/ELF/arm-fix-cortex-a8-recognize.s
@@ -10,6 +10,8 @@
// RUN: llvm-objdump -d %t2 --start-address=0x17ffa --stop-address=0x18002 --no-show-raw-insn | FileCheck --check-prefix=CALLSITE6 %s
// RUN: llvm-objdump -d %t2 --start-address=0x18ffa --stop-address=0x19002 --no-show-raw-insn | FileCheck --check-prefix=CALLSITE7 %s
// RUN: llvm-objdump -d %t2 --start-address=0x19ff4 --stop-address=0x1a002 --no-show-raw-insn | FileCheck --check-prefix=CALLSITE8 %s
+// RUN: ld.lld --fix-cortex-a8 -r %t.o -o %t3
+// RUN: llvm-objdump --no-show-raw-insn -d %t3 --start-address=0xffa --stop-address=0x1002 | FileCheck --check-prefix=CHECK-RELOCATABLE %s
// CHECK: ld.lld: detected cortex-a8-657419 erratum sequence starting at 12FFE in unpatched output.
// CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 13FFE in unpatched output.
@@ -50,6 +52,10 @@
// CALLSITE1: 00012ffa target:
// CALLSITE1-NEXT: 12ffa: nop.w
// CALLSITE1-NEXT: 12ffe: b.w #28674
+/// Expect no patch when doing a relocatable link ld -r.
+// CHECK-RELOCATABLE: 00000ffa target:
+// CHECK-RELOCATABLE-NEXT: ffa: nop.w
+// CHECK-RELOCATABLE-NEXT: ffe: b.w #-4
.space 4088
.type target2, %function
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -876,7 +876,8 @@
config->fini = args.getLastArgValue(OPT_fini, "_fini");
config->fixCortexA53Errata843419 = args.hasArg(OPT_fix_cortex_a53_843419) &&
!args.hasArg(OPT_relocatable);
- config->fixCortexA8 = args.hasArg(OPT_fix_cortex_a8);
+ config->fixCortexA8 =
+ args.hasArg(OPT_fix_cortex_a8) && !args.hasArg(OPT_relocatable);
config->forceBTI = hasZOption(args, "force-bti");
config->gcSections = args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, false);
config->gnuUnique = args.hasFlag(OPT_gnu_unique, OPT_no_gnu_unique, true);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73100.239297.patch
Type: text/x-patch
Size: 2187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/df2ba819/attachment.bin>
More information about the llvm-commits
mailing list