Subject: Re: ELF alignment: linker problem or not?
To: None <tech-toolchain@NetBSD.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-toolchain
Date: 07/06/2006 14:23:52
This is a multipart MIME message.

--==_Exmh_5679301747580
Content-Type: text/plain; charset=us-ascii


M.Drochner@fz-juelich.de said:
> ld: section .eh_frame [fffffe000f7a0270 -> fffffe000f7a02cf] overlaps
> section  .data [fffffe000f7a02c8 -> fffffe000f7a0317] 

After some investigation I'm pretty sure now the linker
is to blame: It does the overlap check too early. The
platform dependent ldemul_finish() function (generated from
binutils/ld/emultempl/elf32.em) recalculates all the section
sizes, so what gets checked is not the final result.

How about the appended patch?

best regards
Matthias



--==_Exmh_5679301747580
Content-Type: text/plain ; name="ldchk.txt"; charset=us-ascii
Content-Description: ldchk.txt
Content-Disposition: attachment; filename="ldchk.txt"

Index: ldlang.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/binutils/ld/ldlang.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 ldlang.c
--- ldlang.c	2 Feb 2006 21:18:10 -0000	1.1.1.3
+++ ldlang.c	6 Jul 2006 12:16:29 -0000
@@ -4876,14 +4876,15 @@ lang_process (void)
 
   lang_do_assignments (statement_list.head, abs_output_section, NULL, 0);
 
+  /* Final stuffs.  */
+
+  ldemul_finish ();
+
   /* Make sure that the section addresses make sense.  */
   if (! link_info.relocatable
       && command_line.check_section_addresses)
     lang_check_section_addresses ();
 
-  /* Final stuffs.  */
-
-  ldemul_finish ();
   lang_finish ();
 }
 

--==_Exmh_5679301747580--