mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-29 16:38:05 +08:00
* 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:
10
ld/ChangeLog
10
ld/ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2009-05-14 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2009-05-05 Paul Brook <paul@codesourcery.com>
|
2009-05-05 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
* emultempl/armelf.em (compare_output_sec_vma): New function.
|
* emultempl/armelf.em (compare_output_sec_vma): New function.
|
||||||
|
@ -1771,6 +1771,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
|
|||||||
char *dollar = NULL;
|
char *dollar = NULL;
|
||||||
lang_output_section_statement_type *os;
|
lang_output_section_statement_type *os;
|
||||||
lang_statement_list_type add_child;
|
lang_statement_list_type add_child;
|
||||||
|
lang_statement_union_type **pl;
|
||||||
|
|
||||||
/* Look through the script to see where to place this section. */
|
/* Look through the script to see where to place this section. */
|
||||||
if (!link_info.relocatable
|
if (!link_info.relocatable
|
||||||
@ -1876,47 +1877,29 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
|
|||||||
&add_child);
|
&add_child);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
/* If the section name has a '\$', sort it with the other '\$'
|
||||||
lang_statement_union_type **pl = &os->children.head;
|
sections. */
|
||||||
|
for (pl = &os->children.head; *pl != NULL; pl = &(*pl)->header.next)
|
||||||
|
{
|
||||||
|
lang_input_section_type *ls;
|
||||||
|
const char *lname;
|
||||||
|
|
||||||
if (dollar != NULL)
|
if ((*pl)->header.type != lang_input_section_enum)
|
||||||
{
|
continue;
|
||||||
bfd_boolean found_dollar;
|
|
||||||
|
|
||||||
/* The section name has a '\$'. Sort it with the other '\$'
|
ls = &(*pl)->input_section;
|
||||||
sections. */
|
|
||||||
found_dollar = FALSE;
|
|
||||||
for ( ; *pl != NULL; pl = &(*pl)->header.next)
|
|
||||||
{
|
|
||||||
lang_input_section_type *ls;
|
|
||||||
const char *lname;
|
|
||||||
|
|
||||||
if ((*pl)->header.type != lang_input_section_enum)
|
lname = bfd_get_section_name (ls->section->owner, ls->section);
|
||||||
continue;
|
if (strchr (lname, '\$') != NULL
|
||||||
|
&& (dollar == NULL || strcmp (orig_secname, lname) < 0))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ls = &(*pl)->input_section;
|
if (add_child.head != NULL)
|
||||||
|
{
|
||||||
lname = bfd_get_section_name (ls->section->owner, ls->section);
|
*add_child.tail = *pl;
|
||||||
if (strchr (lname, '\$') == NULL)
|
*pl = add_child.head;
|
||||||
{
|
}
|
||||||
if (found_dollar)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
found_dollar = TRUE;
|
|
||||||
if (strcmp (orig_secname, lname) < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (add_child.head != NULL)
|
|
||||||
{
|
|
||||||
add_child.head->header.next = *pl;
|
|
||||||
*pl = add_child.head;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
@ -1546,6 +1546,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
|
|||||||
char *dollar = NULL;
|
char *dollar = NULL;
|
||||||
lang_output_section_statement_type *os;
|
lang_output_section_statement_type *os;
|
||||||
lang_statement_list_type add_child;
|
lang_statement_list_type add_child;
|
||||||
|
lang_statement_union_type **pl;
|
||||||
|
|
||||||
/* Look through the script to see where to place this section. */
|
/* Look through the script to see where to place this section. */
|
||||||
if (!link_info.relocatable
|
if (!link_info.relocatable
|
||||||
@ -1651,47 +1652,29 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
|
|||||||
&add_child);
|
&add_child);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
/* If the section name has a '\$', sort it with the other '\$'
|
||||||
lang_statement_union_type **pl = &os->children.head;
|
sections. */
|
||||||
|
for (pl = &os->children.head; *pl != NULL; pl = &(*pl)->header.next)
|
||||||
|
{
|
||||||
|
lang_input_section_type *ls;
|
||||||
|
const char *lname;
|
||||||
|
|
||||||
if (dollar != NULL)
|
if ((*pl)->header.type != lang_input_section_enum)
|
||||||
{
|
continue;
|
||||||
bfd_boolean found_dollar;
|
|
||||||
|
|
||||||
/* The section name has a '\$'. Sort it with the other '\$'
|
ls = &(*pl)->input_section;
|
||||||
sections. */
|
|
||||||
found_dollar = FALSE;
|
|
||||||
for ( ; *pl != NULL; pl = &(*pl)->header.next)
|
|
||||||
{
|
|
||||||
lang_input_section_type *ls;
|
|
||||||
const char *lname;
|
|
||||||
|
|
||||||
if ((*pl)->header.type != lang_input_section_enum)
|
lname = bfd_get_section_name (ls->section->owner, ls->section);
|
||||||
continue;
|
if (strchr (lname, '\$') != NULL
|
||||||
|
&& (dollar == NULL || strcmp (orig_secname, lname) < 0))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ls = &(*pl)->input_section;
|
if (add_child.head != NULL)
|
||||||
|
{
|
||||||
lname = bfd_get_section_name (ls->section->owner, ls->section);
|
*add_child.tail = *pl;
|
||||||
if (strchr (lname, '\$') == NULL)
|
*pl = add_child.head;
|
||||||
{
|
}
|
||||||
if (found_dollar)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
found_dollar = TRUE;
|
|
||||||
if (strcmp (orig_secname, lname) < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (add_child.head != NULL)
|
|
||||||
{
|
|
||||||
add_child.head->header.next = *pl;
|
|
||||||
*pl = add_child.head;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
23
ld/ldlang.c
23
ld/ldlang.c
@ -1668,8 +1668,16 @@ lang_insert_orphan (asection *s,
|
|||||||
push_stat_ptr (&add);
|
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;
|
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
|
/* If the name of the section is representable in C, then create
|
||||||
symbols to mark the start and the end of the section. */
|
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));
|
exp_intop ((bfd_vma) 1 << s->alignment_power));
|
||||||
lang_add_assignment (exp_assop ('=', ".", e_align));
|
lang_add_assignment (exp_assop ('=', ".", e_align));
|
||||||
lang_add_assignment (exp_provide (symname,
|
lang_add_assignment (exp_provide (symname,
|
||||||
exp_nameop (NAME, "."),
|
exp_unop (ABSOLUTE,
|
||||||
|
exp_nameop (NAME, ".")),
|
||||||
FALSE));
|
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)
|
if (add_child == NULL)
|
||||||
add_child = &os->children;
|
add_child = &os->children;
|
||||||
lang_add_section (add_child, s, os);
|
lang_add_section (add_child, s, os);
|
||||||
|
|
||||||
lang_leave_output_section_statement (0, "*default*", NULL, NULL);
|
lang_leave_output_section_statement (0, "*default*", NULL, NULL);
|
||||||
|
|
||||||
if (config.build_constructors && *ps == '\0')
|
if (ps != NULL && *ps == '\0')
|
||||||
{
|
{
|
||||||
char *symname;
|
char *symname;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user