diff options
author | Alan Modra <amodra@gmail.com> | 2009-05-14 02:21:45 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2009-05-14 02:21:45 +0000 |
commit | 011aa75f625b8ef2fe1a8adb9498680410174d3c (patch) | |
tree | bd66045c39a7626699642bdb2f3f6e8b5d13e3b2 /ld/emultempl | |
parent | a8310e20c5a873ff257b07e4dc97acb935e869b4 (diff) | |
download | gdb-011aa75f625b8ef2fe1a8adb9498680410174d3c.zip gdb-011aa75f625b8ef2fe1a8adb9498680410174d3c.tar.gz gdb-011aa75f625b8ef2fe1a8adb9498680410174d3c.tar.bz2 |
* 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.
Diffstat (limited to 'ld/emultempl')
-rw-r--r-- | ld/emultempl/pe.em | 57 | ||||
-rw-r--r-- | ld/emultempl/pep.em | 57 |
2 files changed, 40 insertions, 74 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 2bfd5fa..30f8619 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1771,6 +1771,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s, char *dollar = NULL; lang_output_section_statement_type *os; lang_statement_list_type add_child; + lang_statement_union_type **pl; /* Look through the script to see where to place this section. */ if (!link_info.relocatable @@ -1876,47 +1877,29 @@ gld_${EMULATION_NAME}_place_orphan (asection *s, &add_child); } - { - lang_statement_union_type **pl = &os->children.head; - - if (dollar != NULL) - { - bfd_boolean found_dollar; - - /* The section name has a '\$'. Sort it with the other '\$' - sections. */ - found_dollar = FALSE; - for ( ; *pl != NULL; pl = &(*pl)->header.next) - { - lang_input_section_type *ls; - const char *lname; + /* If the section name has a '\$', sort it with the other '\$' + sections. */ + for (pl = &os->children.head; *pl != NULL; pl = &(*pl)->header.next) + { + lang_input_section_type *ls; + const char *lname; - if ((*pl)->header.type != lang_input_section_enum) - continue; + if ((*pl)->header.type != lang_input_section_enum) + continue; - ls = &(*pl)->input_section; + ls = &(*pl)->input_section; - lname = bfd_get_section_name (ls->section->owner, ls->section); - if (strchr (lname, '\$') == NULL) - { - if (found_dollar) - break; - } - else - { - found_dollar = TRUE; - if (strcmp (orig_secname, lname) < 0) - break; - } - } - } + lname = bfd_get_section_name (ls->section->owner, ls->section); + if (strchr (lname, '\$') != NULL + && (dollar == NULL || strcmp (orig_secname, lname) < 0)) + break; + } - if (add_child.head != NULL) - { - add_child.head->header.next = *pl; - *pl = add_child.head; - } - } + if (add_child.head != NULL) + { + *add_child.tail = *pl; + *pl = add_child.head; + } return os; } diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index 9c79e5a..f855618 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -1546,6 +1546,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s, char *dollar = NULL; lang_output_section_statement_type *os; lang_statement_list_type add_child; + lang_statement_union_type **pl; /* Look through the script to see where to place this section. */ if (!link_info.relocatable @@ -1651,47 +1652,29 @@ gld_${EMULATION_NAME}_place_orphan (asection *s, &add_child); } - { - lang_statement_union_type **pl = &os->children.head; - - if (dollar != NULL) - { - bfd_boolean found_dollar; - - /* The section name has a '\$'. Sort it with the other '\$' - sections. */ - found_dollar = FALSE; - for ( ; *pl != NULL; pl = &(*pl)->header.next) - { - lang_input_section_type *ls; - const char *lname; + /* If the section name has a '\$', sort it with the other '\$' + sections. */ + for (pl = &os->children.head; *pl != NULL; pl = &(*pl)->header.next) + { + lang_input_section_type *ls; + const char *lname; - if ((*pl)->header.type != lang_input_section_enum) - continue; + if ((*pl)->header.type != lang_input_section_enum) + continue; - ls = &(*pl)->input_section; + ls = &(*pl)->input_section; - lname = bfd_get_section_name (ls->section->owner, ls->section); - if (strchr (lname, '\$') == NULL) - { - if (found_dollar) - break; - } - else - { - found_dollar = TRUE; - if (strcmp (orig_secname, lname) < 0) - break; - } - } - } + lname = bfd_get_section_name (ls->section->owner, ls->section); + if (strchr (lname, '\$') != NULL + && (dollar == NULL || strcmp (orig_secname, lname) < 0)) + break; + } - if (add_child.head != NULL) - { - add_child.head->header.next = *pl; - *pl = add_child.head; - } - } + if (add_child.head != NULL) + { + *add_child.tail = *pl; + *pl = add_child.head; + } return os; } |