This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
ld works, gcc doesn't & NS plugin problems
- To: help-gcc at gnu dot org
- Subject: ld works, gcc doesn't & NS plugin problems
- From: Steve Fink <sfink at cs dot berkeley dot edu>
- Date: Wed, 01 Dec 1999 02:10:56 GMT
- Newsgroups: gnu.gcc.help
- Organization: Deja.com - Before you buy.
- Xref: wodc7nx0 gnu.gcc.help:2025
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.