31 lines · plain
1# REQUIRES: x862# RUN: echo ".text; nop; .data; .byte 0" \3# RUN: | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t.o4# RUN: ld.lld -o %t --script %s %t.o5# RUN: llvm-readelf -S -l %t | FileCheck %s6 7## Check we do not remove the empty output sections used in LOADADDR/ADDR8## expressions and hence can evaluate the correct addresses.9 10# CHECK: Name Type Address Off Size11# CHECK-NEXT: NULL 0000000000000000 000000 00000012# CHECK-NEXT: .empty PROGBITS 0000000000080000 000158 00000013# CHECK-NEXT: .text PROGBITS 0000000000080000 001000 00000114# CHECK-NEXT: .data PROGBITS 0000000000080001 001001 00000115 16# CHECK: Program Headers:17# CHECK-NEXT: Type Offset VirtAddr PhysAddr18# CHECK-NEXT: LOAD 0x001000 0x0000000000080000 0x000000000008000019# CHECK-NEXT: LOAD 0x001001 0x0000000000080001 0x000000000008200020 21# CHECK: Section to Segment mapping:22# CHECK: 00 .text {{$}}23# CHECK-NEXT: 01 .data {{$}}24 25SECTIONS {26 . = 0x00080000;27 .empty : { *(.empty ) }28 .text : AT(LOADADDR(.empty) + SIZEOF(.empty)) { *(.text) }29 .data : AT(ADDR(.empty) + 0x2000) { *(.data) }30}31