2 # RUN: echo ".text; nop; .data; .byte 0" \
3 # RUN: | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t.o
4 # RUN: ld.lld -o %t --script %s %t.o
5 # RUN: llvm-readelf -S -l %t | FileCheck %s
7 ## Check we do not remove the empty output sections used in LOADADDR/ADDR
8 ## expressions and hence can evaluate the correct addresses.
10 # CHECK: Name Type Address Off Size
11 # CHECK-NEXT: NULL 0000000000000000 000000 000000
12 # CHECK-NEXT: .empty PROGBITS 0000000000080000 000158 000000
13 # CHECK-NEXT: .text PROGBITS 0000000000080000 001000 000001
14 # CHECK-NEXT: .data PROGBITS 0000000000080001 001001 000001
16 # CHECK: Program Headers:
17 # CHECK-NEXT: Type Offset VirtAddr PhysAddr
18 # CHECK-NEXT: LOAD 0x001000 0x0000000000080000 0x0000000000080000
19 # CHECK-NEXT: LOAD 0x001001 0x0000000000080001 0x0000000000082000
21 # CHECK: Section to Segment mapping:
22 # CHECK: 00 .text {{$}}
23 # CHECK-NEXT: 01 .data {{$}}
27 .empty : { *(.empty ) }
28 .text : AT(LOADADDR(.empty) + SIZEOF(.empty)) { *(.text) }
29 .data : AT(ADDR(.empty) + 0x2000) { *(.data) }