This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: gcc bug on solaris 2.7?


Ops. forgot about the -fPIC flag. But the problem exists even when this 
flag is used.

gcc -shared doesn't make any difference.

The problem occurs when dereferencing a function pointer, when this
function pointer is part of a shared library. This problem occurs
only on solaris 2.7.

I'm attaching the test source files including the modified makefile
to reproduce this problem.

Satish
*****************************************
>cat Makefile 
all:
        gcc -fPIC -v --save-temps -c -g foo.c
        #ld -G foo.o -o libfoo.so
        gcc -fPIC -shared  -v --save-temps foo.o -o libfoo.so
        gcc -fPIC -v --save-temps -g main.c -L. -lfoo -R.
>make
..... lots of out output look at make.out

>a.out
Segmentation fault
>
**************************************

On Fri, 13 Aug 1999, Martin v. Loewis wrote:

> > fire:/homes/balay/junk/bug>gcc -c foo.c
> [...]
> > fire:/homes/balay/junk/bug>ld -G foo.o -o libfoo.so
> > fire:/homes/balay/junk/bug>gcc main.c -L. -lfoo -R.
> 
> Thanks for your bug report. That may be a bug in your build procedure,
> though: Please use -fPIC when compiling objects for use in a shared
> library, and use "gcc -shared" to build the shared library, instead of
> "ld -G". You'll find these options documented in the info pages.
> 
> Regards,
> Martin
> 

bug.tar.gz


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