This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Re: gcc-3.4.X + glibc segfault


Jake Page wrote:
I found this message from a while back (like 2 months ago...):

http://gcc.gnu.org/ml/gcc/2004-05/msg01148.html

...and was wondering if you ever figured out what was going on.

Yes, I think it was gcc-3.4.1 optimizing a bit much. Here's a workaround backported from cvs to glibc-2.3.2:

http://kegel.com/crosstool/crosstool-0.28-rc26/patches/glibc-2.3.2/glibc-2.3.2-allow-gcc-3.4-nounit.patch

Hope that helps.

(I'm now trying to get glibc to build with gcc-3.5 snapshots,
which is a bit more interesting.  Lots of progress so far,
but currently stuck on inlining issues; gcc-3.5 doesn't like
it when you give both an inline and an out-of-line body for
a function declared with 'must inline' attributes...)
- Dan

I am having the same problem with gcc-3.4.1/glibc-2.2.5 on MIPS. I traced it down to the exact same problem, in fact, these instructions:

  mutex_init(&main_arena.mutex);
  403838:       8f848020        lw      a0,-32736(gp)
  40383c:       00000000        nop
  403840:       24840904        addiu   a0,a0,2308
  403844:       00002821        move    a1,zero
  403848:       8f998770        lw      t9,-30864(gp)
  40384c:       00000000        nop
  403850:       0320f809        jalr    t9   <<== BOOM!

$t9 = 0 at the jalr, so it jumps to 0x00000000, whoops!

It looks like in thread-m.h mutex_init() is defined as:

#define mutex_init(m)		\
   (__pthread_mutex_init != NULL \
    ? __pthread_mutex_init (m, NULL) : (*(int *)(m) = 0))

where __pthread_mutex_init is a weak reference in libc and defined in libpthread. I also have a problem with this compiling shared libs... however if I -lpthread shared it works, but static it still seg faults. Basically it looks like gcc-3.4.1 is "optimizing"?!? out the conditional branch (though I tried -O0 and it still does it...)

Anyway, probably more than you wanted to know :) Just curious if you found any more on it, if it's a gcc but I'm not too excited to try and fix it, ugh...

-- My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change

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


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