This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: C++ Exception Handling under eCos
Andrew Lunn wrote:
>
> > > >Can anybody tell me wether C++ exception handling is supported under eCos,
> > > >or not?
> > > >In case it is supported, what do I have to do to make it work properly?
> > > >
> > >
> > > No, it is not supported.
> > >
> > > To make it to work, it requires some work at GCC level. Basically,
> > > to make exceptions *thread-safe*, you would need to make some changes
> > > to GCC. You have to provide some functions that goes to libgcc2.a.
> > > They are basically provided a global mutex that gets created, and something
> > > similar to a POSIX key, so each thread get its own context to store the info
> > > for each exception.
>
> Could you point me towards some documentation as to what is
> required. eCos already has mutex and per thread data storage, so at
> least that part is done.
I have already been working on this too. The complication with eCos is that
at the time you build the toolchains, there's no guarantee that the kernel
is present. I have a solution to this, but it's trickier than a
straightforward hack.
> > > Also, a few extras sections to the linker scripts might be necessary.
> > > I have not looked too close to the eCos scripts.
> >
> > Indeed they would in eCos. I've been working somewhat on this, but it's
> > still work in progress.
>
> Could you P2P distribute this? We may take it a bit further if we
> think it would be usefull to us.
I've attached a very minimal patch for the EBSA (which wasn't my primary
target, hence the minimal nature at this stage) which I believe should give
you something that works (no promises :)). It's relative to hal/arm.
Compile with -fexceptions of course to take advantage of it.
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Index: arch/current/src/arm.ld
===================================================================
RCS file: /home/cvs/ecc/ecc/hal/arm/arch/current/src/arm.ld,v
retrieving revision 1.39
diff -u -5 -p -r1.39 arm.ld
--- arch/current/src/arm.ld 2001/02/22 13:38:00 1.39
+++ arch/current/src/arm.ld 2001/03/16 09:09:41
@@ -126,10 +126,78 @@ OUTPUT_FORMAT(elf32-bigarm)
#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \
.gcc_except_table _vma_ : _lma_ \
{ FORCE_OUTPUT; *(.gcc_except_table) } \
> _region_
+#define SECTION_eh_frame(_region_, _vma_, _lma_) \
+ .eh_frame _vma_ : _lma_ \
+ { \
+ FORCE_OUTPUT; __EH_FRAME_BEGIN__ = .; \
+ KEEP(*(.eh_frame)) \
+ __FRAME_END__ = .; \
+ . = . + 8; \
+ } > _region_ = 0
+
+#define SECTION_RELOCS(_region_, _vma_, _lma_) \
+ .rel.text : \
+ { \
+ *(.rel.text) \
+ *(.rel.text.*) \
+ *(.rel.gnu.linkonce.t*) \
+ } > _region_ \
+ .rela.text : \
+ { \
+ *(.rela.text) \
+ *(.rela.text.*) \
+ *(.rela.gnu.linkonce.t*) \
+ } > _region_ \
+ .rel.data : \
+ { \
+ *(.rel.data) \
+ *(.rel.data.*) \
+ *(.rel.gnu.linkonce.d*) \
+ } > _region_ \
+ .rela.data : \
+ { \
+ *(.rela.data) \
+ *(.rela.data.*) \
+ *(.rela.gnu.linkonce.d*) \
+ } > _region_ \
+ .rel.rodata : \
+ { \
+ *(.rel.rodata) \
+ *(.rel.rodata.*) \
+ *(.rel.gnu.linkonce.r*) \
+ } > _region_ \
+ .rela.rodata : \
+ { \
+ *(.rela.rodata) \
+ *(.rela.rodata.*) \
+ *(.rela.gnu.linkonce.r*) \
+ } > _region_ \
+ .rel.got : { *(.rel.got) } > _region_ \
+ .rela.got : { *(.rela.got) } > _region_ \
+ .rel.ctors : { *(.rel.ctors) } > _region_ \
+ .rela.ctors : { *(.rela.ctors) } > _region_ \
+ .rel.dtors : { *(.rel.dtors) } > _region_ \
+ .rela.dtors : { *(.rela.dtors) } > _region_ \
+ .rel.init : { *(.rel.init) } > _region_ \
+ .rela.init : { *(.rela.init) } > _region_ \
+ .rel.fini : { *(.rel.fini) } > _region_ \
+ .rela.fini : { *(.rela.fini) } > _region_ \
+ .rel.bss : { *(.rel.bss) } > _region_ \
+ .rela.bss : { *(.rela.bss) } > _region_ \
+ .rel.plt : { *(.rel.plt) } > _region_ \
+ .rela.plt : { *(.rela.plt) } > _region_ \
+ .rel.dyn : { *(.rel.dyn) } > _region_
+
+#define SECTION_got(_region_, _vma_, _lma_) \
+ .got _vma_ : _lma_ \
+ { \
+ FORCE_OUTPUT; *(.got.plt) *(.got) \
+ } > _region_
+
#define SECTION_mmu_tables(_region_, _vma_, _lma_) \
.mmu_tables _vma_ : _lma_ \
{ FORCE_OUTPUT; *(.mmu_tables) } \
> _region_
Index: ebsa285/current/include/pkgconf/mlt_arm_ebsa285_ram.ldi
===================================================================
RCS file: /home/cvs/ecc/ecc/hal/arm/ebsa285/current/include/pkgconf/mlt_arm_ebsa285_ram.ldi,v
retrieving revision 1.9
diff -u -5 -p -r1.9 mlt_arm_ebsa285_ram.ldi
--- ebsa285/current/include/pkgconf/mlt_arm_ebsa285_ram.ldi 2000/09/06 14:01:19 1.9
+++ ebsa285/current/include/pkgconf/mlt_arm_ebsa285_ram.ldi 2001/03/16 09:09:41
@@ -12,17 +12,20 @@ MEMORY
SECTIONS
{
SECTIONS_BEGIN
SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA)
SECTION_rom_vectors (ram, 0x20000, LMA_EQ_VMA)
+ SECTION_RELOCS (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_eh_frame (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA)
+ SECTION_got (ram, ALIGN (0x4), LMA_EQ_VMA)
SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)
CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
CYG_LABEL_DEFN(__pci_window) = 0xf00000; . = CYG_LABEL_DEFN(__pci_window) + 0x100000;
SECTIONS_END
}