22 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o3# RUN: echo "SECTIONS { /DISCARD/ : { *(.discard.*) }}" > %t.script4# RUN: ld.lld -o %t --script %t.script -r %t.o5# RUN: llvm-readobj --sections %t | FileCheck %s6 7## Test shows that we do not crash after discarding the .discard.foo with -r.8## Previously it happened because of 2 reasons:9## 1) .rela.discard.foo was not handled properly and was not discarded.10## Remaining reference was invalid and caused the crash.11## 2) Third-party section .debug_info referencing discarded section12## did not handle this case properly and tried to apply the13## relocation instead of ignoring it.14 15# CHECK-NOT: .discard16 17.section .discard.foo,"ax"18callq fn@PLT19 20.section .debug_info,"",@progbits21.long .discard.foo22