Symbol Visibility Problem in C Source File

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I've given up trying to change visibility [1] in favor of adding a
thunk or wrapper for test purposes. The wrapper has extern visibility,
while the [real] function of interest is declared static in the
compilation unit. For the wrapper, dbg_my_function (public) simply
calls my_function (private).

The test platform is Ubuntu 10.04 (x64) fully patched with GCC 4.4.3.
Note that there is no header file - only a C source file. And the
project uses automake and friends.

The static archive is exporting the symbol, while the shared object is
not exporting the symbol. Below, a capitol "T" is a exported symbol in
the text section; and a lower "t" is a local symbol in the text
section.

    $ nm --defined ./lib/.libs/libmylibrary.a | grep my_function
    00000000000003f8 T dbg_my_function
    0000000000000000 t my_function
    $ nm --defined ./lib/.libs/libmylibrary.so | grep my_function
    000000000003356b t dbg_my_function
    0000000000033120 t my_function

I've read "How to use the new C++ visibility support" at
http://gcc.gnu.org/wiki/Visibility (even though this is a *C* source
file), and none of the following have helped:
    (a) declare with "extern"
    (b) visibility push/default/pop in the declaration
    (c) "__attribute__ ((visibility("default")))" on the definition.

I've also tried other Google top hits, such as the man pages,
http://linux.die.net/man/1/gcc, and
http://hirntier.blogspot.com/2008/09/gcc-visibility.html.

If this is a repeat of
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20297, what is the work
around? The bug seems kind of dated, but its being experienced in
2010.

Why is there no visibility("extern")? That seems like the hammer that
could smash this issue instead of all the juggling that's going on.

An ideas how to make the symbol external or public?

Jeff

[1] "Change symbol visibility in library (local -> external)", not yet
indexed from GCC mailing list.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux