M68K MRI Mode "Bug" with Local Labels?

Nick Clifton nickc@redhat.com
Wed Nov 17 17:27:57 GMT 2021
Dear Project Revolution,

> MyGlobalLabel1:
> 1:
>      dbf %d6,1b
>      dbf %d6,MyGlobalLabel1
> 
> MyGlobalLabel2:
> 1:
>      dbf %d6,1b
>      dbf %d6,MyGlobalLabel2
> 
> If assembled with "m68k-linux-gnu-as test.asm -o test.o" it generates the expected offsets (hint: both dbf instructions need to reference the same label). However, if you add --mri, it no longer generates sensible offsets for those local label instructions, in fact it has pretty nonsense offsets (6 and E for some reason). What's going on here? 

Off the top of my head: "local labels do not work in MRI mode".
Which is not hugely surprising since they are kind of a gas-specific feature.


Is there a function scope way to do local labels like what ASM68K supported out of the box? Is this a bug? We need --mri for what we are doing: removing this flag is not an 
option.

How about using a macro ?  eg:

   fred MACRO
   MyGlobalLabel\@:
   .L\@:
       dbf %d6,.L\@
       dbf %d6,MyGlobalLabel\@
   ENDM

	fred
	fred

Which gives:

   % as fred.s -o fred.o.mri --mri
   % objdump -dr fred.o.mri
   00000000 <MyGlobalLabel0>:
    0:	51ce fffe      	dbf %d6,0 <MyGlobalLabel0>
    4:	51ce fffa      	dbf %d6,0 <MyGlobalLabel0>

   00000008 <MyGlobalLabel1>:
    8:	51ce fffe      	dbf %d6,8 <MyGlobalLabel1>
    c:	51ce fffa      	dbf %d6,8 <MyGlobalLabel1>

Cheers
   Nick



More information about the Binutils mailing list