brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · e3c19bc Raw
84 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t3 4## Check simple RAM-only memory region.5 6# RUN: echo "MEMORY { ram (rwx) : ORIGIN = 0x8000, LENGTH = 256K } \7# RUN: SECTIONS { \8# RUN:   .text : { *(.text) } > ram \9# RUN:   .data : { *(.data) } > ram \10# RUN: }" > %t.script11# RUN: ld.lld -o %t1 --script %t.script %t12# RUN: llvm-readelf -S %t1 | FileCheck --check-prefix=RAM %s13 14# RAM:      [ 1] .text PROGBITS 0000000000008000 001000 00000115# RAM-NEXT: [ 2] .data PROGBITS 0000000000008001 001001 00100016 17## Check RAM and ROM memory regions.18 19# RUN: echo "MEMORY { \20# RUN:   ram (rwx) : ORIGIN = 0, LENGTH = 1024M \21# RUN:   rom (rx) : org = (0x80 * 0x1000 * 0x1000), len = 64M \22# RUN: } \23# RUN: SECTIONS { \24# RUN:   .text : { *(.text) } >rom \25# RUN:   .data : { *(.data) } >ram \26# RUN: }" > %t.script27# RUN: ld.lld -o %t1 --script %t.script %t28# RUN: llvm-readelf -S %t1 | FileCheck --check-prefix=RAMROM %s29 30# RAMROM:      [ 1] .text PROGBITS 0000000080000000 001000 00000131# RAMROM-NEXT: [ 2] .data PROGBITS 0000000000000000 002000 00100032 33## Check memory region placement by attributes.34 35# RUN: echo "MEMORY { \36# RUN:   ram (!rx) : ORIGIN = 0, LENGTH = 1024M \37# RUN:   rom (rx) : o = 0x80000000, l = 64M \38# RUN: } \39# RUN: SECTIONS { \40# RUN:   .text : { *(.text) } \41# RUN:   .data : { *(.data) } > ram \42# RUN: }" > %t.script43# RUN: ld.lld -o %t1 --script %t.script %t44# RUN: llvm-readelf -S %t1 | FileCheck --check-prefix=ATTRS %s45 46# ATTRS:      [ 1] .text PROGBITS 0000000080000000 001000 00000147# ATTRS-NEXT: [ 2] .data PROGBITS 0000000000000000 002000 00100048 49## ORIGIN/LENGTH support expressions with symbol assignments.50# RUN: echo 'MEMORY { ram : ORIGIN = symbol, LENGTH = 4097 } \51# RUN: SECTIONS { \52# RUN:   .text : { *(.text) } > ram \53# RUN:   .data : { *(.data) } > ram \54# RUN: }' > %t.script55# RUN: ld.lld -T %t.script %t --defsym symbol=0x5000 -o %t.relro56# RUN: llvm-readelf -S %t.relro | FileCheck --check-prefix=RELRO %s57# RUN: echo 'symbol = 0x5000;' > %t1.script58# RUN: ld.lld -T %t.script -T %t1.script %t -o %t.relro259# RUN: llvm-readelf -S %t.relro2 | FileCheck --check-prefix=RELRO %s60 61# RELRO:      [ 1] .text PROGBITS 0000000000005000 001000 00000162# RELRO-NEXT: [ 2] .data PROGBITS 0000000000005001 001001 00100063 64# RUN: echo 'MEMORY { ram : ORIGIN = CONSTANT(COMMONPAGESIZE), LENGTH = CONSTANT(COMMONPAGESIZE)+1 } \65# RUN: SECTIONS { \66# RUN:   .text : { *(.text) } > ram \67# RUN:   .data : { *(.data) } > ram \68# RUN: }' > %t.script69# RUN: ld.lld -T %t.script %t -o %t.pagesize70# RUN: llvm-readelf -S %t.pagesize | FileCheck --check-prefix=PAGESIZE %s71 72# PAGESIZE:      [ 1] .text PROGBITS 0000000000001000 001000 00000173# PAGESIZE-NEXT: [ 2] .data PROGBITS 0000000000001001 001001 00100074 75.text76.global _start77_start:78  nop79 80.data81b:82  .long 183  .zero 409284