Better handling of PIC suffixes in GAS expression parser

Alan Modra alan@linuxcare.com.au
Sun Apr 8 23:53:00 GMT 2001


On 9 Apr 2001, Alexandre Oliva wrote:

> +#ifdef md_parse_name_and_continuation
> +	  /* This is a hook for the backend to parse certain names
> +	     followed by suffixes. */
> +	  if (md_parse_name_and_continuation (name, c, input_line_pointer,
> +					      expressionP))
> +	    break;
> +#endif
> +
>  #ifdef md_parse_name

Rather than creating a new hook, why don't you make use of the existing
md_parse_name hook?  You'd need to modify it a little, ie. pass `c' in,
and move "*input_line_pointer = c;" into the hook, but then you'd
basically have the same as your new hook.  There are only three back-ends
that use md_parse_name so the modification shouldn't be too painful.

Also, input_line_pointer is a global, and probably will need to be
modified inside the md_.. function so there's not much point in passing it
as a parameter.

> I set TC_SYMFIELD_TYPE and TC_LOCAL_SYMFIELD_TYPE to a struct
> sym_pic_notes, with an enum indicating whether the symbol is a regular
> symbol, a @GOT, @PLT or @GOTOFF reference, or _GLOBAL_OFFSET_TABLE_.

It might make more sense to have TC_*_SYMFIELD_TYPE a pointer to your new
struct.  Regular symbols thus wouldn't need to carry the extra baggage.

> Ok to install?

Not until you convince me I don't know what I'm talking about in the above
comments.  :-)

-- 
Alan Modra



More information about the Binutils mailing list