This is the mail archive of the binutils@sourceware.org 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: binutils-2.19.90 snapshot is available


On Sun, Sep 13, 2009 at 12:03:12PM -0400, Christopher Faylor wrote:
>On Sun, Sep 13, 2009 at 11:37:03AM -0400, Christopher Faylor wrote:
>>On Sun, Sep 13, 2009 at 11:55:26AM +0930, Alan Modra wrote:
>>>On Sat, Sep 12, 2009 at 12:41:59PM -0400, Christopher Faylor wrote:
>>>> On Sat, Sep 12, 2009 at 04:26:26PM +0100, Dave Korn wrote:
>>>> >Seems sane to me.  It works by resetting the VMA after it's been used
>>>> >in lang_size_sections_1 and the subsequent size calculations rather
>>>> >than zeroing it out before these are done, yes?
>>>> 
>>>> Yes.  I tried to do the zero first and then do the size calculations
>>>> using temporary values but couldn't get it quite right.  I was afraid of
>>>> impacting non-COFF too.
>>>
>>>I'm curious to know what the difference was.  ELF scripts set the
>>>output section vma to zero (${RELOCATING-0}) for ld -r, and we also
>>>set it to zero for orphans in lang_insert_orphan.  If setting to zero
>>>at the beginning didn't work, then you may have a problem with
>>>orphans.
>>>
>>>This:
>>>	    if (link_info->relocatable)
>>>	      os->addr_tree = exp_intop (0);
>>>before the first use of addr_tree in lang_size_sections_1 ought to
>>>good for all targets.
>>
>>The problem was that the size of the sections was still too large.  I
>>could have probably tried harder to find the right values to use in the
>>size calculations, though.
>>
>>Where would you suggest that the above be added?  Right before the
>>switch statement in lang_size_sections_1 ?
>
>It seems like it would only make sense in the
>lang_output_section_statement_enum case so I tried the below both with
>and without backing out the previous fix for PR 6945.  This did reset
>the VMA to zero but the sizes were still wrong (see below).

Ah, yes.  The old "Realize you did something stupid 15 seconds after
sending email" scenario.  I was testing the original version of ld
rather than the patched version.  This below patch does seem to work.

Dave can you confirm?

cgf
Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.318
diff -d -p -U7 -r1.318 ldlang.c
--- ldlang.c	11 Sep 2009 15:27:35 -0000	1.318
+++ ldlang.c	13 Sep 2009 16:07:53 -0000
@@ -4661,14 +4661,16 @@ lang_size_sections_1
 	case lang_output_section_statement_enum:
 	  {
 	    bfd_vma newdot, after;
 	    lang_output_section_statement_type *os;
 	    lang_memory_region_type *r;
 
 	    os = &s->output_section_statement;
+	    if (link_info.relocatable)
+	      os->addr_tree = exp_intop (0);
 	    if (os->addr_tree != NULL)
 	      {
 		os->processed_vma = FALSE;
 		exp_fold_tree (os->addr_tree, bfd_abs_section_ptr, &dot);
 
 		if (expld.result.valid_p)
 		  dot = expld.result.value + expld.result.section->vma;
@@ -4785,20 +4787,15 @@ lang_size_sections_1
 			    || os->addr_tree != NULL)
 			&& expld.phase != lang_mark_phase_enum)
 		      einfo (_("%P: warning: changing start of section"
 			       " %s by %lu bytes\n"),
 			     os->name, (unsigned long) (newdot - savedot));
 		  }
 
-		/* PR 6945: Do not update the vma's of output sections
-		   when performing a relocatable link on COFF objects.  */
-		if (! link_info.relocatable
-		    || (bfd_get_flavour (link_info.output_bfd)
-			!= bfd_target_coff_flavour))
-		  bfd_set_section_vma (0, os->bfd_section, newdot);
+		bfd_set_section_vma (0, os->bfd_section, newdot);
 
 		os->bfd_section->output_offset = 0;
 	      }
 
 	    lang_size_sections_1 (os->children.head, os, &os->children.head,
 				  os->fill, newdot, relax, check_regions);
 



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