Next release/allow PE executables to have an export table

Danny Smith danny_r_smith_2001@yahoo.co.nz
Tue Apr 1 23:07:00 GMT 2003


 --- Daniel Jacobowitz <drow@mvista.com> wrote: > 

.  Similarly if
> you have any interesting features you're planning to contribute soon, etc. 
> When I've got a handle on how much needs to settle down before we can
> branch, I'll post a schedule.
> 

Hi, the patch to allow PE executables to have an export table was awaiting
copyright assignment from submitter Fabrizio Gennari.  I understand that is now
cleared.

Here is Fabrizio's patch again, combined with a correction from me for
relocateable output.

2003-04-01  Danny Smith <dannysmith@users.sourceforge.net>

	* emultempl/pe.em (gld_${EMULATION_NAME}_after_open):
	Don't call pe_dll_build_section() if link_info.relocateable.
	(gld_${EMULATION_NAME}_finish): Don't call pe_dll_fill_sections()
	if link_info.relocateable.

2003-04-01  Fabrizio Gennari  <fabrizio.ge@tiscalinet.it>

	* 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): Conditionalize setting
	abfd->dll true on info->shared
	* 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.


Index: pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.55
diff -c -3 -p -r1.55 pe-dll.c
*** pe-dll.c	21 Feb 2003 10:51:24 -0000	1.55
--- pe-dll.c	1 Apr 2003 23:03:40 -0000
*************** process_def_file (abfd, info)
*** 564,569 ****
--- 564,576 ----
  	}
      }
  
+   /* 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)
      {
*************** pe_dll_build_sections (abfd, info)
*** 2666,2671 ****
--- 2673,2681 ----
    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);
  }
*************** pe_dll_fill_sections (abfd, info)
*** 2707,2713 ****
  
    fill_edata (abfd, info);
  
!   pe_data (abfd)->dll = 1;
  
    edata_s->contents = edata_d;
    reloc_s->contents = reloc_d;
--- 2717,2724 ----
  
    fill_edata (abfd, info);
  
!   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.76
diff -c -3 -p -r1.76 pe.em
*** emultempl/pe.em	28 Feb 2003 01:32:30 -0000	1.76
--- emultempl/pe.em	1 Apr 2003 23:03:43 -0000
*************** gld_${EMULATION_NAME}_after_open ()
*** 1019,1025 ****
--- 1019,1029 ----
  
    pe_find_data_imports ();
  
+ #if ! (defined (TARGET_IS_i386pe) || defined (TARGET_IS_armpe))
    if (link_info.shared)
+ #else
+   if (!link_info.relocateable)
+ #endif
      pe_dll_build_sections (output_bfd, &link_info);
  
  #ifndef TARGET_IS_i386pe
*************** gld_${EMULATION_NAME}_finish ()
*** 1456,1462 ****
  #endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) */
  
  #ifdef DLL_SUPPORT
!   if (link_info.shared)
      {
        pe_dll_fill_sections (output_bfd, &link_info);
        if (pe_implib_filename)
--- 1460,1470 ----
  #endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) */
  
  #ifdef DLL_SUPPORT
!   if (link_info.shared
! #if !defined(TARGET_IS_shpe) && !defined(TARGET_IS_mipspe)
!     || (!link_info.relocateable && pe_def_file->num_exports != 0)
! #endif
!     )
      {
        pe_dll_fill_sections (output_bfd, &link_info);
        if (pe_implib_filename)

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.



More information about the Binutils mailing list