ld works, gcc doesn't & NS plugin problems
Arthur Gold
agold@bga.com
Wed Dec 1 16:37:00 GMT 1999
Steve Fink wrote:
>
> I don't know if these are related, but they might be...
>
> I am trying to write a netscape plugin. It works, except their default
> makefile.linux doesn't -- I have to switch from using gcc -shared to ld
> -shared when generating the final shared lib. I have encountered this
> before in simpler situations. Netscape gets a bus error.
>
> But I can live with that without understanding it. What I can't figure
> out is how to make the plugin work. Calling dynamically linked libc and
> netscape symbols works fine. But when I call fstat() (or stat()), it
> fills my struct stat buffer with junk. The exact same code works fine
> when built as a standalone program, and the fstat call isn't failing
> (read() also behaves correctly on the same fd). Is something about the
> way I'm linking causing these things to get tangled up? How is fstat()
> resolved, anyway? Doesn't seem to be in libc.so.
>
> % gcc -shared -fPIC -c -Wall -g -DXP_UNIX -I../../../include
> -I../Source/_gen -I. -I/usr/include ../Source/UnixShell.c
> % ld -shared -o myplugin.so UnixShell.o stubs.o
>
> % rpm -q -f /lib/libc.so.6
> glibc-2.1.2-10
> % rpm -q binutils
> binutils-2.9.1.0.23-1
> % gcc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
> gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
> % ld -v
> GNU ld version 2.9.1 (with BFD 2.9.1.0.23)
> % netscape -v
> Netscape 4.6/U.S., 04-May-99; (c) 1995-1998 Netscape Communications
> Corp.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Steve:
IIRC, the *stat() family of calls are inlined -- look at sys/stat.h --
referring to _xstat, _fxstat, etc. That is likely the source of your
problem.
HTH,
--ag
--
Artie Gold, Austin, TX (finger the cs.utexas.edu account for more info)
mailto:agold@bga.com or mailto:agold@cs.utexas.edu
--
?
More information about the Gcc-help
mailing list