Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Stephen P. Becker" <geoman@gentoo.org>
To: Bryan Althouse <bryan.althouse@3phoenix.com>
Cc: "'Linux/MIPS Development'" <linux-mips@linux-mips.org>
Subject: Re: Seg fault when compiled with -mabi=64 and -lpthread
Date: Thu, 30 Jun 2005 15:08:38 -0400	[thread overview]
Message-ID: <42C44336.1080401@gentoo.org> (raw)
In-Reply-To: <20050630173409Z8226102-3678+735@linux-mips.org>

Bryan Althouse wrote:
> I have a problem when linking a 64 bit application with libpthread.  I
> appears to link fine, but it will seg fault when I execute it.  I wrote
> an empty C program called empty.c:
> 
>  
> 
> int main (void)
> 
> { 
> 
>     return 0;
> 
> }
> 
>  
> 
> I cross compile it with:
> 
> /opt/redhat/mips64linux-031001/H-i686-pc-linux-gnulibc2.2/bin/mips64-linux-gnu-gcc
> –mabi=64 empty.c –o empty –lpthread
> 
> The executable will seg fault.  If I remove the –lpthread, it is fine. 
> Also, if I change the 64 to 32, it is fine.
> 
>  
> 
> Maybe I have a bad libpthread in /lib64?  If I type “file
> /lib64/libpthread-0.10.so” I get: “ELF 64-bit MSB shared object, mips-3
> MIPS R3000_BE, version 1, not stripped”.  Looks fine to me.  Should I
> cross compile and replace libpthread?  If so, where can I find the source?
> 

Wow, so I'm not just smoking crack.  I ran into essentially the same
exact problem with my n32 userland while trying to build glib (not
glibc).  The configure script kept dying while trying to determine if
libpthread was available.  Looking at the config.log, I noticed that the
conftest code was causing a segfault.  Furthermore, this causes a kernel
oops (you should check your kernel logs for an oops).

I isolated the conftest code, and it is available at:
http://beerandrocks.net:8080/~spbecker/oops/

In that directory is also a statically linked big endian n32 executable,
as well as dumps of oops messages that I was able to reproduce 100% of
the time on both ip32 and ip22 systems.  If anyone is in an
experimenting mood, try to run that executable on a mips64 box (with n32
binary support enabled obviously) and see what happens.  The interesting
thing about this problem is that it only happens with recent kernels.  I
can't speak for 2.6.11 since I haven't tested it yet, but the oops only
occurred while running 2.6.12 from cvs HEAD.  When running my 2.6.10
build that has been on my indy for some time, the conftest code runs
fine without any segfault, and there is no kernel oops.

-Steve

  reply	other threads:[~2005-06-30 19:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-30 17:33 Seg fault when compiled with -mabi=64 and -lpthread Bryan Althouse
2005-06-30 19:08 ` Stephen P. Becker [this message]
2005-06-30 19:31   ` Bryan Althouse
2005-06-30 20:21 ` Ralf Baechle
2005-06-30 21:03   ` Daniel Jacobowitz
2005-06-30 22:09     ` Stephen P. Becker
2005-07-01  3:51       ` Daniel Jacobowitz
2005-07-01  4:44         ` Kumba
2005-07-01  8:49         ` Maciej W. Rozycki
2005-07-01 13:39           ` Daniel Jacobowitz
2005-07-01 14:10             ` Maciej W. Rozycki
2005-07-01 14:46               ` Daniel Jacobowitz
2005-07-01 15:04                 ` Maciej W. Rozycki
2005-07-01 14:56         ` Stephen P. Becker
2005-07-01 15:22           ` Maciej W. Rozycki
2005-07-01 16:39             ` Stephen P. Becker
2005-07-01 17:02           ` Daniel Jacobowitz
2005-07-01 17:15             ` Stephen P. Becker
2005-07-01 15:09         ` Bryan Althouse
2005-07-01 14:54           ` sjhill
2005-07-01 15:09           ` Bryan Althouse
2005-07-01 15:29           ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42C44336.1080401@gentoo.org \
    --to=geoman@gentoo.org \
    --cc=bryan.althouse@3phoenix.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox