From patchwork Thu Dec 15 06:21:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhongt X-Patchwork-Id: 33483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp172965wrn; Wed, 14 Dec 2022 22:24:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf6L72nlSHjlICaZE8MCglHVIwTSaUoEfMpUJv3a42E4Mos2dLX/kYCGkzKVKaUgtydv2JDF X-Received: by 2002:a17:906:aadb:b0:7c0:996b:be7f with SMTP id kt27-20020a170906aadb00b007c0996bbe7fmr21443307ejb.29.1671085478584; Wed, 14 Dec 2022 22:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671085478; cv=none; d=google.com; s=arc-20160816; b=rS3U00D1vMPPx/CaTw36hWB2J4QPAvoSXsjMC+1z77vpH3caP9fcBanWN177J9Z9n8 SKSN8yPxak5Vw1LWmar54+acTnAxKFLwQ+5U1fZWf3H6k4RAmHI/SVs1eANLMOEzEZZj 2CFg8tV55C1mZMzoBdSj9rzazjxuE8UsrGsKRJup8oFrEb5rLQ9H2pKNRFp7wR5qHcX0 +EKO9/vcQhqlc+mvrrIiCNCDV9rlQl4tlYfb2FfhamO3vxLKnVjS14kSf1Fsa6mbNwd+ zIEgYp0tl7kDyFZcgeSDUZCq+twmAd0zM3ZX1kPjUaiPMSwYDzK65MyT4XUnwVL6pZYQ w1iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=FsZtK3ejlUvmOA5IQQAHCUAPEZaVtWti9bx+G9u+ZnA=; b=b8GU2VW6CFLh+ILaojKf5oJaQfO0e2zZ5TqL7MVdesENZIN+0G3dA6EAzmEfSgjJQO kyuLTL7UAIKxU+hK7oC6B4XKXGI8rqPmLXq0z6GHSXfLO7Jyx6hRgqIJKrCJC5SwyYer KUYN301a0drlQEcHV9gXrMD4jnaj8le42sXy+oBVzwXbtD11odL5lEUWzdC+x2fbcEac tvuhPIz5UPidlDxpsGf8WIgQwMd828qMUwDSnoNa7jbOaHNWKUpqJ23OttVsgGKhuSNN J1qWMeZ1HnvCM/4A6ldLm/HsRT7EGfsTE1OkyMNK5Nw7VpXArLkw/tU9EHgynLNKF4lb WcsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ToYA3SXm; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id oz20-20020a1709077d9400b007c16e4d5ea6si10447357ejc.957.2022.12.14.22.24.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 22:24:38 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ToYA3SXm; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 751BF382AB5A for ; Thu, 15 Dec 2022 06:24:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 751BF382AB5A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671085472; bh=FsZtK3ejlUvmOA5IQQAHCUAPEZaVtWti9bx+G9u+ZnA=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ToYA3SXm/E1OZXuUOfeGjrTPWTMx3oDDcbvgR8J/M22g/xxD4A3v+tKhNHihbjujv /nK6m/CAQaHUWusL+BneHQqymWxyzOslrmZUaf6wef0YJ8wlAKS3Y4uN+M64xrxscw c8+gJvBaBLNrVTUT+WjcNX4L3dIkDQIokUsRiros= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by sourceware.org (Postfix) with ESMTPS id 1C6763832B98 for ; Thu, 15 Dec 2022 06:23:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1C6763832B98 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="320453181" X-IronPort-AV: E=Sophos;i="5.96,246,1665471600"; d="scan'208";a="320453181" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2022 22:23:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="791517982" X-IronPort-AV: E=Sophos;i="5.96,246,1665471600"; d="scan'208";a="791517982" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmsmga001.fm.intel.com with ESMTP; 14 Dec 2022 22:23:38 -0800 Received: from shliclel4051.sh.intel.com (shliclel4051.sh.intel.com [10.239.240.51]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 12D701005629; Thu, 15 Dec 2022 14:23:38 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: crazylht@gmail.com, hjl.tools@gmail.com, ubizjak@gmail.com Subject: [PATCH V2 1/2] x86: Don't add crtfastmath.o for -shared Date: Thu, 15 Dec 2022 14:21:36 +0800 Message-Id: <20221215062137.3128845-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: liuhongt via Gcc-patches From: liuhongt Reply-To: liuhongt Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752260127119198757?= X-GMAIL-MSGID: =?utf-8?q?1752260127119198757?= Update in V2: Split -shared change into a separate commit and add some documentation for it. Bootstrapped and regtested on x86_64-pc-linu-gnu{-m32,}. Ok of trunk? Don't add crtfastmath.o for -shared to avoid changing the MXCSR register when loading a shared library. crtfastmath.o will be used only when building executables. PR target/55522 * config/i386/gnu-user-common.h (GNU_USER_TARGET_MATHFILE_SPEC): Don't add crtfastmath.o for -shared. * doc/invoke.texi (-shared): Add related documentation. --- gcc/config/i386/gnu-user-common.h | 2 +- gcc/doc/invoke.texi | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h index cab9be2bfb7..9910cd64363 100644 --- a/gcc/config/i386/gnu-user-common.h +++ b/gcc/config/i386/gnu-user-common.h @@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see /* Similar to standard GNU userspace, but adding -ffast-math support. */ #define GNU_USER_TARGET_MATHFILE_SPEC \ - "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ %{mpc32:crtprec32.o%s} \ %{mpc64:crtprec64.o%s} \ %{mpc80:crtprec80.o%s}" diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index cb40b38b73a..cba4f19f4f4 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -17656,7 +17656,8 @@ needs to build supplementary stub code for constructors to work. On multi-libbed systems, @samp{gcc -shared} must select the correct support libraries to link against. Failing to supply the correct flags may lead to subtle defects. Supplying them in cases where they are not necessary -is innocuous.} +is innocuous. For x86, crtfastmath.o will not be added when +@option{-shared} is specified. } @item -shared-libgcc @itemx -static-libgcc