This is the mail archive of the binutils@sourceware.cygnus.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]

Re: [PATCH] Re: Link error with today's CVS binutils


On Tue, Jan 18, 2000 at 12:38:04AM -0500, Ian Lance Taylor wrote:
> 
>    Have you followed this thread? Your change:
> 
>    1999-01-15  Nick Clifton  <nickc@cygnus.com>
> 
> 	   * ldlang.c (lang_size_sections): Only update the current 
> 	     address of a region if the section just placed into it is an
> 	     allocated section.
> 
>    seems to cause the regression. This patch seems to fix it. Any
>    comments?
> 
> Thanks for tracking this down.
> 
> I think that checking the size of the section is not the right way to
> go here.  Instead, check for SEC_NEVER_LOAD.  Look at how
> SEC_NEVER_LOAD is handled in ldwrite.c.
> 
> Ian

Thanks. How about this change? Since it looks like SEC_NEVER_LOAD is
only used by COFF, I left in the size check.


-- 
H.J. Lu (hjl@gnu.org)
---
Tue Jan 18 07:57:08 2000  H.J. Lu  <hjl@gnu.org>

	* ldlang.c (lang_size_sections): Also update the current
	address of a region if the section raw size is > 0 and the
	SEC_NEVER_LOAD bit is not set.

Index: ldlang.c
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/ldlang.c,v
retrieving revision 1.1.1.13
diff -u -p -r1.1.1.13 ldlang.c
--- ldlang.c	2000/01/13 19:36:06	1.1.1.13
+++ ldlang.c	2000/01/18 15:56:02
@@ -2823,10 +2823,17 @@ lang_size_sections (s, output_section_st
 	    /* Update dot in the region ?
 	       We only do this if the section is going to be allocated,
 	       since unallocated sections do not contribute to the region's
-	       overall size in memory.  */
+	       overall size in memory.
+	       
+	       If the section raw size is > 0, it will affect the
+	       addresses of sections after it. We have to update
+	       dot. */
 	    if (os->region != (lang_memory_region_type *) NULL
-		&& (bfd_get_section_flags (output_bfd, os->bfd_section)
-		    & (SEC_ALLOC | SEC_LOAD)))
+		&& ((os->bfd_section->_raw_size > 0
+		     && (bfd_get_section_flags (output_bfd, os->bfd_section)
+		         & SEC_NEVER_LOAD) == 0)
+		    || (bfd_get_section_flags (output_bfd, os->bfd_section)
+			& (SEC_ALLOC | SEC_LOAD))))
 	      {
 		os->region->current = dot;
 		

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