1# REQUIRES: x86
2
3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
4
5# RUN: echo "SECTIONS { /DISCARD/ : { *(.shstrtab) } }" > %t.script
6# RUN: not ld.lld -o %t --script %t.script %t.o 2>&1 | \
7# RUN:   FileCheck -check-prefix=SHSTRTAB %s
8# SHSTRTAB: discarding .shstrtab section is not allowed
9
10## We allow discarding .dynamic, check we don't crash.
11# RUN: echo "SECTIONS { /DISCARD/ : { *(.dynamic) } }" > %t.script
12# RUN: ld.lld -pie -o %t --script %t.script %t.o
13
14## We allow discarding .dynsym, check we don't crash.
15# RUN: echo "SECTIONS { /DISCARD/ : { *(.dynsym) } }" > %t.script
16# RUN: ld.lld -pie -o %t --script %t.script %t.o
17
18## We allow discarding .dynstr, check we don't crash.
19# RUN: echo "SECTIONS { /DISCARD/ : { *(.dynstr) } }" > %t.script
20# RUN: ld.lld -pie -o %t --script %t.script %t.o
21
22# RUN: echo "SECTIONS { /DISCARD/ : { *(.rela.dyn) } }" > %t.script
23# RUN: not ld.lld -pie -o %t --script %t.script %t.o 2>&1 | \
24# RUN:   FileCheck -check-prefix=RELADYN %s
25# RELADYN: discarding .rela.dyn section is not allowed
26
27.comm foo,4,4
28