diff options
Diffstat (limited to 'ld/emultempl/pe.em')
-rw-r--r-- | ld/emultempl/pe.em | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 865cfaaeb02..b963d030918 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -936,7 +936,7 @@ pe_find_data_imports (void) { warned = TRUE; einfo (_("%P: warning: auto-importing has been activated without --enable-auto-import specified on the command line.\n\ -This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.")); +This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.\n")); } } @@ -1122,7 +1122,7 @@ gld_${EMULATION_NAME}_after_open (void) if (nrelocs < 0) { free (relocs); - einfo ("%X%P: unable to process relocs: %E"); + einfo ("%X%P: unable to process relocs: %E\n"); return; } @@ -1380,7 +1380,7 @@ gld_${EMULATION_NAME}_before_allocation (void) (is->the_bfd, & link_info, support_old_code)) { /* xgettext:c-format */ - einfo (_("Errors encountered processing file %s for interworking"), + einfo (_("Errors encountered processing file %s for interworking\n"), is->filename); } } @@ -1612,41 +1612,38 @@ gld_${EMULATION_NAME}_finish (void) default linker script using wildcards, and are sorted by sort_sections. */ -static bfd_boolean -gld_${EMULATION_NAME}_place_orphan (asection *s) +static lang_output_section_statement_type * +gld_${EMULATION_NAME}_place_orphan (asection *s, + const char *secname, + int constraint) { - const char *secname; - const char *orig_secname; + const char *orig_secname = secname; char *dollar = NULL; lang_output_section_statement_type *os; lang_statement_list_type add_child; - secname = bfd_get_section_name (s->owner, s); - /* Look through the script to see where to place this section. */ - orig_secname = secname; if (!link_info.relocatable && (dollar = strchr (secname, '$')) != NULL) { - size_t len = dollar - orig_secname; + size_t len = dollar - secname; char *newname = xmalloc (len + 1); - memcpy (newname, orig_secname, len); + memcpy (newname, secname, len); newname[len] = '\0'; secname = newname; } - os = lang_output_section_find (secname); - lang_list_init (&add_child); - if (os != NULL - && (os->bfd_section == NULL - || os->bfd_section->flags == 0 + if (constraint == 0 + && (os = lang_output_section_find (secname)) != NULL + && os->bfd_section != NULL + && (os->bfd_section->flags == 0 || ((s->flags ^ os->bfd_section->flags) & (SEC_LOAD | SEC_ALLOC)) == 0)) { /* We already have an output section statement with this - name, and its bfd section, if any, has compatible flags. + name, and its bfd section has compatible flags. If the section already exists but does not have any flags set, then it has been created by the linker, probably as a result of a --section-start command line switch. */ @@ -1723,21 +1720,10 @@ gld_${EMULATION_NAME}_place_orphan (asection *s) ->output_section_statement); } - /* Choose a unique name for the section. This will be needed if the - same section name appears in the input file with different - loadable or allocatable characteristics. */ - if (bfd_get_section_by_name (link_info.output_bfd, secname) != NULL) - { - static int count = 1; - secname = bfd_get_unique_section_name (link_info.output_bfd, - secname, &count); - if (secname == NULL) - einfo ("%F%P: place_orphan failed: %E\n"); - } - /* All sections in an executable must be aligned to a page boundary. */ address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__")); - os = lang_insert_orphan (s, secname, after, place, address, &add_child); + os = lang_insert_orphan (s, secname, constraint, after, place, address, + &add_child); } { @@ -1782,7 +1768,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s) } } - return TRUE; + return os; } static bfd_boolean |