From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by sourceware.org (Postfix) with ESMTPS id EB0EB3858401 for ; Thu, 2 Feb 2023 05:50:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB0EB3858401 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com Received: by mail-pj1-x102a.google.com with SMTP id l4-20020a17090a850400b0023013402671so4530149pjn.5 for ; Wed, 01 Feb 2023 21:50:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CC30NH3pUcm8Ocy308L0hkI14q0JY2x8zBIbXa2zUXU=; b=KlusnIdchkkVhwpVibxuy+KknYpUk2UfnyZ6dHNwMilAKrFAGLPh30NIYJjG7EXUhX ugd2cIQTYLILpkfzbyqLtUs6c5qsKfW+sZERfCmZ0Vah3GhINdHI3vM6cGAlOt7Ud1MM Ta70k5dhVXBBvN0qWu7K6uymdTnrhui6YigO5G5xNIgKz4T2EbD3eCG3cnZxHU7VCkPh Toax0n0NCUJf3UU+5Nc+5M97K+FNv+bcAwvdrmvS58bbj7C1IzyqCMxWLMnOSaABqeG0 ko7h4hgYlOxGWn3Qkk08+O5NMHI8UWyXGIdQadw5xtSNVkizg9R2w4i5U7/LYXjWfFtQ qZdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CC30NH3pUcm8Ocy308L0hkI14q0JY2x8zBIbXa2zUXU=; b=FOGFvqyPoux5eqwNDzvBiuu7i1zwsLklkWe+ii095xgYr9fg/hs4M0D5zjXg/NDFZA qQex3OgsJR/n6WnubLbqJBRm7il13fHh3C7SagFMgB+Gxu+ZB+gAldk6PvxjvBGlRHqn rHg16XACaTesirK/mv+FlC179GpAgQtbe6w9Fj3ARCEpq9XYiTz/4kzHHCK+TD3Mo7Wq jXJzVch3H2wFnSsse+NxgepBOeQuvMZgzRU8UvHDU6sv4SsgvuA94x2c1x7CsiwlvBfl HV/VavprCIz7Zv3v28gjV4gJsIS6gjs4eyVWe3fAyreAftZggNoewj0TBSGb/sFW2Og4 iVkA== X-Gm-Message-State: AO0yUKWbt0lTiGAJDHO30UZpp9LVg7pgbTTa2A0n2aykC9d8fgBm1EFQ NmWuHjqr5D+3p8R4AqA2Kb1OEMb90W4YB1NULK8ygA== X-Google-Smtp-Source: AK7set/X7XEbZWMmYuITiDRGaPyvyXxmpT3CtEGGhDtHeqoadYcl4fi4Xoq2iwhbSqCevez3GUMs/yYPjk5/ncFk+mo= X-Received: by 2002:a17:90a:6a05:b0:22c:8e00:1221 with SMTP id t5-20020a17090a6a0500b0022c8e001221mr278548pjj.136.1675317028588; Wed, 01 Feb 2023 21:50:28 -0800 (PST) MIME-Version: 1.0 References: <20230201073859.3920910-1-maskray@google.com> In-Reply-To: From: Fangrui Song Date: Wed, 1 Feb 2023 21:50:17 -0800 Message-ID: Subject: Re: [PATCH] x86: Use DW_EH_PE_indirect|DW_EH_PE_pcrel encodings for -fno-pic code To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-19.0 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > The above is incorrectly formatted, the GCC Coding Conventions say || etc. shouldn't be at the end of lines, but rather at the start of the next ones. Ack. > And, while I can understand the rationale for global cases > (though am not sure I agree, as currently the user can choose > by using -mno-direct-extern-access or not using it, the above change > disallows the choice), for !global I miss the point altogether. > In non-PIC (and non-PECOFF maybe, don't know that format well) > code if code references a local symbol, it will never generate > a copy relocation and so DW_EH_PE_udata4 could be just fine and cheaper > to handle on the consumer sides. On Wed, Feb 1, 2023 at 1:09 AM Jakub Jelinek wrote: > > On Wed, Feb 01, 2023 at 10:01:36AM +0100, Jakub Jelinek via Gcc-patches wrote: > > And, while I can understand the rationale for global cases > > (though am not sure I agree, as currently the user can choose > > by using -mno-direct-extern-access or not using it, the above change > > disallows the choice), for !global I miss the point altogether. > > In non-PIC (and non-PECOFF maybe, don't know that format well) > > code if code references a local symbol, it will never generate > > a copy relocation and so DW_EH_PE_udata4 could be just fine and cheaper > > to handle on the consumer sides. > > Plus, e.g. for the typeinfo references, if using the default > -mdirect-extern-access and RTTI is used, there will be copy relocations > anyway and so the .eh_frame growth will be just waste of .got space. > > Jakub > There is a copy relocation but the canonical PLT entry for __gxx_personality_v0 can be removed. -fno-pic C++ exception code is less common nowadays, so there seems little value to keep a complex condition (if (flag_pic || TARGET_PECOFF || !ix86_direct_extern_access)) to optimize a bit for the object file size (I think you mean .data space instead of .got space). The .eh_frame growth is nearly negligible as well.