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.
It is correct in the sense that we have no better choice, but wrong in the sense that those symbol addresses really aren't "absolute".
Unless I'm missing something, there are three sensible options. 1. A preserved symbol in a discarded section becomes SHN_ABS. 2. A discarded section is not actually discarded, but assigned to one of the adjacent output sections, so its symbols wind up in that section. 3. No orphan input section is discarded if it contains any symbols.
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.
Thanks, Roland