This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

synthetic target fixes

This is an attempt to fix the current linking problems with the
synthetic target and various versions of g++. The infrastructure's
cxxsupp testcase has revealed these problems. Tested with gcc 2.95.4
20011002 (Debian prerelease) and gcc version 3.2.2 20030222 (Red Hat
Linux 3.2.2-5).

2.95.x can bring in libgcc.a's __pure_virtual() which depends on
__write(). __pure_virtual() should never actually get called so a
dummy __write() suffices.

With gcc 3.2.2, libsupc++, the default new operator pulls in exception
handling code from libgcc_eh.a. This happens even if you use the
nothrow version of new and build with -fno-exceptions. I don't know
why this is happening. libgcc_eh.a requires dl_iterate_phdr() from
glibc, which deals with dynamically loaded libraries. That is
obviously not applicable to eCos so a dummy dl_iterate_phdr() should
be fine, and anyway the exception handling code should never actually
get called in current eCos configurations.


2003-07-05  Bart Veer  <>

	* src/synth_entry.c:
	Add more dummy functions to cope with dependencies introduced by
	various versions of g++.

Index: src/synth_entry.c
RCS file: /cvs/ecos/ecos/packages/hal/synth/arch/current/src/synth_entry.c,v
retrieving revision 1.5
diff -u -r1.5 synth_entry.c
--- src/synth_entry.c	3 Dec 2002 21:07:35 -0000	1.5
+++ src/synth_entry.c	5 Jul 2003 23:07:31 -0000
@@ -169,6 +169,18 @@
 // ----------------------------------------------------------------------------
+// Stub functions needed for linking with various versions of gcc
+// configured for Linux rather than i386-elf.
+#if (__GNUC__ < 3)
+// 2.95.x libgcc.a __pure_virtual() calls __write().
+int __write(void)
+    return -1;
+#if (__GNUC__ >= 3)
 // Versions of gcc/g++ after 3.0 (approx.), when configured for Linux
 // native development (specifically, --with-__cxa_enable), have
 // additional dependencies related to the destructors for static
@@ -186,6 +198,18 @@
 void*   __dso_handle = (void*) &__dso_handle;
+// gcc 3.2.2 (approx). The libsupc++ version of the new operator pulls
+// in exception handling code, even when using the nothrow version and
+// building with -fno-exceptions. libgcc_eh.a provides the necessary
+// functions, but requires a dl_iterate_phdr() function. That is related
+// to handling dynamically loaded code so is not applicable to eCos.
+dl_iterate_phdr(void* arg1, void* arg2)
+    return -1;
 // End of entry.c

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]