* ldlang.c (lang_insert_orphan): Add __start_<section> symbol

assignment inside output section statement.  Ensure only one
	set of symbols per output section.
	* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Add non-
	dollar sections before dollar sections.  Correct add_child
	list insertion.
	* emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
This commit is contained in:
Alan Modra
2009-05-14 02:21:45 +00:00
parent a8310e20c5
commit 011aa75f62
4 changed files with 62 additions and 85 deletions

View File

@ -1668,8 +1668,16 @@ lang_insert_orphan (asection *s,
push_stat_ptr (&add);
}
if (link_info.relocatable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = exp_intop (0);
os_tail = ((lang_output_section_statement_type **)
lang_output_section_statement.tail);
os = lang_enter_output_section_statement (secname, address, 0, NULL, NULL,
NULL, constraint);
ps = NULL;
if (config.build_constructors)
if (config.build_constructors && *os_tail == os)
{
/* If the name of the section is representable in C, then create
symbols to mark the start and the end of the section. */
@ -1688,26 +1696,19 @@ lang_insert_orphan (asection *s,
exp_intop ((bfd_vma) 1 << s->alignment_power));
lang_add_assignment (exp_assop ('=', ".", e_align));
lang_add_assignment (exp_provide (symname,
exp_nameop (NAME, "."),
exp_unop (ABSOLUTE,
exp_nameop (NAME, ".")),
FALSE));
}
}
if (link_info.relocatable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = exp_intop (0);
os_tail = ((lang_output_section_statement_type **)
lang_output_section_statement.tail);
os = lang_enter_output_section_statement (secname, address, 0, NULL, NULL,
NULL, constraint);
if (add_child == NULL)
add_child = &os->children;
lang_add_section (add_child, s, os);
lang_leave_output_section_statement (0, "*default*", NULL, NULL);
if (config.build_constructors && *ps == '\0')
if (ps != NULL && *ps == '\0')
{
char *symname;