This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: m68k --register-prefix-optional and labels like registers


Hi Vincent,

$ cat foo.s
        clr.w sp.0

$ as foo.s -o foo.o --register-prefix-optional
foo.s: Assembler messages:

This is a problem because :
1) The default value of flag_reg_prefix_optional is 1, except when M68KCOFF or OBJ_ELF are defined (see REGISTER_PREFIX_OPTIONAL in gas/config/tc-m68k.h).
2) gcc generates labels like this

How ? (ie can you provide a gcc based test case. Please also mention how the toolchain is configured).


In fact, please could you open a bug report for this problem so that we can track it, and its solution.

Why is the default value of the option --register-prefix-optional is not the same for all m68k targets ?

This must be historical. The description of the --register-prefix-optional switch in gas/doc/c-m68k.texi mentions that register prefixing was needed for the sun3, amongst other targets, so presumably the sources evolved from this basis.


> Do you think gcc should avoid to generate labels like this ?

No. There is no way that gcc can guarantee not to generate labels like this. A sufficiently determined programmer can always arrange to get them into the assembler output somehow.

> Do you think gas should accept labels like this, even with
> --register-prefix-optional ?

Yes, but there is always going to be a problem with labels that look like register names. For example if the label in your test had been "sp.w" then the assembler would be right to complain.

Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]