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