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]

ld: EXCLUDE_FILES archive doesn't exclude its members


When a linker script mentions an archive in EXCLUDE_FILES, this
doesn't result in the members of the archive being excluded as, IMO,
it should.  This patch corrects this problem, and passes all ld
regression tests on athlon-pc-linux-gnu.  Ok to install?

Index: ld/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* ldlang.c (walk_wild_section): Exclude object file if enclosing
	archive is excluded.

Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.69
diff -u -p -r1.69 ldlang.c
--- ld/ldlang.c 2001/12/18 12:15:35 1.69
+++ ld/ldlang.c 2002/01/05 04:31:49
@@ -270,6 +270,20 @@ walk_wild_section (ptr, file, callback, 
 	      else
 		skip = strcmp (list_tmp->name, file->filename) == 0;
 
+	      /* If this file is part of an archive, and the archive is
+		 excluded, exclude this file.  */
+	      if (! skip && file->the_bfd && file->the_bfd->my_archive
+		  && file->the_bfd->my_archive->filename)
+		{
+		  if (wildcardp (list_tmp->name))
+		    skip = fnmatch (list_tmp->name,
+				    file->the_bfd->my_archive->filename,
+				    0) == 0;
+		  else
+		    skip = strcmp (list_tmp->name,
+				   file->the_bfd->my_archive->filename) == 0;
+		}
+
 	      if (skip)
 		break;
 	    }

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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