This is the mail archive of the
mailing list for the binutils project.
Re: symbol size as function size
On Fri, 24 Jun 2011 12:01:49 +0930, Alan Modra wrote:
> Again, this boils down to the same thing, needed a special class of
> symbol. If I were implementing this feature I would not use global
> symbols containing size info. Instead
> a) Invent an assembler syntax that allows access to ELF symbol size,
> "sum@size" perhaps. (I'm assuming this is ELF only.) "sum" would
> not even need to be a defined symbol, it could be external.
> b) Arrange for the assembler to emit a relocation on uses of
> "sum@size", R_XXX_SIZE against symbol "sum".
> c) Teach the linker relaxation functions to update ELF symbol size,
> and add processing of the new relocation.
Thanks for the suggestion. I will keep that in mind. In the meantime Nick
suggested a different approach. Using md_allow_local_subtract. I will be
looking at it to see if I can do it this was (seems a lot more
straightforward) and default back to yours if I get blocked by something.