CT: Any obstacles for using gcc 4.0 snapshots?

Dan Kegel dank@kegel.com
Fri Mar 11 00:55:00 GMT 2005


Dan Kegel wrote:
> The next problem was
> In file included from strcoll.c:101:
> ../locale/weight.h: In function 'strcoll':
> ../locale/weight.h:23: error: invalid storage class for function 'findidx'
> make[2]: *** 
> [/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/build-glibc/string/strcoll.o] 
> Error 1
> make[2]: Leaving directory 
> `/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/glibc-2.2.5/string' 
> 
> make[1]: *** [string/subdir_lib] Error 2
> make[1]: Leaving directory 
> `/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/glibc-2.2.5' 
> 
> make: *** [all] Error 2
> 
> I don't have a patch for this just yet, but it was discussed here
> http://sources.redhat.com/ml/libc-hacker/2004-09/msg00015.html
> and the fix checked in to cvs seems to be
> http://sources.redhat.com/ml/glibc-cvs/2004-q3/msg01071.html

[ This message is a bit stream-of-consciousness; feel free to ignore
   it if you don't want to see sausage being made.
   All this nastiness is only for people who really want glibc-2.2.5
   with gcc-4.0.  Sensible people will use glibc-2.3.4 instead.]

Complicating matters, crosstool patches for glibc need to
compile with gcc-2.95.3, which mainline glibc abandoned
recently.  Here are crosstool-friendly fixes for the
"error: invalid storage class for function 'findidx'" errors:

--- glibc-2.2.5/locale/weight.h.old     2001-07-05 21:55:33.000000000 -0700
+++ glibc-2.2.5/locale/weight.h 2005-03-10 16:07:46.669579888 -0800
@@ -18,7 +18,12 @@
     02111-1307 USA.  */

  /* Find index of weight.  */
+#if __GNUC__ >= 4
+auto inline int32_t
+__attribute ((always_inline))
+#else
  static inline int32_t
+#endif
  findidx (const unsigned char **cpp)
  {
    int_fast32_t i = table[*(*cpp)++];
--- glibc-2.2.5/locale/weightwc.h.old   2001-08-06 21:26:15.000000000 -0700
+++ glibc-2.2.5/locale/weightwc.h       2005-03-10 16:13:08.651631176 -0800
@@ -18,7 +18,12 @@
     02111-1307 USA.  */

  /* Find index of weight.  */
+#if __GNUC__ >= 4
+auto inline int32_t
+__attribute ((always_inline))
+#else
  static inline int32_t
+#endif
  findidx (const wint_t **cpp)
  {
    int32_t i;

auth_none.c: In function 'authnone_create':
auth_none.c:83: error: invalid lvalue in assignment
make[2]: *** [/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/build-glibc/sunrpc/auth_none.o] Error 1
make[2]: Leaving directory `/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/glibc-2.2.5/sunrpc'
make[1]: *** [sunrpc/subdir_lib] Error 2
make[1]: Leaving directory `/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/glibc-2.2.5'
make: *** [all] Error 2

The fix in 2.3.2,
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sunrpc/auth_none.c.diff?r1=1.7&r2=1.8&cvsroot=glibc
is way too invasive; here's a gentle fix:

--- glibc-2.2.5/sunrpc/auth_none.c.old  2005-03-10 16:26:53.874178280 -0800
+++ glibc-2.2.5/sunrpc/auth_none.c      2005-03-10 16:34:24.551664888 -0800
@@ -62,7 +62,7 @@
    u_int mcnt;
  };
  #ifdef _RPC_THREAD_SAFE_
-#define authnone_private ((struct authnone_private_s *)RPC_THREAD_VARIABLE(authnone_private_s))
+#define authnone_private RPC_THREAD_VARIABLE(authnone_private_s)
  #else
  static struct authnone_private_s *authnone_private;
  #endif
@@ -80,7 +80,7 @@
        ap = (struct authnone_private_s *) calloc (1, sizeof (*ap));
        if (ap == NULL)
         return NULL;
-      authnone_private = ap;
+      authnone_private = (void *)ap;
      }
    if (!ap->mcnt)
      {

Next problem:
clnt_perr.c: In function '_buf':
clnt_perr.c:68: error: invalid lvalue in assignment
make[2]: *** [/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/build-glibc/sunrpc/clnt_perr.o] Error 1
--- glibc-2.2.5/sunrpc/clnt_perr.c.old  2005-03-10 16:45:46.107052720 -0800
+++ glibc-2.2.5/sunrpc/clnt_perr.c      2005-03-10 16:46:14.124793376 -0800
@@ -56,7 +56,7 @@
   * buf variable in a few functions.  Overriding a global variable
   * with a local variable of the same name is a bad idea, anyway.
   */
-#define buf ((char *)RPC_THREAD_VARIABLE(clnt_perr_buf_s))
+#define buf RPC_THREAD_VARIABLE(clnt_perr_buf_s)
  #else
  static char *buf;
  #endif


clnt_raw.c: In function 'clntraw_create':
clnt_raw.c:103: error: invalid lvalue in assignment
make[2]: *** [/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/build-glibc/sunrpc/clnt_raw.o] Error 1

--- glibc-2.2.5/sunrpc/clnt_raw.c.old   2005-03-10 16:47:24.823045608 -0800
+++ glibc-2.2.5/sunrpc/clnt_raw.c       2005-03-10 16:47:54.458540328 -0800
@@ -61,7 +61,7 @@
      u_int mcnt;
    };
  #ifdef _RPC_THREAD_SAFE_
