On Wed, Feb 01, 2012 at 10:22:35AM -0800, Roland McGrath wrote:
No, and I guess it is more compliant than what is done now. It is just that just turning those symbols into SHN_ABS basically gives up on them. That might be the best we can do with the current ld design though :{
I'm not sure why you say that. They are symbols with names and addresses. In a linked object, the section assignment is really just some ancillary information and not intrinsically all that meaningful.
But if you emit the information anyway then it is (as even Alan admits) useful for analysing tools. In this particular case knowing that a symbol/address came from the .tm_clone_table seems useful to me.
Unless I'm missing something, there are three sensible options.
- A preserved symbol in a discarded section becomes SHN_ABS.
- A discarded section is not actually discarded, but assigned to one of the adjacent output sections, so its symbols wind up in that section.
- No orphan input section is discarded if it contains any symbols.
There also is the option of just doing away with the section table and just keep the program headers when producing an executable of course. But that also isn't particularly useful.
My impression is that gold just doesn't discard any sections at all, instead producing empty output sections. I don't see any harm in that.
Yes, that (3) seems the best option. IMHO. Both 1 and 2 loose the original information. But we need to have this discussion on the binutils list if we want to advocate a change/patch for ld.
Cheers,
Mark