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

Bug#319388: [libglu1-xorg] should hide C++ interfaces



Package: libglu1-xorg
Version: 6.8.2.dfsg.1-3
Severity: wishlist
Tags: patch

The X.org implementation of libGLU is coded in C++, but it is intended
to expose only C interfaces.  At present, many of the internal
interfaces are visible in the dynamic symbol table of the shared library,
which means that people may accidentally use them.  A version script should
be applied to hide these internal symbols.  [This is true for all
the X libraries, but it's especially important for libGLU because Debian
is assuming that libGLU need not participate in the C++ ABI transition
because the C++ symbols are internal only.]

I have prepared a crude patch which does this; please find attached
064_libGLU_symbol_versions.diff.  It uses the existing list of exports
(GLU-def.cpp) to generate the version script, which may well be wrong;
someone who knows what libGLU's external interfaces are should check this
carefully.  Also, my Imake-fu is nonexistent, so I have kludged the
map generation and application into xc/lib/GLU/Imakefile rather than doing
something that could be applied to the other libraries.  For these reasons
I don't suggest applying this verbatim; please consider it a starting point.
(Sequence number 064 was arbitrarily chosen, by the way.  It doesn't much
matter - nothing else seems to touch those files.)

zw
diff -Nru3 xc-old/lib/GLU/Imakefile xc/lib/GLU/Imakefile
--- xc-old/lib/GLU/Imakefile	2005-07-21 06:04:53.000000000 +0000
+++ xc/lib/GLU/Imakefile	2005-07-21 06:04:08.000000000 +0000
@@ -109,12 +109,17 @@
 #endif
 
 #if SharedLibGlu
+SHLIBLDFLAGS += -Wl,--version-script,libglu.ver
 #ifdef SharedDepCplusplusLibraryTarget
-SharedDepCplusplusLibraryTarget($(LIBNAME),$(SOREV),$(SUBDIRS) $(DONES),$(SHARED_OBJS),.,.)
+SharedDepCplusplusLibraryTarget($(LIBNAME),$(SOREV),$(SUBDIRS) $(DONES) libglu.ver,$(SHARED_OBJS),.,.)
 #else
-SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(SUBDIRS) $(DONES),$(SHARED_OBJS),.,.)
+SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(SUBDIRS) $(DONES) libglu.ver,$(SHARED_OBJS),.,.)
 #endif
 InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR))
+
+libglu.ver: def2ver.sed GLU-def.cpp
+	sed -f $^ > $@T
+	mv -f $@T $@
 #endif
 
 #if DebugLibGlu
diff -Nru3 xc-old/lib/GLU/def2ver.sed xc/lib/GLU/def2ver.sed
--- xc-old/lib/GLU/def2ver.sed	1970-01-01 00:00:00.000000000 +0000
+++ xc/lib/GLU/def2ver.sed	2005-07-21 05:53:26.000000000 +0000
@@ -0,0 +1,15 @@
+#n
+1i\
+GLU_1.3 {\
+  global:
+/^$/,/^$/{
+  /^$/d
+  /^;/d
+  s/^/    /
+  s/$/;/
+  p
+}
+$a\
+  local:\
+    *;\
+};

Reply to: