brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 5500b84 Raw
82 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o3 4## Check bad `ORIGIN`.5 6# RUN: echo 'MEMORY { ram (rwx) : XYZ = 0x8000 } }' > %t.script7# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR1 %s8# ERR1: {{.*}}.script:1: expected one of: ORIGIN, org, or o9 10## Check bad `LENGTH`.11 12# RUN: echo 'MEMORY { ram (rwx) : ORIGIN = 0x8000, XYZ = 256K } }' > %t.script13# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR2 %s14# ERR2: {{.*}}.script:1: expected one of: LENGTH, len, or l15 16## Check duplicate regions.17 18# RUN: echo 'MEMORY { ram (rwx) : o = 8, l = 256K ram (rx) : o = 0, l = 256K }' > %t.script19# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR3 %s20# ERR3: {{.*}}.script:1: region 'ram' already defined21 22## Check no region available.23 24# RUN: echo 'MEMORY { ram (!rx) : ORIGIN = 0x8000, LENGTH = 256K } \25# RUN: SECTIONS { \26# RUN:   .text : { *(.text) } \27# RUN:   .data : { *(.data) } > ram \28# RUN: }' > %t.script29# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR4 %s30# ERR4: error: no memory region specified for section '.text'31 32## Check undeclared region.33 34# RUN: echo 'SECTIONS { .text : { *(.text) } > ram }' > %t.script35# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR5 %s36# ERR5: error: memory region 'ram' not declared37 38# RUN: echo 'SECTIONS { .text : { *(.text) } AT> ram }' > %t.script39# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR5 %s40 41## Check region overflow.42 43# RUN: echo 'MEMORY { ram (rwx) : ORIGIN = 0, LENGTH = 2K } \44# RUN: SECTIONS { \45# RUN:   .text : { *(.text) } > ram \46# RUN:   .data : { *(.data) } > ram \47# RUN: }' > %t.script48# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR6 %s49# ERR6: error: section '.data' will not fit in region 'ram': overflowed by 2049 bytes50 51## Check invalid region attributes.52 53# RUN: echo "MEMORY { ram (abc) : ORIGIN = 8000, LENGTH = 256K } }" > %t.script54# RUN: not ld.lld -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR7 %s55# ERR7: {{.*}}.script:1: invalid memory region attribute56 57# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t58# RUN: echo 'MEMORY { name : ORIGIN = ., LENGTH = 1 }' > %t.script59# RUN: not ld.lld -shared -o /dev/null -T %t.script %t.o 2>&1 | FileCheck --check-prefix=ERR_DOT %s60# ERR_DOT: error: {{.*}}.script:1: unable to get location counter value61 62## ORIGIN/LENGTH can be simple symbolic expressions. If the expression63## requires interaction with memory regions, it may fail.64 65# RUN: echo 'MEMORY { ram : ORIGIN = symbol, LENGTH = 4094 } \66# RUN: SECTIONS { \67# RUN:   .text : { *(.text) } > ram \68# RUN:   symbol = .; \69# RUN:   .data : { *(.data) } > ram \70# RUN: }' > %t.script71# RUN: not ld.lld -T %t.script %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=NOT_CONVERGE %s72# NOT_CONVERGE: error: address (0x14) of section '.text' does not converge73 74# RUN: echo 'MEMORY { ram : ORIGIN = symbol, LENGTH = 4094 ' > %t.script75# RUN: not ld.lld -T %t.script %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=UNCLOSED %s76# UNCLOSED: error: {{.*}}:1: unexpected EOF77 78nop79 80.data81.zero 409682