This is an archive of the discontinued LLVM Phabricator instance.

[PPC64] Preserve LocalEntry when linking
ClosedPublic

Authored by luporl on Jan 16 2019, 6:24 AM.

Details

Summary

On PowerPC64, it is necessary to keep the LocalEntry bits in st_other,
especially when -r is used. Otherwise, when the resulting object is used
in a posterior linking, LocalEntry info will be unavailable and functions may
be called through the wrong entrypoint.

Event Timeline

luporl created this revision.Jan 16 2019, 6:24 AM
luporl retitled this revision from [PPC64] Preserve LocalEntry when linking On PowerPC64, it is necessary to keep the LocalEntry bits in st_other, especially when -r is used. Otherwise, when the resulting object is used in a posterior linking, LocalEntry info will be unavailable... to [PPC64] Preserve LocalEntry when linking.Jan 16 2019, 6:27 AM
luporl edited the summary of this revision. (Show Details)
luporl added a reviewer: ruiu.
luporl added subscribers: Bdragon28, adalava, lbianc, leitao.
ruiu added a comment.Feb 11 2019, 4:31 PM

Sorry for the belated response. I missed this one for some reason.

Can you add a test?

ELF/SyntheticSections.cpp
2003

I think you need to define a new function that is so trivial. I'd hardcode & 0xe0 with an explanation what that is.

Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2019, 4:31 PM
MaskRay added inline comments.
ELF/Target.h
182

Perhaps add a comment referencing Arch/PPC64.cpp getPPC64GlobalEntryToLocalEntryOffset

The 3 most significant bits of st_other are used by OpenPOWER ABI.

MaskRay added inline comments.Feb 11 2019, 5:47 PM
ELF/Target.h
182

Sorry, the comment should be near line 2003 :)

luporl updated this revision to Diff 186838.Feb 14 2019, 6:51 AM
  • Addressed review's comments
  • Added a test for the fix
luporl marked an inline comment as done.Feb 14 2019, 6:53 AM

Sorry for the belated response. I missed this one for some reason.

Can you add a test?

Yes, I've added the ppc64-local-entry.s test.

ruiu accepted this revision.Feb 14 2019, 8:53 AM

LGTM

This revision is now accepted and ready to land.Feb 14 2019, 8:53 AM

Thank you @ruiu. Can you commit this change for me?

This revision was automatically updated to reflect the committed changes.