From patchwork Wed Apr 21 14:37:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1468748 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; 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=MI29i0id; 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 4FQNSm6bjYz9sX5 for ; Thu, 22 Apr 2021 00:37:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B779A39F245A; Wed, 21 Apr 2021 14:37:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B779A39F245A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1619015876; bh=Klbt6h8uUE6AKIAwOe0mQRjxMFH4Ie2nv2KN/3HpZ34=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MI29i0idRdD46rrODy9BWg7cF3s3qWRFAuiNCVN1E2DwqwI17qbUQSPkVO5IDpcmS YqpCNINDi0Wb9OuXejclv3RMKOLcip2fxNHVz+dd4riE78Ps1AYAvuN79qV7u9K/7A xXSQcDToY4+Qb2AFHfrAlWR+Dij6+W60OGULYv+0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 4B887395541A for ; Wed, 21 Apr 2021 14:37:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4B887395541A Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E4B311FB for ; Wed, 21 Apr 2021 07:37:44 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 463AB3F774 for ; Wed, 21 Apr 2021 07:37:44 -0700 (PDT) To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] aarch64: Always use .init/.fini_array for GNU/Linux Date: Wed, 21 Apr 2021 15:37:43 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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: Richard Sandiford via Gcc-patches From: Richard Sandiford Reply-To: Richard Sandiford Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" I was wondering why the (now fixed) c-c++-common/attr-retain-[78].c failures were showing up in the native results for aarch64-linux-gnu but not in the posted cross results. It turns out that .init/ .fini_array support is disabled by default for cross builds, which in turn stops those tests from running. The test for .init/fini_array support has two parts: one that builds something with the assembler and linker, and another that compiles C code and uses preprocessor macros to test the glibc version. The first test would work with build=host but the second is only safe for build=target. However, AArch64 postdates glibc and binutils support for .init/fini_array by some distance, so it's safe to hard-code the result to "yes" for cross compilers. This fixes the only material difference in auto-host.h between a native and a cross build. Tested on aarch64-linux-gnu, pushed to trunk. Richard gcc/ * acinclude.m4 (gcc_AC_INITFINI_ARRAY): When cross-compiling, default to yes for aarch64-linux-gnu. * configure: Regenerate. --- gcc/acinclude.m4 | 14 ++++++++++++-- gcc/configure | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 index 74c18241c91..f9f6a07b040 100644 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -422,8 +422,18 @@ changequote([,])dnl ])],, [gcc_cv_initfini_array=no]);; esac else - AC_MSG_CHECKING(cross compile... guessing) - gcc_cv_initfini_array=no + case "${target}" in + aarch64*-linux-gnu*) + # AArch64 postdates glibc support for .init_array/.fini_array, + # so we don't need the preprocessor test above. + gcc_cv_initfini_array=yes + ;; + + *) + AC_MSG_CHECKING(cross compile... guessing) + gcc_cv_initfini_array=no + ;; + esac fi]) enable_initfini_array=$gcc_cv_initfini_array ]) diff --git a/gcc/configure b/gcc/configure index e8ecb3b0297..33eae5451ad 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24132,9 +24132,19 @@ fi rm -f conftest.err conftest.i conftest.$ac_ext;; esac else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking cross compile... guessing" >&5 + case "${target}" in + aarch64*-linux-gnu*) + # AArch64 postdates glibc support for .init_array/.fini_array, + # so we don't need the preprocessor test above. + gcc_cv_initfini_array=yes + ;; + + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking cross compile... guessing" >&5 $as_echo_n "checking cross compile... guessing... " >&6; } - gcc_cv_initfini_array=no + gcc_cv_initfini_array=no + ;; + esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_initfini_array" >&5