From patchwork Mon Oct 14 06:38:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 98830 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 23B8F385735B for ; Mon, 14 Oct 2024 06:40:04 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 36BFF3858CDA for ; Mon, 14 Oct 2024 06:38:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 36BFF3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 36BFF3858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::434 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728887922; cv=none; b=ukvohQdMkCG/5qBc+mOxlFydMxyTJcx1h2BEQoRbdzuI0I/zmd3rcdGzyxpjiNDpXbUAGRlyTbI1llUw5JXjQ4ocJCAINbpQZwCu0DUX862ELaIZ/imYyAGNfWTr5NHxwcQGowS0y9Ei4FNzmhlYQoNe8sLItg7VDgILdNcWy5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728887922; c=relaxed/simple; bh=g+UYAXKmBjKQGsnzLQeV0i52Jf3hwHsJTBI9BoTzlhg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=qZMZq6MMc91J37iFWV/WuLYLujgR9tSWjxcwSI9HwhvL00iAMtjdfQLwPC85natXRQIIIqdlJzo5bSUmSpHW83g5Y5JJx5HQSqFnYskxGj4Pz5ipyzt7L1hyaCXpSTym5PSExuNNRHRF113aoz9gn5lGZiJAbiW/nRZUkmP8mWU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-37d43a9bc03so2358173f8f.2 for ; Sun, 13 Oct 2024 23:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728887910; x=1729492710; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=wp399hTl9OLmRQx0S1a660QLgH+8Nq1EecBi0OzHCFw=; b=OuO0tLqhJ1SD2S3iULpy8aracoUoYB6SB3M2hOHALEodkJ/l7bz/YvYvx9S3gLuqeH U8W3SEaUeOSz/ZPOJsI2BibhEflD+cTdWvYrjt5D5eB1WqUot9imEcH/wfWuQKNy4YAp vpLWvBcLnnHZe0iRkv6+zNjhOd0u5xUaxDZlpV9QT16w4lWNxMH3DTT4oxtdcwt7IOUm 8oFN0DlRNUUJL8WAgRMb/hgxiWsz3Rc1raoq0Ha2KrKU1tEDyKQM++eyhlfbavvDfnjz D7eqdljdscPirjNrMSyvAZP7RkBCSVz2eSZI0ghj7fxNpD7cc/t18WwxxnYCap6a2X1p M52A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728887910; x=1729492710; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wp399hTl9OLmRQx0S1a660QLgH+8Nq1EecBi0OzHCFw=; b=GrEMqCLHYFys5c4FQOu1QNQK8kCNvzS2afrXGqYggnLZjooEQ6p1/MEjH3gWmfinhf ZF0yQKbqeTZtCJZkm0TqI82KqVBZGvVIYI0/AQCKGfIy5DE6XumSAKAdrZGdJQo6Thj0 WSJbc6HEqQcNAqDgeQwclHj5UFK78g32FvevkKTLf17QMI4dO2lqYUFXxAvzM9lBPnie 8tI+rrMVjfN41GRiN2hccEFAAlFZD8bL1kGcJm9MNSpJsi8oN0ZmuZZQeEIEOuFrI9cW qXNphPAsIcwmG3h/C1k6Ot3zsSwGWEWUn+LMyTzcdoc4abPTApo1afcYP1OSkx/cPZ25 3qbQ== X-Gm-Message-State: AOJu0YzAqcTZCwkEt95Hf65BnOVZLp5EEHIum8QRXxIPH3Y3Q/wLV2bJ 95aujD9d/DYuS1lWcLpfEVaNyrZ5v3ZSqb+frCAWqk4iZiO7cK+Cr62wmo1VH0Nzf1PkDi5Oqk4 = X-Google-Smtp-Source: AGHT+IE2yVqQ8IlUCi+CRNAIFvezmsREgffi7CfoL88qa/nItqDUW361Km4qGroRnkYQ5wrZQwEeSA== X-Received: by 2002:adf:fa52:0:b0:37d:4a7b:eeb2 with SMTP id ffacd0b85a97d-37d5ff1c34emr5017834f8f.35.1728887909815; Sun, 13 Oct 2024 23:38:29 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b79f9c1sm10511120f8f.68.2024.10.13.23.38.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Oct 2024 23:38:29 -0700 (PDT) Message-ID: <79fa6785-c0b9-44af-8dde-dfd9360da449@suse.com> Date: Mon, 14 Oct 2024 08:38:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/2] gas: make fix_new_exp()'s "exp" parameter const From: Jan Beulich To: Binutils References: Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/Br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VSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3023.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org This really should be only an input; in particular it looks bogus that O_add expressions are even altered. That altering and the recursion are even pointless: Once expanding what the inner call would do (with O_symbol) it becomes clear that this is no different than the default case. Simplify the code accordingly, retaining the comment. --- Question of course is whether any caller has grown a dependency on O_add expressions being converted to O_symbol ones. Pretty wide testing suggests no. The simplification really ought to have happened when 00a69b895a5f replaced the as_bad() in the default case, post-dating 4acf8c78e659 which introduced the special O_add handling. --- a/gas/write.c +++ b/gas/write.c @@ -238,7 +238,7 @@ fixS * fix_new_exp (fragS *frag, /* Which frag? */ unsigned long where, /* Where in that frag? */ unsigned long size, /* 1, 2, or 4 usually. */ - expressionS *exp, /* Expression. */ + const expressionS *exp, /* Expression. */ int pcrel, /* TRUE if PC-relative relocation. */ RELOC_ENUM r_type /* Relocation type. */) { @@ -255,20 +255,6 @@ fix_new_exp (fragS *frag, /* Which frag as_bad (_("register value used as expression")); break; - case O_add: - /* This comes up when _GLOBAL_OFFSET_TABLE_+(.-L0) is read, if - the difference expression cannot immediately be reduced. */ - { - symbolS *stmp = make_expr_symbol (exp); - - exp->X_op = O_symbol; - exp->X_op_symbol = 0; - exp->X_add_symbol = stmp; - exp->X_add_number = 0; - - return fix_new_exp (frag, where, size, exp, pcrel, r_type); - } - case O_symbol_rva: add = exp->X_add_symbol; off = exp->X_add_number; @@ -290,6 +276,8 @@ fix_new_exp (fragS *frag, /* Which frag off = exp->X_add_number; break; + case O_add: /* This comes up when _GLOBAL_OFFSET_TABLE_+(.-L0) is read, if + the difference expression cannot immediately be reduced. */ default: add = make_expr_symbol (exp); break; --- a/gas/write.h +++ b/gas/write.h @@ -188,7 +188,7 @@ extern fixS *fix_new (fragS *, unsigned extern fixS *fix_at_start (fragS *, unsigned long, symbolS *, offsetT, int, bfd_reloc_code_real_type); extern fixS *fix_new_exp (fragS *, unsigned long, unsigned long, - expressionS *, int, bfd_reloc_code_real_type); + const expressionS *, int, bfd_reloc_code_real_type); extern void write_print_statistics (FILE *); extern void as_bad_subtract (fixS *);