[lsb-discuss] Setting symbol versions to use without stub libraries

Mike Hearn mike at theoretic.com
Tue Jul 1 14:21:44 PDT 2003


Hi,

You know how the LSB CC dev environment uses stub libs? Well, I think
it'd be cleaner to use this approach:

[mike at littlegreen test]$ cat test.c
#include <stdlib.h>
 
__asm__(".symver realpath,realpath at GLIBC_2.0");
 
int main() {
  char *rp;
  printf("foo\n");
 
  rp = malloc(512);
   
  realpath("/lib", rp);
   
  return 0;
}


Ignore the program itself, it just uses the "realpath" function which
has several versions. You can use that asm directive to set the one you
want. Try it! Good clean fun for all the family.

Anyway, I think embedding these directives in the header files might
have the following advantages:

* No need for stub libs, just use a different set of headers.
* Simpler
* You can link against your system libs, which means you can link
against other libs as well (obviously not a concern for the LSB as you
need to statically link it all anyway, but I want to do this).

Disadvantage: well, it's effort to change the current build process, and
I don't know how well it'd fit in with the database approach.

OTOH I am willing to do some of the work for this, because at the moment
in order to compile a binary that happens to use an older set of glibc
symvers, we need to use a hacked up lsbcc style program, which is less
than ideal. In particular, it means we need to create stub libs for
everything we link against, due to lds habit of attempting to close the
symbol set. 

Just being able to alter the headers in use would be a MUCH easier way
of building binaries using old symbol versions.

Thoughts? Comments?
thanks -mike





More information about the lsb-discuss mailing list