Subject: ld error " linking PIC files with non-PIC files "

From: Wayne Gowcher <[email-masked]>
Date: Tue, 13 Nov 2001 12:09:48 -0800 (PST)

I am trying to cross compile X using the redhat7.0
distribution from the sgi mips site as my base. Most
files compile OK, but they fail at the link stage with
the following error :

linking PIC files with non-PIC files.

I created my cross-compile library files in
/usr/mipsel-linux from the packages :
glibc-2.2.2-1.mipsel.rpm &
glibc-devel-2.2.2-1.mipsel.rpm
are there other libraries I need ?

I found a reference on the web to a module called
libc6-pic.o, I don't see this anywhere in my libraries
is this what I need ?

Has anyone else seen this problem before and do they
know how to fix it ?

TIA

Wayne

__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

---

From: Ralf Baechle <[email-masked]>
Date: Wed, 14 Nov 2001 11:18:34 +1100

> Has anyone else seen this problem before and do they

Don't use non-pic code ever in userspace.  Actually it's very strange
that you hit this problem as gcc defaults to pic code so you should
try to find which of your object files or libraries are non-pic.

  Ralf

---

From: Ralf Baechle <[email-masked]>
Date: Mon, 19 Nov 2001 20:05:15 +1100

On Mon, Nov 19, 2001 at 04:05:09PM +0800, renc stone wrote:

> That's the same problem as mine.
> I try to use 64bit long long div& mod in one module,
> and find I miss some _divdi3 and something like that.
> 
> when I try to link my module with libgcc.a, in my mipsel-glibc 2.95.3,
> the ld report the same thing.
> 
> Does it mean I can't use 64bit div in module? How to get rid of this error?

Again, it's a grave mistake to mix pic and non-pic libraries.

To solve this you must either supply your own non-pic versions of the
routines in question or - and better - try to avoid them.  In your case
take a look at <asm/div64.h> which supplies a 64-bit by 32-bit division
routine.

  Ralf