[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Templates & shared libs

> Date: Thu, 31 Oct 2002 06:25:31 -0800 (PST)
> From: Boris Visnjic <bvisnjic@xxxxxxx.com>

> I found my problem. I was compiling & linking both
> library and program with the fPIC (position
> independent code) option. As soon I removed it as
> compile option for the program, everything is working
> great. I am not exactly sure what that did, but surely
> it solved all problems.

It's non-optimal to compile a program with -fpic/-fPIC; the code
gets larger and slower.  However, if the program is bug-free, it
should work the same.  (Program bugs can certainly give the
behavior of "working" without -fpic and crashing with it.  I
suggest running Valgrind on the ix86 host-version if you haven't
already done so.)

Let me take this opportunity to recommend -fpic over -fPIC; it
gives smaller and faster code.  The limit on 8188 exported
symbols (or really: the size of the GOT) is very unlikely to be
reached; you'll bounce into other size problems before that.
Compare it to glibc, which has "only" 1103 exported symbols.

> Maybe somebody can proved more
> in depth explanation. Ill look into it as well, but
> right now deadlines are more important :)

I'm glad the bug does not affect you anymore.  However, I'll
still be grateful for a test-program that exposes this possible
compiler bug.

brgds, H-P