This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
m68k --register-prefix-optional and labels like registers
- From: Vincent Rivière <vincent dot riviere at freesbee dot fr>
- To: binutils at sourceware dot org
- Date: Fri, 18 May 2007 21:29:19 +0200
- Subject: m68k --register-prefix-optional and labels like registers
Hi.
The following scenario is run for a m68k-linux target (using ELF).
$ cat foo.s
clr.w sp.0
Note that "sp.0" is just a label with an embedded dot.
However, the first part "sp" has the same name as the stack pointer
register.
$ as foo.s -o foo.o
$ objdump -d foo.o
foo.o: file format elf32-m68k
Disassembly of section .text:
00000000 <.text>:
0: 4279 0000 0000 clrw 0x0
$ objdump -r foo.o
foo.o: file format elf32-m68k
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000002 R_68K_32 sp.0
Ok, the label is treated as an external symbol.
$ as foo.s -o foo.o --register-prefix-optional
foo.s: Assembler messages:
foo.s:1: Error: syntax error -- statement `clr.w sp.0' ignored
Now the label name conflicts with the register sp.
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
Do you think gas should accept labels like this, even with
--register-prefix-optional ?
Do you think gcc should avoid to generate labels like this ?
Why is the default value of the option --register-prefix-optional is not
the same for all m68k targets ?
Regards,
Vincent Rivière