diff options
author | Alan Modra <amodra@gmail.com> | 2009-05-15 14:22:36 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2009-05-15 14:22:36 +0000 |
commit | d127ecce68b9052033148696008a8a905f661301 (patch) | |
tree | c4b31acc130ee14648913fb99d0a280de36dcb3c /ld/emultempl/pep.em | |
parent | 0643c12ee1f4e258e1efea52d46b4c4e67fc8f78 (diff) | |
download | gdb-d127ecce68b9052033148696008a8a905f661301.zip gdb-d127ecce68b9052033148696008a8a905f661301.tar.gz gdb-d127ecce68b9052033148696008a8a905f661301.tar.bz2 |
ld/
* ldlang.c (lang_output_section_statement_lookup): Add function
comment. Make "name" non-const. Ensure duplicate entries use
the same string, allowing simple comparison in hash bucket loop.
Tweak constraint check.
(next_matching_output_section_statement): New function.
* ldlang.h (lang_output_section_statement_lookup): Update.
(next_matching_output_section_statement): Declare.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't
combine orphan sections when input sections flags differ in
alloc or load.
* emultempl/pe.em: Formatting throughout.
(gld${EMULATION_NAME}_place_orphan): As for elf32.em.
* emultempl/pep.em: Formatting throughout.
(gld${EMULATION_NAME}_place_orphan): As for elf32.em.
ld/testsuite/
* ld-elf/orphan3.d, * ld-elf/orphan3a.s, * ld-elf/orphan3b.s,
* ld-elf/orphan3c.s, * ld-elf/orphan3d.s, * ld-elf/orphan3e.s,
* ld-elf/orphan3f.s: New test.
* ld-pe/orphan.d, * ld-pe/orphana.s, * ld-pe/orphanb.s,
* ld-pe/orphand.s, * ld-pe/orphane.s: New test.
* ld-pe/direct.exp: Use is_pecoff_format.
* ld-pe/longsecn.exp: Delete.
* ld-pe/pe.exp: Run new test and longsecn tests.
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 f855618..e4519c5 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[] = { |