[Zlib-devel] [Zlib-announce] zlib 1.2.4 released

Dmitry V. Levin ldv at altlinux.org
Sun Mar 28 18:03:43 EDT 2010


On Sun, Mar 28, 2010 at 12:03:42PM -0700, Mark Adler wrote:
> On Mar 28, 2010, at 7:31 AM, Enrico Weigelt wrote:
> > http://repo.or.cz/w/oss-qm-packages.git/shortlog/refs/tags/METUX.zlib-1.2.4.0
> 
> Are you suggesting the symbol-visibility patch?

This particular patch is broken: it defines CFLAGS instead of SFLAGS.
I've attached another patch that works, but I see no reason to apply it.

The symbol visibility feature is usually used for a shared library when
a symbol versioning is not implemented for it.  In case when symbol
versioning is implemented, visibility could be used as a hardening, to
ensure that no symbols leaked to the public API accidentally.

In zlib, to make this extra feature at least a bit useful, no internal
functions like gz_error should be declared as exported (with ZEXTERN
attribute).  In current situation, symbol visibility restrictions just
will not apply.


-- 
ldv
-------------- next part --------------
From fdf8db4d988d27d07dd01d7a901010752eb3875c Mon Sep 17 00:00:00 2001
From: Dmitry V. Levin <ldv at altlinux.org>
Date: Thu, 28 Jan 2010 18:55:32 +0000
Subject: [PATCH] configure: Enable symbols visibility restrictions on platforms that have attribute(visibility) support

---
 zlib/configure |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/zlib/configure b/zlib/configure
index 8a36129..a735e2d 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -502,6 +502,18 @@ EOF
   fi
 fi
 
+cat >$test.c <<EOF
+int foo __attribute__ ((visibility ("default")));
+int main() { return 0; }
+EOF
+if test "`($CC -c $CFLAGS -fvisibility=hidden $test.c) 2>&1`" = ""; then
+  CFLAGS="$CFLAGS -DHAVE_VISIBILITY_PRAGMA -fvisibility=hidden"
+  SFLAGS="$SFLAGS -DHAVE_VISIBILITY_PRAGMA -fvisibility=hidden"
+  echo "Checking for attribute(visibility) support... Yes."
+else
+  echo "Checking for attribute(visibility) support... No."
+fi
+
 CPP=${CPP-"$CC -E"}
 case $CFLAGS in
   *ASMV*)
-- 
1.7.0.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20100329/d7a7ca0a/attachment.sig>


More information about the Zlib-devel mailing list