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.
+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.
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')
{
+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.
--- /dev/null
+#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 *
--- /dev/null
+MEMORY
+{
+ region : ORIGIN = 0x40000000, LENGTH = 8M
+}
+
+SECTIONS
+{
+ .text : ALIGN (4) { *(.text) } > region
+ .rodata : ALIGN (4) { *(.rodata) } > region
+}
\ No newline at end of file
--- /dev/null
+ .text
+ .long 0
+ .section ".rodata", "a", %progbits
+ .long 0
+ .section ".moredata", "a", %progbits
+ .long 0
+ .section ".notdata", "", %progbits
+ .long 0