From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.smtpout.orange.fr (smtp-21.smtpout.orange.fr [80.12.242.21]) by sourceware.org (Postfix) with ESMTPS id 9C80A385840F for ; Mon, 28 Aug 2023 07:05:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C80A385840F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jacob.remcomp.fr Authentication-Results: sourceware.org; spf=none smtp.mailfrom=jacob.remcomp.fr Received: from smtpclient.apple ([90.22.252.13]) by smtp.orange.fr with ESMTPS id aWJ6qalnNJ5zLaWJ6qW2rm; Mon, 28 Aug 2023 09:05:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1693206305; bh=0ErzLIhyG5UB4w+9x16ycvZixhorctaQTMAArLINMX8=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=gGguKmcUFND6Ft/vTnIv70c7AaWRuMU2u85vJW7HKT2R76u/xhtc6xXK+by2++TRj 0vyOQDgn+iXdxEVtmF2ySZlwtlNhjO23vFr4b2IUUKtZnroCuZwa7qOCyLiIpDW1MM CRrnHBb9CXOGwDNASNngLax1Stq1410WcGjIGBT0mh5F4QXP6ZPvuELdJeHtds/t+c e3LaGlosQYGq5uGI7kYU0xTQX0BlDy3E8bFvvSePEhTO3i2wkgbgWrF5cBEKBuakg0 6zVjyhrxOTVaffX5aT7OkH3xaBv/DXxi62s3lgrenHxhObR0J9EgS1du0ey4g8lJPv 2nFSkFK/J4EKQ== X-ME-Helo: smtpclient.apple X-ME-Date: Mon, 28 Aug 2023 09:05:05 +0200 X-ME-IP: 90.22.252.13 From: jacob navia Message-Id: <43A05AC2-BF9F-4688-851A-410CC8A57489@jacob.remcomp.fr> Content-Type: multipart/alternative; boundary="Apple-Mail=_1BBF6D58-E0E4-45C0-B51D-CDF6D1E40A75" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: P.S. Follow up to my last post Date: Mon, 28 Aug 2023 09:04:53 +0200 In-Reply-To: <3a591c4f-806b-4c40-f127-46bd9a065206@suse.com> Cc: Palmer Dabbelt , binutils@sourceware.org, Paul Koning To: Jan Beulich References: <502E2019-6C30-45ED-9EE4-A5ABAABBB750@jacob.remcomp.fr> <8C7981E4-01DE-4C70-92DB-6C711D95D710@comcast.net> <44B3B136-BE36-4D9C-AF87-B39228860B27@jacob.remcomp.fr> <3a591c4f-806b-4c40-f127-46bd9a065206@suse.com> X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --Apple-Mail=_1BBF6D58-E0E4-45C0-B51D-CDF6D1E40A75 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 OK Just do nothing. It is the best solution. The assembler doesn=E2=80=99t assemble instructions recognized by the machi= ne it is running on? The user should use the undocumented march=3Dxxx option. And if he doesn=E2= =80=99t read the inexistent documentation, that=E2=80=99s his/her fault. Thank you very much for your attention Jacob > Le 28 ao=C3=BBt 2023 =C3=A0 08:17, Jan Beulich a =C3= =A9crit : >=20 > On 25.08.2023 21:44, jacob navia wrote: >> I am just invoking the assembler with its default settings: >>=20 >> ~/star64 $ as -o test.o test.s >>=20 >> The assembler is testing the default architecture here: >> Function: riscv_ip >>=20 >> for (; insn && insn->name && strcmp(insn->name,str) =3D=3D 0; insn++) { >> #if 0 >> if ((insn->xlen_requirement !=3D 0) && (xlen !=3D insn->xlen_requireme= nt)) >> continue; >>=20 >> if (!riscv_multi_subset_supports(&riscv_rps_as,insn->insn_class)) { >> error.missing_ext =3D riscv_multi_subset_supports_ext(&riscv_rps_as, >> insn->insn_class); >> continue; >> } >> #endif >>=20 >> The #if 0/#endif were added by me. I think those tests do not belong her= e. The assembler should assemble and not test if the instruction is legal. = If the instruction is illegal the program will crash at run-time, something= not that unusual if you are programming in assembler! >=20 > Having a program crash at runtime when this can be avoided at build time = is > deemed undesirable by many people, including me. I did point out before t= hat > there are two approaches for assemblers - default-enabling everything and > default-disabling everything except the base architecture insns. To a lar= ge > part this is a decision to be taken by the people writing an assembler. B= ut > there are technical constraints as well: As soon as you have two conflict= ing > extensions (which RISC-V was always allowing for, and which it now active= ly > has), the former model won't work very well anymore. >=20 > Of course you're free to propose a patch allowing the alternative model (= via > command line option and/or directive). Obviously whether that'll be appro= ved > is unknown up front. >=20 >> And if you are assembling compiler output, it is up to the compiler to f= urnish the correct instructions. >=20 > Yes. Plus, with an assembler following the former model, the necessary > directives. (As an aside, compilers aren't bug-free, and hence the assemb= ler > still applying some sanity checks makes some sense.) >=20 >> Tiny-asm doesn=E2=80=99t test any instruction compliance and that is why= it works out of the box! >=20 > As said, which model to use is up to the writers of any particular assemb= ler. >=20 > Jan --Apple-Mail=_1BBF6D58-E0E4-45C0-B51D-CDF6D1E40A75--