From 1a797ac67ca917b617496fe40b9b17aa50f75ee8 Mon Sep 17 00:00:00 2001 From: Geoff Thorpe Date: Wed, 21 Jun 2000 14:12:25 +0000 Subject: * This adds some checking to the 'dlfcn' DSO_METHOD that at least lets it cope with OpenBSD which doesn't understand "RTLD_NOW". * Added the dso_scheme config string entry for OpenBSD-x86 to give it DSO support. * 'make update' that has also absorbed some of Steve's mkstack changes for the ASN-related macros. --- crypto/dso/dso_dlfcn.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'crypto/dso') diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c index c12583cdc4..e709c721cc 100644 --- a/crypto/dso/dso_dlfcn.c +++ b/crypto/dso/dso_dlfcn.c @@ -106,6 +106,26 @@ DSO_METHOD *DSO_METHOD_dlfcn(void) return(&dso_meth_dlfcn); } +/* Prior to using the dlopen() function, we should decide on the flag + * we send. There's a few different ways of doing this and it's a + * messy venn-diagram to match up which platforms support what. So + * as we don't have autoconf yet, I'm implementing a hack that could + * be hacked further relatively easily to deal with cases as we find + * them. Initially this is to cope with OpenBSD. */ +#ifdef __OpenBSD__ +# ifdef DL_LAZY +# define DLOPEN_FLAG DL_LAZY +# else +# ifdef RTLD_NOW +# define DLOPEN_FLAG RTLD_NOW +# else +# define DLOPEN_FLAG 0 +# endif +# endif +#else +# define DLOPEN_FLAG RTLD_NOW /* Hope this works everywhere else */ +#endif + /* For this DSO_METHOD, our meth_data STACK will contain; * (i) the handle (void*) returned from dlopen(). */ @@ -126,11 +146,11 @@ static int dlfcn_load(DSO *dso, const char *filename) (strstr(filename, "/") == NULL)) { sprintf(translated, "lib%s.so", filename); - ptr = dlopen(translated, RTLD_NOW); + ptr = dlopen(translated, DLOPEN_FLAG); } else { - ptr = dlopen(filename, RTLD_NOW); + ptr = dlopen(filename, DLOPEN_FLAG); } if(ptr == NULL) { -- cgit v1.2.3