From e1c37eb57ebf5a431a508918321a1f07fc3025ac Mon Sep 17 00:00:00 2001 From: Dave Korn Date: Sat, 3 Jan 2009 18:04:16 +0000 Subject: * NEWS: Mention new feature --exclude-modules-for-implib. * ld.texinfo: Document new --exclude-modules-for-implib option. * pe-dll.c (exclude_list_struct): Change type member from int to new enumeration exclude_type. (pe_dll_add_excludes): Accept exclude_type instead of int param. (auto_export): Replace magic constants by exclude_type values and handle new choice EXCLUDEFORIMPLIB. (pe_dll_generate_implib): Accept a pointer to the link_info and iterate all input BFDs looking for EXCLUDEFORIMPLIB modules; re-open fresh BFDs for any found and link into import lib archive chain. * pe-dll.h (exclude_type): Add new enumerated type to replace magic constants previously used for exclude_list_struct type member. (pe_dll_add_excludes, pe_dll_generate_implib): Update prototypes. * pep-dll.h (exclude_type, pe_dll_add_excludes, pe_dll_generate_implib): Likewise to all the above. * emultempl/pe.em (OPTION_EXCLUDE_MODULES_FOR_IMPLIB): Define new getopts long option code for new --exclude-modules-for-implib option. (gld${EMULATION_NAME}_add_options): Add new entry to xtra_long[]. (gld_${EMULATION_NAME}_list_options): List usage for it. (gld${EMULATION_NAME}_handle_option): Use exclude_type enumerated values when calling pe_dll_add_excludes, and handle EXCLUDEFORIMPLIB. (gld_${EMULATION_NAME}_finish): Pass pointer to link_info when calling pe_dll_generate_implib. * emultempl/pep.em (options): Define new enumerated value for getopts long option code for new --exclude-modules-for-implib option. (gld${EMULATION_NAME}_add_options, gld_${EMULATION_NAME}_list_options, gld${EMULATION_NAME}_handle_option, gld_${EMULATION_NAME}_finish): Again, likewise to all the above. --- ld/emultempl/pe.em | 15 ++++++++++++--- ld/emultempl/pep.em | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'ld/emultempl') diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 43c0be3..f902812 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -207,6 +207,8 @@ gld_${EMULATION_NAME}_before_parse (void) (OPTION_LARGE_ADDRESS_AWARE + 1) #define OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2 \ (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1 + 1) +#define OPTION_EXCLUDE_MODULES_FOR_IMPLIB \ + (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2 + 1) static void gld${EMULATION_NAME}_add_options @@ -240,6 +242,7 @@ gld${EMULATION_NAME}_add_options {"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL}, {"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS}, {"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS}, + {"exclude-modules-for-implib", required_argument, NULL, OPTION_EXCLUDE_MODULES_FOR_IMPLIB}, {"kill-at", no_argument, NULL, OPTION_KILL_ATS}, {"add-stdcall-alias", no_argument, NULL, OPTION_STDCALL_ALIASES}, {"enable-stdcall-fixup", no_argument, NULL, OPTION_ENABLE_STDCALL_FIXUP}, @@ -341,6 +344,9 @@ gld_${EMULATION_NAME}_list_options (FILE *file) fprintf (file, _(" --enable-stdcall-fixup Link _sym to _sym@nn without warnings\n")); fprintf (file, _(" --exclude-symbols sym,sym,... Exclude symbols from automatic export\n")); fprintf (file, _(" --exclude-libs lib,lib,... Exclude libraries from automatic export\n")); + fprintf (file, _(" --exclude-modules-for-implib mod,mod,...\n")); + fprintf (file, _(" Exclude objects, archive members from auto\n")); + fprintf (file, _(" export, place into import library instead.\n")); fprintf (file, _(" --export-all-symbols Automatically export all globals to DLL\n")); fprintf (file, _(" --kill-at Remove @nn from exported symbols\n")); fprintf (file, _(" --out-implib Generate import library\n")); @@ -598,10 +604,13 @@ gld${EMULATION_NAME}_handle_option (int optc) pe_dll_export_everything = 1; break; case OPTION_EXCLUDE_SYMBOLS: - pe_dll_add_excludes (optarg, 0); + pe_dll_add_excludes (optarg, EXCLUDESYMS); break; case OPTION_EXCLUDE_LIBS: - pe_dll_add_excludes (optarg, 1); + pe_dll_add_excludes (optarg, EXCLUDELIBS); + break; + case OPTION_EXCLUDE_MODULES_FOR_IMPLIB: + pe_dll_add_excludes (optarg, EXCLUDEFORIMPLIB); break; case OPTION_KILL_ATS: pe_dll_kill_ats = 1; @@ -1584,7 +1593,7 @@ gld_${EMULATION_NAME}_finish (void) { pe_dll_fill_sections (link_info.output_bfd, &link_info); if (pe_implib_filename) - pe_dll_generate_implib (pe_def_file, pe_implib_filename); + pe_dll_generate_implib (pe_def_file, pe_implib_filename, &link_info); } #if defined(TARGET_IS_shpe) || defined(TARGET_IS_mipspe) /* ARM doesn't need relocs. */ diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index 35fd6e0..721fc23 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -175,7 +175,8 @@ enum options OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC, OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC, OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1, - OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2 + OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2, + OPTION_EXCLUDE_MODULES_FOR_IMPLIB }; static void @@ -213,6 +214,7 @@ gld${EMULATION_NAME}_add_options {"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL}, {"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS}, {"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS}, + {"exclude-modules-for-implib", required_argument, NULL, OPTION_EXCLUDE_MODULES_FOR_IMPLIB}, {"kill-at", no_argument, NULL, OPTION_KILL_ATS}, {"add-stdcall-alias", no_argument, NULL, OPTION_STDCALL_ALIASES}, {"enable-stdcall-fixup", no_argument, NULL, OPTION_ENABLE_STDCALL_FIXUP}, @@ -307,6 +309,9 @@ gld_${EMULATION_NAME}_list_options (FILE *file) fprintf (file, _(" --enable-stdcall-fixup Link _sym to _sym@nn without warnings\n")); fprintf (file, _(" --exclude-symbols sym,sym,... Exclude symbols from automatic export\n")); fprintf (file, _(" --exclude-libs lib,lib,... Exclude libraries from automatic export\n")); + fprintf (file, _(" --exclude-modules-for-implib mod,mod,...\n")); + fprintf (file, _(" Exclude objects, archive members from auto\n")); + fprintf (file, _(" export, place into import library instead.\n")); fprintf (file, _(" --export-all-symbols Automatically export all globals to DLL\n")); fprintf (file, _(" --kill-at Remove @nn from exported symbols\n")); fprintf (file, _(" --out-implib Generate import library\n")); @@ -559,10 +564,13 @@ gld${EMULATION_NAME}_handle_option (int optc) pep_dll_export_everything = 1; break; case OPTION_EXCLUDE_SYMBOLS: - pep_dll_add_excludes (optarg, 0); + pep_dll_add_excludes (optarg, EXCLUDESYMS); break; case OPTION_EXCLUDE_LIBS: - pep_dll_add_excludes (optarg, 1); + pep_dll_add_excludes (optarg, EXCLUDELIBS); + break; + case OPTION_EXCLUDE_MODULES_FOR_IMPLIB: + pep_dll_add_excludes (optarg, EXCLUDEFORIMPLIB); break; case OPTION_KILL_ATS: pep_dll_kill_ats = 1; @@ -1386,7 +1394,7 @@ gld_${EMULATION_NAME}_finish (void) { pep_dll_fill_sections (link_info.output_bfd, &link_info); if (pep_implib_filename) - pep_dll_generate_implib (pep_def_file, pep_implib_filename); + pep_dll_generate_implib (pep_def_file, pep_implib_filename, &link_info); } if (pep_out_def_filename) -- cgit v1.1