[patch][gas/z80] Prevent using register names as ordinary symbols

Arnold Metselaar arnold.metselaar@planet.nl
Sun May 6 10:13:00 GMT 2012


Peter Hanzel has reported to me that z80-coff-as happily produces code 
for pseudo instructions like LD HL,(SP+0).
Register names, like `SP' were only recognised when they appeared 
alone in an argument or as part of standard indexed addressing 
constructs, like `(ix+d)'.
This patch creates symbol table entries for z80 registers, preventing 
their usage as ordinary symbols and bringing the parsing of them more 
in line with other ports.

Changelog:
2012-05-06  Arnold Metselaar <arnold_m@operamail.com>

	* config/tc-z80.h(md_register_arithmetic): Define as 0.
	* config/tc-z80.c(md_begin): Store register names in symbol table, 
prevents usage as ordinary symbol.
	* config/tc-z80.c(contains_register): New function.
	* config/tc-z80.c(parse_exp2): Removed.
	* config/tc-z80.c(parse_exp_not_indexed): New function.
	* config/tc-z80.c(parse_exp): Add code to recogize indexed 
addressing after parsing.
	* config/tc-z80.c(emit_byte, emit_word): Use contains_register.
	* config/tc-z80.c(emit_jp): Use parse_exp_not_indexed, simplify 
condition for jump to register.
	* config/tc-z80.c(emit_call, emit_jr, emit_ex, emit_rst): Use 
parse_exp_not_indexed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: register-symbols.patch
Type: text/x-patch
Size: 11621 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20120506/a46882e1/attachment.bin>


More information about the Binutils mailing list