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

Bug#319388: libGLU should hide C++ interfaces



On Tue, Aug 14, 2007 at 09:00:56 +0100, Brian Paul wrote:

> On 8/14/07, Michel Dänzer <michel@tungstengraphics.com> wrote:
> > On Mon, 2007-08-13 at 17:58 -0700, Zack Weinberg wrote:
> [...]
> > > Second, the bin/mklib script has some internal support for restricting
> > > the set of exports (the -exports option) but that feature has a
> > > critical bug when used with Linux/Solaris version scripts: it assigns
> > > all symbols the same version, derived from the soname.  This is wrong.
> > >  Symbol versions are part of the ABI and need to stay stable once
> > > assigned; if a program that wants, say, gluNewQuadric@GLU_1.0 is run
> > > with a libglu.so that only has a @GLU_1.1 version, the dynamic linker
> > > will barf.
> > >
> > > My preferred way to deal with this would be to have a GNU-ld-style
> > > version script for GLU in the source tree, and document that mklib
> > > -exports expects a file in that format.  mklib would then convert that
> > > to whatever format other platforms' linkers want -- as far as I know,
> > > the GNU version script is strictly more featureful than any other
> > > similar format. I'm not going to implement the conversions, though;
> > > that's for the maintainers of the support for those other platforms.
> > > Do you think that would be something you could get back into upstream?

Instead of doing that conversion, I suggest just changing mklib to not
set a version in the version script (none of the Makefiles in mesa
currently seem to use that, so it seems safe, if other platforms'
linkers can deal with that).

> Go ahead and implement it and submit a patch to bugzilla.  Sounds good
> from your description.
> 
Attached two patches.  The first modifies mklib as mentioned above.  The
second uses that to restrict the list of symbols exported by libGLU
(I copied the list from src/glu/sgi/glu.def).

Cheers,
Julien
>From 7d7fc90d26f22ed8c49ffca968c73f74c795f2fe Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Sun, 13 Jul 2008 17:13:32 +0200
Subject: [PATCH] mklib: don't version symbols when using --exports

Use the default version instead of one based on the library SONAME
in the version script created by --exports.
---
 bin/mklib |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 0dc3135..69e8242 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -271,7 +271,7 @@ case $ARCH in
 	    if [ $EXPORTS ] ; then
 		#OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}"
 		# Make the 'exptmp' file for --version-script option
-		echo "VERSION_${MAJOR}.${MINOR} {" > exptmp
+		echo "{" > exptmp
 		echo "global:" >> exptmp
 		sed 's/$/;/' ${EXPORTS} >> exptmp
 		echo "local:" >> exptmp
-- 
1.5.6.2

>From 575c56de36c04454a377a50606731034a5c5e768 Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcristau@debian.org>
Date: Sun, 13 Jul 2008 17:27:58 +0200
Subject: [PATCH] glu: only export public symbols

---
 src/glu/sgi/Makefile    |    1 +
 src/glu/sgi/glu.exports |   59 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)
 create mode 100644 src/glu/sgi/glu.exports

diff --git a/src/glu/sgi/Makefile b/src/glu/sgi/Makefile
index 63eca5c..cd1354c 100644
--- a/src/glu/sgi/Makefile
+++ b/src/glu/sgi/Makefile
@@ -139,6 +139,7 @@ $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
 	$(MKLIB) -o $(GLU_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
 		-major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
 		-cplusplus $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
+		-exports glu.exports \
 		$(GLU_LIB_DEPS) $(OBJECTS)
 
 
diff --git a/src/glu/sgi/glu.exports b/src/glu/sgi/glu.exports
new file mode 100644
index 0000000..1d1b6da
--- /dev/null
+++ b/src/glu/sgi/glu.exports
@@ -0,0 +1,59 @@
+	gluBeginCurve
+	gluBeginPolygon
+	gluBeginSurface
+	gluBeginTrim
+	gluBuild1DMipmapLevels
+	gluBuild1DMipmaps
+	gluBuild2DMipmapLevels
+	gluBuild2DMipmaps
+	gluBuild3DMipmapLevels
+	gluBuild3DMipmaps
+	gluCheckExtension
+	gluCylinder
+	gluDeleteNurbsRenderer
+	gluDeleteQuadric
+	gluDeleteTess
+	gluDisk
+	gluEndCurve
+	gluEndPolygon
+	gluEndSurface
+	gluEndTrim
+	gluErrorString
+	gluGetNurbsProperty
+	gluGetString
+	gluGetTessProperty
+	gluLoadSamplingMatrices
+	gluLookAt
+	gluNewNurbsRenderer
+	gluNewQuadric
+	gluNewTess
+	gluNextContour
+	gluNurbsCallback
+	gluNurbsCallbackData
+	gluNurbsCallbackDataEXT
+	gluNurbsCurve
+	gluNurbsProperty
+	gluNurbsSurface
+	gluOrtho2D
+	gluPartialDisk
+	gluPerspective
+	gluPickMatrix
+	gluProject
+	gluPwlCurve
+	gluQuadricCallback
+	gluQuadricDrawStyle
+	gluQuadricNormals
+	gluQuadricOrientation
+	gluQuadricTexture
+	gluScaleImage
+	gluSphere
+	gluTessBeginContour
+	gluTessBeginPolygon
+	gluTessCallback
+	gluTessEndContour
+	gluTessEndPolygon
+	gluTessNormal
+	gluTessProperty
+	gluTessVertex
+	gluUnProject
+	gluUnProject4
-- 
1.5.6.2


Reply to: