Tidy linker scripts

Alan Modra amodra@bigpond.net.au
Tue Sep 29 02:22:00 GMT 2009


On Mon, Sep 28, 2009 at 11:27:27AM -0400, Christopher Faylor wrote:
> Should these changes now be part of the next release?

The patch for 6945 and the followup for 10634 are really only
papering over the underlying problem.  ld should not care about
section vmas in relocatable object files, but given that no one has
time and inclination to go over all the coff backends, I think it's
reasonable to make 2.20 ld -r produce zero-based sections just like
gas.

Hmm, perhaps better with the following so that scripts can set a
non-zero vma if so desired.

	* ldlang.c (lang_size_sections_1): Allow scripts to specify a
	non-zero vma even when relocatable.

Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.319
diff -u -p -r1.319 ldlang.c
--- ld/ldlang.c	27 Sep 2009 16:08:34 -0000	1.319
+++ ld/ldlang.c	29 Sep 2009 01:26:13 -0000
@@ -4665,7 +4665,7 @@ lang_size_sections_1
 	    lang_memory_region_type *r;
 
 	    os = &s->output_section_statement;
-	    if (link_info.relocatable)
+	    if (os->addr_tree == NULL && link_info.relocatable)
 	      os->addr_tree = exp_intop (0);
 	    if (os->addr_tree != NULL)
 	      {

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list