-#define clntraw_private ((struct clntraw_private_s *)RPC_THREAD_VARIABLE(clntraw_private_s))
+#define clntraw_private RPC_THREAD_VARIABLE(clntraw_private_s)
  #else
  static struct clntraw_private_s *clntraw_private;
  #endif
@@ -100,7 +100,7 @@
        clp = (struct clntraw_private_s *) calloc (1, sizeof (*clp));
        if (clp == 0)
         return (0);
-      clntraw_private = clp;
+      clntraw_private = (void *)clp;
      }
    /*
     * pre-serialize the static part of the call msg and stash it away

clnt_simp.c: In function 'callrpc':
clnt_simp.c:78: error: invalid lvalue in assignment
make[2]: *** [/home/dank/queue/jobdir.fast2/crosstool-dev/build/i686-unknown-linux-gnu/gcc-4.0-20050305-glibc-2.2.5/build-glibc/sunrpc/clnt_simp.o] Error 1

--- glibc-2.2.5/sunrpc/clnt_simp.c.old  2005-03-10 16:49:59.051599304 -0800
+++ glibc-2.2.5/sunrpc/clnt_simp.c      2005-03-10 16:50:26.839374920 -0800
@@ -55,7 +55,7 @@
      char *oldhost;
    };
  #ifdef _RPC_THREAD_SAFE_
-#define callrpc_private ((struct callrpc_private_s *)RPC_THREAD_VARIABLE(callrpc_private_s))
+#define callrpc_private RPC_THREAD_VARIABLE(callrpc_private_s)
  #else
  static struct callrpc_private_s *callrpc_private;
  #endif
@@ -75,7 +75,7 @@
        crp = (struct callrpc_private_s *) calloc (1, sizeof (*crp));
        if (crp == 0)
         return 0;
-      callrpc_private = crp;
+      callrpc_private = (void *)crp;
      }
    if (crp->oldhost == NULL)
      {

The next one was more interesting:

rpc_cmsg.c: In function 'xdr_callmsg':
rpc_cmsg.c:70: error: invalid lvalue in increment
rpc_cmsg.c:71: error: invalid lvalue in increment
rpc_cmsg.c:74: error: invalid lvalue in increment
...
rpc_cmsg.c:122: warning: operation on 'buf' may be undefined

That's a bit like
http://kegel.com/crosstool/crosstool-0.28-rc37/patches/glibc-2.3.2/glibc-2.3.2-allow-gcc-3.5-xdr.patch

I haven't put together a fix for that yet;
have to dash off to the vet.
-- 
Trying to get a job as a c++ developer?  See http://kegel.com/academy/getting-hired.html

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list