This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Fix the ELF type for the linker-generated _DYNAMIC symbol
AbandonedPublic

Authored by davide on Mar 3 2016, 7:29 PM.

Details

Summary

This was wrong before, because the type set was None. Instead it's supposed to be Object (checked both what ld.bfd and gold produce).

Diff Detail

Event Timeline

davide updated this revision to Diff 49794.Mar 3 2016, 7:29 PM
davide retitled this revision from to [ELF] Fix the ELF type for the linker-generated _DYNAMIC symbol.
davide updated this object.
davide added reviewers: rafael, ruiu, grimar.
davide added a subscriber: llvm-commits.
ruiu edited edge metadata.Mar 3 2016, 8:12 PM

Did it cause any issues that _DYNAMIC symbol has STT_NOTYPE instead of STT_OBJECT?

davide added a comment.Mar 3 2016, 8:41 PM

No, not really. I just wanted to be compliant with what gold produces. I can't find easily documentation on _DYNAMIC, so, I can't verify if it's a strict requirement. OTOH, I also don't see why we should diverge when doing what others do comes at no-cost. Your mileage may vary, of course =)

grimar edited edge metadata.Mar 3 2016, 9:52 PM

I also checked the gold/bfd output when implemented the _DYNAMIC and yes, it is STT_OBJECT for both.
Please refer to my comment about that (at the end):
http://reviews.llvm.org/D17607#362668

But seems that nobody remembers why it was done in that way:
https://sourceware.org/ml/binutils/2002-03/msg00360.html

So I decided not to do that without need. I think it does not affect anything.

davide abandoned this revision.Mar 3 2016, 10:22 PM

On a second though, let's abandon this review.
I think maintaining this code is little effort but it's also little effort introducing this if really needed.
If Ian Taylor doesn't remember the need for it, that says a lot.

grimar added a comment.Mar 4 2016, 1:48 AM

If Ian Taylor doesn't remember the need for it, that says a lot.

Looking on a talk date (2002-03), that was 14 years ago. So if he did not remember it that time, I think nowadays that's even more true :)

ruiu added a comment.Mar 4 2016, 10:32 AM

Sure. But that fact that even Ian were not sure why _DYNAMIC symbol has STT_OBJECT type.
It's worth noting as a comment. I'll add that.