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 /dev/null --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: ld.lld -pie -o %t %t.o 24# RUN: llvm-readobj -S %t | FileCheck --check-prefix=RELADYN %s 25# RELADYN: Name: .rela.dyn 26# RUN: ld.lld -pie -o %t --script %t.script %t.o 27# RUN: llvm-readobj -S %t | FileCheck /dev/null --implicit-check-not='Name: .rela.dyn' 28 29# RUN: echo "SECTIONS { /DISCARD/ : { *(.relr.dyn) } }" > %t.script 30# RUN: not ld.lld -pie --pack-dyn-relocs=relr -o /dev/null --script %t.script %t.o 2>&1 | \ 31# RUN: FileCheck -check-prefix=RELRDYN %s 32# RELRDYN: discarding .relr.dyn section is not allowed 33 34.data 35.align 8 36foo: 37## Emits an R_X86_64_RELATIVE in -pie mode. 38.quad foo 39