From patchwork Tue Aug 23 20:49:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 56959 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CAE883858D1E for ; Tue, 23 Aug 2022 20:49:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CAE883858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661287787; bh=fUAZD+FTOoBnBIFVAD76UfqIHbdb6FbRPttwQJ1Gj1w=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=eO/OqB7nliJeA4FhpG7aWEp1Lstd2Na8zptwKRMIunXX2Ok4RIVm++Q+nFZUmQwEv Eo9+/pHH2H+VFvsIOP899f6Ch8Tptx8HQW73rC2aXYas7VCqaSPPKl64LDLVkpgG31 Tj20FG5ytfFa7M0EgPZvQKEIZhYzrywztQ/d8Yoc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by sourceware.org (Postfix) with ESMTPS id ED3583858D3C for ; Tue, 23 Aug 2022 20:49:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED3583858D3C Received: by mail-pj1-x1034.google.com with SMTP id m15so7029851pjj.3 for ; Tue, 23 Aug 2022 13:49:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc; bh=fUAZD+FTOoBnBIFVAD76UfqIHbdb6FbRPttwQJ1Gj1w=; b=RYolWVfTj3hRh4b5GIVZ96FIDbkTVZ0zMwjEfpAeOYk/55qXf5NlDNkjaAc7JeYL6S qwOGpNohsBOJeOuExIpQr86i6BIzWYEzFEJlM9OKX/tJ0+mCWnsN4LQ3nUVcwVUSJf0Y A8fMV4ytPxkecjVq/TDZT9yPaOJTXXaxmhGjwj3jWel/BrNDxqjvr1OQj/aZ7op/svfE oHblmQEvTLbREqPyP37TnZNZWW8mFpd0SbfFOSWG579y70qFZ5LhDode3iBpPZwzYSxa p18lCRO5iIn0QCVdco17CJS1GdJeSFtyNeDpk2cwpTr6FebZomCo7Z6YXn9BJAgqUyvc RbRw== X-Gm-Message-State: ACgBeo3ESJx7sHQLF3MuKQsCyW9XkOhBXzAsI3xOZjy/pYPigs8dqboD qt9ywQ55bVC5D5LdK9ZcVDZciQr8Cj57IA== X-Google-Smtp-Source: AA6agR64OSo3KzMTHA35ebKpAMWnYhnq5aHTaqKkYUKKRv1ZGQZjnQz6wpNbI4Cnt+lEfVYqfTh//A== X-Received: by 2002:a17:902:f70f:b0:171:2572:4f5e with SMTP id h15-20020a170902f70f00b0017125724f5emr25232797plo.40.1661287765764; Tue, 23 Aug 2022 13:49:25 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:46f9:77b4:ec0a:c2d9]) by smtp.gmail.com with ESMTPSA id z6-20020a170903018600b0016d2db82962sm11118446plg.16.2022.08.23.13.49.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 13:49:24 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH] Makeconfig: Set pie-ccflag to -fPIE by default [BZ# 29514] Date: Tue, 23 Aug 2022 13:49:23 -0700 Message-Id: <20220823204923.1969486-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Henderson via Libc-alpha From: Richard Henderson Reply-To: Richard Henderson Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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. Reviewed-by: Carlos O'Donell --- For 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. 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. r~ --- Makeconfig | 2 +- sysdeps/sparc/Makefile | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Makeconfig b/Makeconfig index e78cf220af..f8164a0025 100644 --- a/Makeconfig +++ b/Makeconfig @@ -1052,7 +1052,7 @@ pic-ccflag = -fPIC PIC-ccflag = -fPIC endif # This can be changed by a sysdep makefile -pie-ccflag = -fpie +pie-ccflag = -fPIE no-pie-ccflag = -fno-pie # This one should always stay like this unless there is a very good reason. PIE-ccflag = -fPIE diff --git a/sysdeps/sparc/Makefile b/sysdeps/sparc/Makefile index 12c2c1b085..26b4a84606 100644 --- a/sysdeps/sparc/Makefile +++ b/sysdeps/sparc/Makefile @@ -1,9 +1,6 @@ # The Sparc `long double' is a distinct type we support. long-double-fcts = yes -pie-ccflag = -fPIE -no-pie-ccflag = -fno-PIE - ifeq ($(subdir),gmon) sysdep_routines += sparc-mcount endif