ld tests about protected visibility

CHIGOT, CLEMENT clement.chigot@atos.net
Thu Nov 25 13:59:30 GMT 2021


Hi everyone, 

I'm currently implementing visibility for XCOFF format and while doing 
so I'm running tests inside "ld-elfvsb" testsuite. 
However, I'm not sure all the tests are doing what they are supposed to do. 
Especially tests about the protected visibility, I have exactly the same result 
whether or not ".protected" instructions are being added or not. 
   
With ".protected" in main.c, 
$ readelf -s tmpdir/mainnp.o | grep shared_
    42: 0000000000000000     4 OBJECT  GLOBAL PROTECTED    2 shared_data
    43: 0000000000000020    10 FUNC    GLOBAL PROTECTED    1 shared_func
$ gcc ... -o tmpdir/vp ... tmpdir/mainnp.o tmpdir/vp.so
$ ./tmpdir/vp
...
$ echo $?
0


Without ".protected": 
$ readelf -s tmpdir/mainnp.o | grep shared_
    44: 0000000000000020    10 FUNC    GLOBAL DEFAULT    1 shared_func
    80: 0000000000000000     4 OBJECT  GLOBAL DEFAULT    2 shared_data
$ gcc ... -o tmpdir/vp ... tmpdir/mainnp.o tmpdir/vp.so
$ ./tmpdir/vp
...
$ echo $?
0


As I'm not fully aware of all the subtleties of ELF and visibility, does anyone know 
if this is intended and if it's not what it should be ? 

Thanks, 
Clément


More information about the Binutils mailing list