Changeset: dd46179053ad for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dd46179053ad
Modified Files:
        configure.ag
        monetdb5/mal/mal_linker.c
Branch: Mar2018
Log Message:

Remove RTLD_DEEPBIND flag and use linker -Bsymbolic option instead.
The RTLD_DEEPBIND flag had the effect that the sanitizer would always
fail.


diffs (66 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -743,6 +743,30 @@ AS_VAR_IF([enable_sanitizer], [no], [], 
 AC_SUBST([CFLAGS])
 AC_SUBST([X_CFLAGS])
 
+AC_MSG_CHECKING([for ld -Bsymbolic option])
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
+AC_LINK_IFELSE([
+       AC_LANG_SOURCE([[
+               @%:@include <stdio.h>
+               @%:@include <stdlib.h>
+               @%:@include <string.h>
+
+               @%:@if -_LARGEFILE64_SOURCE - -1 == 1
+               @%:@include <stdio.h>
+               @%:@endif
+               int main(int argc, char **av) {
+                       char buf[24];
+                       double d = atof("4.2");
+                       if (argc == 0 || strchr(av[0], av[0][0]) != NULL)
+                               snprintf(buf, sizeof(buf), "%f", d);
+                       return 0;
+               }
+               ]])],
+       [result=yes],
+       [LDFLAGS="$save_LDFLAGS"; result=no])
+AC_MSG_RESULT([$result])
+
 # icc needs -fPIC (but the current autoconf still uses -KPIC)
 AS_CASE([$GCC-$CC-$host_os],
        [-*icc*-linux*|-*ecc*-linux*], [
diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -34,10 +34,6 @@
 
 #define MAXMODULES 128
 
-#ifndef RTLD_DEEPBIND
-#define RTLD_DEEPBIND 0
-#endif
-
 typedef struct{
        str modname;
        str fullname;
@@ -107,7 +103,7 @@ getAddress(str fcnname)
         *
         * the first argument must be the same as the base name of the
         * library that is created in src/tools */
-       dl = mdlopen("libmonetdb5", RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND);
+       dl = mdlopen("libmonetdb5", RTLD_NOW | RTLD_GLOBAL);
        if (dl == NULL) 
                return NULL;
 
@@ -147,7 +143,7 @@ getAddress(str fcnname)
 str
 loadLibrary(str filename, int flag)
 {
-       int mode = RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND;
+       int mode = RTLD_NOW | RTLD_GLOBAL;
        char nme[FILENAME_MAX];
        void *handle = NULL;
        str s;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to