public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch ld]: Let binutils understand DOS-paths (3 of 4)
@ 2011-02-28  8:00 Kai Tietz
  2011-02-28 13:41 ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Tietz @ 2011-02-28  8:00 UTC (permalink / raw)
  To: Binutils, Nick Clifton; +Cc: Dave Korn

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

Hello,

ChangeLog ld/
2011-02-27  Kai Tietz

	* emultempl/beos.em (sort_by_file_name): Use filename_(n)cmp.
	* emultempl/elf32.em (gld${EMULATION_NAME}_vercheck):
	Likewise.
	(gld${EMULATION_NAME}_stat_needed): Likewise.
	(gld${EMULATION_NAME}_check_needed): Likewise.
	* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise.
	(gld_${EMULATION_NAME}_unrecognized_file): Likewise.
	* emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
	(gld_${EMULATION_NAME}_unrecognized_file): Likewise.
	* ldfile.c (ldfile_open_file): Likewise.
	* ldlang.c (wild_sort): Likewise.
	(lookup_name): Likewise.
	(check_excluded_libs): Likewise.
	* ldmisc.c (vfinfo): Likewise.
	* pe-dll.c (libnamencmp): Likewise.
	(auto_export): Likewise.
	(pe_dll_generate_implib): Likewise.
	* testplug.c (onclaim_file): Likewise.

Tested for x86_64-w64-mingw32, i686-pc-cygwin, and
x86_64-pc-linux-gnu. Ok for apply?

Regards,
Kai

