H' hex constants

DJ Delorie dj@redhat.com
Mon Jul 7 21:36:00 GMT 2008


I've been asked to add H'00 syntax for hex constants to gas, for
compatibility with other assemblers.  The easiest thing to do is to
replace the H' with 0x early on, so I've been looking at
do_scrub_chars() in app.c.  I've got added logic to brute-force all H'
into 0x but it doesn't handle things like FGH't' gracefully.  One
problem is that there isn't a way to peek far enough ahead to see if
the character after the ' is a hex digit (you may not be able to unget
all those characters, and/or you may not be able to PUT() them all
into the output buffer).

However, the current code will take something like H'1234 and replace
the '1 with 0x30 (48), resulting in a symbol called H49234.  I figured
just replacing all H' with 0x wouldn't break any existing valid code,
but I thought I'd ask.  If so, I'll need to work on smarter logic.

Comments?



More information about the Binutils mailing list