Section symbols not getting created. Bug? Is attached patch correct fix?

John Marino binutils@marino.st
Tue Apr 5 19:36:00 GMT 2011


DragonFly BSD has moved to Binutils 2.21 from 2.17 for its upcoming 
release.  During the transition an anomaly was seen, and the cause was 
traced back to missing __start_set and __end_set symbols within a 
generated file.  It appeared that lang_insert_orphan function was 
silently discarding the section label symbols due to being assigned the 
"dot" (the origin).

It appears that exp_provide() function used there discards the symbols 
assigned "." and exp_assign() function does not.  The following patch 
was used to restore the section label generation.

Did DragonFly discover a previously unknown bug?
Is this patch the correct approach to restore these missing section labels?

Thanks,
John



diff --git a/ld/ldlang.c b/ld/ldlang.c
index 76b02f4..6a6b09e 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1821,10 +1821,9 @@ lang_insert_orphan (asection *s,
  	  e_align = exp_unop (ALIGN_K,
  			      exp_intop ((bfd_vma) 1 << s->alignment_power));
  	  lang_add_assignment (exp_assign (".", e_align));
-	  lang_add_assignment (exp_provide (symname,
+	  lang_add_assignment (exp_assign (symname,
  					    exp_unop (ABSOLUTE,
-						      exp_nameop (NAME, ".")),
-					    FALSE));
+						  exp_nameop (NAME, "."))));
  	}
      }

@@ -1854,9 +1853,8 @@ lang_insert_orphan (asection *s,
        symname = (char *) xmalloc (ps - secname + sizeof "__stop_" + 1);
        symname[0] = bfd_get_symbol_leading_char (link_info.output_bfd);
        sprintf (symname + (symname[0] != 0), "__stop_%s", secname);
-      lang_add_assignment (exp_provide (symname,
-					exp_nameop (NAME, "."),
-					FALSE));
+      lang_add_assignment (exp_assign (symname,
+					exp_nameop (NAME, ".")));
      }

    /* Restore the global list pointer.  */



More information about the Binutils mailing list