Re: Achieving binary compatibility for 7/8/9

Jonathan Bartlett <[email protected]>
Newsgroups gmane.linux.redhat.devel
Message-ID <[email protected]>
I wonder if you could ship your own nss libs and LD_PRELOAD them before
the application start.

You may also bbe able to define your own loader rather than libc's - just
give your own definition of _start and give -nostartfiles (I think).

Of course, if the LD_PRELOAD trick works, that's much better.

Jon

On Sat, 19 Apr 2003, [iso-8859-1] Peter Åstrand wrote:

> > Have you run a debugger to see _why_ gethostbyname is failing?
>
> The program I'm testing is:
>
> #include <netdb.h>
> #include <stdio.h>
>
> int main()
> {
>     struct hostent * hp;
>
>     if ( (hp = gethostbyname("localhost")) == NULL )
>         printf("gethostbyname failed\n");
>     return 0;
> }
>
> >From gdb:
>
> (gdb) run
> Starting program: /root/a.out
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x08080c09 in _dl_relocate_object ()
> (gdb) bt
> #0  0x08080c09 in _dl_relocate_object ()
> #1  0x080758ef in dl_open_worker ()
> #2  0x0806248b in _dl_catch_error ()
> #3  0x08075ae3 in _dl_open ()
> #4  0x0806353e in do_dlopen ()
> #5  0x0806248b in _dl_catch_error ()
> #6  0x08063431 in __libc_dlopen ()
> #7  0x0805c682 in __nss_lookup_function ()
> #8  0x0805cd0a in __nss_lookup ()
> #9  0x0805d4f3 in __nss_hosts_lookup ()
> #10 0x0804d35c in gethostbyname_r ()
> #11 0x0804d157 in gethostbyname ()
> #12 0x0804820c in main ()
> #13 0x0804830a in __libc_start_main ()
>
> > I see absolutely no reason for a statically linked binary to fail on any
> > system, unless it is using network communication whose protocol has
> > changed or a config file whose format has changed.
>
> I also wished this was the case, but it seems like it doesn't work if the
> static binaires uses NSS. Take a look at
> http://lists.debian.org/debian-glibc/2002/debian-glibc-200210/msg00093.html:
>
>   From: Roland McGrath <[email protected]>
>   ...
>   I'm afraid you are SOL if you want to use stock glibc 2.3 with those old
>   static binaries.
>   ...
>
> > Are you sure you aren't LD_PRELOADing anything?
>
> Yes.
>
> --
> Peter Åstrand		www.thinlinc.com
> Cendio Systems		www.cendio.se
> Teknikringen 3		Phone: +46-13-21 46 00
> 583 30 Linköping
>
>
>
> _______________________________________________
> Redhat-devel-list mailing list
> [email protected]
> https://listman.redhat.com/mailman/listinfo/redhat-devel-list
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.