Patches for BSDI dlsym stupidity

This commit is contained in:
hag 1996-11-17 18:49:56 +00:00
parent 9f7d624413
commit 4ba01266de
4 changed files with 92 additions and 28 deletions

61
configure vendored
View File

@ -1879,13 +1879,52 @@ else
fi fi
echo "$ac_t""$s48_cv_uscore" 1>&6 echo "$ac_t""$s48_cv_uscore" 1>&6
rm -f conftest.c a.out
if test $s48_cv_uscore = yes; then if test $s48_cv_uscore = yes; then
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define USCORE 1 #define USCORE 1
EOF EOF
if test $ac_cv_func_dlopen = yes ; then
echo $ac_n "checking whether dlsym always adds an underscore for us""... $ac_c" 1>&6
if eval "test \"`echo '$''{'s48_cv_dlsym_adds_uscore'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 1900 "configure"
#include "confdefs.h"
#include <dlfcn.h>
#include <stdio.h>
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 && !ptr2) exit(0); } exit(1); }
EOF
{ (eval echo configure:1911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
s48_cv_dlsym_adds_uscore=yes
cat >> confdefs.h <<\EOF
#define DLSYM_ADDS_USCORE 1
EOF
else
s48_cv_dlsym_adds_uscore=no
fi
fi
rm -fr conftest*
fi
echo "$ac_t""$s48_cv_dlsym_adds_uscore" 1>&6
fi
fi fi
rm -f conftest.c a.out
echo $ac_n "checking for n_name""... $ac_c" 1>&6 echo $ac_n "checking for n_name""... $ac_c" 1>&6
@ -1894,7 +1933,7 @@ EOF
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1898 "configure" #line 1937 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <nlist.h> #include <nlist.h>
int main() { return 0; } int main() { return 0; }
@ -1903,7 +1942,7 @@ struct nlist name_list;
name_list.n_name = "foo"; name_list.n_name = "foo";
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
s48_cv_nlist=yes s48_cv_nlist=yes
else else
@ -1929,7 +1968,7 @@ EOF
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1933 "configure" #line 1972 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { return 0; } int main() { return 0; }
@ -1937,7 +1976,7 @@ int t() {
return stdin->_cnt; return stdin->_cnt;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:1980: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
s48_cv__cnt=yes s48_cv__cnt=yes
else else
@ -1964,7 +2003,7 @@ EOF
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 1968 "configure" #line 2007 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <time.h> #include <time.h>
int main() { return 0; } int main() { return 0; }
@ -1972,7 +2011,7 @@ int t() {
return (int) tzname; return (int) tzname;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:1976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:2015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
scsh_cv_tzname=yes scsh_cv_tzname=yes
else else
@ -1998,7 +2037,7 @@ EOF
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2002 "configure" #line 2041 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <time.h> #include <time.h>
int main() { return 0; } int main() { return 0; }
@ -2007,7 +2046,7 @@ struct tm time;
return time.tm_gmtoff; return time.tm_gmtoff;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:2050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
scsh_cv_gmtoff=yes scsh_cv_gmtoff=yes
else else
@ -2033,7 +2072,7 @@ EOF
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 2037 "configure" #line 2076 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@ -2042,7 +2081,7 @@ int t() {
const extern char *sys_errlist[]; const extern char *sys_errlist[];
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:2046: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:2085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
scsh_cv_const_sys_errlist=yes scsh_cv_const_sys_errlist=yes
else else

View File

@ -85,10 +85,26 @@ AC_DEFUN(S48_USCORE, [
s48_cv_uscore=no s48_cv_uscore=no
fi]) fi])
AC_MSG_RESULT($s48_cv_uscore) AC_MSG_RESULT($s48_cv_uscore)
rm -f conftest.c a.out
if test $s48_cv_uscore = yes; then if test $s48_cv_uscore = yes; then
AC_DEFINE(USCORE) AC_DEFINE(USCORE)
if test $ac_cv_func_dlopen = yes ; then
AC_MSG_CHECKING(whether dlsym always adds an underscore for us)
AC_CACHE_VAL(s48_cv_dlsym_adds_uscore,AC_TRY_RUN( [
#include <dlfcn.h>
#include <stdio.h>
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 && !ptr2) exit(0); } exit(1); }
], [s48_cv_dlsym_adds_uscore=yes
AC_DEFINE(DLSYM_ADDS_USCORE) ], s48_cv_dlsym_adds_uscore=no))
AC_MSG_RESULT($s48_cv_dlsym_adds_uscore)
fi
fi fi
rm -f conftest.c a.out
]) ])
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

View File

@ -125,6 +125,11 @@ lookup_dlsym(char *name, long *location)
void *adr; void *adr;
static void *selfhandle; static void *selfhandle;
int rank; int rank;
#if defined(USCORE) && defined(DLSYM_ADDS_USCORE)
name++;
#endif
/* perhaps i should scan the dlopened_handle from last to first, /* perhaps i should scan the dlopened_handle from last to first,
to find newest incarnation of symbol? in practice it should be faster to find newest incarnation of symbol? in practice it should be faster
to go from first (oldest) to last, to go from first (oldest) to last,

View File

@ -120,6 +120,10 @@ struct sigaction {
/* Define USCORE if your c externals are prepended with an underscore */ /* Define USCORE if your c externals are prepended with an underscore */
#undef USCORE #undef USCORE
/* Define DLSYM_ADDS_USCORE if your system's dlsym() prepends an underscore
to symbol names. */
#undef DLSYM_ADDS_USCORE
/* Define if you have POSIX tzname (Losing sunos4...). */ /* Define if you have POSIX tzname (Losing sunos4...). */
#undef HAVE_TZNAME #undef HAVE_TZNAME