ld to library without version information in Linux

Viewed 2658

When compiling a C/C++ program, is there a way to link to library exports in Linux without having ld embed the version information?

I am building a shared object that links to libxul.so in Firefox (it's a Firefox binary extension). I want to build my shared object and link to libxul.so so that at runtime, the loader does not care what version libxul.so is.

Right now, my output .so file has the following dependency:

readelf -V myext.so
  0x0080: Version: 1  File: libxul.so  Cnt: 1
  0x0090:   Name: xul24.0  Flags: none  Version: 9

(Note that it depends on the version 'xul24.0')

The exported functions do not change between Firefox versions. So, I want to remove this version instruction.

When attempting to load into Firefox 26, LD_DEBUG=file provides the following error:

/usr/lib/firefox/libxul.so: error: version lookup error:
version `xul24.0' not found (required by /.../myext.so) (fatal)

In the case of the Firefox 26 version of libxul.so, the version is 'xul26'.

So, how can I prevent ld from embedding version information into my library?

2 Answers
Related