openbsd-ports/lang/scm/patches/patch-scm_dynl_c
2001-02-03 20:42:45 +00:00

54 lines
1.2 KiB
Plaintext

$OpenBSD: patch-scm_dynl_c,v 1.3 2001/02/03 20:42:46 espie Exp $
--- dynl.c.orig Tue Sep 7 15:14:00 1999
+++ dynl.c Thu Feb 1 00:50:38 2001
@@ -419,7 +419,23 @@ SCM l_dyn_call(symb, shl)
ASSERT(NIMP(symb) && STRINGP(symb), symb, ARG1, s_call);
ASSERT(NIMP(shl) && CAR(shl)==tc16_shl, shl, ARG2, s_call);
DEFER_INTS;
- func = dlsym(SHL(shl), CHARS(symb));
+#ifdef __OpenBSD__
+# ifndef __ELF__
+ {
+ char *n;
+
+ n = malloc(LENGTH(symb)+2);
+ if (n) {
+ *n = '_';
+ strcpy(n+1, CHARS(symb));
+ func = dlsym(SHL(shl), n);
+ free(n);
+ }
+ }
+# endif
+#endif
+ if (!func)
+ func = dlsym(SHL(shl), CHARS(symb));
if (!func) {
char *dlr = dlerror();
ALLOW_INTS;
@@ -448,7 +464,23 @@ SCM l_dyn_main_call(symb, shl, args)
ASSERT(NIMP(symb) && STRINGP(symb), symb, ARG1, s_main_call);
ASSERT(NIMP(shl) && CAR(shl)==tc16_shl, shl, ARG2, s_main_call);
DEFER_INTS;
- func = dlsym(SHL(shl), CHARS(symb));
+#ifdef __OpenBSD__
+# ifndef __ELF__
+ {
+ char *n;
+
+ n = malloc(LENGTH(symb)+2);
+ if (n) {
+ *n = '_';
+ strcpy(n+1, CHARS(symb));
+ func = dlsym(SHL(shl), n);
+ free(n);
+ }
+ }
+# endif
+#endif
+ if (!func)
+ func = dlsym(SHL(shl), CHARS(symb));
if (!func) {
char *dlr = dlerror();
ALLOW_INTS;