public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch/xcoff]: xcofflink.c: handle new dwarf sections and symbols
@ 2011-05-13  9:13 Tristan Gingold
  2011-05-17 14:49 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2011-05-13  9:13 UTC (permalink / raw)
  To: binutils Development

Hi,

with this patch, gnu-ld for xcoff properly deals with new dwarf sections and symbols.

Ok for trunk ?

Tristan.

bfd/
2011-05-13  Tristan Gingold  <gingold@adacore.com>

	* xcofflink.c (xcoff_link_add_symbols): Handle C_DWARF symbols.
	(xcoff_sweep): Always keep dwarf sections.
	(xcoff_link_input_bfd): Handle dwarf symbols and sections.

diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 47e094e..4308b18 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -1365,11 +1365,12 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
 	     If C_FILE or first time, handle special
 
 	     Advance esym, sym_hash, csect_hash ptrs.  */
-	  if (sym.n_sclass == C_FILE)
+	  if (sym.n_sclass == C_FILE || sym.n_sclass == C_DWARF)
 	    csect = NULL;
 	  if (csect != NULL)
 	    *csect_cache = csect;
-	  else if (first_csect == NULL || sym.n_sclass == C_FILE)
+	  else if (first_csect == NULL
+                   || sym.n_sclass == C_FILE || sym.n_sclass == C_DWARF)
 	    *csect_cache = coff_section_from_bfd_index (abfd, sym.n_scnum);
 	  else
 	    *csect_cache = NULL;
@@ -2073,6 +2074,10 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
   /* Make sure that we have seen all the relocs.  */
   for (o = abfd->sections; o != first_csect; o = o->next)
     {
+      /* Debugging sections have no csects.  */
+      if (bfd_get_section_flags (abfd, o) & SEC_DEBUGGING)
+        continue;
+
       /* Reset the section size and the line number count, since the
 	 data is now attached to the csects.  Don't reset the size of
 	 the .debug section, since we need to read it below in
@@ -3009,6 +3014,7 @@ xcoff_sweep (struct bfd_link_info *info)
 		  || o == xcoff_hash_table (info)->loader_section
 		  || o == xcoff_hash_table (info)->linkage_section
 		  || o == xcoff_hash_table (info)->descriptor_section
+                  || (bfd_get_section_flags (sub, o) & SEC_DEBUGGING)
 		  || strcmp (o->name, ".debug") == 0)
 		o->flags |= SEC_MARK;
 	      else
@@ -4930,21 +4936,25 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
 			     this case, but I don't think it's worth it.  */
 			  is = flinfo->internal_syms + r_symndx;
 
-			  name = (_bfd_coff_internal_syment_name
-				  (input_bfd, is, buf));
+                          if (is->n_sclass != C_DWARF)
+                            {
+                              name = (_bfd_coff_internal_syment_name
+                                      (input_bfd, is, buf));
 
-			  if (name == NULL)
-			    return FALSE;
+                              if (name == NULL)
+                                return FALSE;
 
-			  if (! ((*flinfo->info->callbacks->unattached_reloc)
-				 (flinfo->info, name, input_bfd, o,
-				  irel->r_vaddr)))
-			    return FALSE;
+                              if (!(*flinfo->info->callbacks->unattached_reloc)
+                                  (flinfo->info, name, input_bfd, o,
+                                   irel->r_vaddr))
+                                return FALSE;
+                            }
 			}
 		    }
 		}
 
-	      if (xcoff_need_ldrel_p (flinfo->info, irel, h))
+	      if ((o->flags & SEC_DEBUGGING) == 0
+                  && xcoff_need_ldrel_p (flinfo->info, irel, h))
 		{
 		  asection *sec;
 

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

* Re: [Patch/xcoff]: xcofflink.c: handle new dwarf sections and symbols
  2011-05-13  9:13 [Patch/xcoff]: xcofflink.c: handle new dwarf sections and symbols Tristan Gingold
@ 2011-05-17 14:49 ` Nick Clifton
  2011-05-18  8:01   ` Tristan Gingold
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2011-05-17 14:49 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils Development

Hi Tristan,

> bfd/
> 2011-05-13  Tristan Gingold<gingold@adacore.com>
>
> 	* xcofflink.c (xcoff_link_add_symbols): Handle C_DWARF symbols.
> 	(xcoff_sweep): Always keep dwarf sections.
> 	(xcoff_link_input_bfd): Handle dwarf symbols and sections.

Approved - please apply.

Cheers
   Nick

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

* Re: [Patch/xcoff]: xcofflink.c: handle new dwarf sections and symbols
  2011-05-17 14:49 ` Nick Clifton
@ 2011-05-18  8:01   ` Tristan Gingold
  0 siblings, 0 replies; 3+ messages in thread
From: Tristan Gingold @ 2011-05-18  8:01 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils Development


On May 17, 2011, at 4:49 PM, Nick Clifton wrote:

> Hi Tristan,
> 
>> bfd/
>> 2011-05-13  Tristan Gingold<gingold@adacore.com>
>> 
>> 	* xcofflink.c (xcoff_link_add_symbols): Handle C_DWARF symbols.
>> 	(xcoff_sweep): Always keep dwarf sections.
>> 	(xcoff_link_input_bfd): Handle dwarf symbols and sections.
> 
> Approved - please apply.

Thanks, committed.

Tristan.

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

end of thread, other threads:[~2011-05-18  8:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-13  9:13 [Patch/xcoff]: xcofflink.c: handle new dwarf sections and symbols Tristan Gingold
2011-05-17 14:49 ` Nick Clifton
2011-05-18  8:01   ` Tristan Gingold

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