public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* ld works, gcc doesn't & NS plugin problems
@ 1999-11-30 18:24 Steve Fink
  1999-11-30 23:28 ` Steve Fink
  1999-12-01 16:37 ` Arthur Gold
  0 siblings, 2 replies; 4+ messages in thread
From: Steve Fink @ 1999-11-30 18:24 UTC (permalink / raw)
  To: help-gcc

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* ld works, gcc doesn't & NS plugin problems
  1999-11-30 18:24 ld works, gcc doesn't & NS plugin problems Steve Fink
@ 1999-11-30 23:28 ` Steve Fink
  1999-12-01 16:37 ` Arthur Gold
  1 sibling, 0 replies; 4+ messages in thread
From: Steve Fink @ 1999-11-30 23:28 UTC (permalink / raw)
  To: help-gcc

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld works, gcc doesn't & NS plugin problems
  1999-11-30 18:24 ld works, gcc doesn't & NS plugin problems Steve Fink
  1999-11-30 23:28 ` Steve Fink
@ 1999-12-01 16:37 ` Arthur Gold
  1999-12-31 22:24   ` Arthur Gold
  1 sibling, 1 reply; 4+ messages in thread
From: Arthur Gold @ 1999-12-01 16:37 UTC (permalink / raw)
  To: help-gcc

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
--
?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld works, gcc doesn't & NS plugin problems
  1999-12-01 16:37 ` Arthur Gold
@ 1999-12-31 22:24   ` Arthur Gold
  0 siblings, 0 replies; 4+ messages in thread
From: Arthur Gold @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

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
--
?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-30 18:24 ld works, gcc doesn't & NS plugin problems Steve Fink
1999-11-30 23:28 ` Steve Fink
1999-12-01 16:37 ` Arthur Gold
1999-12-31 22:24   ` Arthur Gold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).