On Fri, Jul 20, 2012, at 12:13 AM, Дилян Палаузов wrote:
> On 19.07.2012 03:11, Greg Banks wrote:
> > On Wed, Jul 18, 2012, at 10:46 PM, Дилян Палаузов wrote:
> >> On 16.07.2012 02:08, Greg Banks wrote:
> > That's a lot of exported symbols for such a small library :(
> > But you could fix that without advanced non-portable linker trickery, by
> > (for example) moving chunks of sieve/tree.c into sieve/sieve.y, or
> > #include'ing one into the other or vice versa.
> The most T-symbols are generated by flex/bison and this cannot be
> tricked. Flex can be instructed not to generate unnecessary functions
> with %option noyyset_in or alike, however flex on ci.cyrus-imapd.org
> does not support these options. So the functions are there.
You could always post-process the generated C code at build time with a
two-line Perl script which inserts the word "static" in front of
function definitions and/or declarations.
There are still some other compilers left in the world. The Sun, sorry
Oracle, compiler, for example, will parse and ignore both
__attribute__(visibility()) in the code and -fvisibility=hidden on the
commandline, without failing.
nm -D does the same thing as the GNU nm, i.e. prints the symbols visible
to the dynamic linker.
Here, you're lucky that -fvisibility=hidden is effectively ignored by
the compile stage, and is harmlessly misinterpreted by the linker as
Useful only when building a shared object. Specifies
that the symbol table of the shared object is used as an
auxiliary filter on the symbol table of the shared
object specified by name. Multiple instances of this
option are allowed. This option can not be combined with
the -F option.
I think that you can solve this problem in a more portable way, that
actually does the useful thing you want to achieve on all platforms,
without breaking our link semantics on any platform.