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

[Fwd: Bug#167831: [PATCH] libcrypto.so contains extraneous symbols on Sparc (breaking software)]

Hi glibc and gcc Maintainers,

I need some help with this bugreport. I checked that the problem is
reproduceable. Could someone please verify that the problem description
is correct. Do you think the solution is the right one?

--- Begin Message ---

Package: libssl0.9.6
Version: 0.9.6g-9

On the sparc libcrypto.so dynamically exports some symbols that it pulls
in from libgcc.a (e.g. __muldi3), but the v8/v9 versions of libcrypto.so
do not export these symbols.

The net result is that binaries that need __muldi3, link with libcrypto,
and do not link with another shared library that happens to export
__muldi3 will fail to run.  (Because at runtime, v9/libcrypto.os will
be used instead.)

This causes configure scripts to think that long long is not 64bits. This triggered bug #165060 in postgresql. (It's a grave bug, so the maintainer applied a hack to the configure script to make it work for now.) This probably is causing some subtle issues in other packages that haven't been noticed yet.

There doesn't appear to be an option to ld or gcc to exclude symbols
or libraries from being dynamically exported when linking shared
libraries (except for PE binaries), and objcopy won't delete dynamic
symbols.  So, my solution is to make a simple "version script" that
doesn't export symbols starting with "__", and tweak the debian/rules
file to use this version script when linking shared libraries on
the sparc platform (I pass the magic params to make via SHARED_LDFLAGS).

I've built openssl with the patch on the sparc and verified that
everything still works, and it actually fixes the problem.

Oh, an the problem could be reproduced (on a sparc) by compiling
conftest.c and linking with crypto. It will link but complain
about a missing symbol at runtime.

Steve Dunham

diff -ruN openssl-0.9.6g.orig/debian/rules openssl-0.9.6g/debian/rules
--- openssl-0.9.6g.orig/debian/rules	2002-11-04 19:30:30.000000000 -0800
+++ openssl-0.9.6g/debian/rules	2002-11-04 19:31:38.000000000 -0800
@@ -25,6 +25,9 @@
 OPTS      = $($(ARCHOPTS))
+ifeq (sparc,$(DEB_HOST_ARCH))
+SHARED_LDFLAGS = -Wl,--version-script,debian/version.sparc
@@ -40,7 +43,7 @@
 	do \
 		set -xe; \
 		./Configure shared $(CONFARGS) debian-$(DEB_HOST_ARCH)-$$opt; \
-		make -f Makefile.ssl DIRS="crypto ssl" all; \
+		make -f Makefile.ssl DIRS="crypto ssl" all SHARED_LDFLAGS="$(SHARED_LDFLAGS)"; \
 		mkdir $$opt; \
 		mv libcrypto.so* libssl.so* $$opt/; \
 		make -f Makefile.ssl DIRS="crypto ssl" clean; \
@@ -49,7 +52,7 @@
 	#make -f Makefile.ssl depend
 	ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
 #	make -f Makefile.ssl linux-shared
-	make -f Makefile.ssl all
+	make -f Makefile.ssl all SHARED_LDFLAGS="$(SHARED_LDFLAGS)"
 #	strip apps/openssl
 #	make -f Makefile.ssl clean DIRS="crypto ssl"
 #	./Configure --prefix=/usr --openssldir=/usr/lib/ssl no-idea no-mdc2 no-rc5 debian-$(DEB_HOST_ARCH)
@@ -95,7 +98,7 @@
 #	cd debian/libssl09-dev && install -d `cat ../libssl09-dev.dirs`
 #openssl install
-	make -f Makefile.ssl  install INSTALL_PREFIX=`pwd`/debian/tmp
+	make -f Makefile.ssl  install INSTALL_PREFIX=`pwd`/debian/tmp SHARED_LDFLAGS="$(SHARED_LDFLAGS)"
 	#rm debian/tmp/usr/share/man/man1/openssl.1
 	#rm debian/tmp/usr/share/man/man3/crypto.3
 	#rm debian/tmp/usr/share/man/man3/ssl.3
diff -ruN openssl-0.9.6g.orig/debian/version.sparc openssl-0.9.6g/debian/version.sparc
--- openssl-0.9.6g.orig/debian/version.sparc	1969-12-31 16:00:00.000000000 -0800
+++ openssl-0.9.6g/debian/version.sparc	2002-11-03 12:30:20.000000000 -0800
@@ -0,0 +1,6 @@
+  global:
+	!__*;
+  local:
+	__*;
typedef long long int int64;

 * These are globals to discourage the compiler from folding all the
 * arithmetic tests down to compile-time constants.
int64 a = 20000001;
int64 b = 40000005;

int does_int64_work()
  int64 c,d;

  if (sizeof(int64) != 8)
    return 0;                   /* definitely not the right size */

  /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
  c = a * b;
  d = (c + b) / b;
  if (d != a+1)
    return 0;
  return 1;
main() {
  exit(! does_int64_work());

--- End Message ---

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply to: