This is an archive of the discontinued LLVM Phabricator instance.

Allow use define symbols to override linker defined ones
ClosedPublic

Authored by rafael on Nov 17 2016, 7:46 AM.

Details

Reviewers
ruiu
davide
Summary

I hit an internal linker script that was defining _DYNAMIC instead of letting the linker do it. It turns out that both bfd and gold allow that.

This is pretty easy to implement, just make the linker defined symbol weak. This should have no impact in the case where there is no user defined symbol: The visibility is hidden, which causes the output to still be local.

Diff Detail

Event Timeline

rafael updated this revision to Diff 78367.Nov 17 2016, 7:46 AM
rafael retitled this revision from to Allow use define symbols to override linker defined ones.
rafael updated this object.
rafael added a reviewer: ruiu.
rafael added a subscriber: llvm-commits.

Was the MIPS duplicate _gp issue entirely a false error now fixed by this change?

Was the MIPS duplicate _gp issue entirely a false error now fixed by this change?

This fix removes false error message but the linker will not use _gp value provided in the linker script. That needs to be fixed separately. I will do that soon.

ruiu accepted this revision.Nov 17 2016, 9:05 AM
ruiu edited edge metadata.

LGTM with a comment saying that new symbols are added as weak symbols so that they can be overriden by user-defined linker script symbols.

This revision is now accepted and ready to land.Nov 17 2016, 9:05 AM
davide accepted this revision.Nov 17 2016, 9:57 AM
davide added a reviewer: davide.
davide added a subscriber: davide.

lgtm

davide closed this revision.Nov 22 2016, 1:56 PM
ELF/Writer.cpp