Skip to Content.
Sympa Menu

freetds - Re: [freetds] freetds on solaris 11: symbol scope specifies local binding (same problem)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] freetds on solaris 11: symbol scope specifies local binding (same problem)
  • Date: Wed, 2 Oct 2013 19:52:41 -0400

On Tue, 1 Oct 2013 09:02:47 -0700
Justin T Pryzby <justinp AT norchemlab.com> wrote:

> I ran gobjdump -t, and found that strlen had a "hidden" attribute; I
> noticed that ctlib.h sets gcc attribute "hidden":
> #pragma GCC visibility push(hidden)
>
> I was able to compile TDS by moving the include file outside of the
> hidden "stack"; not sure if that's correct, but "works for me".
>
> $ diff -U1 freetds-0.91{.orig,}/include/ctlib.h
> --- freetds-0.91.orig/include/ctlib.h Tue Oct 5 01:36:36 2010
> +++ freetds-0.91/include/ctlib.h Tue Oct 1 08:58:01 2013
> @@ -26,2 +26,4 @@
>
> +#include <tds.h>
> +
> #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
> @@ -41,3 +43,2 @@
>
> -#include <tds.h>
> /*

I don't know what Frediano will say, but IMO that is the right fix.
Well done!

tds.h has its own visibility guard, and notably it appears after
the line that includes stddef.h. It would seem that on Solaris the
hidden attribute is applied to standard library functions, and on Linux
it's not.

I've never paid much attention to symbol visibility management; I've
always felt that by taking some care with the choice of names, the
probability of conflict was small. And I prefer to write strictly
standard C, and not delve into proprietary GNU features.

If we're going to employ the visibility attribute, though, it would
seem a good idea to make sure it never appears above an #include
statement. Thankfully,

$ for F in include/*.h src/*/*.[ch]; do sed -ne '/GCC *visibility/,$p'
$F | grep '^# *include' && echo $F ; done
#include <freetds/tds.h>
include/ctlib.h

you found the single case where that didn't hold.

Mystery solved and we learned something. A good day.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page