[-- Attachment #2: ld_filename.txt --]
[-- Type: text/plain, Size: 14221 bytes --]

Index: src/ld/emultempl/beos.em
===================================================================
--- src.orig/ld/emultempl/beos.em	2011-02-26 23:06:34.147909100 +0100
+++ src/ld/emultempl/beos.em	2011-02-27 12:09:12.716398100 +0100
@@ -40,6 +40,7 @@ fragment <<EOF
 #include "bfdlink.h"
 #include "getopt.h"
 #include "libiberty.h"
+#include "filenames.h"
 #include "ld.h"
 #include "ldmain.h"
 #include "ldexp.h"
@@ -396,13 +397,13 @@ sort_by_file_name (const void *a, const
   const lang_statement_union_type *const *rb = b;
   int i, a_sec, b_sec;
 
-  i = strcmp ((*ra)->input_section.section->owner->my_archive->filename,
-	      (*rb)->input_section.section->owner->my_archive->filename);
+  i = filename_cmp ((*ra)->input_section.section->owner->my_archive->filename,
+		    (*rb)->input_section.section->owner->my_archive->filename);
   if (i != 0)
     return i;
 
-  i = strcmp ((*ra)->input_section.section->owner->filename,
-		 (*rb)->input_section.section->owner->filename);
+  i = filename_cmp ((*ra)->input_section.section->owner->filename,
+		    (*rb)->input_section.section->owner->filename);
   if (i != 0)
     return i;
   /* the tail idata4/5 are the only ones without relocs to an
Index: src/ld/emultempl/elf32.em
===================================================================
--- src.orig/ld/emultempl/elf32.em	2011-02-26 23:06:34.148909100 +0100
+++ src/ld/emultempl/elf32.em	2011-02-27 12:09:12.726398700 +0100
@@ -40,6 +40,7 @@ fragment <<EOF
 #include "sysdep.h"
 #include "bfd.h"
 #include "libiberty.h"
+#include "filenames.h"
 #include "safe-ctype.h"
 #include "getopt.h"
 #include "md5.h"
@@ -200,7 +201,7 @@ gld${EMULATION_NAME}_vercheck (lang_inpu
     {
       const char *suffix;
 
-      if (strcmp (soname, l->name) == 0)
+      if (filename_cmp (soname, l->name) == 0)
 	{
 	  /* Probably can't happen, but it's an easy check.  */
 	  continue;
@@ -215,7 +216,7 @@ gld${EMULATION_NAME}_vercheck (lang_inpu
 
       suffix += sizeof ".so." - 1;
 
-      if (strncmp (soname, l->name, suffix - l->name) == 0)
+      if (filename_ncmp (soname, l->name, suffix - l->name) == 0)
 	{
 	  /* Here we know that S is a dynamic object FOO.SO.VER1, and
 	     the object we are considering needs a dynamic object
@@ -290,7 +291,7 @@ gld${EMULATION_NAME}_stat_needed (lang_i
   if (soname == NULL)
     soname = lbasename (s->filename);
 
-  if (strncmp (soname, global_needed->name, suffix - global_needed->name) == 0)
+  if (filename_ncmp (soname, global_needed->name, suffix - global_needed->name) == 0)
     einfo ("%P: warning: %s, needed by %B, may conflict with %s\n",
 	   global_needed->name, global_needed->by, soname);
 }
@@ -855,7 +856,7 @@ gld${EMULATION_NAME}_check_needed (lang_
       && (bfd_elf_get_dyn_lib_class (s->the_bfd) & DYN_AS_NEEDED) != 0)
     return;
 
-  if (strcmp (s->filename, global_needed->name) == 0)
+  if (filename_cmp (s->filename, global_needed->name) == 0)
     {
       global_found = s;
       return;
@@ -865,7 +866,7 @@ gld${EMULATION_NAME}_check_needed (lang_
     {
       const char *f = strrchr (s->filename, '/');
       if (f != NULL
-	  && strcmp (f + 1, global_needed->name) == 0)
+	  && filename_cmp (f + 1, global_needed->name) == 0)
 	{
 	  global_found = s;
 	  return;
@@ -874,7 +875,7 @@ gld${EMULATION_NAME}_check_needed (lang_
 
   soname = bfd_elf_get_dt_soname (s->the_bfd);
   if (soname != NULL
-      && strcmp (soname, global_needed->name) == 0)
+      && filename_cmp (soname, global_needed->name) == 0)
     {
       global_found = s;
       return;
Index: src/ld/emultempl/pe.em
===================================================================
--- src.orig/ld/emultempl/pe.em	2011-02-26 23:06:34.149909100 +0100
+++ src/ld/emultempl/pe.em	2011-02-27 12:09:12.740399500 +0100
@@ -56,6 +56,7 @@ fragment <<EOF
 #include "bfdlink.h"
 #include "getopt.h"
 #include "libiberty.h"
+#include "filenames.h"
 #include "ld.h"
 #include "ldmain.h"
 #include "ldexp.h"
@@ -1405,8 +1406,9 @@ gld_${EMULATION_NAME}_after_open (void)
 			    ? bfd_get_filename (blhe->u.def.section->owner->my_archive)
 			    : bfd_get_filename (blhe->u.def.section->owner);
 
-			if (strcmp (bfd_get_filename (is->the_bfd->my_archive),
-				    other_bfd_filename) == 0)
+			if (filename_cmp (bfd_get_filename
+					    (is->the_bfd->my_archive),
+					  other_bfd_filename) == 0)
 			  continue;
 
 			/* Rename this implib to match the other one.  */
@@ -1460,7 +1462,7 @@ gld_${EMULATION_NAME}_after_open (void)
 		       extension, and use that for the remainder of the
 		       comparisons.  */
 		    pnt = strrchr (is3->the_bfd->filename, '.');
-		    if (pnt != NULL && strcmp (pnt, ".dll") == 0)
+		    if (pnt != NULL && filename_cmp (pnt, ".dll") == 0)
 		      break;
 		  }
 
@@ -1477,11 +1479,11 @@ gld_${EMULATION_NAME}_after_open (void)
 			/* Skip static members, ie anything with a .obj
 			   extension.  */
 			pnt = strrchr (is2->the_bfd->filename, '.');
-			if (pnt != NULL && strcmp (pnt, ".obj") == 0)
+			if (pnt != NULL && filename_cmp (pnt, ".obj") == 0)
 			  continue;
 
-			if (strcmp (is3->the_bfd->filename,
-				    is2->the_bfd->filename))
+			if (filename_cmp (is3->the_bfd->filename,
+					  is2->the_bfd->filename))
 			  {
 			    is_ms_arch = 0;
 			    break;
@@ -1495,7 +1497,7 @@ gld_${EMULATION_NAME}_after_open (void)
 	       then leave the filename alone.  */
 	    pnt = strrchr (is->the_bfd->filename, '.');
 
-	    if (is_ms_arch && (strcmp (pnt, ".dll") == 0))
+	    if (is_ms_arch && (filename_cmp (pnt, ".dll") == 0))
 	      {
 		int idata2 = 0, reloc_count=0;
 		asection *sec;
@@ -1668,7 +1670,7 @@ gld_${EMULATION_NAME}_unrecognized_file
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
 
-  if (strcmp (ext, ".def") == 0 || strcmp (ext, ".DEF") == 0)
+  if (filename_cmp (ext, ".def") == 0 || filename_cmp (ext, ".DEF") == 0)
     {
       pe_def_file = def_file_parse (entry->filename, pe_def_file);
 
Index: src/ld/emultempl/pep.em
===================================================================
--- src.orig/ld/emultempl/pep.em	2011-02-26 23:06:34.157909100 +0100
+++ src/ld/emultempl/pep.em	2011-02-27 12:09:12.754400300 +0100
@@ -44,6 +44,7 @@ fragment <<EOF
 #include "bfdlink.h"
 #include "getopt.h"
 #include "libiberty.h"
+#include "filenames.h"
 #include "ld.h"
 #include "ldmain.h"
 #include "ldexp.h"
@@ -1318,8 +1319,9 @@ gld_${EMULATION_NAME}_after_open (void)
 			    ? bfd_get_filename (blhe->u.def.section->owner->my_archive)
 			    : bfd_get_filename (blhe->u.def.section->owner);
 
-			if (strcmp (bfd_get_filename (is->the_bfd->my_archive),
-				    other_bfd_filename) == 0)
+			if (filename_cmp (bfd_get_filename
+					    (is->the_bfd->my_archive),
+					  other_bfd_filename) == 0)
 			  continue;
 
 			/* Rename this implib to match the other one.  */
@@ -1373,7 +1375,7 @@ gld_${EMULATION_NAME}_after_open (void)
 		       extension, and use that for the remainder of the
 		       comparisons.  */
 		    pnt = strrchr (is3->the_bfd->filename, '.');
-		    if (pnt != NULL && strcmp (pnt, ".dll") == 0)
+		    if (pnt != NULL && filename_cmp (pnt, ".dll") == 0)
 		      break;
 		  }
 
@@ -1390,11 +1392,11 @@ gld_${EMULATION_NAME}_after_open (void)
 			/* Skip static members, ie anything with a .obj
 			   extension.  */
 			pnt = strrchr (is2->the_bfd->filename, '.');
-			if (pnt != NULL && strcmp (pnt, ".obj") == 0)
+			if (pnt != NULL && filename_cmp (pnt, ".obj") == 0)
 			  continue;
 
-			if (strcmp (is3->the_bfd->filename,
-				    is2->the_bfd->filename))
+			if (filename_cmp (is3->the_bfd->filename,
+					  is2->the_bfd->filename))
 			  {
 			    is_ms_arch = 0;
 			    break;
@@ -1408,7 +1410,7 @@ gld_${EMULATION_NAME}_after_open (void)
 	       then leave the filename alone.  */
 	    pnt = strrchr (is->the_bfd->filename, '.');
 
-	    if (is_ms_arch && (strcmp (pnt, ".dll") == 0))
+	    if (is_ms_arch && (filename_cmp (pnt, ".dll") == 0))
 	      {
 		int idata2 = 0, reloc_count=0;
 		asection *sec;
@@ -1472,7 +1474,7 @@ gld_${EMULATION_NAME}_unrecognized_file
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
 
-  if (strcmp (ext, ".def") == 0 || strcmp (ext, ".DEF") == 0)
+  if (filename_cmp (ext, ".def") == 0 || filename_cmp (ext, ".DEF") == 0)
     {
       pep_def_file = def_file_parse (entry->filename, pep_def_file);
 
Index: src/ld/ldfile.c
===================================================================
--- src.orig/ld/ldfile.c	2011-02-26 23:06:34.158909100 +0100
+++ src/ld/ldfile.c	2011-02-27 12:09:12.765400900 +0100
@@ -443,7 +443,7 @@ ldfile_open_file (lang_input_statement_t
       if (ldfile_try_open_bfd (entry->filename, entry))
 	return;
 
-      if (strcmp (entry->filename, entry->local_sym_name) != 0)
+      if (filename_cmp (entry->filename, entry->local_sym_name) != 0)
 	einfo (_("%P: cannot find %s (%s): %E\n"),
 	       entry->filename, entry->local_sym_name);
       else
Index: src/ld/ldlang.c
===================================================================
--- src.orig/ld/ldlang.c	2011-02-26 23:06:34.159909100 +0100
+++ src/ld/ldlang.c	2011-02-27 12:09:12.774401400 +0100
@@ -23,6 +23,7 @@
 #include "sysdep.h"
 #include "bfd.h"
 #include "libiberty.h"
+#include "filenames.h"
 #include "safe-ctype.h"
 #include "obstack.h"
 #include "bfdlink.h"
@@ -2446,7 +2447,7 @@ wild_sort (lang_wild_statement_type *wil
 	      la = FALSE;
 	    }
 
-	  i = strcmp (fn, ln);
+	  i = filename_cmp (fn, ln);
 	  if (i > 0)
 	    continue;
 	  else if (i < 0)
@@ -2459,7 +2460,7 @@ wild_sort (lang_wild_statement_type *wil
 	      if (la)
 		ln = ls->section->owner->filename;
 
-	      i = strcmp (fn, ln);
+	      i = filename_cmp (fn, ln);
 	      if (i > 0)
 		continue;
 	      else if (i < 0)
@@ -2572,7 +2573,7 @@ lookup_name (const char *name)
       const char *filename = search->local_sym_name;
 
       if (filename != NULL
-	  && strcmp (filename, name) == 0)
+	  && filename_cmp (filename, name) == 0)
 	break;
     }
 
@@ -2639,7 +2640,7 @@ check_excluded_libs (bfd *abfd)
 	  return;
 	}
 
-      if (strncmp (lib->name, filename, len) == 0
+      if (filename_ncmp (lib->name, filename, len) == 0
 	  && (filename[len] == '\0'
 	      || (filename[len] == '.' && filename[len + 1] == 'a'
 		  && filename[len + 2] == '\0')))
Index: src/ld/ldmisc.c
===================================================================
--- src.orig/ld/ldmisc.c	2011-02-26 23:06:34.160909100 +0100
+++ src/ld/ldmisc.c	2011-02-27 12:09:12.804403100 +0100
@@ -25,6 +25,7 @@
 #include "bfd.h"
 #include "bfdlink.h"
 #include "libiberty.h"
+#include "filenames.h"
 #include "demangle.h"
 #include <stdarg.h>
 #include "ld.h"
@@ -231,7 +232,7 @@ vfinfo (FILE *fp, const char *fmt, va_li
 			   bfd_get_filename (bfd_my_archive (i->the_bfd)));
 		fprintf (fp, "%s", i->local_sym_name);
 		if (bfd_my_archive (i->the_bfd) == NULL
-		    && strcmp (i->local_sym_name, i->filename) != 0)
+		    && filename_cmp (i->local_sym_name, i->filename) != 0)
 		  fprintf (fp, " (%s)", i->filename);
 	      }
 	      break;
@@ -318,7 +319,7 @@ vfinfo (FILE *fp, const char *fmt, va_li
 			    || last_function == NULL
 			    || last_bfd != abfd
 			    || (filename != NULL
-				&& strcmp (last_file, filename) != 0)
+				&& filename_cmp (last_file, filename) != 0)
 			    || strcmp (last_function, functionname) != 0)
 			  {
 			    lfinfo (fp, _("%B: In function `%T':\n"),
Index: src/ld/pe-dll.c
===================================================================
--- src.orig/ld/pe-dll.c	2011-02-26 23:06:34.161909100 +0100
+++ src/ld/pe-dll.c	2011-02-27 12:09:12.809403400 +0100
@@ -24,6 +24,7 @@
 #include "bfd.h"
 #include "bfdlink.h"
 #include "libiberty.h"
+#include "filenames.h"
 #include "safe-ctype.h"
 
 #include <time.h>
@@ -343,7 +344,7 @@ static const autofilter_entry_type autof
   returning zero if so or -1 if not.  */
 static int libnamencmp (const char *libname, const autofilter_entry_type *afptr)
 {
-  if (strncmp (libname, afptr->name, afptr->len))
+  if (filename_ncmp (libname, afptr->name, afptr->len))
     return -1;
 
   libname += afptr->len;
@@ -619,13 +620,13 @@ auto_export (bfd *abfd, def_file *d, con
       if (ex->type == EXCLUDELIBS)
 	{
 	  if (libname
-	      && ((strcmp (libname, ex->string) == 0)
+	      && ((filename_cmp (libname, ex->string) == 0)
 		   || (strcasecmp ("ALL", ex->string) == 0)))
 	    return 0;
 	}
       else if (ex->type == EXCLUDEFORIMPLIB)
 	{
-	  if (strcmp (abfd->filename, ex->string) == 0)
+	  if (filename_cmp (abfd->filename, ex->string) == 0)
 	    return 0;
 	}
       else if (strcmp (n, ex->string) == 0)
@@ -2701,7 +2702,7 @@ pe_dll_generate_implib (def_file *def, c
 	{
 	  if (ex->type != EXCLUDEFORIMPLIB)
 	    continue;
-	  found = (strcmp (ex->string, ibfd->filename) == 0);
+	  found = (filename_cmp (ex->string, ibfd->filename) == 0);
 	}
       /* If it matched, we must open a fresh BFD for it (the original
         input BFD is still needed for the DLL's final link) and add
@@ -2731,7 +2732,7 @@ pe_dll_generate_implib (def_file *def, c
 	      newbfd = NULL;
 	      while ((newbfd = bfd_openr_next_archived_file (arbfd, newbfd)) != 0)
 		{
-		  if (strcmp (newbfd->filename, ibfd->filename) == 0)
+		  if (filename_cmp (newbfd->filename, ibfd->filename) == 0)
 		    break;
 		}
 	      if (!newbfd)
Index: src/ld/testplug.c
===================================================================
--- src.orig/ld/testplug.c	2011-02-26 23:06:34.173909100 +0100
+++ src/ld/testplug.c	2011-02-27 12:09:12.824404300 +0100
@@ -23,6 +23,7 @@
 #include "plugin-api.h"
 /* For ARRAY_SIZE macro only - we don't link the library itself.  */
 #include "libiberty.h"
+#include "filenames.h"
 
 extern enum ld_plugin_status onload (struct ld_plugin_tv *tv);
 static enum ld_plugin_status onclaim_file (const struct ld_plugin_input_file *file,
@@ -519,7 +520,7 @@ onclaim_file (const struct ld_plugin_inp
   claim_file_t *claimfile = claimfiles_list;
   while (claimfile)
     {
-      if (!strcmp (file->name, claimfile->file.name))
+      if (!filename_cmp (file->name, claimfile->file.name))
 	break;
       claimfile = claimfile->next;
     }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-01 23:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-28  8:00 [patch ld]: Let binutils understand DOS-paths (3 of 4) Kai Tietz
2011-02-28 13:41 ` Nick Clifton
2011-02-28 18:39   ` Kai Tietz
2011-03-01 22:42     ` H.J. Lu
2011-03-01 22:59       ` H.J. Lu
2011-03-01 23:16         ` DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).