This is an archive of the discontinued LLVM Phabricator instance.

[ELF2] Don't create RelativeReloc for weak undef symbols
ClosedPublic

Authored by hfinkel on Oct 16 2015, 12:30 PM.

Details

Summary

When we have a R_PPC64_ADDR64 for a weak undef symbol, which thus resolves to 0, and we're creating a shared library, we need to make sure that it stays 0 (because code that conditionally calls the weak function tests for this). Unfortunately, we were creating a R_PPC64_RELATIVE for these relocation targets, making the address of the undefined weak symbol equal to the base address of the shared library (which is non-zero). It seems like, in general, we should not be creating RelativeReloc relocs for undef weak symbols.

Diff Detail

Event Timeline

hfinkel updated this revision to Diff 37626.Oct 16 2015, 12:30 PM
hfinkel retitled this revision from to [ELF2] Don't create RelativeReloc for weak undef symbols.
hfinkel updated this object.
hfinkel added reviewers: rafael, ruiu.
hfinkel added a project: lld.
hfinkel added a subscriber: llvm-commits.
rafael edited edge metadata.Oct 16 2015, 1:24 PM
rafael added a subscriber: rafael.

The test I think is correct. Give me a minute to see if there is a
better place in the code to put the check.

The test is OK, but would the attached patch fix the problem for you?

I think it is a better spot to put the test.

hfinkel accepted this revision.Oct 16 2015, 3:13 PM
hfinkel added a reviewer: hfinkel.

(as suggested by Rafael)

This revision is now accepted and ready to land.Oct 16 2015, 3:13 PM
hfinkel closed this revision.Oct 16 2015, 3:13 PM

r250558, thanks!