| Message ID | 3ecb6e90-f46f-46de-ba79-f4188e25e58f@suse.com |
|---|---|
| State | New |
| Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3681B4BA9011 for <patchwork@sourceware.org>; Fri, 19 Jun 2026 12:00:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3681B4BA9011 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=PEI/fwOd X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 112544B9DB75 for <binutils@sourceware.org>; Fri, 19 Jun 2026 11:52:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 112544B9DB75 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 112544B9DB75 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781869962; cv=none; b=eOsTqMeNuH4nSBvFU0j+ZJs7967s5TiZT5Nkq6XY9W4mhvgfTshIorGLti/DjKbt77Qfw97hmW7X8B2YamIr6gOnBOYk2mfaG0l+mXHq4vc5iogfLduw8ePNT9XQyYfpd0srDgx2IyyVMS3Xf+JjB1koQxb7fENZfkmosukG/vg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781869962; c=relaxed/simple; bh=drVs/H1itjGNGDduR6PhzkW0/dYwbSEslBayac1cWUk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=lk69A4fLTkYbKgevPF/CxBKuvHFQXu4HvlZznz0N6Ht9UERFvs+pLFTCXdu/e5Kxbh9mNSippOfH8cx+74fzArpj2WGEfNXFLgxNJKBvZcsukJ45eTD5QGo24vPlnXwQ+zq1A023plxvij6t5p+c3Zx6C5aEoFQE0+8VFDSST24= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=PEI/fwOd DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 112544B9DB75 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-46066e640easo1260085f8f.1 for <binutils@sourceware.org>; Fri, 19 Jun 2026 04:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1781869961; x=1782474761; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=uvN24YzQZynwvz1ZbYMK56Y2xEDzOQvRblQHw3RCoCE=; b=PEI/fwOdtQOpfsJcd1Ep/NhEu0kTmSiLTlOJD8VLxjZbZEQkG0rf5ejQjjll/MFy+5 nZPMPwi5otIYA4863EBL7i3/S4BkT+22rLAcAtjiJ6F97js7CS1fDCnbzOSngfZAU8T1 512jccLite8ncZC+XKc4ftB+j9Fi4sBY29uk7YfRslGvEU8nQ7GVzKqqTSY4/AwAPGqQ kzLn1hF74jHuRefsDTg7HHo7nBfbq7FkQWpbVt3tfceY7jMlB3L6ruMWsKCx4O9XzeVi mmSeynkerNKmEED1RVPUPi1RZ4hn88SQjbbvKPCfpCtqWGuz4z6r/MWKZSEkP4vMcyXn lDZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781869961; x=1782474761; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uvN24YzQZynwvz1ZbYMK56Y2xEDzOQvRblQHw3RCoCE=; b=CtT+AnFwKbHzy4TOqdpAbihL09t4svf6p4kdj05HwAZvMleexz2aGBvI0tgJMA+Ovg DplFNPa+6G7dQtB/MjaT1d8l/30gn5sq7uUVT90iw919cR0URd3pniYMa/OvfKNtAmM6 vHLqcpiqrqHd/O0PxO42xJorn5H8r6TUysmW06WyKeYLir/MjEfMuX8C0p1/ym2dfWsx ENGJOBkoGvmsHbT2Qp+nVaeuSODFsDCqz5v6Ldn2HhwlYiKrvkWmq8Y5cNl4z0avOQ92 ZDKIhhcU1QremeZwvqNTQZnGCuv3sOPc+chpPon8e9QpwQRjowlHu/QytTT0j23o0fYD YD5w== X-Gm-Message-State: AOJu0YyRXB90ahrbJ5Ohmb1TKXEdQLhvDY9YjJOCm4DIrFLyr7e83Li5 z9eC5aKq2IieyoCvsALghzac8v9G/XJEYjI/70xrqD5EQl19kvNE86z7H4C7V4mA6nbkH/6MEES MUZxGqw== X-Gm-Gg: AfdE7cmGKdN/PmXVgIjoKjRnotLubcRNLkiZIq5ehYaD9on7i1/x1VWOWzuPXx/UCl+ 9u9mge5gq9d7BC9ztvpPhO2zoIL7f76yNkcJD0L8LeIlhP7P8Xe6nesEJNN3zJ1de+O7BxvPode VWC1MdD5G49fadjbaiKCA0b1FMWdfjemcteI2c6RloM34+6puQTQYLWt0Z30NhPsjyTMJxqhZa/ tJuhP+eh1D6pXzU0k/t+cDPfx7GhALkvIoE3F0ScfdsPGVK+QAYh0Zhe0v+7zznt7Knydg2ZYRj ai3qyPoBpEBzuU5iqq7abEJQUq3XU6LyLkG1iu+DBtldDhHHHzGIMD1nRu9SP/bAaObKxpA24Lv 1BEheH6NzoKz+7szu0DoJ31dO5SsTKFvXLiwGn8wELmxXE5QzP7oLjmiT3KvVxjGoW8dELKfdf4 muOn2p5lHPRoXheKQRui/svVA4luGn+dBS5y9BlE8eYxYf7uQkbL3ePbpNerwXUwQJwm0Zl+BXf U11 X-Received: by 2002:a5d:5f82:0:b0:45e:b99d:dad with SMTP id ffacd0b85a97d-4650a32ad1amr5813189f8f.38.1781869961024; Fri, 19 Jun 2026 04:52:41 -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-465090c42d6sm7296548f8f.10.2026.06.19.04.52.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Jun 2026 04:52:40 -0700 (PDT) Message-ID: <3ecb6e90-f46f-46de-ba79-f4188e25e58f@suse.com> Date: Fri, 19 Jun 2026 13:52:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v3 12/13] RISC-V/bfd: warn about non-boolean unaligned-access attribute From: Jan Beulich <jbeulich@suse.com> To: Binutils <binutils@sourceware.org> Cc: Palmer Dabbelt <palmer@dabbelt.com>, Andrew Waterman <andrew@sifive.com>, Jim Wilson <jim.wilson.gcc@gmail.com>, Nelson Chu <nelson.chu1990@gmail.com>, jiawei <jiawei@iscas.ac.cn> References: <8243b692-4895-420c-b2d0-27ee3b714732@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9o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rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <8243b692-4895-420c-b2d0-27ee3b714732@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3016.1 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 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
RISC-V: assorted fixes and (hopefully) improvements
|
|
Checks
| Context | Check | Description |
|---|---|---|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | success | Build passed |
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 | success | Test passed |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm | success | Build passed |
| linaro-tcwg-bot/tcwg_binutils_check--master-arm | success | Test passed |
Commit Message
Jan Beulich
June 19, 2026, 11:52 a.m. UTC
The attribute being a boolean one, incoming values should be solely 0 or 1. Convert other non-zero values to 1. --- v3: New.
Comments
On 2026/6/19 19:52, Jan Beulich wrote: > The attribute being a boolean one, incoming values should be solely 0 or > 1. Convert other non-zero values to 1. > --- > v3: New. > > --- a/bfd/elfxx-riscv.c > +++ b/bfd/elfxx-riscv.c > @@ -3777,6 +3777,23 @@ riscv_merge_attributes (bfd *ibfd, struc > initialized. */ > out_attr[0].i = 1; > > + for (i = LEAST_KNOWN_OBJ_ATTRIBUTE; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++) > + { > + switch (i) > + { > + case Tag_RISCV_unaligned_access: > + if (out_attr[i].i <= 1) > + break; > + > + _bfd_error_handler > + (_("warning: %pB uses non-boolean `unaligned access' attribute; " > + "converting to boolean"), > + ibfd); > + out_attr[i].i = 1; > + break; > + } > + } > + > return true; > } > > @@ -3865,7 +3882,12 @@ riscv_merge_attributes (bfd *ibfd, struc > break; > > case Tag_RISCV_unaligned_access: > - out_attr[i].i |= in_attr[i].i; > + if (in_attr[i].i > 1) > + _bfd_error_handler > + (_("warning: %pB uses non-boolean `unaligned access' attribute; " > + "converting to boolean"), > + ibfd); > + out_attr[i].i |= !!in_attr[i].i; > break; > > case Tag_RISCV_stack_align: LGTM. Checking the copied attributes for the first input object is necessary, since otherwise a non-boolean unaligned_access value from the first object would be carried into the output unchanged. One very small wording thought: the gas-side diagnostic uses `unaligned_access', while this one uses `unaligned access'. Either is fine with me, using the same spelling might make the diagnostics more consistent, but this does not need to block the patch. Reviewed-by: Jiawei jiawei@iscas.ac.cn
On 22.06.2026 11:02, Jiawei wrote: > On 2026/6/19 19:52, Jan Beulich wrote: >> The attribute being a boolean one, incoming values should be solely 0 or >> 1. Convert other non-zero values to 1. >> --- >> v3: New. >> >> --- a/bfd/elfxx-riscv.c >> +++ b/bfd/elfxx-riscv.c >> @@ -3777,6 +3777,23 @@ riscv_merge_attributes (bfd *ibfd, struc >> initialized. */ >> out_attr[0].i = 1; >> >> + for (i = LEAST_KNOWN_OBJ_ATTRIBUTE; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++) >> + { >> + switch (i) >> + { >> + case Tag_RISCV_unaligned_access: >> + if (out_attr[i].i <= 1) >> + break; >> + >> + _bfd_error_handler >> + (_("warning: %pB uses non-boolean `unaligned access' attribute; " >> + "converting to boolean"), >> + ibfd); >> + out_attr[i].i = 1; >> + break; >> + } >> + } >> + >> return true; >> } >> >> @@ -3865,7 +3882,12 @@ riscv_merge_attributes (bfd *ibfd, struc >> break; >> >> case Tag_RISCV_unaligned_access: >> - out_attr[i].i |= in_attr[i].i; >> + if (in_attr[i].i > 1) >> + _bfd_error_handler >> + (_("warning: %pB uses non-boolean `unaligned access' attribute; " >> + "converting to boolean"), >> + ibfd); >> + out_attr[i].i |= !!in_attr[i].i; >> break; >> >> case Tag_RISCV_stack_align: > > LGTM. > > Checking the copied attributes for the first input > object is necessary, since otherwise a non-boolean unaligned_access > value from > the first object would be carried into the output unchanged. > > One very small wording thought: the gas-side diagnostic uses > `unaligned_access', while this one uses `unaligned access'. Either is fine > with me, using the same spelling might make the diagnostics more > consistent, but this does not need to block the patch. Oh, thanks for noticing. I've added in the underscores, also for the subsequent stack-align patch. > Reviewed-by: Jiawei jiawei@iscas.ac.cn Thanks. Jan
--- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -3777,6 +3777,23 @@ riscv_merge_attributes (bfd *ibfd, struc initialized. */ out_attr[0].i = 1; + for (i = LEAST_KNOWN_OBJ_ATTRIBUTE; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++) + { + switch (i) + { + case Tag_RISCV_unaligned_access: + if (out_attr[i].i <= 1) + break; + + _bfd_error_handler + (_("warning: %pB uses non-boolean `unaligned access' attribute; " + "converting to boolean"), + ibfd); + out_attr[i].i = 1; + break; + } + } + return true; } @@ -3865,7 +3882,12 @@ riscv_merge_attributes (bfd *ibfd, struc break; case Tag_RISCV_unaligned_access: - out_attr[i].i |= in_attr[i].i; + if (in_attr[i].i > 1) + _bfd_error_handler + (_("warning: %pB uses non-boolean `unaligned access' attribute; " + "converting to boolean"), + ibfd); + out_attr[i].i |= !!in_attr[i].i; break; case Tag_RISCV_stack_align: