[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 07:16:53 PST 2020


peter.smith updated this revision to Diff 239316.
peter.smith added a comment.

Added a check for lld -v to make sure a detection message isn't printed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73100/new/

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 -v -r %t.o -o %t3 2>&1 | FileCheck --check-prefix=CHECK-RELOCATABLE-LLD %s
+// 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.
@@ -19,6 +21,10 @@
 // CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 17FFE in unpatched output.
 // CHECK-NEXT: ld.lld: detected cortex-a8-657419 erratum sequence starting at 18FFE in unpatched output.
 
+/// We do not detect errors when doing a relocatable link as we don't know what
+/// the final addresses are.
+// CHECK-RELOCATABLE-LLD-NOT: ld.lld: detected cortex-a8-657419 erratum sequence
+
 /// Basic tests for the -fix-cortex-a8 erratum fix. The full details of the
 /// erratum and the patch are in ARMA8ErrataFix.cpp . The test creates an
 /// instance of the erratum every 4KiB (32-bit non-branch, followed by 32-bit
@@ -50,6 +56,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.239316.patch
Type: text/x-patch
Size: 2906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/5f0674bd/attachment.bin>


More information about the llvm-commits mailing list