public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: jacob navia <jacob@jacob.remcomp.fr>
To: Paul Koning <paulkoning@comcast.net>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	jbeulich@suse.com, binutils@sourceware.org
Subject: Re: P.S. Follow up to my last post
Date: Fri, 25 Aug 2023 21:44:46 +0200	[thread overview]
Message-ID: <44B3B136-BE36-4D9C-AF87-B39228860B27@jacob.remcomp.fr> (raw)
In-Reply-To: <8C7981E4-01DE-4C70-92DB-6C711D95D710@comcast.net>

[-- Attachment #1: Type: text/plain, Size: 2168 bytes --]

I am just invoking the assembler with its default settings:

~/star64 $ as -o test.o test.s

The assembler is testing the default architecture here:
Function: riscv_ip

	for (; insn && insn->name && strcmp(insn->name,str) == 0; insn++) {
#if 0
		if ((insn->xlen_requirement != 0) && (xlen != insn->xlen_requirement))
			continue;

		if (!riscv_multi_subset_supports(&riscv_rps_as,insn->insn_class)) {
			error.missing_ext = riscv_multi_subset_supports_ext(&riscv_rps_as,
							    insn->insn_class);
			continue;
		}
#endif

The #if 0/#endif were added by me. I think those tests do not belong here. 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!

And if you are assembling compiler output, it is up to the compiler to furnish the correct instructions.

Tiny-asm doesn’t test any instruction compliance and that is why it works out of the box!

Jacob


> Le 25 août 2023 à 19:03, Paul Koning <paulkoning@comcast.net> a écrit :
> 
> 
> 
>> On Aug 25, 2023, at 12:10 PM, jacob navia <jacob@jacob.remcomp.fr> wrote:
>> 
>> OK.
>> 1) We agree that the -march=rv64gc_zbb option is completely undocumented and impossible for the user to know.
>> 2) We agree that « gnu gas » is an assembler whose duty is to assemble instructions. But « gas » will refuse to assemble those instructions. 
>> Why is that? It is the responsibility of the programmer or the compiler to write the instructions that are present in this or another machine. 
>> Why the assembler thinks it is necessary to forbid some instructions???
> 
> It's reasonable for the assembler to enforce ISA variations, based on what it's told in the -march switch.  If so, then (a) gcc has to pass that switch, and (b) gcc can't add a variant that gas doesn't know about.
> 
> Is that the case here?  Are you invoking the assembler manually or having it done for you by gcc?  If the former, the -march switch is your responsibility; if the latter, then gcc is responsible for getting it right.
> 
> 	paul


  reply	other threads:[~2023-08-25 19:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AEF14E89-14CF-4474-8822-B0139F3F740B@jacob.remcomp.fr>
2023-08-25 15:32 ` Palmer Dabbelt
2023-08-25 16:10   ` jacob navia
2023-08-25 17:03     ` Paul Koning
2023-08-25 19:44       ` jacob navia [this message]
2023-08-28  6:17         ` Jan Beulich
2023-08-28  7:04           ` jacob navia
2023-08-25 11:52 jacob navia
2023-08-25 12:00 ` Jan Beulich
2023-08-25 13:07   ` jacob navia
2023-08-25 13:30     ` Jan Beulich
2023-08-25 13:40       ` Paul Koning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44B3B136-BE36-4D9C-AF87-B39228860B27@jacob.remcomp.fr \
    --to=jacob@jacob.remcomp.fr \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    --cc=palmer@dabbelt.com \
    --cc=paulkoning@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).