binutils-gdb/ld/testsuite/ld-elf/size-2.d
Alan Modra 326adec374 PR26378, sections initialised only by linker scripts are always read/write
This changes the initialisation of output sections so that it is
possible to create read-only sections fed only from linker script
BYTE, SHORT, LONG or QUAD.  That currently isn't possible even for one
of the well-known ELF sections like .rodata, because once a section is
marked read/write that sticks.  On the other hand if we start
read-only, well-known ELF sections end up read/write as appropriate.
For example .tdata will still be SHF_ALLOC + SHF_WRITE + SHF_TLS.

	PR 26378
	* ldlang.c (map_input_to_output_sections): Start with a read-only
	section for data statements.
	* testsuite/ld-elf/size-2.d: Adjust to suit.
2021-01-18 23:07:40 +10:30

22 lines
873 B
Makefile

#source: size-2.s
#ld: -T size-2.t
#readelf: -lS --wide
# v850 .tdata/.tbss are not TLS sections
#xfail: v850*-*-*
# The three alternatives for PHDR and LOAD are: 64-bit, 32-bit, 32-bit
# not demand paged. 32-bit LOAD has a variant for spu-elf, which rounds
# load size up to multiples of 16 bytes.
#...
.* \.text +PROGBITS +0+100 [0-9a-f]+ 0+10 00 AX .*
.* \.tdata +PROGBITS +0+110 [0-9a-f]+ 0+20 00 WAT .*
.* \.tbss +NOBITS +0+130 [0-9a-f]+ 0+30 00 WAT .*
.* \.map +PROGBITS +0+130 [0-9a-f]+ 0+c 00 +A .*
#...
+PHDR +(0x0+40 0x0+40 0x0+40 0x0+a8 0x0+a8|0x0+34 0x0+34 0x0+34 0x0+60 0x0+60|0x0+34 0x0+a0 0x0+a0 0x0+60 0x0+60) R .*
+LOAD +(0x0+40 0x0+40 0x0+40 0x0+fc 0x0+fc|0x0+34 0x0+34 0x0+34 0x0+1(08|10) 0x0+1(08|10)|0x0+34 0x0+a0 0x0+a0 0x0+9c 0x0+9c) R E .*
+TLS +0x0+(110|a4) 0x0+110 0x0+110 0x0+20 0x0+50 R .*
#...
.* \.text \.tdata \.map
.* \.tdata \.tbss