[parisc-linux] glibc-2.3.3 & gcc-snapshot (3.5.0) pb

Joel Soete soete.joel at tiscali.be
Wed Feb 18 06:16:36 MST 2004


Carlos,

>I'm building with a fix right now "__attribute__((used))" to war
> gcc-3.5 that it should not remove the function. I hadn't even realized
>that it was only being called by assembly, hence gcc-3.5 is doing a
>*better* job of removing apparently dead code.
>
>When the build finishes I'll update my glibc patches online

Ah :)
So you would certainly need some more hack because of lvalue casting.
Here are some one which could already help you:
--- glibc-2.3.3-20040212/iconv/gconv_simple.c	2004-02-07 17:27:50.000000000
+0100
+++ glibc-2.3.3-20040209/iconv/gconv_simple.c	2004-02-09 18:44:41.217390320
+0100
@@ -453,9 +453,11 @@
 #if __BYTE_ORDER == __BIG_ENDIAN
   /* Sigh, we have to do some real work.  */
   size_t cnt;
+  uint32_t *outptr32 = (uint32_t *) outptr;
 
   for (cnt = 0; cnt < n_convert; ++cnt, inptr += 4)
-    *((uint32_t *) outptr)++ = bswap_32 (*(const uint32_t *) inptr);
+    *outptr32++ = bswap_32 (*(const uint32_t *) inptr);
+  outptr = (unsigned char *) outptr32;
 
   *inptrp = inptr;
   *outptrp = outptr;
=========><=========
I already submitted it and accepted by its maintainer (as it is just a complement
to his job) but not yet ci.

=========><=========
--- glibc-2.3.3-20040212/elf/dl-load.c	2004-02-09 08:03:48.000000000 +0100
+++ glibc-2.3.3-20040209/elf/dl-load.c	2004-02-10 16:32:53.250787488 +0100
@@ -1226,9 +1226,13 @@
 			    (header->e_phnum * sizeof (ElfW(Phdr))));
 	l->l_phdr_allocated = 1;
       }
-    else
+    else {
       /* Adjust the PT_PHDR value by the runtime load address.  */
-      (ElfW(Addr)) l->l_phdr += l->l_addr;
+      /*       (ElfW(Addr)) l->l_phdr += l->l_addr; */
+      ElfW(Addr) *tmpp = (ElfW(Addr) *) l->l_phdr;
+      tmpp += l->l_addr;
+      l->l_phdr = (ElfW(Phdr) *) tmpp;
+    }
   }
 
 #ifdef USE_TLS
@@ -1253,8 +1257,12 @@
 	  goto call_lose;
 	}
     }
-  else
-    (ElfW(Addr)) l->l_ld += l->l_addr;
+  else {
+    /* (ElfW(Addr)) l->l_ld += l->l_addr; */
+    ElfW(Addr) *tmpp = (ElfW(Addr) *) l->l_phdr;
+    tmpp += l->l_addr;
+    l->l_phdr = (ElfW(Phdr) *) tmpp;
+  }
 
   l->l_entry += l->l_addr;
 
=========><=========
--- glibc-2.3.3-20040212/sunrpc/rpc/xdr.h	2002-12-16 03:05:49.000000000 +0100
+++ glibc-2.3.3-20040209/sunrpc/rpc/xdr.h	2004-02-10 11:43:02.022656032 +0100
@@ -263,9 +263,19 @@
  * in the RPC code will not work on 64bit Solaris platforms !
  */
 #define IXDR_GET_LONG(buf) \
-	((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))
+	({			\
+	long l;			\
+	u_int32_t *buf_u32 = (u_int32_t *) buf;			\
+	l = ((long)ntohl((u_long)*__extension__(buf_u32)++));	\
+	buf = (__typeof__(*buf) *) buf_u32;			\
+	l;							\
+	})
 #define IXDR_PUT_LONG(buf, v) \
-	(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))
+	do {			\
+	u_int32_t *buf_u32 = (u_int32_t *) buf;			\
+	(*__extension__(buf_u32)++ = (long)htonl((u_long)(v)));	\
+	buf = (__typeof__(*buf) *) buf_u32;			\
+	} while (0)
 #define IXDR_GET_U_LONG(buf)	      ((u_long)IXDR_GET_LONG(buf))
 #define IXDR_PUT_U_LONG(buf, v)	      IXDR_PUT_LONG(buf, (long)(v))
 
=========><=========
But this one is just a very ugly (just quick and dirty :( )

but also:
--- glibc/iconvdata/euc-jisx0213.c.orig	2004-02-18 12:07:32.723703576 +0100
+++ glibc/iconvdata/euc-jisx0213.c	2004-02-18 12:10:13.832211360 +0100
@@ -83,7 +83,9 @@
 	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
 	    {								      \
 	      /* Write out the last character.  */			      \
-	      *((uint32_t *) outbuf)++ = data->__statep->__count >> 3;	      \
+	      uint32_t *outptr32 = (uint32_t *) outbuf;			      \
+	      *outptr32++ = data->__statep->__count >> 3;		      \
+	      outbuf = (unsigned char *) outptr32;			      \
 	      data->__statep->__count = 0;				      \
 	    }								      \
 	  else								      \
--- glibc/iconvdata/iso-2022-cn-ext.c.orig	2004-02-18 11:13:48.000000000
+0100
+++ glibc/iconvdata/iso-2022-cn-ext.c	2004-02-18 11:21:56.511671032 +0100
@@ -171,6 +171,7 @@
 #define BODY \
   {									      \
     uint32_t ch = *inptr;						      \
+    uint32_t *outptr32 = (uint32_t *) outptr;				      \
 									      \
     /* This is a 7bit character set, disallow all 8bit characters.  */	
     \
     if (ch > 0x7f)							      \
@@ -377,7 +378,8 @@
 	  }								      \
       }									      \
 									      \
