This is the mail archive of the ecos-discuss@sources.redhat.com 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]

string library compile problem with gcc 3.2


I tried building RedBoot with gcc 3.2 and ran into a problem with the
eCos C library. This simple example shows the problem:

  -- cut foo.cxx --
extern "C" void foo(void);

extern "C" void foo(void)  __attribute__ ((weak)) __attribute__ ((alias ("__foo")));

void __foo(void) {}
  -- cut foo.cxx --

% gcc foo.cxx
foo.cxx:3: `void foo()' defined both normally and as an alias

This shows up in the eCos string library because the extern decl without
the weak alias is in <string.h> while the individual compilation units
have extern decls with the weak alias attributes. Older gcc didn't have
a problem with this, but according to a gcc engineer it is probably a
loose rule which was tightened in recent gcc versions.

Anyway, a patch for what I think is a good workaround is included. I
wanted to run it by other folks before checking it in. BTW, the
-fno-builtin was needed because gcc apparently uses a builtin protoype
for some of these functions. I don't think that using it causes an
performance issue in the case of the string library.

Also, there may well be the same problem elsewhere, but I just didn't
run into them when building RedBoot.

--Mark



Index: language/c/libc/string/current/cdl/string.cdl
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/cdl/string.cdl,v
retrieving revision 1.6
diff -u -p -5 -r1.6 string.cdl
--- language/c/libc/string/current/cdl/string.cdl	2002/05/21 21:10:46	1.6
+++ language/c/libc/string/current/cdl/string.cdl	2002/08/17 17:45:51
@@ -170,11 +170,11 @@ cdl_package CYGPKG_LIBC_STRING {
 
         cdl_option CYGPKG_LIBC_STRING_CFLAGS_ADD {
             display "Additional compiler flags"
             flavor  data
             no_define
-            default_value { "" }
+            default_value { "-fno-builtin" }
             description   "
                 This option modifies the set of compiler flags for
                 building the C library. These flags are used in addition
                 to the set of global flags."
         }
Index: language/c/libc/string/current/src/memchr.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/memchr.cxx,v
retrieving revision 1.5
diff -u -p -5 -r1.5 memchr.cxx
--- language/c/libc/string/current/src/memchr.cxx	2002/05/21 21:10:47	1.5
+++ language/c/libc/string/current/src/memchr.cxx	2002/08/17 17:45:51
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>          // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/memcmp.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/memcmp.cxx,v
retrieving revision 1.5
diff -u -p -5 -r1.5 memcmp.cxx
--- language/c/libc/string/current/src/memcmp.cxx	2002/05/21 21:10:47	1.5
+++ language/c/libc/string/current/src/memcmp.cxx	2002/08/17 17:45:51
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>           // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 
Index: language/c/libc/string/current/src/memmove.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/memmove.cxx,v
retrieving revision 1.5
diff -u -p -5 -r1.5 memmove.cxx
--- language/c/libc/string/current/src/memmove.cxx	2002/05/21 21:10:47	1.5
+++ language/c/libc/string/current/src/memmove.cxx	2002/08/17 17:45:51
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strcat.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strcat.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strcat.cxx
--- language/c/libc/string/current/src/strcat.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strcat.cxx	2002/08/17 17:45:51
@@ -58,14 +58,16 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>           // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
+
+// Can't include string.h here.
+externC char *strcpy( char *s1, const char *s2 );
 
 // EXPORTED SYMBOLS
 
 externC char *
 strcat( char *s1, const char *s2 ) CYGBLD_ATTRIB_WEAK_ALIAS(__strcat);
Index: language/c/libc/string/current/src/strchr.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strchr.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strchr.cxx
--- language/c/libc/string/current/src/strchr.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strchr.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strcmp.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strcmp.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strcmp.cxx
--- language/c/libc/string/current/src/strcmp.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strcmp.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strcoll.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strcoll.cxx,v
retrieving revision 1.5
diff -u -p -5 -r1.5 strcoll.cxx
--- language/c/libc/string/current/src/strcoll.cxx	2002/05/21 21:10:47	1.5
+++ language/c/libc/string/current/src/strcoll.cxx	2002/08/17 17:45:52
@@ -65,13 +65,16 @@
 #endif
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
+// Can't include string.h here.
+externC int strcmp( const char *s1, const char *s2 );
+
+
 // EXPORTED SYMBOLS
 
 externC int
 strcoll( const char *s1, const char *s2 ) CYGBLD_ATTRIB_WEAK_ALIAS(__strcoll);
 
Index: language/c/libc/string/current/src/strcpy.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strcpy.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strcpy.cxx
--- language/c/libc/string/current/src/strcpy.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strcpy.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>          // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx>  // Useful string function support and
                                            // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strcspn.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strcspn.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strcspn.cxx
--- language/c/libc/string/current/src/strcspn.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strcspn.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strlen.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strlen.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strlen.cxx
--- language/c/libc/string/current/src/strlen.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strlen.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strncat.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strncat.cxx,v
retrieving revision 1.5
diff -u -p -5 -r1.5 strncat.cxx
--- language/c/libc/string/current/src/strncat.cxx	2002/05/21 21:10:47	1.5
+++ language/c/libc/string/current/src/strncat.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strncmp.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strncmp.cxx,v
retrieving revision 1.5
diff -u -p -5 -r1.5 strncmp.cxx
--- language/c/libc/string/current/src/strncmp.cxx	2002/05/21 21:10:47	1.5
+++ language/c/libc/string/current/src/strncmp.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strncpy.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strncpy.cxx,v
retrieving revision 1.5
diff -u -p -5 -r1.5 strncpy.cxx
--- language/c/libc/string/current/src/strncpy.cxx	2002/05/21 21:10:47	1.5
+++ language/c/libc/string/current/src/strncpy.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strpbrk.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strpbrk.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strpbrk.cxx
--- language/c/libc/string/current/src/strpbrk.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strpbrk.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strrchr.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strrchr.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strrchr.cxx
--- language/c/libc/string/current/src/strrchr.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strrchr.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strspn.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strspn.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strspn.cxx
--- language/c/libc/string/current/src/strspn.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strspn.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strstr.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strstr.cxx,v
retrieving revision 1.4
diff -u -p -5 -r1.4 strstr.cxx
--- language/c/libc/string/current/src/strstr.cxx	2002/05/21 21:10:47	1.4
+++ language/c/libc/string/current/src/strstr.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
                                           // prototypes
 
 // EXPORTED SYMBOLS
Index: language/c/libc/string/current/src/strxfrm.cxx
===================================================================
RCS file: /home/cvs/ecc/ecc/language/c/libc/string/current/src/strxfrm.cxx,v
retrieving revision 1.5
diff -u -p -5 -r1.5 strxfrm.cxx
--- language/c/libc/string/current/src/strxfrm.cxx	2002/05/21 21:10:47	1.5
+++ language/c/libc/string/current/src/strxfrm.cxx	2002/08/17 17:45:52
@@ -58,11 +58,10 @@
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions
 #include <cyg/infra/cyg_trac.h>    // Tracing support
 #include <cyg/infra/cyg_ass.h>     // Assertion support
-#include <string.h>                // Header for this file
 #include <stddef.h>         // Compiler definitions such as size_t, NULL etc.
 #include <cyg/libc/string/stringsupp.hxx> // Useful string function support and

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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