fix synth linker script
Bart Veer
bartv@ecoscentric.com
Mon Aug 17 14:44:00 GMT 2009
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_) \
More information about the Ecos-patches
mailing list