Re: Shared libs with non-PIC code on i386
Eduard Bloch <firstname.lastname@example.org> writes:
> I know that it is to late to change the policy, but I will try to
> explain my problems and what the problem is. I have a problem with
> linking PIC (position independent code) with non-PIC code in a
> shared library. The current policy requires all libraries to contain
This should read "policy requires all *shared* libraries ------/
>From section 11.2:
All libraries must have a shared version in the `lib*' package and a
static version in the `lib*-dev' package. The shared version must be
compiled with `-fPIC', and the static version must not be. In other
words, each `*.c' file will need to be compiled twice.
> only PIC code, and the gcc (especially gcc-3.0) refuses to do such
> linking on non-x86 plattforms. Fortunately, this works fine on i386
> and used sometimes.
This ie evil. Having non-PIC shared libraries makes them non-shared
anymore (at least in memory).
> In my case, the problem are the xlibs, particularly libXxf86dga.a. This
> library provides the DGA support.
libXxf86dga.a is a static lib, hence should contain non-PIC code
according to policy.
> Unfortunately, it contains non-strip'able non-PIC code, so any
> *shared* library which wants to use DGA access via libXxf86dga must
> be linked with non-PIC code. This problems affects the DGA plugin in
> my Allegro library and probably some others, ie. SDL. Now the
> question: who cares is I build with the DGA plugin on i386 but
> without DGA on non-x86? Currently, I had to remove the complete DGA
> support (though it is stable enough), so this "exceptional case"
> would make DGA for most users possible.
Maybe you should lobby for a libXxf86dga.so shared library ? Policy
mandates that both .a and .so of all libraries should be provided.