From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id B83833858427 for ; Fri, 26 Aug 2022 17:29:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B83833858427 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pj1-x102f.google.com with SMTP id x63-20020a17090a6c4500b001fabbf8debfso2448645pjj.4 for ; Fri, 26 Aug 2022 10:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=78EYSwTDE1hCLDrhJWAz105AQDWYxod/4Sg+tIQiSOk=; b=ZcKE3ZJB/yZEbZNj6kAlrknqSEEVTltb2xujZpCVtgpsIwLdjToK7+zYUTbc/eSK8o 4uG7TfE8umCQ7l21BDC1NTxEObFw5gm2ylSpjyiPeNojM76cOG1/EsK90omGKwgH5JT4 g9avpE2DzuiNBKIWAGLfiFd5dCyhkUnSO9ZWkzI3Lp7tswKQIgeP5zbcVDnAAIlu9i09 bp9opvpjC1UPt/AlYMRUXz7v/vShP+I8tm4eCR2fEXeP3UM9ZeYdAEzbsWq6YIzIhNR2 BuuEtRiHJb48amgfdUv0LTTWJqJpQxD/1x+cUIfZRCHlwtqwjJBRspz+qgkM3tvgQf5p i05A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=78EYSwTDE1hCLDrhJWAz105AQDWYxod/4Sg+tIQiSOk=; b=PmIUiI7lYSxRh1yLAk3YQQu8yPJOsbHeklpbFE3HqPPEq5f7vj8fwvZe0ByJk3qstx AKMJ/RNp1M3nT9ZL6532yFHV9gAxUyNLa3jCAMglA9OUJq3+KImyXSo6/IHGETg+02lm gnMh1FYxXbQ2vfbR/fiUW6YRLxDih1RlkScyIm86AIAoiyjPRkz7cwhjMPKlgcHChgx2 KGT6/Wo7GnfOOlMJbTN3Z5el+w6H8Ovy5uYzfyNVQhwoBoVW3jlbCCIv1VqoYYGAa1zR GeZgXWEx8BhR+46B/Z6YlSfF7PxAtajM2+7lQXvhGZi7rqLvHDhhNjoGyEeGvMv40EPX O53w== X-Gm-Message-State: ACgBeo3z/NNEeA/pSwdvsTXoJ45lMkN8O0Mg3HlLLLgy4Ozz7AflvlMK Dp33r/o99Lsps9T8621HnHImrA== X-Google-Smtp-Source: AA6agR5Hr8bQSdpBeW5WoRpZj9l3ISFw6TUeco///pq/BCCvmYQXV42voCq+4Nft7UR1b/zY93LkTw== X-Received: by 2002:a17:902:db01:b0:173:d08:b8ab with SMTP id m1-20020a170902db0100b001730d08b8abmr4701968plx.94.1661534974731; Fri, 26 Aug 2022 10:29:34 -0700 (PDT) Received: from ?IPV6:2602:47:d49d:ec01:68d8:30f3:fbd7:6f7f? ([2602:47:d49d:ec01:68d8:30f3:fbd7:6f7f]) by smtp.gmail.com with ESMTPSA id n8-20020a170903110800b0017440342b5bsm1534691plh.206.2022.08.26.10.29.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Aug 2022 10:29:33 -0700 (PDT) Message-ID: Date: Fri, 26 Aug 2022 10:29:32 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RESEND PATCH] Makeconfig: Set pie-ccflag to -fPIE by default Content-Language: en-US To: Adhemerval Zanella Netto , libc-alpha@sourceware.org Cc: fweimer@redhat.com References: <20220825210103.2259134-1-richard.henderson@linaro.org> <43f24a1f-6237-2f45-ec0e-2fea9367f0b3@linaro.org> From: Richard Henderson In-Reply-To: <43f24a1f-6237-2f45-ec0e-2fea9367f0b3@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On 8/26/22 05:32, Adhemerval Zanella Netto wrote: > > > On 25/08/22 18:01, Richard Henderson via Libc-alpha wrote: >> [ I never saw this arrive in the list archives. >> Trying again with my linaro address subscribed. ] >> >> We should default to the larger code model, in order to support >> larger applications built with -static -pie. This should be >> consistent with pic-ccflag, which defaults to -fPIC. >> >> Remove the now redundant override from sysdeps/sparc/Makefile. >> Note that -fno-pie and -fno-PIE have the same effect. >> >> --- >> >> In the case of AArch64, the code changes are small but significant: >> >> 0000000000000000 <__libc_init_first>: >> 0: a9bd7bfd stp x29, x30, [sp, #-48]! >> - 4: 90000003 adrp x3, 0 <_GLOBAL_OFFSET_TABLE_> >> - 4: R_AARCH64_ADR_PREL_PG_HI21 _GLOBAL_OFFSET_TABLE_ >> + 4: 90000003 adrp x3, 0 <__environ> >> + 4: R_AARCH64_ADR_GOT_PAGE __environ >> 8: 90000004 adrp x4, 0 <__libc_init_first> >> 8: R_AARCH64_ADR_PREL_PG_HI21 .bss >> c: 910003fd mov x29, sp >> 10: f9400063 ldr x3, [x3] >> - 10: R_AARCH64_LD64_GOTPAGE_LO15 __environ >> + 10: R_AARCH64_LD64_GOT_LO12_NC __environ >> >> In the small model, we are constrained to 15 bits of GOT, with a >> single shared base, _GLOBAL_OFFSET_TABLE_. In the large model, >> each symbol has a page + offset pair. For small functions like >> this, where there are no other variable references to share the >> common GOT pointer, there is no actual code change. >> >> r~ > > I recall that powerpc wanted to use -mcmodel=large, but it would require to > adjust a lot of assembly implementations. Are we sure this change does not > trigger any regression with current glibc code? Ah, the resend is missing some detail I included in the original: > For s390x, I would expect changes similar to c64a10e54441, and > an eventual similar bug report if this were left unchanged. > > For x86, ppc64 and riscv64, -fpie & -fPIE are identical. For ppc64 specifically, I audited gcc/config/rs6000/ for references to flag_pic, and the only changes between -fpic and -fPIC are for 32-bit ABI_V4. More generally, our assembly is already set up for -fPIC, which is the pic-ccflag default; the difference for -fPIE is only in the selection of external vs local binding. For aarch64, I've audited uses of the adrp instruction in sysdeps/, and they are what I'd expect, e.g. aarch64/start.S: adrp x0, :got:main and there are no instances of '_GLOBAL_OFFSET_TABLE_', which is indicative of -fpic. For s390, I've similarly audited uses of the larl instruction: s390/s390-64/start.S: larl %r2,main@GOTENT # load pointer to main r~