public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld: EXCLUDE_FILES archive doesn't exclude its members
@ 2002-01-04 21:01 Alexandre Oliva
  2002-01-07 15:51 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2002-01-04 21:01 UTC (permalink / raw)
  To: binutils

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

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ld-exclude-archive.patch --]
[-- Type: text/x-patch, Size: 1039 bytes --]

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;
 	    }

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


-- 
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

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

* Re: ld: EXCLUDE_FILES archive doesn't exclude its members
  2002-01-04 21:01 ld: EXCLUDE_FILES archive doesn't exclude its members Alexandre Oliva
@ 2002-01-07 15:51 ` Alan Modra
  2002-01-08  9:47   ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2002-01-07 15:51 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: binutils

On Sat, Jan 05, 2002 at 02:37:20AM -0200, Alexandre Oliva wrote:
> 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?

OK, except for this style nit.

> +	      if (! skip && file->the_bfd && file->the_bfd->my_archive
> +		  && file->the_bfd->my_archive->filename)

	      if (! skip && file->the_bfd != NULL
		  && file->the_bfd->my_archive != NULL
		  && file->the_bfd->my_archive->filename != NULL)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* Re: ld: EXCLUDE_FILES archive doesn't exclude its members
  2002-01-07 15:51 ` Alan Modra
@ 2002-01-08  9:47   ` Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2002-01-08  9:47 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

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

On Jan  7, 2002, Alan Modra <amodra@bigpond.net.au> wrote:

> On Sat, Jan 05, 2002 at 02:37:20AM -0200, Alexandre Oliva wrote:
>> 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?

> OK, except for this style nit.

Thanks, here's what I'm checking in:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ld-exclude-archive.patch --]
[-- Type: text/x-patch, Size: 1351 bytes --]

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/08 14:54:43
@@ -1,6 +1,6 @@
 /* Linker command language support.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001
+   2001, 2002
    Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
@@ -269,6 +269,21 @@ walk_wild_section (ptr, file, callback, 
 		skip = fnmatch (list_tmp->name, file->filename, 0) == 0;
 	      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 != NULL
+		  && file->the_bfd->my_archive != NULL
+		  && file->the_bfd->my_archive->filename != NULL)
+		{
+		  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;

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


-- 
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

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

end of thread, other threads:[~2002-01-08 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-04 21:01 ld: EXCLUDE_FILES archive doesn't exclude its members Alexandre Oliva
2002-01-07 15:51 ` Alan Modra
2002-01-08  9:47   ` Alexandre Oliva

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).