This is an archive of the discontinued LLVM Phabricator instance.

Keep some relocations with undefined weak symbols
ClosedPublic

Authored by rafael on Sep 13 2017, 5:22 PM.

Details

Reviewers
pcc
davide
ruiu
Summary

This is pr34301.

As the bug points out, we want to keep some relocations with undefined weak symbols. This means that we cannot always claim that these symbols are not preemptible as we do now.

Unfortunately, we cannot also just always claim that they are preemptible. Doing so would, for example, cause us to try to create a plt entry when we don't even have a dynamic symbol table.

What almost works is to say that weak undefined symbols are preemptible if and only if we have a dynamic symbol table. Almost because we don't want to fail the build trying to create a copy relocation to a weak undefined.

Diff Detail

Event Timeline

rafael created this revision.Sep 13 2017, 5:22 PM
davide edited edge metadata.Sep 14 2017, 2:36 PM

Thanks for fixing this.
I have no objections to the way you fixed it, some comments inline. Maybe Rui wants to take a look at the style.

ELF/Config.h
130

you seem to assign this unconditionally, so do you need to initialize this to false?

ELF/Driver.cpp
1012–1013

Maybe you can add a comment here? I remember the rule now, but I won't in a bit :)

ELF/Relocations.cpp
571–581

I see what you mean here, but, do we have a better way of saying "degrade it to zero?"
Something like, force its value to be zero? (Sorry, I don't have a better way of expressing it)

ruiu added inline comments.Sep 14 2017, 5:28 PM
ELF/Driver.cpp
1012–1013

Since this is computed based on other configurations, I'd move this to setConfigs because that's where other non-command-line parameters are set.

Address review comments.

davide accepted this revision.Sep 14 2017, 7:42 PM

LGTM

This revision is now accepted and ready to land.Sep 14 2017, 7:42 PM
ruiu edited edge metadata.Sep 14 2017, 7:45 PM

Unfortunately it also depends on there being a .so in the link or not,
so it has to be set after the others.

SetConfigs is called after createFiles, and all .so files are added by createFiles, it is safe to initialize the variable in SetConfigs, no?

ruiu accepted this revision.Sep 15 2017, 9:51 AM

LGTM

davide closed this revision.Sep 15 2017, 11:11 AM

r313372