diff options
Diffstat (limited to 'ld/emultempl/pep.em')
-rw-r--r-- | ld/emultempl/pep.em | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index f8556189cd..e4519c576e 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -260,10 +260,12 @@ gld${EMULATION_NAME}_add_options {"no-seh", no_argument, NULL, OPTION_NO_SEH}, {"no-bind", no_argument, NULL, OPTION_NO_BIND}, {"wdmdriver", no_argument, NULL, OPTION_WDM_DRIVER}, - {"tsaware", no_argument, NULL, OPTION_TERMINAL_SERVER_AWARE}, {NULL, no_argument, NULL, 0} + {"tsaware", no_argument, NULL, OPTION_TERMINAL_SERVER_AWARE}, + {NULL, no_argument, NULL, 0} }; - *longopts = xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long)); + *longopts + = xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long)); memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long)); } @@ -370,7 +372,7 @@ gld_${EMULATION_NAME}_list_options (FILE *file) fprintf (file, _(" --no-isolation Image understands isolation but do not isolate the image\n")); fprintf (file, _(" --no-seh Image does not use SEH. No SE handler may\n\ be called in this image\n")); - fprintf (file, _(" --no-bind Do not bind this image\n")); + fprintf (file, _(" --no-bind Do not bind this image\n")); fprintf (file, _(" --wdmdriver Driver uses the WDM model\n")); fprintf (file, _(" --tsaware Image is Terminal Server aware\n")); #endif @@ -757,15 +759,18 @@ gld_${EMULATION_NAME}_set_symbols (void) if (link_info.relocatable) init[IMAGEBASEOFF].value = 0; else if (init[DLLOFF].value || (link_info.shared && !link_info.pie)) + { #ifdef DLL_SUPPORT - init[IMAGEBASEOFF].value = (pep_enable_auto_image_base) ? - compute_dll_image_base (output_filename) : NT_DLL_IMAGE_BASE; + init[IMAGEBASEOFF].value = (pep_enable_auto_image_base + ? compute_dll_image_base (output_filename) + : NT_DLL_IMAGE_BASE); #else - init[IMAGEBASEOFF].value = NT_DLL_IMAGE_BASE; + init[IMAGEBASEOFF].value = NT_DLL_IMAGE_BASE; #endif + } else init[IMAGEBASEOFF].value = NT_EXE_IMAGE_BASE; - init[MSIMAGEBASEOFF].value = init[IMAGEBASEOFF].value; + init[MSIMAGEBASEOFF].value = init[IMAGEBASEOFF].value; } /* Don't do any symbol assignments if this is a relocatable link. */ @@ -1057,7 +1062,7 @@ This should work unless it involves constant data structures referencing symbols } pep_walk_relocs_of_symbol (&link_info, undef->root.string, - make_import_fixup); + make_import_fixup); /* Let's differentiate it somehow from defined. */ undef->type = bfd_link_hash_defweak; @@ -1561,21 +1566,32 @@ gld_${EMULATION_NAME}_place_orphan (asection *s, lang_list_init (&add_child); - 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 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. */ - lang_add_section (&add_child, s, os); - } - else + os = NULL; + if (constraint == 0) + for (os = lang_output_section_find (secname); + os != NULL; + os = next_matching_output_section_statement (os, 0)) + { + /* If we don't match an existing output section, tell + lang_insert_orphan to create a new output section. */ + constraint = SPECIAL; + + if (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 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. */ + lang_add_section (&add_child, s, os); + break; + } + } + + if (os == NULL) { static struct orphan_save hold[] = { |