
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
21 lines
488 B
ArmAsm
21 lines
488 B
ArmAsm
# REQUIRES: x86
|
|
## Test --emit-relocs handles .debug*
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
|
|
# RUN: ld.lld --emit-relocs %t.o -o %t
|
|
# RUN: llvm-readobj -r %t | FileCheck %s
|
|
# RUN: ld.lld --emit-relocs --strip-debug %t.o -o %t.no
|
|
# RUN: llvm-readobj -r %t.no | FileCheck --check-prefix=NO %s
|
|
|
|
# CHECK: Section {{.*}} .rela.debug_info {
|
|
# CHECK-NEXT: R_X86_64_64 .text 0x0
|
|
# CHECK-NEXT: }
|
|
|
|
# NO: Relocations [
|
|
# NO-NEXT: ]
|
|
|
|
foo:
|
|
|
|
.section .debug_info
|
|
.quad foo
|