[lld] r342146 - [ELF] Guard --fix-cortex-a53-843419 against --just-syms
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 13 08:49:13 PDT 2018
Author: psmith
Date: Thu Sep 13 08:49:13 2018
New Revision: 342146
URL: http://llvm.org/viewvc/llvm-project?rev=342146&view=rev
Log:
[ELF] Guard --fix-cortex-a53-843419 against --just-syms
If --just-syms is used the mapping symbols from the ELF file will be
absolute symbols with no section. The code to process mapping symbols in
--fix-cortex-a53-843419 assumes that these symbols have a defining section
so a crash will result when --just-syms is used. The simple fix is to not
process the symbol when it doesn't have a section.
Fixes PR37971
Differential Revision: https://reviews.llvm.org/D52038
Added:
lld/trunk/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s
Modified:
lld/trunk/ELF/AArch64ErrataFix.cpp
Modified: lld/trunk/ELF/AArch64ErrataFix.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/AArch64ErrataFix.cpp?rev=342146&r1=342145&r2=342146&view=diff
==============================================================================
--- lld/trunk/ELF/AArch64ErrataFix.cpp (original)
+++ lld/trunk/ELF/AArch64ErrataFix.cpp Thu Sep 13 08:49:13 2018
@@ -451,7 +451,7 @@ void AArch64Err843419Patcher::init() {
continue;
if (!IsCodeMapSymbol(Def) && !IsDataMapSymbol(Def))
continue;
- if (auto *Sec = dyn_cast<InputSection>(Def->Section))
+ if (auto *Sec = dyn_cast_or_null<InputSection>(Def->Section))
if (Sec->Flags & SHF_EXECINSTR)
SectionMap[Sec].push_back(Def);
}
Added: lld/trunk/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s?rev=342146&view=auto
==============================================================================
--- lld/trunk/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s (added)
+++ lld/trunk/test/ELF/aarch64-cortex-a53-843419-abs-mapsyms.s Thu Sep 13 08:49:13 2018
@@ -0,0 +1,22 @@
+// REQUIRES: aarch64
+// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t
+// RUN: ld.lld --just-symbols %t -fix-cortex-a53-843419 -o %t.axf
+// RUN: llvm-readobj --symbols %t.axf | FileCheck %s
+
+// Check that we can gracefully handle --just-symbols, which gives a local
+// absolute mapping symbol (with no Section). Previously we assumed that all
+// mapping symbols were defined relative to a section and assert failed.
+
+ .text
+ .global _start
+ .type _start, %function
+_start: ret
+
+// CHECK: Name: $x.0
+// CHECK-NEXT: Value: 0x0
+// CHECK-NEXT: Size: 0
+// CHECK-NEXT: Binding: Local (0x0)
+// CHECK-NEXT: Type: None (0x0)
+// CHECK-NEXT: Other: 0
+// CHECK-NEXT: Section: Absolute (0xFFF1)
+// CHECK-NEXT: }
More information about the llvm-commits
mailing list