1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o 3 4# RUN: echo "SECTIONS { ASSERT(1, fail) }" > %t1.script 5# RUN: ld.lld -shared -o %t1 --script %t1.script %t1.o 6# RUN: llvm-readobj %t1 > /dev/null 7 8# RUN: echo "SECTIONS { ASSERT(0, fail) }" > %t3.script 9# RUN: not ld.lld -shared -o %t3 --script %t3.script %t1.o > %t.log 2>&1 10# RUN: FileCheck %s -check-prefix=FAIL < %t.log 11# FAIL: fail 12 13# RUN: echo "SECTIONS { . = ASSERT(0x1000, fail); }" > %t4.script 14# RUN: ld.lld -shared -o %t4 --script %t4.script %t1.o 15# RUN: llvm-readobj %t4 > /dev/null 16 17# RUN: echo "SECTIONS { .foo : { *(.foo) } }" > %t5.script 18# RUN: echo "ASSERT(SIZEOF(.foo) == 8, fail);" >> %t5.script 19# RUN: ld.lld -shared -o %t5 --script %t5.script %t1.o 20# RUN: llvm-readobj %t5 > /dev/null 21 22## Even without SECTIONS block we still use section names 23## in expressions 24# RUN: echo "ASSERT(SIZEOF(.foo) == 8, fail);" > %t5.script 25# RUN: ld.lld -shared -o %t5 --script %t5.script %t1.o 26# RUN: llvm-readobj %t5 > /dev/null 27 28## Test assertions inside of output section decriptions. 29# RUN: echo "SECTIONS { .foo : { *(.foo) ASSERT(SIZEOF(.foo) == 8, \"true\"); } }" > %t6.script 30# RUN: ld.lld -shared -o %t6 --script %t6.script %t1.o 31# RUN: llvm-readobj %t6 > /dev/null 32 33# RUN: echo "SECTIONS { .foo : { ASSERT(1, \"true\") } }" > %t7.script 34# RUN: not ld.lld -shared -o %t7 --script %t7.script %t1.o > %t.log 2>&1 35# RUN: FileCheck %s -check-prefix=CHECK-SEMI < %t.log 36# CHECK-SEMI: error: {{.*}}.script:1: ; expected, but got } 37 38.section .foo, "a" 39 .quad 0 40