This is the mail archive of the mailing list for the libc-ports project.

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

static link on MIPS

As glibc bugzilla #1048 show, static linking on MIPS is somewhat
broken for years.  For example,

$ cat foo.c
#include <netdb.h>
int main(int argc, char **argv)
        return 0;
$ gcc -o foo foo.c -static
/tmp/ccSCPyxW.o: In function `main':
foo.c:(.text+0x2c): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
$ ./foo
foo: ../sysdeps/unix/sysv/linux/ia64/getpagesize.c:35: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' failed.
Floating point exception

(Note that mips getpagesize.c includes ia64/getpagesize.c)

Up to glibc 2.8, glibc-2.3.90-20050704-mips-dl-static.patch by Maciej
could be used to fix the problem.  But with glibc 2.9, it causes

Did someone already fixed this for recent glibc?

If no, I want to forward-port the patch.  Can anybody suggests where
to fix?  I suppose the patch was broken since this commit
(, but not
sure yet.

On Wed, 1 Oct 2008 09:30:40 -0400, Daniel Jacobowitz <> wrote:
> I have checked in this patch, which adds support for the new PLT
> format recently added to binutils and gcc.
> This patch also fixes a bug in dlsym on MIPS, even with current GCC
> and binutils; dlsym would sometimes return lazy binding stubs.  That's
> what the copy of dl-lookup.c and the trick in do-lookup.h are for.
> -- 
> Daniel Jacobowitz
> CodeSourcery
> 2008-10-01  Mark Shinwell  <>
> 	    Daniel Jacobowitz  <>
> 	    Richard Sandiford  <>

Any suggestions are welcome.  Thanks.

Atsushi Nemoto

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