From patchwork Wed Sep 30 07:31:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 1374170 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=j2ixj4/D; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C1Sct6lf2z9sSf for ; Wed, 30 Sep 2020 17:31:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 23274384B13C; Wed, 30 Sep 2020 07:31:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23274384B13C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1601451113; bh=/UpNGrNtBILJGlIKyriuWThN9b4RTLnAD/gx3HzybJ0=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=j2ixj4/DJUprxzOMoxKKPhP+su8QOR/AePLulmlvi+o93Ek8wutxMf1O6qcNWeddP Y6LIcRjsA6Rfo2N0mzrMqPALVJWp4LkjaRnt+On2cX9BPh8SxmUZ+QZl9UbdOpkEzc s/qUypPXEkmBaYWHWtalgkT8btM8676nXv0UAG+8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id EE3D63857008 for ; Wed, 30 Sep 2020 07:31:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EE3D63857008 Received: by mail-pf1-x435.google.com with SMTP id q123so606246pfb.0 for ; Wed, 30 Sep 2020 00:31:50 -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=/UpNGrNtBILJGlIKyriuWThN9b4RTLnAD/gx3HzybJ0=; b=SfWnndmxgNiasPXbf/ffGxmPY8NqALl85ZrkVa0pp0vbPyngJlKWDSi37xF+lXVKEl DyBDo3LxcslQ+5Gi+oQ1s/Lb9O6Dlbq68NLHavPQlPJmLdC4/+AM1JihvcV9R8JvEhsV s0IjwQINFrweuZYVFe1J7qpDb9H+pHUOilXcH/UsFtx7WTJwhdoERMmfmWb5SBYMfMp9 y8820zswPY8gFiNjhhMiDrTztH5WkqIFDfFY+EpoAqT6btGXo7zIWLlXLEl6vcvoz52B 5SoC0fzJHH8FxKj5gFmp5R2IoNzCmVXv3ChSGshJEcE6gIm3QXvsvDZhPfqsLGX8Purm RPfQ== X-Gm-Message-State: AOAM532Umjl2UIrB7TNyc8otWyTlxYHCW8o66CyoRTmw/7qsJ+jh/tJv h/SmScUmv/Y5nCp9SGemCLRoj6iRm7tm0Q== X-Google-Smtp-Source: ABdhPJx+l1/Q+zPw3qoNrPScbWgExecVRQD2vsamEjMqLL5U3KVY1pN1B0pcfJr82AOx9S3gu1mlfQ== X-Received: by 2002:a62:1850:0:b029:142:2501:35e8 with SMTP id 77-20020a6218500000b0290142250135e8mr1414453pfy.72.1601451109514; Wed, 30 Sep 2020 00:31:49 -0700 (PDT) Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:859:796:86a:89b1]) by smtp.gmail.com with ESMTPSA id c1sm1187780pfj.219.2020.09.30.00.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 00:31:48 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 64C7B85E08; Wed, 30 Sep 2020 17:01:45 +0930 (ACST) Date: Wed, 30 Sep 2020 17:01:45 +0930 To: gcc-patches@gcc.gnu.org Subject: [RS6000] -mno-minimal-toc vs. power10 pcrelative Message-ID: <20200930073145.GG15011@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Alan Modra via Gcc-patches From: Alan Modra Reply-To: Alan Modra Cc: Segher Boessenkool Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" We've had this hack in the libgcc config to build libgcc with -mcmodel=small for powerpc64 for a long time. It wouldn't be a bad thing if someone who knows the multilib machinery well could arrange for -mcmodel=small to be passed just for ppc64 when building for earlier than power10. But for now, make -mno-minimal-toc do nothing when pcrel. Which will do the right thing for any project that has copied libgcc's trick. We want this if configuring using --with-cpu=power10 to build a power10 pcrel libgcc. --mcmodel=small turns off pcrel. Bootstrapped and regression tested powerpc64le-linux. OK? gcc/ * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Don't set -mcmodel=small for -mno-minimal-toc when pcrel. libgcc/ * config/rs6000/t-linux: Document purpose of -mno-minimal-toc. diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 2ded3301282..2de1097d3ec 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -132,20 +132,25 @@ extern int dot_symbols; if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \ { \ rs6000_isa_flags |= OPTION_MASK_POWERPC64; \ - error ("%<-m64%> requires a PowerPC64 cpu"); \ + error ("%<-m64%> requires a PowerPC64 cpu"); \ } \ + if (!global_options_set.x_rs6000_current_cmodel) \ + SET_CMODEL (CMODEL_MEDIUM); \ if ((rs6000_isa_flags_explicit \ & OPTION_MASK_MINIMAL_TOC) != 0) \ { \ if (global_options_set.x_rs6000_current_cmodel \ && rs6000_current_cmodel != CMODEL_SMALL) \ error ("%<-mcmodel incompatible with other toc options%>"); \ - SET_CMODEL (CMODEL_SMALL); \ + if (TARGET_MINIMAL_TOC \ + || !(TARGET_PCREL \ + || (PCREL_SUPPORTED_BY_OS \ + && (rs6000_isa_flags_explicit \ + & OPTION_MASK_PCREL) == 0))) \ + SET_CMODEL (CMODEL_SMALL); \ } \ else \ { \ - if (!global_options_set.x_rs6000_current_cmodel) \ - SET_CMODEL (CMODEL_MEDIUM); \ if (rs6000_current_cmodel != CMODEL_SMALL) \ { \ if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \ diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux index 4f6d4c4a4d2..ed821947b66 100644 --- a/libgcc/config/rs6000/t-linux +++ b/libgcc/config/rs6000/t-linux @@ -1,3 +1,8 @@ SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver -HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc +HOST_LIBGCC2_CFLAGS += -mlong-double-128 + +# This is a way of selecting -mcmodel=small for ppc64, which gives +# smaller and faster libgcc code. Directly specifying -mcmodel=small +# would need to take into account targets for which -mcmodel is invalid. +HOST_LIBGCC2_CFLAGS += -mno-minimal-toc