From patchwork Wed Nov 25 09:49:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1405966 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; dmarc=none (p=none dis=none) header.from=sandoe.co.uk 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 4Cgx2j1lX2z9s0b for ; Wed, 25 Nov 2020 20:50:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C6553954C7A; Wed, 25 Nov 2020 09:50:16 +0000 (GMT) X-Original-To: GCC-patches@gcc.gnu.org Delivered-To: GCC-patches@gcc.gnu.org Received: from smtp2.wavenetuk.net (unknown [195.26.37.10]) by sourceware.org (Postfix) with ESMTP id 0377E386181F for ; Wed, 25 Nov 2020 09:50:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0377E386181F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=iain@sandoe.co.uk Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp2.wavenetuk.net (Postfix) with ESMTPA id AEF7A6000FD; Wed, 25 Nov 2020 09:50:09 +0000 (GMT) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH] configury : Fix LEB128 support for non-GNU assemblers. Message-Id: <0099CE62-D849-40BA-BCBD-1AD3882AA9AD@sandoe.co.uk> Date: Wed, 25 Nov 2020 09:49:58 +0000 To: GCC Patches X-Mailer: Apple Mail (2.3273) X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_COUK, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, MAY_BE_FORGED, SPF_HELO_NONE, SPF_NONE, 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: , Cc: Andrew Stubbs , David Edelsohn Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, I’ve had this patch in my Darwin trees for (literally) years, it is relevant to the GCC ports that use a non-binutils assembler. At present, even if such an assembler supports LEB128, the GCC config is setting HAVE_LEB128 = 0. The ports I know of that can benefit from a change here are: AIX (unaffected by this change, since the assembler [at least on gcc119] does not support leb128 directives) Darwin (checked the various different assemblers) GCN (I can’t test this, so Andrew, please could you say if the change is OK for that) Solaris (bootstrapped and tests running on GCC211, but maybe Rainer would want wider checks). I guess we could exclude specific ports that don’t want to use leb128 with a target elif in the configuration. OK for master? thanks Iain ===== commit message Some assemblers that either do not respond to --version, or are non-GNU, do support leb128 directives. The current configuration test omits these cases and only supports GNU assemblers with a version > 2.11. The patch extends the asm test to cover one failure case present in assemblers based off an older version of GAS (where a 64 bit value with the MSB set presented to a .uleb128 directive causes a fail). This change then assumes that a non-GNU assembler that passes the asm test correctly supports the directives. gcc/ChangeLog: * configure.ac (check leb128 support): Support non-GNU assemblers that pass the leb128 confgure test. Add a test for uleb128 with the MSB set for a 64 bit value. * configure: Regenerated. --- gcc/configure | 6 ++++++ gcc/configure.ac | 6 ++++++ 2 files changed, 12 insertions(+) # despite appearing to. @@ -3095,6 +3098,9 @@ L2:], then : else gcc_cv_as_leb128=yes fi + else + # This is a non-GNU assembler, which passes the feature check. + gcc_cv_as_leb128=yes fi]], [AC_DEFINE(HAVE_AS_LEB128, 1, [Define if your assembler supports .sleb128 and .uleb128.])], diff --git a/gcc/configure.ac b/gcc/configure.ac index b410428b4fc..8a1aa95f01b 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3072,6 +3072,8 @@ AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix) gcc_AC_INITFINI_ARRAY # Check if we have .[us]leb128, and support symbol arithmetic with it. +# Some assemblers based on older GAS have a bug when the MSB is set for +# a 64b value and used in a uleb128. gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, [elf,2,11,0],, [ .data @@ -3079,6 +3081,7 @@ gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, L1: .uleb128 1280 .sleb128 -1010 + .uleb128 0x8000000000000000 L2:], [[# GAS versions before 2.11 do not support uleb128,