-    *((uint32_t *) outptr)++ = ch;					      \
+    *outptr32++ = ch;							      \
+    outptr = (unsigned char *) outptr32;				      \
   }
 #define EXTRA_LOOP_DECLS	, int *setp
 #define INIT_PARAMS		int set = (*setp >> 3) & CURRENT_MASK; \
--- glibc/iconvdata/shift_jisx0213.c.orig	2004-02-18 12:15:21.953369824 +0100
+++ glibc/iconvdata/shift_jisx0213.c	2004-02-18 12:16:30.127005856 +0100
@@ -83,7 +83,9 @@
 	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
 	    {								      \
 	      /* Write out the last character.  */			      \
-	      *((uint32_t *) outbuf)++ = data->__statep->__count >> 3;	      \
+	      uint32_t *outptr32 = (uint32_t *) outbuf;			      \
+	      *outptr32++ = data->__statep->__count >> 3;		      \
+	      outbuf = (unsigned char *) outptr32;			      \
 	      data->__statep->__count = 0;				      \
 	    }								      \
 	  else								      \
--- glibc/iconvdata/tcvn5712-1.c.orig	2004-02-18 11:18:22.027277616 +0100
+++ glibc/iconvdata/tcvn5712-1.c	2004-02-18 11:54:17.527591760 +0100
@@ -68,7 +68,9 @@
 	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
 	    {								      \
 	      /* Write out the last character.  */			      \
-	      *((uint32_t *) outbuf)++ = data->__statep->__count >> 3;	      \
+	      uint32_t *outptr32 = (uint32_t *) outbuf;			      \
+	      *outptr32++ = data->__statep->__count >> 3;		      \
+	      outbuf = (unsigned char *) outptr32;			      \
 	      data->__statep->__count = 0;				      \
 	    }								      \
 	  else								      \
--- glibc/iconvdata/tscii.c.orig	2004-02-18 12:23:37.289067352 +0100
+++ glibc/iconvdata/tscii.c	2004-02-18 12:24:25.417750680 +0100
@@ -98,7 +98,9 @@
 		  break;						      \
 		}							      \
 	      /* Write out the pending character.  */			      \
-	      *((uint32_t *) outbuf)++ = data->__statep->__count >> 8;	      \
+	      uint32_t *outptr32 = (uint32_t *) outbuf;			      \
+	      *outptr32++ = data->__statep->__count >> 8;		      \
+	      outbuf = (unsigned char *) outptr32;			      \
 	      /* Retrieve the successor state.  */			      \
 	      data->__statep->__count =					      \
 		tscii_next_state[(data->__statep->__count >> 4) & 0x0f];      \
=========><=========

But now I need more to try to complete job because:
make[2]: *** [/Develop/parisc-linux/build/glibc/sunrpc/xbootparam_prot.stmp]

Segmentation fault

And dmesg saying:

do_page_fault() pid=6547 command='ld.so.1' type=15 address=0x0016b690
vm_start = 0x00033000, vm_end = 0x00034000

     YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
PSW: 00000000000001000000111100001111 Not tainted
r00-03  0000000000000000 000000004102b6fc 000000004100721f 00000000faf02040
r04-07  000000004102b6fc 00000000400002b8 00000000faf02158 00000000faf01d8c
r08-11  0000000040170000 0000000000170e60 000000004016fd98 00000000faf01dc0
r12-15  0000000040171e60 0000000000000002 00000000faf02128 ffffffffffffffff
r16-19  00000000faf02180 0000000000000003 0000000000000004 000000004102b6fc
r20-23  000000004102bd80 0000000000000008 000000000016b690 0000000040000000
r24-27  000000000016b690 0000000000001e60 0000000000000003 00000000000c97f0
r28-31  0000000040001000 0000000000000000 00000000faf02180 0000000041013fc7
sr0-3   0000000000003580 0000000000003580 0000000000000000 0000000000003580
sr4-7   0000000000003580 0000000000003580 0000000000003580 0000000000003580

IASQ: 0000000000003580 0000000000003580 IAOQ: 0000000041007293 0000000041007297
 IIR: 0ec01095    ISR: 0000000000003580  IOR: 000000000016b690
 CPU:        8   CR30: 000000003a038000 CR31: 00000000104a4000
 ORIG_R28: 0000000040170000
 IAOQ[0]: 0x41007293
 IAOQ[1]: 0x41007297
 RP(r2): 0x4100721f

But I need first to reboot with a new kernel (the present one was build with
gcc-hppa64-3.3 :( ).
Then get the very last gcc and glibc cvs and restart the scipt :)

hth,
    Joel

PS: I also join diff as files because of bad wraping of my webmail interface.


----------------------------------------------------------------------------------------
Tiscali ADSL: 19,50 €/mois, pendant 3 mois! L'Internet rapide, c'est pour
tout le monde.
http://reg.tiscali.be/default.asp?lg=fr



-------------- next part --------------
A non-text attachment was scrubbed...
Name: GLibC-diff
Type: application/octet-stream
Size: 2427 bytes
Desc: not available
Url : http://lists.parisc-linux.org/pipermail/parisc-linux/attachments/20040218/5aa3279c/GLibC-diff.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GLibC-diff2
Type: application/octet-stream
Size: 3382 bytes
Desc: not available
Url : http://lists.parisc-linux.org/pipermail/parisc-linux/attachments/20040218/5aa3279c/GLibC-diff2.obj


More information about the parisc-linux mailing list