1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t 3 4# RUN: ld.lld -z max-page-size=0x4000 %t -o %t2 5# RUN: llvm-readobj -l %t2 | FileCheck %s 6 7# CHECK: ProgramHeaders [ 8# CHECK: ProgramHeader { 9# CHECK: Type: PT_LOAD 10# CHECK-NEXT: Offset: 0x0 11# CHECK-NEXT: VirtualAddress: 0x200000 12# CHECK-NEXT: PhysicalAddress: 0x200000 13# CHECK-NEXT: FileSize: 344 14# CHECK-NEXT: MemSize: 344 15# CHECK-NEXT: Flags [ 16# CHECK-NEXT: PF_R 17# CHECK-NEXT: ] 18# CHECK-NEXT: Alignment: 16384 19# CHECK-NEXT: } 20# CHECK-NEXT: ProgramHeader { 21# CHECK-NEXT: Type: PT_LOAD 22# CHECK-NEXT: Offset: 0x158 23# CHECK-NEXT: VirtualAddress: 0x204158 24# CHECK-NEXT: PhysicalAddress: 0x204158 25# CHECK-NEXT: FileSize: 1 26# CHECK-NEXT: MemSize: 1 27# CHECK-NEXT: Flags [ 28# CHECK-NEXT: PF_R 29# CHECK-NEXT: PF_X 30# CHECK-NEXT: ] 31# CHECK-NEXT: Alignment: 16384 32# CHECK-NEXT: } 33# CHECK-NEXT: ProgramHeader { 34# CHECK-NEXT: Type: PT_LOAD 35# CHECK-NEXT: Offset: 0x159 36# CHECK-NEXT: VirtualAddress: 0x208159 37# CHECK-NEXT: PhysicalAddress: 0x208159 38# CHECK-NEXT: FileSize: 8 39# CHECK-NEXT: MemSize: 8 40# CHECK-NEXT: Flags [ 41# CHECK-NEXT: PF_R 42# CHECK-NEXT: PF_W 43# CHECK-NEXT: ] 44# CHECK-NEXT: Alignment: 16384 45# CHECK-NEXT: } 46 47# RUN: echo "SECTIONS { symbol = CONSTANT(MAXPAGESIZE); }" > %t.script 48# RUN: ld.lld -z max-page-size=0x4000 -o %t1 --script %t.script %t 49# RUN: llvm-readelf -s %t1 | FileCheck -check-prefix CHECK-SCRIPT %s 50 51# CHECK-SCRIPT: 0000000000004000 0 NOTYPE GLOBAL DEFAULT ABS symbol 52 53# RUN: not ld.lld -z max-page-size=0x1001 -o /dev/null --script %t.script %t 2>&1 \ 54# RUN: | FileCheck -check-prefix=ERR1 %s 55# ERR1: max-page-size: value isn't a power of 2 56 57# RUN: not ld.lld -z max-page-size=-0x1000 -o /dev/null --script %t.script %t 2>&1 \ 58# RUN: | FileCheck -check-prefix=ERR2 %s 59# ERR2: invalid max-page-size: -0x1000 60 61.global _start 62_start: 63 nop 64 65.section .a, "aw" 66.quad 0 67