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]

[PATCH] Change export behavior for PE files


Hi!

I guess this one will not get accepted and you'll tell me that it's not bug, but feature. Anyway I decided to at least try to push this patch since I need to generate export-less DLLs and I don't see any other way to do it when "-shared" is used.

Regards,
Filip
2005-03-11  Filip Navara  <navaraf@reactos.com>

	* ld/pe-dll.c (process_def_file, pe_dll_build_sections,
	pe_dll_fill_sections): Don't export all symbols for shared
	libraries when --export-all-symbols is not specified and
	no .def file is specified.

--- ld/pe-dll.c	Sun Oct 24 03:00:12 2004
+++ ld/pe-dll.c	Fri Mar 11 14:36:31 2005
@@ -526,8 +542,7 @@
 
   /* 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 (!pe_dll_export_everything && pe_def_file->num_exports == 0)
     return;
 
   /* Now, maybe export everything else the default way.  */
@@ -2630,8 +2701,13 @@
   if (pe_def_file->num_exports == 0 && !info->shared)
     return;
 
-  generate_edata (abfd, info);
-  build_filler_bfd (1);
+  if (pe_def_file->num_exports > 0)
+    {
+      generate_edata (abfd, info);
+      build_filler_bfd (1);
+    }
+  else
+    build_filler_bfd (0);
 }
 
 void
@@ -2663,13 +2739,16 @@
       lang_do_assignments (stat_ptr->head, abs_output_section, NULL, 0);
     }
 
-  fill_edata (abfd, info);
-
   if (info->shared && !info->pie)
     pe_data (abfd)->dll = 1;
 
-  edata_s->contents = edata_d;
   reloc_s->contents = reloc_d;
+
+  if (pe_def_file->num_exports > 0)
+    {
+      fill_edata (abfd, info);
+      edata_s->contents = edata_d;
+    }
 }
 
 void

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