? no-relocate.patch
Index: pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.23
diff -u -p -r1.23 pe-dll.c
--- pe-dll.c	2001/03/13 06:14:27	1.23
+++ pe-dll.c	2001/07/23 06:23:21
@@ -63,6 +63,7 @@ int pe_dll_kill_ats = 0;
 int pe_dll_stdcall_aliases = 0;
 int pe_dll_warn_dup_exports = 0;
 int pe_dll_compat_implib = 0;
+int pe_dll_no_relocate = 0; 

 /************************************************************************
 
@@ -484,6 +485,7 @@ build_filler_bfd (include_edata)
      int include_edata;
 {
   lang_input_statement_type *filler_file;
+
   filler_file = lang_add_input_file ("dll stuff",
 				     lang_input_file_is_fake_enum,
 				     NULL);
@@ -517,7 +519,7 @@ build_filler_bfd (include_edata)
   reloc_s = bfd_make_section_old_way (filler_bfd, ".reloc");
   if (reloc_s == NULL
       || !bfd_set_section_flags (filler_bfd, reloc_s,
-				 (SEC_HAS_CONTENTS
+	  			 (SEC_HAS_CONTENTS
 				  | SEC_ALLOC
 				  | SEC_LOAD
 				  | SEC_KEEP
@@ -1914,6 +1916,14 @@ pe_dll_fill_sections (abfd, info)
 
   edata_s->contents = edata_d;
   reloc_s->contents = reloc_d;
+
+  /* if it's not used, remove the reloc setion. 
+   * A better way would be to avoid all the relocation calculations earlier
+   * as it might allow faster execution?
+   * Ditto for the import library
+   */
+  if (pe_dll_no_relocate)
+    _bfd_strip_section_from_output (info, reloc_s);
 }
 
 void
Index: pe-dll.h
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.h,v
retrieving revision 1.3
diff -u -p -r1.3 pe-dll.h
--- pe-dll.h	2001/03/13 06:14:27	1.3
+++ pe-dll.h	2001/07/23 06:23:21
@@ -33,6 +33,7 @@ extern int pe_dll_kill_ats;
 extern int pe_dll_stdcall_aliases;
 extern int pe_dll_warn_dup_exports;
 extern int pe_dll_compat_implib;
+extern int pe_dll_no_relocate;
 
 extern void pe_dll_id_target PARAMS ((const char *));
 extern void pe_dll_add_excludes PARAMS ((const char *));
Index: emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.45
diff -u -p -r1.45 pe.em
--- pe.em	2001/07/11 08:11:16	1.45
+++ pe.em	2001/07/23 06:23:22
@@ -191,6 +191,7 @@ gld_${EMULATION_NAME}_before_parse()
 #define OPTION_DISABLE_AUTO_IMAGE_BASE	(OPTION_ENABLE_AUTO_IMAGE_BASE + 1)
 #define OPTION_DLL_SEARCH_PREFIX	(OPTION_DISABLE_AUTO_IMAGE_BASE + 1)
 #define OPTION_NO_DEFAULT_EXCLUDES	(OPTION_DLL_SEARCH_PREFIX + 1)
+#define OPTION_NO_RELOCATE		(OPTION_NO_DEFAULT_EXCLUDES +1)
 
 static struct option longopts[] = {
   /* PE options */
@@ -228,6 +229,7 @@ static struct option longopts[] = {
   {"disable-auto-image-base", no_argument, NULL, OPTION_DISABLE_AUTO_IMAGE_BASE},
   {"dll-search-prefix", required_argument, NULL, OPTION_DLL_SEARCH_PREFIX},
   {"no-default-excludes", no_argument, NULL, OPTION_NO_DEFAULT_EXCLUDES},
+  {"no-relocate", no_argument, NULL, OPTION_NO_RELOCATE},
 #endif
   {NULL, no_argument, NULL, 0}
 };
@@ -313,6 +315,7 @@ gld_${EMULATION_NAME}_list_options (file
   fprintf (file, _("  --dll-search-prefix=<string>       When linking dynamically to a dll witout an\n"));
   fprintf (file, _("                                       importlib, use <string><basename>.dll \n"));
   fprintf (file, _("                                       in preference to lib<basename>.dll \n"));
+  fprintf (file, _("  --no-relocate                      Generate a non-relocatable dll. \n"));
 #endif
 }
 
@@ -582,6 +585,9 @@ gld_${EMULATION_NAME}_parse_args(argc, a
       break;
     case OPTION_NO_DEFAULT_EXCLUDES:
       pe_dll_do_default_excludes = 0;
+      break;
+    case OPTION_NO_RELOCATE:
+      pe_dll_no_relocate = 1;
       break;
 #endif
     }
