(gld${EMULATION_NAME}_add_options): Add new --exclude-all-symbols option
to exclude all symbols from automatic export.
(gld_${EMULATION_NAME}_list_options): Describe it.
(gld${EMULATION_NAME}_handle_option): Handle it.
* emultempl/pep.em: Likewise to all the above.
* pe-dll.c (pe_dll_exclude_all_symbols): New variable.
(process_def_file_and_drectve): Use it.
* pe-dll.h (pe_dll_exclude_all_symbols): Declare.
* pep-dll.c (pep_dll_exclude_all_symbols): Define pep_ alias.
* pep-dll.h (pe_dll_exclude_all_symbols): Declare.
* NEWS: Mention the new feature.
* ld.texinfo: Document the new command line switch.
+2009-10-16 Dimitry Gorbachev <d.g.gorbachev@gmail.com>
+
+ * emultempl/pe.em (OPTION_EXCLUDE_ALL_SYMBOLS): New macro.
+ (gld${EMULATION_NAME}_add_options): Add new --exclude-all-symbols option
+ to exclude all symbols from automatic export.
+ (gld_${EMULATION_NAME}_list_options): Describe it.
+ (gld${EMULATION_NAME}_handle_option): Handle it.
+ * emultempl/pep.em: Likewise to all the above.
+ * pe-dll.c (pe_dll_exclude_all_symbols): New variable.
+ (process_def_file_and_drectve): Use it.
+ * pe-dll.h (pe_dll_exclude_all_symbols): Declare.
+ * pep-dll.c (pep_dll_exclude_all_symbols): Define pep_ alias.
+ * pep-dll.h (pe_dll_exclude_all_symbols): Declare.
+ * NEWS: Mention the new feature.
+ * ld.texinfo: Document the new command line switch.
+
2009-10-14 Andreas Schwab <schwab@linux-m68k.org>
* ldlex.l (yy_input): Remove second argument and return the value
-*- text -*-
+* Add --exlcude-all-symbols option to PE based linkers. This prevents all
+ symbols from automatically being exported.
+
* Add support for the Renesas RX processor.
Changes in 2.20:
#define OPTION_OUT_DEF (OPTION_SUPPORT_OLD_CODE + 1)
#define OPTION_EXPORT_ALL (OPTION_OUT_DEF + 1)
#define OPTION_EXCLUDE_SYMBOLS (OPTION_EXPORT_ALL + 1)
-#define OPTION_KILL_ATS (OPTION_EXCLUDE_SYMBOLS + 1)
+#define OPTION_EXCLUDE_ALL_SYMBOLS (OPTION_EXCLUDE_SYMBOLS + 1)
+#define OPTION_KILL_ATS (OPTION_EXCLUDE_ALL_SYMBOLS + 1)
#define OPTION_STDCALL_ALIASES (OPTION_KILL_ATS + 1)
#define OPTION_ENABLE_STDCALL_FIXUP (OPTION_STDCALL_ALIASES + 1)
#define OPTION_DISABLE_STDCALL_FIXUP (OPTION_ENABLE_STDCALL_FIXUP + 1)
{"output-def", required_argument, NULL, OPTION_OUT_DEF},
{"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL},
{"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS},
+ {"exclude-all-symbols", no_argument, NULL, OPTION_EXCLUDE_ALL_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},
fprintf (file, _(" --disable-stdcall-fixup Don't link _sym to _sym@nn\n"));
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-all-symbols Exclude all 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"));
case OPTION_EXCLUDE_SYMBOLS:
pe_dll_add_excludes (optarg, EXCLUDESYMS);
break;
+ case OPTION_EXCLUDE_ALL_SYMBOLS:
+ pe_dll_exclude_all_symbols = 1;
+ break;
case OPTION_EXCLUDE_LIBS:
pe_dll_add_excludes (optarg, EXCLUDELIBS);
break;
OPTION_OUT_DEF,
OPTION_EXPORT_ALL,
OPTION_EXCLUDE_SYMBOLS,
+ OPTION_EXCLUDE_ALL_SYMBOLS,
OPTION_KILL_ATS,
OPTION_STDCALL_ALIASES,
OPTION_ENABLE_STDCALL_FIXUP,
{"output-def", required_argument, NULL, OPTION_OUT_DEF},
{"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL},
{"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS},
+ {"exclude-all-symbols", no_argument, NULL, OPTION_EXCLUDE_ALL_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},
fprintf (file, _(" --disable-stdcall-fixup Don't link _sym to _sym@nn\n"));
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-all-symbols Exclude all 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"));
case OPTION_EXCLUDE_SYMBOLS:
pep_dll_add_excludes (optarg, EXCLUDESYMS);
break;
+ case OPTION_EXCLUDE_ALL_SYMBOLS:
+ pep_dll_exclude_all_symbols = 1;
+ break;
case OPTION_EXCLUDE_LIBS:
pep_dll_add_excludes (optarg, EXCLUDELIBS);
break;
exported. The symbol names may be delimited by commas or colons.
[This option is specific to the i386 PE targeted port of the linker]
+@kindex --exclude-all-symbols
+@item --exclude-all-symbols
+Specifies no symbols should be automatically exported.
+[This option is specific to the i386 PE targeted port of the linker]
+
@kindex --file-alignment
@item --file-alignment
Specify the file alignment. Sections in the file will always begin at
def_file * pe_def_file = 0;
int pe_dll_export_everything = 0;
+int pe_dll_exclude_all_symbols = 0;
int pe_dll_do_default_excludes = 1;
int pe_dll_kill_ats = 0;
int pe_dll_stdcall_aliases = 0;
}
}
- /* If we are not building a DLL, when there are no exports
- we do not build an export table at all. */
- if (!pe_dll_export_everything && pe_def_file->num_exports == 0
- && info->executable)
+ /* If we are building an executable and there is nothing
+ to export, we do not build an export table at all. */
+ if (info->executable && pe_def_file->num_exports == 0
+ && (!pe_dll_export_everything || pe_dll_exclude_all_symbols))
return;
/* Now, maybe export everything else the default way. */
- if (pe_dll_export_everything || pe_def_file->num_exports == 0)
+ if ((pe_dll_export_everything || pe_def_file->num_exports == 0)
+ && !pe_dll_exclude_all_symbols)
{
for (b = info->input_bfds; b; b = b->link_next)
{
extern def_file *pe_def_file;
extern int pe_dll_export_everything;
+extern int pe_dll_exclude_all_symbols;
extern int pe_dll_do_default_excludes;
extern int pe_dll_kill_ats;
extern int pe_dll_stdcall_aliases;
extern bfd_boolean pe_bfd_is_dll
(bfd *);
extern void pe_output_file_set_long_section_names
- (bfd *abfd);
-
+ (bfd *);
#endif /* PE_DLL_H */
#define pe_dll_compat_implib pep_dll_compat_implib
#define pe_dll_extra_pe_debug pep_dll_extra_pe_debug
#define pe_dll_export_everything pep_dll_export_everything
+#define pe_dll_exclude_all_symbols pep_dll_exclude_all_symbols
#define pe_dll_do_default_excludes pep_dll_do_default_excludes
#define pe_dll_kill_ats pep_dll_kill_ats
#define pe_dll_stdcall_aliases pep_dll_stdcall_aliases
extern def_file * pep_def_file;
extern int pep_dll_export_everything;
+extern int pep_dll_exclude_all_symbols;
extern int pep_dll_do_default_excludes;
extern int pep_dll_kill_ats;
extern int pep_dll_stdcall_aliases;
(struct bfd_link_info *, const char *, int (*) (arelent *, asection *));
extern void pep_create_import_fixup (arelent * rel, asection *, bfd_vma);
extern bfd_boolean pep_bfd_is_dll (bfd *);
-extern void pep_output_file_set_long_section_names
- (bfd *abfd);
+extern void pep_output_file_set_long_section_names (bfd *);
#endif /* PEP_DLL_H */