X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Femultempl%2Fpe.em;h=37146ab59f843f9e248f9232f3812e269233a16c;hb=c553bb910d30224f6d5e1e10a67a839093e97fa0;hp=a863526b4fbe2bcf35dd941b5abfa4e9aa628151;hpb=72358f656865476617bb9ee497d08b32a48c95c8;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index a863526b4f..37146ab59f 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -9,7 +9,7 @@ rm -f e${EMULATION_NAME}.c (echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-) cat >>e${EMULATION_NAME}.c < Generate import library\n")); fprintf (file, _(" --output-def Generate a .DEF file for the built DLL\n")); fprintf (file, _(" --warn-duplicate-exports Warn about duplicate exports.\n")); - fprintf (file, _(" --compat-implib Create backward compatible import libs;\n")); - fprintf (file, _(" create __imp_ as well.\n")); - fprintf (file, _(" --enable-auto-image-base Automatically choose image base for DLLs\n")); - fprintf (file, _(" unless user specifies one\n")); + fprintf (file, _(" --compat-implib Create backward compatible import libs;\n\ + create __imp_ as well.\n")); + fprintf (file, _(" --enable-auto-image-base Automatically choose image base for DLLs\n\ + unless user specifies one\n")); fprintf (file, _(" --disable-auto-image-base Do not auto-choose image base. (default)\n")); - fprintf (file, _(" --dll-search-prefix= When linking dynamically to a dll witout an\n")); - fprintf (file, _(" importlib, use .dll \n")); - fprintf (file, _(" in preference to lib.dll \n")); - fprintf (file, _(" --enable-auto-import Do sophistcated linking of _sym to \n")); - fprintf (file, _(" __imp_sym for DATA references\n")); + fprintf (file, _(" --dll-search-prefix= When linking dynamically to a dll without an\n\ + importlib, use .dll \n\ + in preference to lib.dll \n")); + fprintf (file, _(" --enable-auto-import Do sophistcated linking of _sym to \n\ + __imp_sym for DATA references\n")); fprintf (file, _(" --disable-auto-import Do not auto-import DATA items from DLLs\n")); - fprintf (file, _(" --enable-extra-pe-debug Enable verbose debug output when building\n")); - fprintf (file, _(" or linking to DLLs (esp. auto-import)\n")); + fprintf (file, _(" --enable-extra-pe-debug Enable verbose debug output when building\n\ + or linking to DLLs (esp. auto-import)\n")); #endif } @@ -449,7 +451,7 @@ set_pe_subsystem () entry = alc_entry; } - lang_add_entry (entry, 1); + lang_add_entry (entry, 0); return; } @@ -587,7 +589,10 @@ gld_${EMULATION_NAME}_parse_args(argc, argv) pe_dll_export_everything = 1; break; case OPTION_EXCLUDE_SYMBOLS: - pe_dll_add_excludes (optarg); + pe_dll_add_excludes (optarg, 0); + break; + case OPTION_EXCLUDE_LIBS: + pe_dll_add_excludes (optarg, 1); break; case OPTION_KILL_ATS: pe_dll_kill_ats = 1; @@ -623,10 +628,10 @@ gld_${EMULATION_NAME}_parse_args(argc, argv) pe_dll_do_default_excludes = 0; break; case OPTION_DLL_ENABLE_AUTO_IMPORT: - link_info.pei386_auto_import = true; + link_info.pei386_auto_import = 1; break; case OPTION_DLL_DISABLE_AUTO_IMPORT: - link_info.pei386_auto_import = false; + link_info.pei386_auto_import = 0; break; case OPTION_ENABLE_EXTRA_PE_DEBUG: pe_dll_extra_pe_debug = 1; @@ -709,7 +714,8 @@ gld_${EMULATION_NAME}_set_symbols () { long val = init[j].value; lang_assignment_statement_type *rv; - rv = lang_add_assignment (exp_assop ('=' ,init[j].symbol, exp_intop (val))); + rv = lang_add_assignment (exp_assop ('=', init[j].symbol, + exp_intop (val))); if (init[j].size == sizeof(short)) *(short *)init[j].ptr = val; else if (init[j].size == sizeof(int)) @@ -752,27 +758,16 @@ gld_${EMULATION_NAME}_after_parse () opened, so registering the symbol as undefined will make a difference. */ - if (! link_info.relocateable && entry_symbol != NULL) - ldlang_add_undef (entry_symbol); + if (! link_info.relocateable && entry_symbol.name != NULL) + ldlang_add_undef (entry_symbol.name); } -/* Previously, pe-dll.c directly accessed pe_data_import_dll, - which was only defined if DLL_SUPPORT. This cause a build - failure on certain targets. At least this function will - exist regardless of whether DLL_SUPPORT is defined or not. - - However, it's still a kludge. pe-dll.c shouldn't directly - call any functions other than the gld_${EMULATION_NAME}_*. */ - -char * -pe_get_data_import_dll_name () -{ -#ifdef DLL_SUPPORT - return pe_data_import_dll; -#else - return "unknown"; -#endif -} +/* pe-dll.c directly accesses pe_data_import_dll, + so it must be defined outside of #ifdef DLL_SUPPORT. + Note - this variable is deliberately not initialised. + This allows it to be treated as a common varaible, and only + exist in one incarnation in a multiple target enabled linker. */ +char * pe_data_import_dll; #ifdef DLL_SUPPORT static struct bfd_link_hash_entry *pe_undef_found_sym; @@ -917,8 +912,9 @@ pe_find_data_imports () sym = bfd_link_hash_lookup (link_info.hash, buf, 0, 0, 1); if (sym && sym->type == bfd_link_hash_defined) { - einfo (_("Warning: resolving %s by linking to %s (auto-import)\n"), - undef->root.string, buf); + if (link_info.pei386_auto_import == -1) + info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"), + undef->root.string, buf); { bfd *b = sym->u.def.section->owner; asymbol **symbols; @@ -1422,10 +1418,10 @@ gld_${EMULATION_NAME}_finish () sprintf_vma (buffer + 2, val); - if (entry_symbol != NULL && entry_from_cmdline) + if (entry_symbol.name != NULL && entry_from_cmdline) einfo (_("%P: warning: '--thumb-entry %s' is overriding '-e %s'\n"), - thumb_entry_symbol, entry_symbol); - entry_symbol = buffer; + thumb_entry_symbol, entry_symbol.name); + entry_symbol.name = buffer; } else einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol); @@ -1653,7 +1649,7 @@ gld_${EMULATION_NAME}_place_orphan (file, s) lang_leave_output_section_statement ((bfd_vma) 0, "*default*", - (struct lang_output_section_phdr_list *) NULL, "*default*"); + (struct lang_output_section_phdr_list *) NULL, NULL); if (config.build_constructors && *ps == '\0') { @@ -1672,7 +1668,7 @@ gld_${EMULATION_NAME}_place_orphan (file, s) stat_ptr = old; - if (place != NULL) + if (place != NULL && os->bfd_section != NULL) { asection *snew, **pps; @@ -1697,16 +1693,15 @@ gld_${EMULATION_NAME}_place_orphan (file, s) if (place->section != NULL) { - /* Unlink the section. */ + /* Unlink the section. */ for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next) ; - *pps = snew->next; + bfd_section_list_remove (output_bfd, pps); /* Now tack it on to the "place->os" section list. */ - snew->next = *place->section; - *place->section = snew; + bfd_section_list_insert (output_bfd, place->section, snew); } /* Save the end of this list. Further ophans of this type will @@ -1949,6 +1944,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = gld_${EMULATION_NAME}_unrecognized_file, gld_${EMULATION_NAME}_list_options, gld_${EMULATION_NAME}_recognized_file, - gld_${EMULATION_NAME}_find_potential_libraries + gld_${EMULATION_NAME}_find_potential_libraries, + NULL /* new_vers_pattern */ }; EOF