Re: freetds on solaris 11: symbol scope specifies local binding (same problem)
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 1 Oct 2013 09:02:47 -0700 Justin T Pryzby <[email protected]> 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