This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: allow PE executables to have an export table


We do need an assignment from Fabrizio so this can't go in until
that happens.

You might want to submit your unrelated patch separately in the
meantime.

cgf

On Fri, Jan 03, 2003 at 07:07:31AM -0500, Charles Wilson wrote:
>Tested on cygwin, works as advertised.  Updated patch attached (to apply 
>cleanly to current CVS, and hopefully address the formatting issues).
>
>Also, I found that there is a symbol that appears in .exe's that 
>auto-export picks up on, but shouldn't.  So, this patch adds 
>'cygwin_crt0' to the list of exclusions.
>
>--Chuck
>
>2002-12-10  Fabrizio Gennari  <fabrizio.ge@tiscalinet.it>
>
>	* ld/pe-dll.c (process_def_file): don't create an export
>	section if there are no exports and we're building an exe
>	(pe_dll_build_sections): ditto
>	(pe_dll_fill_sections): since this now gets called
>	even when we're building an exe, conditionalize setting
>	abfd->dll true on info->shared
>	* ld/emultempl/pe.em (gld_${EMULATION_NAME}_after_open):
>	if i386pe or armpe, call pe_dll_build_section()
>	for both exe's and dll's, not just dll's.
>	(gld_${EMULATION_NAME}_finish): for all targets except
>	shpe and mipspe, call pe_dll_fill_sections() for both
>	exe's and dll's, not just dll's.
>
>2003-01-03  Charles Wilson  <cwilson@ece.gatech.edu>
>
>	* ld/pe-dll.c (autofilter_symbollist): add cygwin_crt0
>
>

>Index: pe-dll.c
>===================================================================
>RCS file: /cvs/src/src/ld/pe-dll.c,v
>retrieving revision 1.52
>diff -u -u -r1.52 pe-dll.c
>--- pe-dll.c	2 Jan 2003 10:26:41 -0000	1.52
>+++ pe-dll.c	3 Jan 2003 11:50:21 -0000
>@@ -225,6 +225,7 @@
>   { "impure_ptr", 10 },
>   { "_pei386_runtime_relocator", 25 },
>   { "do_pseudo_reloc", 15 },
>+  { "cygwin_crt0", 11 },
>   { NULL, 0 }
> };
> 
>@@ -563,6 +564,12 @@
> 	}
>     }
> 
>+  /* 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->shared))
>+    return;
>+  
>   /* Now, maybe export everything else the default way.  */
>   if (pe_dll_export_everything || pe_def_file->num_exports == 0)
>     {
>@@ -2655,6 +2662,9 @@
>   pe_dll_id_target (bfd_get_target (abfd));
>   process_def_file (abfd, info);
> 
>+  if (pe_def_file->num_exports == 0 && !(info->shared))
>+    return;
>+
>   generate_edata (abfd, info);
>   build_filler_bfd (1);
> }
>@@ -2696,7 +2706,8 @@
> 
>   fill_edata (abfd, info);
> 
>-  pe_data (abfd)->dll = 1;
>+  if (info->shared)
>+    pe_data (abfd)->dll = 1;
> 
>   edata_s->contents = edata_d;
>   reloc_s->contents = reloc_d;
>Index: emultempl/pe.em
>===================================================================
>RCS file: /cvs/src/src/ld/emultempl/pe.em,v
>retrieving revision 1.74
>diff -u -u -r1.74 pe.em
>--- emultempl/pe.em	17 Dec 2002 12:16:38 -0000	1.74
>+++ emultempl/pe.em	3 Jan 2003 11:52:04 -0000
>@@ -1022,8 +1022,11 @@
>   pe_process_import_defs (output_bfd, & link_info);
> 
>   pe_find_data_imports ();
>-
>+#ifndef TARGET_IS_i386pe
>+#ifndef TARGET_IS_armpe
>   if (link_info.shared)
>+#endif
>+#endif
>     pe_dll_build_sections (output_bfd, &link_info);
> 
> #ifndef TARGET_IS_i386pe
>@@ -1460,7 +1463,11 @@
> #endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) */
> 
> #ifdef DLL_SUPPORT
>-  if (link_info.shared)
>+  if (link_info.shared
>+#if !defined(TARGET_IS_shpe) && !defined(TARGET_IS_mipspe)
>+    || pe_def_file->num_exports != 0
>+#endif
>+    )
>     {
>       pe_dll_fill_sections (output_bfd, &link_info);
>       if (pe_implib_filename)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]