From patchwork Mon Sep 5 09:56:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivchenko X-Patchwork-Id: 665694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sSQBC5hgBz9s4n for ; Mon, 5 Sep 2016 19:57:07 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=jx+KGnqa; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; q=dns; s=default; b=IS2yUwMpESedMiZ ZOCk45MmtPuM57/TH2PRSPcLJN6URs/WcfE1sekwOqduGyYP1oASyGOEvZBNWlhN IwHqLkLj1J6bk3r+KpygKb6Ls2F86pq9U/GplMj8QIMV6uEqxQEqKLVJ7ticgpLW Fpuh5p85IKb6HixPeqFElwcU8IuM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; s=default; bh=J9zlyFno0Ldd/kKPRz3zB cpv+yw=; b=jx+KGnqakznNyNxhB5zaQyDcOzgxtXeLg/jsErb91l/PCCBvGa9is 2QSNQ61tnOJzZBGvCsWMQN3RSMPvEMeN5Ja23gc28iPBqgQ5x1nxk2TNTrit0H4D 7Z0Df/K9E91n9yeAtmYf23ZdC2+v5PTKTuIGvHd8BQDgh1l5g4/C50= Received: (qmail 19551 invoked by alias); 5 Sep 2016 09:56:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 19536 invoked by uid 89); 5 Sep 2016 09:56:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=988, whole-archive, wholearchive X-HELO: mail-qk0-f178.google.com Received: from mail-qk0-f178.google.com (HELO mail-qk0-f178.google.com) (209.85.220.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Sep 2016 09:56:48 +0000 Received: by mail-qk0-f178.google.com with SMTP id l2so185988820qkf.3 for ; Mon, 05 Sep 2016 02:56:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1AsT+vifzVmOpBFnZ+Awptl14I8FlaryFRLdKEj/G8Q=; b=KcMBPLD/Zv+uaQt1xb3fu1c1JIEZc51H0iQBtSUV7Me1kUkJvbKMBY7YDnvlznQm0g sXizvmLQKPObh7flWibzu3g+zTJ/9GX4CjX+9HpNNcIkYIREZEVsJYAr+FdkDaS9FWzo IwkAYBk5uEOsrXGwXlsZ7Nhv0dzw3gUhUuzdRBLiBxUPlVyJCmYqWdSlRBIOYSViPA5O Eh2L0/D0InuZOucD+uAFblXh2j+kRHpTgIQAMJgqY/jQOTRNoysTaSvD4w8dJb75mcza xTv5ubBMu4/HhOzrK9vjBLvsslV8isjCRWt72R6BavrIs31/Lu6TXhe0jUAQKn1pfrVV fR+w== X-Gm-Message-State: AE9vXwNeN9y9YosloDtBVyVc7YHFMa5WQarkhWkKWXf0BNVmnLsmVtmMLutC4r0UemmlcGNfeA0LugCMe+8KEg== X-Received: by 10.55.116.7 with SMTP id p7mr40082549qkc.239.1473069406613; Mon, 05 Sep 2016 02:56:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.42.4 with HTTP; Mon, 5 Sep 2016 02:56:46 -0700 (PDT) In-Reply-To: References: From: Alexander Ivchenko Date: Mon, 5 Sep 2016 12:56:46 +0300 Message-ID: Subject: Re: [MPX] Fix for PR77267 To: Ilya Enkovich Cc: GCC Patches , "H.J. Lu" X-IsSubscribed: yes Ok, thanks. The full updated patch is below. I also removed the '--whole-archive' thing from -static-libmpxwrappers case. Would that be possible to backport that patch to 6 branch as well? And could you please also address Sergey's comment on adding weak symbol that he's made in the bugzilla? # AC_CONFIG_SUBDIRS($subdirs) diff --git a/gcc/config.in b/gcc/config.in index fc3321c..a736de3 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1538,6 +1538,12 @@ #endif +/* Define if your linker supports --push-state/--pop-state */ +#ifndef USED_FOR_TARGET +#undef HAVE_LD_PUSHPOPSTATE_SUPPORT +#endif + + /* Define if your linker links a mix of read-only and read-write sections into a read-write section. */ #ifndef USED_FOR_TARGET diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h index 4b9910f..2273170 100644 --- a/gcc/config/i386/linux-common.h +++ b/gcc/config/i386/linux-common.h @@ -79,13 +79,23 @@ along with GCC; see the file COPYING3. If not see #endif #endif +#ifdef HAVE_LD_PUSHPOPSTATE_SUPPORT +#define MPX_LD_AS_NEEDED_GUARD_PUSH "--push-state --no-as-needed" +#define MPX_LD_AS_NEEDED_GUARD_POP "--pop-state" +#else +#define MPX_LD_AS_NEEDED_GUARD_PUSH "" +#define MPX_LD_AS_NEEDED_GUARD_POP "" +#endif + #ifndef LIBMPX_SPEC #if defined(HAVE_LD_STATIC_DYNAMIC) #define LIBMPX_SPEC "\ %{mmpx:%{fcheck-pointer-bounds:\ %{static:--whole-archive -lmpx --no-whole-archive" LIBMPX_LIBS "}\ %{!static:%{static-libmpx:" LD_STATIC_OPTION " --whole-archive}\ - -lmpx %{static-libmpx:--no-whole-archive " LD_DYNAMIC_OPTION \ + %{!static-libmpx:" MPX_LD_AS_NEEDED_GUARD_PUSH "} -lmpx \ + %{!static-libmpx:" MPX_LD_AS_NEEDED_GUARD_POP "} \ + %{static-libmpx:--no-whole-archive " LD_DYNAMIC_OPTION \ LIBMPX_LIBS "}}}}" #else #define LIBMPX_SPEC "\ @@ -98,8 +108,8 @@ along with GCC; see the file COPYING3. If not see #define LIBMPXWRAPPERS_SPEC "\ %{mmpx:%{fcheck-pointer-bounds:%{!fno-chkp-use-wrappers:\ %{static:-lmpxwrappers}\ - %{!static:%{static-libmpxwrappers:" LD_STATIC_OPTION " --whole-archive}\ - -lmpxwrappers %{static-libmpxwrappers:--no-whole-archive "\ + %{!static:%{static-libmpxwrappers:" LD_STATIC_OPTION "}\ + -lmpxwrappers %{static-libmpxwrappers: "\ LD_DYNAMIC_OPTION "}}}}}" #else #define LIBMPXWRAPPERS_SPEC "\ diff --git a/gcc/configure b/gcc/configure index 871ed0c..0eeee94 100755 --- a/gcc/configure +++ b/gcc/configure @@ -29609,6 +29609,30 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_bndplt_support" >&5 $as_echo "$ld_bndplt_support" >&6; } +# Check linker supports '--push-state'/'--pop-state' +ld_pushpopstate_support=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --push-state/--pop-state options" >&5 +$as_echo_n "checking linker --push-state/--pop-state options... " >&6; } +if test x"$ld_is_gold" = xno; then + if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then + ld_pushpopstate_support=yes + fi + elif test x$gcc_cv_ld != x; then + # Check if linker supports --push-state/--pop-state options + if $gcc_cv_ld --help 2>/dev/null | grep -- '--push-state' > /dev/null; then + ld_pushpopstate_support=yes + fi + fi +fi +if test x"$ld_pushpopstate_support" = xyes; then + +$as_echo "#define HAVE_LD_PUSHPOPSTATE_SUPPORT 1" >>confdefs.h + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_pushpopstate_support" >&5 +$as_echo "$ld_pushpopstate_support" >&6; } + # Configure the subdirectories # AC_CONFIG_SUBDIRS($subdirs) diff --git a/gcc/configure.ac b/gcc/configure.ac index 241e82d..93af766 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -6237,6 +6237,27 @@ if test x"$ld_bndplt_support" = xyes; then fi AC_MSG_RESULT($ld_bndplt_support) +# Check linker supports '--push-state'/'--pop-state' +ld_pushpopstate_support=no +AC_MSG_CHECKING(linker --push-state/--pop-state options) +if test x"$ld_is_gold" = xno; then + if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 25 -o "$gcc_cv_gld_major_version" -gt 2; then + ld_pushpopstate_support=yes + fi + elif test x$gcc_cv_ld != x; then + # Check if linker supports --push-state/--pop-state options + if $gcc_cv_ld --help 2>/dev/null | grep -- '--push-state' > /dev/null; then + ld_pushpopstate_support=yes + fi + fi +fi +if test x"$ld_pushpopstate_support" = xyes; then + AC_DEFINE(HAVE_LD_PUSHPOPSTATE_SUPPORT, 1, + [Define if your linker supports --push-state/--pop-state]) +fi +AC_MSG_RESULT($ld_pushpopstate_support) + # Configure the subdirectories