[PATCH] Missing TO_ADDR

Dan dgisselq@verizon.net
Fri Apr 1 14:42:00 GMT 2016


Alan,

Sorry, I'm still kind of new to the whole idea of posting patches.  Will
this work better?

2016-04-01  Dan Gisselquist <dgisselq@ieee.org>

	* ld/ldlang.c: Updated minfo lines so that map file sizes are
	given in the target machines address units.
	* ld/ldlang.c: Fixed three other references to section sizes
	that didn't go through the size in octets to target address
	units translation

I used diff -Naur -up this time ...

(Rest of patch attached)


Dan


On Fri, 2016-04-01 at 12:01 +1030, Alan Modra wrote:
> On Thu, Mar 31, 2016 at 12:03:17PM -0400, Dan wrote:
> > This would be my proposal for what to change:
> 
> I'll approve a patch that is against current master, diff -up
> preferred, and has a changelog.  Please repost.
> 
-------------- next part --------------
diff -Naur -up a/ld/ChangeLog b/ld/ChangeLog
--- a/ld/ChangeLog	2016-04-01 10:36:46.571415208 -0400
+++ b/ld/ChangeLog	2016-04-01 10:40:00.458440792 -0400
@@ -1,3 +1,11 @@
+2016-04-01  Dan Gisselquist <dgisselq@ieee.org>
+
+	* ld/ldlang.c: Updated minfo lines so that map file sizes are
+	given in the target machines address units.
+	* ld/ldlang.c: Fixed three other references to section sizes
+	that didn't go through the size in octets to target address
+	units translation
+
 2016-02-23  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* testsuite/ld-frv/fdpic-pie-6.d: Updated.
diff -Naur -up a/ld/ldlang.c b/ld/ldlang.c
--- a/ld/ldlang.c	2016-03-31 11:52:02.147253098 -0400
+++ b/ld/ldlang.c	2016-03-31 12:01:13.039773821 -0400
@@ -1886,7 +1886,7 @@ lang_insert_orphan (asection *s,
 	 before sizing dynamic sections.  */
       dot = os->bfd_section->vma;
       exp_fold_tree (start_assign->exp, os->bfd_section, &dot);
-      dot += s->size;
+      dot += TO_ADDR(s->size);
       exp_fold_tree (stop_assign->exp, os->bfd_section, &dot);
     }
 
@@ -4002,7 +4002,7 @@ print_output_section_statement
 	      ++len;
 	    }
 
-	  minfo ("0x%V %W", section->vma, section->size);
+	  minfo ("0x%V %W", section->vma, TO_ADDR(section->size));
 
 	  if (section->vma != section->lma)
 	    minfo (_(" load address 0x%V"), section->lma);
@@ -4312,7 +4312,9 @@ print_data_statement (lang_data_statemen
       break;
     }
 
-  minfo ("0x%V %W %s 0x%v", addr, size, name, data->value);
+  if (size < TO_SIZE ((unsigned) 1))
+    size = TO_SIZE ((unsigned) 1);
+  minfo ("0x%V %W %s 0x%v", addr, TO_ADDR(size), name, data->value);
 
   if (data->exp->type.node_class != etree_value)
     {
@@ -4355,7 +4357,7 @@ print_reloc_statement (lang_reloc_statem
 
   size = bfd_get_reloc_size (reloc->howto);
 
-  minfo ("0x%V %W RELOC %s ", addr, size, reloc->howto->name);
+  minfo ("0x%V %W RELOC %s ", addr, TO_ADDR(size), reloc->howto->name);
 
   if (reloc->name != NULL)
     minfo ("%s+", reloc->name);
@@ -4388,7 +4390,7 @@ print_padding_statement (lang_padding_st
   addr = s->output_offset;
   if (s->output_section != NULL)
     addr += s->output_section->vma;
-  minfo ("0x%V %W ", addr, (bfd_vma) s->size);
+  minfo ("0x%V %W ", addr, TO_ADDR((bfd_vma) s->size));
 
   if (s->fill->size != 0)
     {
@@ -5067,7 +5069,7 @@ lang_size_sections_1
 		   create overlapping LMAs.  */
 		if (dot < last->vma
 		    && os->bfd_section->size != 0
-		    && dot + os->bfd_section->size <= last->vma)
+		    && dot + TO_ADDR(os->bfd_section->size) <= last->vma)
 		  {
 		    /* If dot moved backwards then leave lma equal to
 		       vma.  This is the old default lma, which might
@@ -5084,7 +5086,7 @@ lang_size_sections_1
 		    /* If this is an overlay, set the current lma to that
 		       at the end of the previous section.  */
 		    if (os->sectype == overlay_section)
-		      lma = last->lma + last->size;
+		      lma = last->lma + TO_ADDR(last->size);
 
 		    /* Otherwise, keep the same lma to vma relationship
 		       as the previous section.  */


More information about the Binutils mailing list