Overlap error not generated for sections w/o content

Alan Modra amodra@bigpond.net.au
Thu Jan 17 23:50:00 GMT 2008


Re: http://sourceware.org/ml/binutils/2004-01/msg00179.html

I was looking at this code the other day, and puzzled for a while over
why we want to test output_section_statement->flags & SEC_ALLOC here.
I figure it's just there to save an unnecessary write to memory, but
the "flags" are different so it isn't obviously correct.

	* ldlang.c (lang_size_sections_1): Simplify SEC_NEVER_LOAD test.

Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.277
diff -u -p -r1.277 ldlang.c
--- ld/ldlang.c	16 Jan 2008 00:31:18 -0000	1.277
+++ ld/ldlang.c	16 Jan 2008 00:34:45 -0000
@@ -4702,8 +4702,7 @@ lang_size_sections_1
 		       should have space allocated to it, unless the
 		       user has explicitly stated that the section
 		       should never be loaded.  */
-		    if (!(output_section_statement->flags
-			  & (SEC_NEVER_LOAD | SEC_ALLOC)))
+		    if (!(output_section_statement->flags & SEC_NEVER_LOAD))
 		      output_section_statement->bfd_section->flags |= SEC_ALLOC;
 		  }
 		dot = newdot;

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list