1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t 3# RUN: echo "SECTIONS { \ 4# RUN: .aaa 0x2000 : { *(.aaa) } \ 5# RUN: .bbb 0x1 ? 0x3000 : 0x4000 : { *(.bbb) } \ 6# RUN: .ccc ALIGN(CONSTANT(MAXPAGESIZE)) + (. & (CONSTANT(MAXPAGESIZE) - 1)) : { *(.ccc) } \ 7# RUN: .ddd 0x5001 : { *(.ddd) } \ 8# RUN: }" > %t.script 9# RUN: ld.lld %t --script %t.script -o %tout 10# RUN: llvm-readobj -S %tout | FileCheck %s 11 12## Check: 13## 1) Simple constant as address. 14## 2) That something that contains ":" character, like ternary 15## operator works as expression. 16## 3) That complex expressions work. 17## 4) That section alignment still applied to explicitly specified address. 18 19#CHECK:Sections [ 20#CHECK: Section { 21#CHECK: Index: 0 22#CHECK: Name: 23#CHECK: Type: SHT_NULL 24#CHECK: Flags [ 25#CHECK: ] 26#CHECK: Address: 0x0 27#CHECK: Offset: 0x0 28#CHECK: Size: 0 29#CHECK: Link: 0 30#CHECK: Info: 0 31#CHECK: AddressAlignment: 0 32#CHECK: EntrySize: 0 33#CHECK: } 34#CHECK: Section { 35#CHECK: Index: 1 36#CHECK: Name: .aaa 37#CHECK: Type: SHT_PROGBITS 38#CHECK: Flags [ 39#CHECK: SHF_ALLOC 40#CHECK: ] 41#CHECK: Address: 0x2000 42#CHECK: Offset: 0x1000 43#CHECK: Size: 8 44#CHECK: Link: 0 45#CHECK: Info: 0 46#CHECK: AddressAlignment: 1 47#CHECK: EntrySize: 0 48#CHECK: } 49#CHECK: Section { 50#CHECK: Index: 2 51#CHECK: Name: .bbb 52#CHECK: Type: SHT_PROGBITS 53#CHECK: Flags [ 54#CHECK: SHF_ALLOC 55#CHECK: ] 56#CHECK: Address: 0x3000 57#CHECK: Offset: 0x2000 58#CHECK: Size: 8 59#CHECK: Link: 0 60#CHECK: Info: 0 61#CHECK: AddressAlignment: 1 62#CHECK: EntrySize: 0 63#CHECK: } 64#CHECK: Section { 65#CHECK: Index: 3 66#CHECK: Name: .ccc 67#CHECK: Type: SHT_PROGBITS 68#CHECK: Flags [ 69#CHECK: SHF_ALLOC 70#CHECK: ] 71#CHECK: Address: 0x4008 72#CHECK: Offset: 0x3008 73#CHECK: Size: 8 74#CHECK: Link: 0 75#CHECK: Info: 0 76#CHECK: AddressAlignment: 1 77#CHECK: EntrySize: 0 78#CHECK: } 79#CHECK: Section { 80#CHECK: Index: 4 81#CHECK: Name: .ddd 82#CHECK: Type: SHT_PROGBITS 83#CHECK: Flags [ 84#CHECK: SHF_ALLOC 85#CHECK: ] 86#CHECK: Address: 0x5001 87#CHECK: Offset: 0x4001 88#CHECK: Size: 23 89#CHECK: Link: 0 90#CHECK: Info: 0 91#CHECK: AddressAlignment: 16 92#CHECK: EntrySize: 0 93#CHECK: } 94 95.globl _start 96_start: 97nop 98 99.section .aaa, "a" 100.quad 0 101 102.section .bbb, "a" 103.quad 0 104 105.section .ccc, "a" 106.quad 0 107 108.section .ddd, "a" 109.align 16 110.quad 0 111