Using previous build as a library

I recently built a Linux shared library using its previous build as one of the statically linked libraries. I had an unusual case where I had to build a new version of a shared library, half of the sources to which where lost. To be more precise, it was not the sources, it was a library from an old SDK, which we lost. But since the sources from that missing library were statically linked in the previous shared library, I decided to use them.

That turned out to be a fairly simple task. I had to identify symbols that ld was missing and copy them from the previous build:

objcopy -w -R'.eh_frame' -N'*' -G'_Z*CTTS*' libPrev.a libMissing.a

I also dropeed eh_frame section, because ld was giving me a warning.

After that the build passed without a hitch and the resulting library was fully functional. That surprised me, because the previous build was produced many a years ago, with glibc 2.2.5 and a much older version of GCC. But nevertheless, it is all workign now!