I guess this has been asked before, but I'll ask it again. Why is there no
generic underscore support for dlfcn routines? There's plenty of platforms
that need it, and there's no point of doing it at application level,
because there's no option to do it in many cases. (OpenSSL's internal
engine loading et all)
Anyway, here's a patch for MacOS X, the patch for dso_dlfcn.c could be
implemented in other ways also. There would be no need for ifdef's if
dlfcn_bind_var and dlfcn_bind_func would just probe for underscored symbol
names at first, and then without it, if the first probe fails. I'd rather
see the later method used, if possible.
-Antti
diff -ruN openssl-0.9.7b.orig/Configure openssl-0.9.7b/Configure
--- openssl-0.9.7b.orig/Configure 2003-04-10 08:46:55.000000000 +0300
+++ openssl-0.9.7b/Configure 2003-09-21 21:04:01.000000000 +0300
@@ -543,6 +543,8 @@
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR
RC4_CHUNK DES_UNROLL BF_PTR:::",
"darwin-ppc-cc","cc:-O3 -fomit-frame-pointer -fno-common
-DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL
BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
"darwin-i386-cc","cc:-O3 -fomit-frame-pointer -fno-common
-DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL
BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin-ppc-cc-dl","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN
-DDLFCN_NEED_UNDERSCORE::-D_REENTRANT:MACOSX:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK
DES_UNROLL
BF_PTR::::::::::dlfcn:darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+"darwin-i386-cc-dl","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN
-DDLFCN_NEED_UNDERSCORE::-D_REENTRANT:MACOSX:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK
DES_UNROLL
BF_PTR::::::::::dlfcn:darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
##### A/UX
"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL
BF_PTR:::",
diff -ruN openssl-0.9.7b.orig/Makefile.org openssl-0.9.7b/Makefile.org
--- openssl-0.9.7b.orig/Makefile.org 2003-04-08 14:54:32.000000000 +0300
+++ openssl-0.9.7b/Makefile.org 2003-09-21 21:05:18.000000000 +0300
@@ -294,7 +294,7 @@
# For Darwin AKA Mac OS/X (dyld)
do_darwin-shared:
- libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
+ libs='-L. ${SHLIBDEPS} ${EX_LIBS}'; for i in ${SHLIBDIRS}; do \
if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
libs="$(LIBKRB5) $$libs"; \
fi; \
diff -ruN openssl-0.9.7b.orig/crypto/dso/dso_dlfcn.c
openssl-0.9.7b/crypto/dso/dso_dlfcn.c
--- openssl-0.9.7b.orig/crypto/dso/dso_dlfcn.c 2002-05-30 00:00:33.000000000 +0300
+++ openssl-0.9.7b/crypto/dso/dso_dlfcn.c 2003-09-21 21:45:42.000000000 +0300
@@ -194,6 +194,9 @@
static void *dlfcn_bind_var(DSO *dso, const char *symname)
{
void *ptr, *sym;
+#ifdef DLFCN_NEED_UNDERSCORE
+ char usymname[1024];
+#endif
if((dso == NULL) || (symname == NULL))
{
@@ -211,7 +214,12 @@
DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_NULL_HANDLE);
return(NULL);
}
+#ifdef DLFCN_NEED_UNDERSCORE
+ snprintf(usymname, sizeof(usymname), "_%s", symname);
+ sym = dlsym(ptr, usymname);
+#else
sym = dlsym(ptr, symname);
+#endif
if(sym == NULL)
{
DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_SYM_FAILURE);
@@ -225,6 +233,9 @@
{
void *ptr;
DSO_FUNC_TYPE sym;
+#ifdef DLFCN_NEED_UNDERSCORE
+ char usymname[1024];
+#endif
if((dso == NULL) || (symname == NULL))
{
@@ -242,7 +253,12 @@
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE);
return(NULL);
}
+#ifdef DLFCN_NEED_UNDERSCORE
+ snprintf(usymname, sizeof(usymname), "_%s", symname);
+ sym = (DSO_FUNC_TYPE)dlsym(ptr, usymname);
+#else
sym = (DSO_FUNC_TYPE)dlsym(ptr, symname);
+#endif
if(sym == NULL)
{
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE);
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]