Linking a static library with -fPIC for flex
Hi,
Starting with version 2.5.31-18 of flex we have started
providing a static library compiled with position independent code,
namely, libfl_pic.a, in addition to the normal libfl.a library. This
is my mail, in accordance to §10.2 of the Debian policy.
The problem is with packages that contain shared libraries
with a flex scanner compiled in. Since flex generates code
that is not self contained, and the missing symbols live in
libfl.a. However, since linking a shared library with a object
containing non position independent code stopped working with gcc 4.1
(apparently, it was sheer luck that it worked at all). So now we also
provide libfla_pic.a for shared library packages to link with.
I was initially going to just provide libfl.a with position
independent code, which would have prevented the FTBS breakage for
scanner containing shared libraries, at the expense of a register
lost for binaries that were otherwise statically linked, and perhaps
slower execution speeds. When I broached this on IRC, people
commented that I could provide libfl_pic.a in addition to libfl.a ,
but compile them both with -fPIC, and transition back at some later
point to having a non position independent static libfl.a
Then I realized I was falling into the trap of preferring
convenience to correctness; the right thing to identify and fix
packages building shared objects linked to non relocatable code. So,
now these packages can link to libfl_pic.a, and binaries can
continue to link with libfl.a.
An alternative would have been to provide a full fledged
shared library, but that would have been a major break with upstream
and other distributions that also have flex, and would entail
creating new library and devel packages for flex, which is more work
that seems justified (considering that we would have to maintain the
fork, and keep track of any ABI changes, and all that).
manoj
arch-tag: 7421b315-d205-4e09-9a81-0fef07ba57b7
--
A grammarian's life is always in tense.
Manoj Srivastava <srivasta@debian.org> <http://www.debian.org/%7Esrivasta/>
1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C
Reply to: