P.S. Follow up to my last post
jacob navia
jacob@jacob.remcomp.fr
Fri Aug 25 19:44:46 GMT 2023
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
More information about the Binutils
mailing list