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