brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 5ea6e77 Raw
76 lines · plain
1REQUIRES: x862 3RUN: split-file %s %ts4RUN: llvm-mc -filetype=obj -triple=x86_64 %ts/s -o %t.o5 6## Check assigning sections to memory regions by attributes.7 8#--- s9  .text10  .zero 811 12  .rodata13  .zero 814 15  .data16  .zero 817 18#--- t119## Check memory region attribute 'a'.20 21# RUN: ld.lld -o %t1 -T %ts/t1 %t.o22# RUN: llvm-readelf -S %t1 | FileCheck %s --check-prefix=TEST123 24# TEST1:      Name     Type      Address25# TEST1:      .text    PROGBITS  000000000000200026# TEST1-NEXT: .rodata  PROGBITS  000000000000200827# TEST1-NEXT: .data    PROGBITS  000000000000201028 29MEMORY30{31  ## All sections have SHF_ALLOC attribute, so no one can be added here.32  NOMEM (rwx!a) : org = 0x1000, l = 1K33  ## All sections are assigned to this memory region.34  MEM   (a)     : org = 0x2000, l = 1K35}36 37SECTIONS38{39  .text   : { *(.text) }40  .rodata : { *(.rodata) }41  .data   : { *(.data) }42}43 44#--- t245## Check that memory region attributes 'r', 'w', and 'x' are supported both in46## positive and negative forms.47 48# RUN: ld.lld -o %t2 -T %ts/t2 %t.o49# RUN: llvm-readelf -S %t2 | FileCheck %s --check-prefix=TEST250 51# TEST2:      Name     Type      Address52# TEST2:      .text    PROGBITS  000000000000400053# TEST2-NEXT: .rodata  PROGBITS  000000000000300054# TEST2-NEXT: .data    PROGBITS  000000000000200055 56MEMORY57{58  ## While all sections are allocatable, '.text' and '.rodata' are read-only and59  ## '.data' is writable, so no sections should be assigned to this region.60  NOMEM (a!rw) : org = 0x1000, l = 1K61  ## Only writable section '.data' is allowed here.62  RAM   (w)    : org = 0x2000, l = 1K63  ## Executable sections are not allowed here, so only '.rodata' should be64  ## assigned to the region.65  ROM   (r!x)  : org = 0x3000, l = 1K66  ## An executable section '.text' comes here.67  EXEC  (x)    : org = 0x4000, l = 1K68}69 70SECTIONS71{72  .text   : { *(.text) }73  .rodata : { *(.rodata) }74  .data   : { *(.data) }75}76