Skip to content

Commit c81fe34

Browse files
committed
[lld][ELF] Don't apply --fix-cortex-a53-843419 to relocatable links.
The code doesn't apply the fix correctly to relocatable links. I could try to fix the code that applies the fix, but it's pointless: we don't actually know what the offset will be in the final executable. So just ignore the flag for relocatable links. Issue discovered building Android. Differential Revision: https://reviews.llvm.org/D72968
1 parent 317fdcd commit c81fe34

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lld/ELF/Driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,8 @@ static void readConfigs(opt::InputArgList &args) {
874874
args.hasFlag(OPT_export_dynamic, OPT_no_export_dynamic, false);
875875
config->filterList = args::getStrings(args, OPT_filter);
876876
config->fini = args.getLastArgValue(OPT_fini, "_fini");
877-
config->fixCortexA53Errata843419 = args.hasArg(OPT_fix_cortex_a53_843419);
877+
config->fixCortexA53Errata843419 = args.hasArg(OPT_fix_cortex_a53_843419) &&
878+
!args.hasArg(OPT_relocatable);
878879
config->fixCortexA8 = args.hasArg(OPT_fix_cortex_a8);
879880
config->forceBTI = hasZOption(args, "force-bti");
880881
config->gcSections = args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, false);

lld/test/ELF/aarch64-cortex-a53-843419-recognize.s

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// RUN: llvm-objdump -triple=aarch64-linux-gnu -d %t2 | FileCheck %s -check-prefixes=CHECK,CHECK-FIX
55
// RUN: ld.lld %t.o -z separate-code -o %t3
66
// RUN: llvm-objdump -triple=aarch64-linux-gnu -d %t3 | FileCheck %s -check-prefixes=CHECK,CHECK-NOFIX
7+
// RUN: ld.lld -fix-cortex-a53-843419 -r -z separate-code %t.o -o %t4
8+
// RUN: llvm-objdump -triple=aarch64-linux-gnu -d %t4 | FileCheck %s -check-prefixes=CHECK-RELOCATABLE
79
// Test cases for Cortex-A53 Erratum 843419
810
// See ARM-EPM-048406 Cortex_A53_MPCore_Software_Developers_Errata_Notice.pdf
911
// for full erratum details.
@@ -33,6 +35,12 @@
3335
// CHECK-FIX: 212000: 03 c8 00 14 b #204812
3436
// CHECK-NOFIX: 212000: 00 00 40 f9 ldr x0, [x0]
3537
// CHECK-NEXT: 212004: c0 03 5f d6 ret
38+
// CHECK-RELOCATABLE: t3_ff8_ldr:
39+
// CHECK-RELOCATABLE-NEXT: ff8: 00 00 00 90 adrp x0, #0
40+
// CHECK-RELOCATABLE-NEXT: ffc: 21 00 40 f9 ldr x1, [x1]
41+
// CHECK-RELOCATABLE-NEXT: 1000: 00 00 40 f9 ldr x0, [x0]
42+
// CHECK-RELOCATABLE-NEXT: 1004: c0 03 5f d6 ret
43+
3644
.section .text.01, "ax", %progbits
3745
.balign 4096
3846
.globl t3_ff8_ldr

0 commit comments

Comments
 (0)