From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 02E173856DCE for ; Mon, 29 Aug 2022 19:57:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 02E173856DCE 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-pl1-x634.google.com with SMTP id u22so9007117plq.12 for ; Mon, 29 Aug 2022 12:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=KrgNuV//PbdPVqA0BHcyQK0topu4RtwOuIzAEdMridE=; b=jMlBSMudWynzm/rSovRm4yfr4yd+7rrSx+wpD41hstDRB2yy+tQUetseUM29zzF7Xh vpp5FlzzWcB+JwIyqwRqoERYr/P8U89eAVijqNY+a71dTm3hddixsB/o0a5ubZgN3EQE ylfSflOW5fu2RZsaaWvIe4sNtuzaLwVfyUP6ORslm6tK63Gbs+tpbqeNdxMoTXbgkPUS ncvjhN4J2xkX5/2DDGB+O40rasIm/frZrjKmzOf+LXXnufIY9x12+hAN5ndAP3EVKwNG JPWislGicyes0tBi1QrRGe7oYvB7HgY8sGnBxiEqLmcQUwLxYMXiyZBppHcy51GhKN0b trZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=KrgNuV//PbdPVqA0BHcyQK0topu4RtwOuIzAEdMridE=; b=FuPo6u4hd6WW+YFOeBXLwVw6l8VOiUR3STJ7FEiVzPJ0hBG8A/+S8PF0LfRbOS7E2Z 79klXR8tPYQkcZ+2HHJmDn6e0y4i5Sw9bKHwnf/3//QPyvl7+vVDL1h2DLr9EEfCuJPt 90QiH4MNfYklK76Ak88QRp6ON2c2tueCfUTVrPrz0Ojm1UtQLyhOa/czELx9aSFNIVv8 gk5dyWkTQqNahU1sfyUYHrmZgTA3TsUmhD6WJb9eP3r3/XOZwcD4xxxVeQ9sqIDW0hZT Dv7BcS84eZjSH+czenFanfg6SXYKgoSlat/97RrGtQBiSU9FMKB0i2ov+PwrG1+OgSHg ziCw== X-Gm-Message-State: ACgBeo3asauEB1xE+dqzYyn3D3aaGnaDC302r6VhO/oy3SuW16cqTrEE W8EwSX8qpaPeDgU/FTxaye8m9g== X-Google-Smtp-Source: AA6agR5Ck1Ui5Ztz80LnXPflQ8avEl5I/CcwN51yqq9kSYJCI2wY9h6LmM2zgcLkvtx2A3ZFpPmMJQ== X-Received: by 2002:a17:90b:3006:b0:1fd:e61b:8666 with SMTP id hg6-20020a17090b300600b001fde61b8666mr4111016pjb.95.1661803027250; Mon, 29 Aug 2022 12:57:07 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:717a:c8d6:2ca6:48b6]) by smtp.gmail.com with ESMTPSA id b124-20020a62cf82000000b005381d037d07sm3576186pfg.217.2022.08.29.12.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 12:57:06 -0700 (PDT) Date: Mon, 29 Aug 2022 12:57:03 -0700 From: Fangrui Song To: Wilco Dijkstra Cc: "H.J. Lu" , Florian Weimer , Wilco Dijkstra via Libc-alpha Subject: Re: [RESEND PATCH] Makeconfig: Set pie-ccflag to -fPIE by default Message-ID: <20220829195703.tvrqhe7ggnaks3oo@google.com> References: <10cbed26-dc3c-3a55-8e39-95916c614dbb@linaro.org> <87pmgj2o1d.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.4 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,FSL_HELO_FAKE,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-08-29, H.J. Lu via Libc-alpha wrote: >On Mon, Aug 29, 2022 at 8:27 AM Wilco Dijkstra wrote: >> >> Hi Florian, >> >> * Wilco Dijkstra via Libc-alpha: >> >> However this leads to the question is why aren't all symbols marked as >> >> hidden in the static PIE build? Ie. are there any symbols that must be >> >> shared with a DSO loaded by a dl_open? >> > >> > The static main executable does not have a dynamic symbol table, so such >> > sharing cannot happen (except through function pointers being passed >> > around, but symbol visibility of course does not matter there). >> >> Right, so it should be safe then to mark all symbols as hidden. >> >> We could also teach GCC to never emit GOT indirections with -fPIE -static >> (the only reason to use a GOT indirection is to avoid copy relocations in >> dynamically linked binaries). >> > >But -static isn't passed to cc1. With Clang, -fPIE -fno-direct-access-external-data can be used. See https://maskray.me/blog/2021-01-09-copy-relocations-canonical-plt-entries-and-protected GCC's x86 port went with -mdirect-extern-access.