mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
[ELF] Support input section description .rel[a].dyn in /DISCARD/
Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D70695
This commit is contained in:
parent
92f1446b8b
commit
a71c1e2a57
@ -442,7 +442,7 @@ LinkerScript::computeInputSections(const InputSectionDescription *cmd) {
|
||||
}
|
||||
|
||||
void LinkerScript::discard(InputSectionBase *s) {
|
||||
if (s == in.shStrTab || s == mainPart->relaDyn || s == mainPart->relrDyn)
|
||||
if (s == in.shStrTab || s == mainPart->relrDyn)
|
||||
error("discarding " + s->name + " section is not allowed");
|
||||
|
||||
// You can discard .hash and .gnu.hash sections by linker scripts. Since
|
||||
|
@ -20,8 +20,19 @@
|
||||
# RUN: ld.lld -pie -o %t --script %t.script %t.o
|
||||
|
||||
# RUN: echo "SECTIONS { /DISCARD/ : { *(.rela.dyn) } }" > %t.script
|
||||
# RUN: not ld.lld -pie -o %t --script %t.script %t.o 2>&1 | \
|
||||
# RUN: FileCheck -check-prefix=RELADYN %s
|
||||
# RELADYN: discarding .rela.dyn section is not allowed
|
||||
# RUN: ld.lld -pie -o %t %t.o
|
||||
# RUN: llvm-readobj -S %t | FileCheck --check-prefix=RELADYN %s
|
||||
# RELADYN: Name: .rela.dyn
|
||||
# RUN: ld.lld -pie -o %t --script %t.script %t.o
|
||||
# RUN: llvm-readobj -S %t | FileCheck /dev/null --implicit-check-not='Name: .rela.dyn'
|
||||
|
||||
.comm foo,4,4
|
||||
# RUN: echo "SECTIONS { /DISCARD/ : { *(.relr.dyn) } }" > %t.script
|
||||
# RUN: not ld.lld -pie --pack-dyn-relocs=relr -o %t --script %t.script %t.o 2>&1 | \
|
||||
# RUN: FileCheck -check-prefix=RELRDYN %s
|
||||
# RELRDYN: discarding .relr.dyn section is not allowed
|
||||
|
||||
.data
|
||||
.align 8
|
||||
foo:
|
||||
## Emits an R_X86_64_RELATIVE in -pie mode.
|
||||
.quad foo
|
||||
|
Loading…
Reference in New Issue
Block a user