4 RUN: llvm-mc -filetype=obj -triple=x86_64 %ts/s -o %t.o
6 ## Check assigning sections to memory regions by attributes.
19 ## Check memory region attribute 'a'.
21 # RUN: ld.lld -o %t1 -T %ts/t1 %t.o
22 # RUN: llvm-readelf -S %t1 | FileCheck %s --check-prefix=TEST1
24 # TEST1: Name Type Address
25 # TEST1: .text PROGBITS 0000000000002000
26 # TEST1-NEXT: .rodata PROGBITS 0000000000002008
27 # TEST1-NEXT: .data PROGBITS 0000000000002010
31 ## All sections have SHF_ALLOC attribute, so no one can be added here.
32 NOMEM (rwx!a) : org = 0x1000, l = 1K
33 ## All sections are assigned to this memory region.
34 MEM (a) : org = 0x2000, l = 1K
40 .rodata : { *(.rodata) }
45 ## Check that memory region attributes 'r', 'w', and 'x' are supported both in
46 ## positive and negative forms.
48 # RUN: ld.lld -o %t2 -T %ts/t2 %t.o
49 # RUN: llvm-readelf -S %t2 | FileCheck %s --check-prefix=TEST2
51 # TEST2: Name Type Address
52 # TEST2: .text PROGBITS 0000000000004000
53 # TEST2-NEXT: .rodata PROGBITS 0000000000003000
54 # TEST2-NEXT: .data PROGBITS 0000000000002000
58 ## While all sections are allocatable, '.text' and '.rodata' are read-only and
59 ## '.data' is writable, so no sections should be assigned to this region.
60 NOMEM (a!rw) : org = 0x1000, l = 1K
61 ## Only writable section '.data' is allowed here.
62 RAM (w) : org = 0x2000, l = 1K
63 ## Executable sections are not allowed here, so only '.rodata' should be
64 ## assigned to the region.
65 ROM (r!x) : org = 0x3000, l = 1K
66 ## An executable section '.text' comes here.
67 EXEC (x) : org = 0x4000, l = 1K
73 .rodata : { *(.rodata) }