--version-script

Mathieu Lacage mathieu.lacage@gmail.com
Wed Sep 24 05:59:00 GMT 2008


hi,

It looks like I am pretty unlucky with this so, it is quite likely I
have missed something important. Help would be welcome.

mathieu@mathieu:~/code$ cat test.c
void test (void)
{}
mathieu@mathieu:~/code$ cat test.map
A {
global:
  test;
local:
  *;
};
B {
global:
  test;
} A;
mathieu@mathieu:~/code$ gcc -O0 -g -fpic -c test.c -o test.o
mathieu@mathieu:~/code$ gcc -shared -Wl,--version-script=./test.map
./test.o -o test.so
mathieu@mathieu:~/code$ readelf -V -s ./test.so |grep test
     5: 0000039c     5 FUNC    GLOBAL DEFAULT   12 test@@A
    48: 00000000     0 FILE    LOCAL  DEFAULT  ABS test.c
    62: 0000039c     5 FUNC    GLOBAL DEFAULT   12 test
  000000: Rev: 1  Flags: BASE   Index: 1  Cnt: 1  Name: test.so
mathieu@mathieu:~/code$

The above shows that test is exported under version 'A' as the default
symbol. I was expecting instead something like that (imaginary
output):
     5: 0000039c     5 FUNC    GLOBAL DEFAULT   12 test@A
     5: 0000039c     5 FUNC    GLOBAL DEFAULT   12 test@@B

which would indicate that symbol test is exported under both version A
and B and that B is the 'default' version. What step did I miss to get
this result ?

Mathieu
-- 
Mathieu Lacage <mathieu.lacage@gmail.com>



More information about the Gcc-help mailing list