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]

Re: PATCH: Remove bfd_comdat_info and move section_already_linked


On Tue, Jun 29, 2004 at 11:13:32AM -0700, H. J. Lu wrote:
> On Tue, Jun 29, 2004 at 12:56:06AM -0700, H. J. Lu wrote:
> > On Mon, Jun 28, 2004 at 06:22:42PM -0700, H. J. Lu wrote:
> > > section_already_linked in ldlang.c has some code to deal with PE's
> > > comdat, which isn't use by any other targets. Also there is
> > > bfd_comdat_info in bfd_section for it. I suggest we move
> > > bfd_comdat_info to PE target and move section_already_linked into
> > > bfd target vector. We can have a special section_already_linked
> > > function for PE and a generic one for others. With those changes, we
> > > can remove PE specifc code from linker as well as bfd_section. Any
> > > comments?

> This is the complete patch. With this patch, I withdraw the section
> identifier patch:

I like it, except that it seems to me that you could leave
section_already_linked where it is, and just provide a bfd xvec
predicate.  That would save some code duplication, which helps
in maintaining the linker.

ie. something like the following

Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.156
diff -u -p -r1.156 ldlang.c
--- ld/ldlang.c	29 Jun 2004 14:13:47 -0000	1.156
+++ ld/ldlang.c	30 Jun 2004 13:40:28 -0000
@@ -959,9 +959,7 @@ section_already_linked (bfd *abfd, asect
 
   for (l = already_linked_list->entry; l != NULL; l = l->next)
     {
-      if (sec->comdat == NULL
-	  || l->sec->comdat == NULL
-	  || strcmp (sec->comdat->name, l->sec->comdat->name) == 0)
+      if (bfd_match_section_already_linked (abfd, sec, l->sec))
 	{
 	  /* The section has already been linked.  See if we should
              issue a warning.  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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