can't mix -pic and -PIC?

joe_h at apollo.com joe_h at apollo.com
Wed Apr 24 10:00:00 AEST 1991


I'm having trouble figuring out an error message given by the loader, that
seems to be nonsensical to me.  Here's what happens:

On SunOS 4.1.1, compile a .c file with -PIC, the run ld -r on
the resultant .o
>cc -PIC foo.c
>ld -r foo.o
>ld: (foo.o): can't mixed pic and PIC .o

I am running SunOS 4.0.3, and this doesn't happen.  It has been reported
to me by another user.  Speaking generically, it seems the message is only
relevent if the ld operation is applied to multiple operands (.o's).  What
is the meaning of this message when ld is only applied to a single
operand?  If I tried to specify both mutually exclusive options to cc, I
would expect a complaint from it.  

To provide a little more background, this was uncoverd when the user tried
to link with a shared library I provided.  I had cc'd all the components
with -PIC (at the user's insistence, I'm sure there aren't that many
symbols that the larger relocation table is needed.  Maybe there's a
reason I'm not aware of.).  I then built both a shared lib and an archive.
When they tried to link with the shared lib, they got this "can't mix -PIC
and -pic..." message.  At least the message makes sense in this context,
but I provided a log of the make, showing clearly all the .c's were built
with only -PIC.  Then they extracted all the .o's from the ar lib, and
tried "ld -r" on individual components, getting the same message.

If anyone has seen this, or knows more about -pic/PIC and shared libs then
I apparently do, I'd appreciate any info you can send.  Email please, our
newsfeed is a week behind and unreliable.

Joe Harrington
joe_h at apollo.hp.com




More information about the Comp.sys.sun mailing list