Re: cause for armel nss (i.e., firefox) build segfault
Hi,
I am building firefox on my ARM platform. I got the same
shlibsign segfault error under
security/nss/lib/softoken/shlibsign/Linux2.6_armc_PCH_OPT.OBJ
directory. I tried lennert's below fix for this and it didn't work
out. Then, i have found out that _PR_PTHREADS gets defined in my
system and hence the patch portion of the code is not executed in the
file nsprpub/pr/include/md/_linux.h. I couldn't figure out where and
how _PR_PTHREADS is defined. I am using arm-none-linux-gnueabi tools
built from codesourcery source and running linux 2.6.16 kernel. Please
let me know if any one face this issue and the possible solution to
this.
Thanks & Regards,
Nizam.
cause for armel nss (i.e., firefox) build segfault
Lennert Buytenhek
Sat, 05 May 2007 18:40:13 -0700
Hi,
The reason that building nss (i.e., firefox) would segfault on ARM EABI
systems is an assumption about the layout of the jmp_buf structure in
the nspr library (which nss depends on) that does hold on old-ABI but
no longer holds on EABI. The attached patch fixes this assumption,
and fixes the shlibsign segfault during the building of nss (it also
fixes a floating point byte order assumption.)
Looks sane?
It's of course a stupid idea to depend on a particular layout of the
jmp_buf structure in application programs, but oh well. People write
ugly buggy code, film at 11.
cheers,
Lennert
--- nspr-4.6.6/mozilla/nsprpub/pr/src/misc/prdtoa.c.orig 2007-05-06
02:39:00.000000000 +0200
+++ nspr-4.6.6/mozilla/nsprpub/pr/src/misc/prdtoa.c 2007-05-06
02:39:22.000000000 +0200
@@ -59,8 +59,8 @@
/* FIXME: deal with freelist and p5s. */
}
-#if defined(__arm) || defined(__arm__) || defined(__arm26__) \
- || defined(__arm32__)
+#if (defined(__arm) || defined(__arm__) || defined(__arm26__) \
+ || defined(__arm32__)) && !defined(__ARM_EABI__) && !defined(__ARMEB__)
#define IEEE_ARM
#elif defined(IS_LITTLE_ENDIAN)
#define IEEE_8087
--- nspr-4.6.6/mozilla/nsprpub/pr/include/md/_linux.h.orig 2007-05-06
02:39:45.000000000 +0200
+++ nspr-4.6.6/mozilla/nsprpub/pr/include/md/_linux.h 2007-05-06
02:40:57.000000000 +0200
@@ -346,7 +346,7 @@
#error "Linux/MIPS pre-glibc2 not supported yet"
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
-#elif defined(__arm__)
+#elif defined(__arm__) && !defined(__ARM_EABI__)
/* ARM/Linux */
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[20]
@@ -358,6 +358,18 @@
#error "ARM/Linux pre-glibc2 not supported yet"
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
+#elif defined(__arm__) && defined(__ARM_EABI__)
+/* ARM/Linux */
+#if defined(__GLIBC__) && __GLIBC__ >= 2
+#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[8]
+#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[7] = (val))
+#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
+#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[7])
+#define _MD_SP_TYPE __ptr_t
+#else
+#error "ARM/Linux pre-glibc2 not supported yet"
+#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
+
#else
#error "Unknown CPU architecture"
-
Reply to: