* ldlang.c (lang_insert_orphan): Place loadable orphans in the same

region and phdrs as their placement section.

	testsuite/
	* ld-elf/orphan-region.d, ld-elf/orphan-region.ld,
	ld-elf/orphan-region.s: New files.
This commit is contained in:
Daniel Jacobowitz 2010-03-16 14:14:40 +00:00
parent 99164030b9
commit f77c394825
6 changed files with 58 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2010-03-15 Daniel Jacobowitz <dan@codesourcery.com>
* ldlang.c (lang_insert_orphan): Place loadable orphans in the same
region and phdrs as their placement section.
2010-03-15 Alan Modra <amodra@gmail.com>
* emultempl/ppc64elf.em (move_input_section, sort_toc_sections): New.

View file

@ -1761,7 +1761,20 @@ lang_insert_orphan (asection *s,
add_child = &os->children;
lang_add_section (add_child, s, os);
lang_leave_output_section_statement (0, "*default*", NULL, NULL);
if (after && (s->flags & (SEC_LOAD | SEC_ALLOC)) != 0)
{
const char *region = (after->region
? after->region->name_list.name
: DEFAULT_MEMORY_REGION);
const char *lma_region = (after->lma_region
? after->lma_region->name_list.name
: NULL);
lang_leave_output_section_statement (NULL, region, after->phdrs,
lma_region);
}
else
lang_leave_output_section_statement (NULL, DEFAULT_MEMORY_REGION, NULL,
NULL);
if (ps != NULL && *ps == '\0')
{

View file

@ -1,3 +1,8 @@
2010-03-15 Daniel Jacobowitz <dan@codesourcery.com>
* ld-elf/orphan-region.d, ld-elf/orphan-region.ld,
ld-elf/orphan-region.s: New files.
2010-03-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* ld-arm/arm-merge-incompatible.d: New test.

View file

@ -0,0 +1,16 @@
#source: orphan-region.s
#ld: -T orphan-region.ld
#readelf: -S -l --wide
#...
\[[ 0-9]+\] \.text[ \t]+PROGBITS[ \t]+0*40000000[ \t]+.*
\[[ 0-9]+\] \.rodata[ \t]+PROGBITS[ \t]+0*400000[0-9a-f]+[ \t]+.*
\[[ 0-9]+\] \.moredata[ \t]+PROGBITS[ \t]+0*400000[0-9a-f]+[ \t]+.*
#...
Program Headers:
Type.*
LOAD[ \t]+0x[0-9a-f]+ 0x0*40000000 0x0*40000000 0x[0-9a-f]+ 0x[0-9a-f]+ R E 0x[0-9a-f]+
Section to Segment mapping:
Segment Sections...
00 .text .rodata .moredata *

View file

@ -0,0 +1,10 @@
MEMORY
{
region : ORIGIN = 0x40000000, LENGTH = 8M
}
SECTIONS
{
.text : ALIGN (4) { *(.text) } > region
.rodata : ALIGN (4) { *(.rodata) } > region
}

View file

@ -0,0 +1,8 @@
.text
.long 0
.section ".rodata", "a", %progbits
.long 0
.section ".moredata", "a", %progbits
.long 0
.section ".notdata", "", %progbits
.long 0