Commit: Gas: Add .nop directive.

Jose E. Marchesi jose.marchesi@oracle.com
Tue Sep 15 11:57:35 GMT 2020


>> In the same spirit, it would be awesome to be able to generate
>> architecture-neutral data directives as well, for DWARF and CTF and the
>> like :)
>
> What about ".dc.b <val>" ?  Does that not work for all targets ?

Maybe it does.

We found problems while trying to have .s files in CTF tests in ld,
generated with a patched GCC: the data directives emitted by the
compiler are architecture-specific.  I think the GDB testsuite ships
with a DWARF assembler because of the same reason.

So I guess the problem is more a compiler one... i.e. what data
directives it uses.

>>> +#define md_single_noop_insn "mov %r1,%r1"
>> 
>> For BPF we have this in GCC:
>> 
>> (define_insn "nop"
>>   [(const_int 0)]
>>   ""
>>   "mov\t%%r0,%%r0"
>
>> I think it would be good to settle on the same way to encode nops in
>> both GCC and binutils.
>
> Actually David Faust just posted a patch to change the instruction to "ja 0"
> as this is what the kernel expects.  I have applied his patch to gas.  Maybe
> gcc should be updated as well ?

Yeah, actually it was your patch that prompted us to revisit the NOP
situation in BPF, and we found out the kernel actually expects a
particular encoding for them.  So thanks for that :)

We fixed GCC as well.


More information about the Binutils mailing list