From patchwork Thu Oct 19 00:25:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 23678 Received: (qmail 110388 invoked by alias); 19 Oct 2017 00:25:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 110362 invoked by uid 89); 19 Oct 2017 00:25:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pf0-f170.google.com Received: from mail-pf0-f170.google.com (HELO mail-pf0-f170.google.com) (209.85.192.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Oct 2017 00:25:23 +0000 Received: by mail-pf0-f170.google.com with SMTP id p87so5190126pfj.3; Wed, 18 Oct 2017 17:25:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=9pWYXakI8UXdYLv/zANsjfCYtm7BGFO8PaH5LrVV6nA=; b=Oftf0zg1ref176r+j5Iwxh6rbVb9LlRNxsJxUuZdbGDViaAAOA5lvEEtGJDw4Ae23v 3eMjKgd+l2l2vUbE7pKe7975cmRs4JySP5BrPdE4ovi84nHdbredRK2t8AVdDcHzu0N3 gr8lKN0fBBczSSw7LihK9mGTdU4xLcU0pvhT5XOJj9xtI4uAHlxzG1SYfDyB731LsThn RVYpOTa2HuCIv5LAKW1D1HfNd1XYdkU15WBTle/S0GEmR8ltdB2xjWkRN0nVhCVC2Oyg F3JFaFL0/JoMdX7ndjnY+EiBDPmXgzw1zxALS0JGQDGJ/ggbcBkkMVcfZc7CFr2mybG8 b7uw== X-Gm-Message-State: AMCzsaW/nnP9UUX9b9RnXNwDKddtgQbfVwGDyz+Xzpon9BYxjCOdQQ05 Sev+Ir0RSvQHKRKO0DWiLuzVlA== X-Google-Smtp-Source: AOwi7QB6ns6AZmlQV66bWgluWwLaRul5pxdY07YYMXP5HZw2rDEA87izumc3AfkHZKbp8wVxcjMsvA== X-Received: by 10.98.66.139 with SMTP id h11mr15981465pfd.174.1508372721761; Wed, 18 Oct 2017 17:25:21 -0700 (PDT) Received: from gnu-tools-1.localdomain (c-73-93-86-59.hsd1.ca.comcast.net. [73.93.86.59]) by smtp.gmail.com with ESMTPSA id z9sm23940104pgc.85.2017.10.18.17.25.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2017 17:25:21 -0700 (PDT) Received: by gnu-tools-1.localdomain (Postfix, from userid 1000) id 279591C0427; Wed, 18 Oct 2017 17:25:20 -0700 (PDT) Date: Wed, 18 Oct 2017 17:25:20 -0700 From: "H.J. Lu" To: binutils@sourceware.org Cc: gcc-patches@gcc.gnu.org, GDB Subject: [PATCH] Use dlsym to check if libdl is needed for plugin Message-ID: <20171019002520.GA4932@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-IsSubscribed: yes config/plugins.m4 has if test "$plugins" = "yes"; then AC_SEARCH_LIBS([dlopen], [dl]) fi Plugin uses dlsym, but libasan.so only intercepts dlopen, not dlsym: [hjl@gnu-tools-1 binutils-text]$ nm -D /lib64/libasan.so.4| grep " dl" 0000000000038580 W dlclose U dl_iterate_phdr 000000000004dc50 W dlopen U dlsym U dlvsym [hjl@gnu-tools-1 binutils-text]$ Testing dlopen for libdl leads to false negative when -fsanitize=address is used. It results in link failure: ../bfd/.libs/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.16' dlsym should be used to check if libdl is needed for plugin. OK for master? H.J. --- bfd/ PR gas/22318 * configure: Regenerated. binutils/ PR gas/22318 * configure: Regenerated. config/ * plugins.m4 (AC_PLUGINS): Use dlsym to check if libdl is needed. gas/ PR gas/22318 * configure: Regenerated. gprof/ PR gas/22318 * configure: Regenerated. ld/ PR gas/22318 * configure: Regenerated. --- bfd/configure | 24 ++++++++++++------------ binutils/configure | 24 ++++++++++++------------ config/plugins.m4 | 2 +- gas/configure | 24 ++++++++++++------------ gprof/configure | 24 ++++++++++++------------ ld/configure | 24 ++++++++++++------------ 6 files changed, 61 insertions(+), 61 deletions(-) diff --git a/bfd/configure b/bfd/configure index 32ee062e80..f019a61fb0 100755 --- a/bfd/configure +++ b/bfd/configure @@ -11826,9 +11826,9 @@ else fi if test "$plugins" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if test "${ac_cv_search_dlopen+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5 +$as_echo_n "checking for library containing dlsym... " >&6; } +if test "${ac_cv_search_dlsym+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -11841,11 +11841,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dlopen (); +char dlsym (); int main () { -return dlopen (); +return dlsym (); ; return 0; } @@ -11858,25 +11858,25 @@ for ac_lib in '' dl; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res + ac_cv_search_dlsym=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_dlopen+set}" = set; then : + if test "${ac_cv_search_dlsym+set}" = set; then : break fi done -if test "${ac_cv_search_dlopen+set}" = set; then : +if test "${ac_cv_search_dlsym+set}" = set; then : else - ac_cv_search_dlopen=no + ac_cv_search_dlsym=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5 +$as_echo "$ac_cv_search_dlsym" >&6; } +ac_res=$ac_cv_search_dlsym if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" diff --git a/binutils/configure b/binutils/configure index 22e1b1736e..9691ec23f0 100755 --- a/binutils/configure +++ b/binutils/configure @@ -11622,9 +11622,9 @@ else fi if test "$plugins" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if test "${ac_cv_search_dlopen+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5 +$as_echo_n "checking for library containing dlsym... " >&6; } +if test "${ac_cv_search_dlsym+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -11637,11 +11637,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dlopen (); +char dlsym (); int main () { -return dlopen (); +return dlsym (); ; return 0; } @@ -11654,25 +11654,25 @@ for ac_lib in '' dl; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res + ac_cv_search_dlsym=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_dlopen+set}" = set; then : + if test "${ac_cv_search_dlsym+set}" = set; then : break fi done -if test "${ac_cv_search_dlopen+set}" = set; then : +if test "${ac_cv_search_dlsym+set}" = set; then : else - ac_cv_search_dlopen=no + ac_cv_search_dlsym=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5 +$as_echo "$ac_cv_search_dlsym" >&6; } +ac_res=$ac_cv_search_dlsym if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" diff --git a/config/plugins.m4 b/config/plugins.m4 index 513c690e1b..c6acebc1ca 100644 --- a/config/plugins.m4 +++ b/config/plugins.m4 @@ -16,6 +16,6 @@ AC_DEFUN([AC_PLUGINS], [plugins=$maybe_plugins] ) if test "$plugins" = "yes"; then - AC_SEARCH_LIBS([dlopen], [dl]) + AC_SEARCH_LIBS([dlsym], [dl]) fi ]) diff --git a/gas/configure b/gas/configure index 93afb20c8f..b4dcc12e22 100755 --- a/gas/configure +++ b/gas/configure @@ -11383,9 +11383,9 @@ else fi if test "$plugins" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if test "${ac_cv_search_dlopen+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5 +$as_echo_n "checking for library containing dlsym... " >&6; } +if test "${ac_cv_search_dlsym+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -11398,11 +11398,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dlopen (); +char dlsym (); int main () { -return dlopen (); +return dlsym (); ; return 0; } @@ -11415,25 +11415,25 @@ for ac_lib in '' dl; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res + ac_cv_search_dlsym=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_dlopen+set}" = set; then : + if test "${ac_cv_search_dlsym+set}" = set; then : break fi done -if test "${ac_cv_search_dlopen+set}" = set; then : +if test "${ac_cv_search_dlsym+set}" = set; then : else - ac_cv_search_dlopen=no + ac_cv_search_dlsym=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5 +$as_echo "$ac_cv_search_dlsym" >&6; } +ac_res=$ac_cv_search_dlsym if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" diff --git a/gprof/configure b/gprof/configure index e71fe8b9e4..a4d0ed360a 100755 --- a/gprof/configure +++ b/gprof/configure @@ -11298,9 +11298,9 @@ else fi if test "$plugins" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if test "${ac_cv_search_dlopen+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5 +$as_echo_n "checking for library containing dlsym... " >&6; } +if test "${ac_cv_search_dlsym+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -11313,11 +11313,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dlopen (); +char dlsym (); int main () { -return dlopen (); +return dlsym (); ; return 0; } @@ -11330,25 +11330,25 @@ for ac_lib in '' dl; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res + ac_cv_search_dlsym=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_dlopen+set}" = set; then : + if test "${ac_cv_search_dlsym+set}" = set; then : break fi done -if test "${ac_cv_search_dlopen+set}" = set; then : +if test "${ac_cv_search_dlsym+set}" = set; then : else - ac_cv_search_dlopen=no + ac_cv_search_dlsym=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5 +$as_echo "$ac_cv_search_dlsym" >&6; } +ac_res=$ac_cv_search_dlsym if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" diff --git a/ld/configure b/ld/configure index 473b6c0562..8b74a03cd8 100755 --- a/ld/configure +++ b/ld/configure @@ -15137,9 +15137,9 @@ else fi if test "$plugins" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if test "${ac_cv_search_dlopen+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5 +$as_echo_n "checking for library containing dlsym... " >&6; } +if test "${ac_cv_search_dlsym+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -15152,11 +15152,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dlopen (); +char dlsym (); int main () { -return dlopen (); +return dlsym (); ; return 0; } @@ -15169,25 +15169,25 @@ for ac_lib in '' dl; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res + ac_cv_search_dlsym=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_dlopen+set}" = set; then : + if test "${ac_cv_search_dlsym+set}" = set; then : break fi done -if test "${ac_cv_search_dlopen+set}" = set; then : +if test "${ac_cv_search_dlsym+set}" = set; then : else - ac_cv_search_dlopen=no + ac_cv_search_dlsym=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5 +$as_echo "$ac_cv_search_dlsym" >&6; } +ac_res=$ac_cv_search_dlsym if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"