ld/emultempl/elf32.em trusts inode numbers even under Mingwin

Zack Weinberg zack@codesourcery.com
Fri Feb 11 23:39:00 GMT 2005


On Thu, 2005-02-10 at 08:18 +1030, Alan Modra wrote:
>       /* If we have already included this dynamic object in the
> 	 link, just ignore it.  There is no reason to include a
> 	 particular dynamic object more than once.  */
>       if (ret > 0)
> 	return TRUE;

Great, so, how about this revised patch?

zw
-------------- next part --------------
===================================================================
Index: ld/emultempl/elf32.em
--- ld/emultempl/elf32.em	3 Feb 2005 14:12:54 -0000	1.127
+++ ld/emultempl/elf32.em	11 Feb 2005 20:00:30 -0000
@@ -231,8 +231,16 @@ gld${EMULATION_NAME}_stat_needed (lang_i
       return;
     }
 
+  /* Some operating systems, e.g. Windows, do not provide a meaningful
+     st_ino; they always set it to zero.  (Windows does provide a
+     meaningful st_dev.)  Do not indicate a duplicate library in that
+     case.  While there is no guarantee that a system that provides
+     meaningful inode numbers will never set st_ino to zero, this is
+     merely an optimization, so we do not need to worry about false
+     negatives.  */
   if (st.st_dev == global_stat.st_dev
-      && st.st_ino == global_stat.st_ino)
+      && st.st_ino == global_stat.st_ino
+      && st.st_ino != 0)
     {
       global_found = TRUE;
       return;


More information about the Binutils mailing list