public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* fix synth linker script
@ 2009-08-17 14:44 Bart Veer
  0 siblings, 0 replies; only message in thread
From: Bart Veer @ 2009-08-17 14:44 UTC (permalink / raw)
  To: ecos-patches

Thanks to an option hidden away in gcc's specs file the Linux linker
may synthesize a section .eh_frame_hdr. The linker script did not
allow for this so this .eh_frame_hdr ended up in the middle of the
.eh_frame section. Now, currently there is no eCos code for the
synthetic target which actually looks at .eh_frame, so synth
applications would continue to run perfectly happily.

However, when current gdb loads an executable it iterates through
.eh_frame looking for CIE and FDE structures. The relevant code got
rather confused when it came across an eh_frame_hdr instead, and for
some executables it would report an assertion failure. gdb would
continue running quite happily afterwards, but the assertion failure
message was disconcerting.

This patch sorts out the synth linker script so that .eh_frame_hdr
ends up in its own section, not mixed in with the rest of .eh_frame.

Bart

2009-08-13  Bart Veer  <bartv@ecoscentric.com>

	* src/synth.ld (SECTION_eh_frame): allow for a .eh_frame_hdr
	section.
Index: src/synth.ld
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/synth/arch/current/src/synth.ld,v
retrieving revision 1.9
diff -u -p -r1.9 synth.ld
--- src/synth.ld	29 Jan 2009 17:49:43 -0000	1.9
+++ src/synth.ld	17 Aug 2009 14:42:17 -0000
@@ -108,13 +108,24 @@ GROUP(libtarget.a libgcc.a)
       _EXCEPT_END_ = ABSOLUTE(.);}                                      	\
     > _region_
 
-#define SECTION_eh_frame(_region_, _vma_, _lma_)      \
-  .eh_frame _vma_ : _lma_                             \
-    {                                                 \
-       FORCE_OUTPUT;  __EH_FRAME_BEGIN__ = .;         \
-       KEEP(*(.eh_frame*))                             \
-       __FRAME_END__ = .;                             \
-       . = . + 8;                                     \
+#define SECTION_eh_frame(_region_, _vma_, _lma_)                            \
+    . = _vma_ ;                                                             \
+    . = ALIGN(ALIGN_LMA) ;                                                  \
+    .eh_frame_hdr . : _lma_                                                 \
+    {                                                                       \
+       FORCE_OUTPUT;                                                        \
+       *(.eh_frame_hdr)                                                     \
+    } > _region_ = 0                                                        \
+    . = ALIGN(ALIGN_LMA) ;                                                  \
+    .eh_frame . : FOLLOWING(.eh_frame_hdr)                                  \
+    {                                                                       \
+       FORCE_OUTPUT;                                                        \
+       __EH_FRAME_BEGIN__ = .;                                              \
+       KEEP(*(.eh_frame))                                                   \
+       KEEP(*(.eh_frame*))                                                  \
+       __EH_FRAME_END__ = .;                                                \
+       . = ALIGN(4) ;                                                       \
+       . = . + 8;                                                           \
     } > _region_ = 0
 
 #define SECTION_RELOCS(_region_, _vma_, _lma_)                              \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-17 14:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-17 14:44 fix synth linker script Bart Veer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).