This is the mail archive of the gcc@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: SunOS shared libs ?


> You need to add "-fPIC" to the linker command line  as well. If any of
> your  *.o files  contain  static CTOR/DTORs, a   small .c file will be
> generated by the  collect2 program which  in turn will be compiled and
> linked into  your shared lib.  Since you  didn't specify "-fPIC"  when
> linking, bloody  StunOS ld starts complaining...  Of course, using GNU
> ld (e.g. from  binutils-2.9.1) would cure  this; the current  mainline
> sources (the  snapshots)  address  this   differently, i.e.  you   can
> continue using SunOS ld.

    Ok, thanks that seems to have fixed the problem. I'd strongly
    suggest adding this to the FAQ.

    I still don't understand a couple of items:
    -- My files are all C (no C++) so there is CTOR/DTOR issue at all;
       how come I still need the -fPIC linker option ?
    -- How come I did not need -fPIC linker option with gcc-2.7.2 ?

    Anyway, thanks for the help.

    Ram


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