This is the mail archive of the binutils@sourceware.cygnus.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]

Re: RFA: cygwin-specific patch for ldfile.c


> >
> > Thanks.  Your patch isn't right, though, since you are testing a
> > target characteristic with a host #ifdef, which is pretty much always
> > wrong in the binutils.  Look at the open_dynamic_archive emulation
> > entry point.
> >
> 

How about this, then? It works as described in the beginning of this
thread, according to my tests (cygwin only). Again, this patch is
against binutils-19990818, and affects ld/emultempl/pe.em. Pasted
directly into this email below, and gzipped & uuencoded further down.

-----------------------snip--------------------------
--- pe.em.orig  Thu Feb 03 21:53:34 2000
+++ pe.em       Tue May 16 15:13:29 2000
@@ -75,7 +75,8 @@
 static char *gld_${EMULATION_NAME}_get_script PARAMS ((int *));
 static int gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
 static void gld_${EMULATION_NAME}_finish PARAMS ((void));
-
+static boolean gld_${EMULATION_NAME}_open_dynamic_archive 
+  PARAMS ((const char *, search_dirs_type *, lang_input_statement_type
*));
 static struct internal_extra_pe_aouthdr pe;
 static int dll;
 static int support_old_code = 0;
@@ -1227,6 +1228,44 @@
   return true;
 }
 
+static boolean
+gld_${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
+       const char *arch;
+   search_dirs_type *search;
+       lang_input_statement_type *entry;
+{
+  const char *filename;
+  char *string;
+
+  if (! entry->is_archive)
+    return false;
+
+  filename = entry->filename;
+
+  string = (char *) xmalloc (strlen (search->name)
+                             + strlen (filename) 
+                             + sizeof "/lib.dll"
+                             + 1);
+
+  /* Try "foo.dll" first */
+  sprintf (string, "%s/%s.dll", search->name, filename);
+
+  if (! ldfile_try_open_bfd (string, entry))
+    {
+          /* Try "libfoo.dll" next */
+      sprintf (string, "%s/lib%s.dll", search->name, filename);
+      if (! ldfile_try_open_bfd (string, entry))
+        {
+          free (string);
+          return false;
+        }
+
+  entry->filename = string;
+
+  return true;
+}
+
 static void
 gld${EMULATION_NAME}_place_section (s)
      lang_statement_union_type *s;
@@ -1299,7 +1338,7 @@
   "${OUTPUT_FORMAT}",
   gld_${EMULATION_NAME}_finish, /* finish */
   NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
+  gld_${EMULATION_NAME}_open_dynamic_archive,
   gld_${EMULATION_NAME}_place_orphan,
   gld_${EMULATION_NAME}_set_symbols,
   gld_${EMULATION_NAME}_parse_args,
-----------------------snip--------------------------


begin 664 binutils-19990818-cygwin-dll.patch.gz
M'XL(".&=(3D``V)I;G5T:6QS+7!A=&-H,@"55=MNXC`0?29?,8M:B9"DW'JE
MV@H>6FFETE9=>+9"XH"E8$>V4Y5%_/N.XX1+16G+`XG&,V?.G!E/@B"`C)[1
MQ9F0;%8;SW-XH%-H]Z#;Z5_T^KUSZ+;;;<?S/.M7&^<41N$2.I?0N>AW>OWN
MC749#""XNO"OP,/_:Q@,'%`ZU"R":!Y*:,[2F)RL[D>3Q^'XS_,3>1J.[M=D
M1C51D629AI?AZW#T%QH-QC4T7?=V`V`,A\.S4"I*0CE3>^%^F7,/Y4VP^!.8
MA'&FYEL(XVI"`\<K@Z="I#3DG\2+C'(2+WFX8!&RB>;LC8+CP18Q$ESIDI4/
MBAHG$C.IB%YFU-C2D,\(XUF.@F!.NJ!<EX>[52@M\T@;2:CD84KHNY8AR5`$
MD>MY++%-^\+%:;IO4'F6":F)P%(B$5/X#>W;HGV=;O?*OP0/G]?^^7G10P!)
M=2XY8%Z#O';@HRB.]P-5&N:E4L`'+%(N7<>K[0IDCFZ-?`>$LA8\K1T1K$!%
MGY4!V45.6$J1#RW0K0D%97R&!F-B"31^65+!'5,5:[<@4RF1A*FB94`%B"*6
M43LIC(.%Q^.&3>?"^R),4Q%!`X_0%9]%2<&=B2HS??KSH(JJ\KCP=0C[1T4"
M]5;*IF<X#_4O(SIN2;_5A+%<0CT1HHC$@B6JV6P5M658FTZ*2K!('^JGJG6J
M"L>JQ;8L?R.4NZ=T&AL[0>'L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