From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2078) id 0ADCE39AB9C4; Mon, 19 Dec 2022 08:48:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0ADCE39AB9C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671439684; bh=FqzAH+pxP+mxjRR83rnMlLb1SnWfCT86gWzUxxEko+A=; h=From:To:Subject:Date:From; b=lUM7P6Ro0KCXAKt5e2rgbMxN4y0g2pPHAraEVfcjYkIlaqP+lalDxuxYeT5cvfqxk vFZqpAknhdoY3IjBrlxsKN4tVoEW6V4HnkbH7Zf5sdNq/01uI6eBXdXFKNsfEmAJ5B Vj9s0EGuo8jSu0vbjnuDaC64U651yiRr9/lBhrqc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: hongtao Liu To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4769] x86: Don't add crtfastmath.o for -shared X-Act-Checkin: gcc X-Git-Author: liuhongt X-Git-Refname: refs/heads/master X-Git-Oldrev: e4337398620098f96a7680ce748c9da178514acf X-Git-Newrev: 88b531d0323fc1fc4173f1975d6a4f408a096f8b Message-Id: <20221219084804.0ADCE39AB9C4@sourceware.org> Date: Mon, 19 Dec 2022 08:48:04 +0000 (GMT) List-Id: https://gcc.gnu.org/g:88b531d0323fc1fc4173f1975d6a4f408a096f8b commit r13-4769-g88b531d0323fc1fc4173f1975d6a4f408a096f8b Author: liuhongt Date: Thu Dec 15 09:38:08 2022 +0800 x86: Don't add crtfastmath.o for -shared 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. Diff: --- 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 c7e88e46e28..d8a20797603 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -17693,7 +17693,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