[all-commits] [llvm/llvm-project] 489a73: [ELF] Fix a null pointer dereference when --emit-r...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Fri Apr 10 17:17:57 PDT 2020
Branch: refs/heads/release/10.x
Home: https://github.com/llvm/llvm-project
Commit: 489a7356cca373de761ada4c06c5b43edc581b4b
https://github.com/llvm/llvm-project/commit/489a7356cca373de761ada4c06c5b43edc581b4b
Author: Fangrui Song <maskray at google.com>
Date: 2020-04-10 (Fri, 10 Apr 2020)
Changed paths:
M lld/ELF/Driver.cpp
M lld/ELF/InputSection.cpp
M lld/ELF/InputSection.h
A lld/test/ELF/emit-relocs-debug.s
Log Message:
-----------
[ELF] Fix a null pointer dereference when --emit-relocs and --strip-debug are used together
Fixes https://bugs.llvm.org//show_bug.cgi?id=44878
When --strip-debug is specified, .debug* are removed from inputSections
while .rel[a].debug* (incorrectly) remain.
LinkerScript::addOrphanSections() requires the output section of a relocated
InputSectionBase to be created first.
.debug* are not in inputSections ->
output sections .debug* are not created ->
getOutputSectionName(.rel[a].debug*) dereferences a null pointer.
Fix the null pointer dereference by deleting .rel[a].debug* from inputSections as well.
Reviewed By: grimar, nickdesaulniers
Differential Revision: https://reviews.llvm.org/D74510
(cherry picked from commit 6c73246179376442705b3a545f4e1f1478777a04)
More information about the All-commits
mailing list