This is an archive of the discontinued LLVM Phabricator instance.

LTO: Export functions referenced by the CFI jump table.
ClosedPublic

Authored by pcc on Jul 18 2017, 7:40 PM.

Details

Summary

If the LowerTypeTests pass decides to add a function to a jump
table for CFI, it will add its name to the set cfiFunctionDefs,
which among other things will cause the function to be renamed in
the ThinLTO backend.

One other thing that we must do with such functions is to not
internalize them, because the jump table in the full LTO object will
contain a reference to the actual function body in the ThinLTO object.

This patch handles that by ensuring that we export any functions
whose names appear in the cfiFunctionDefs set.

Fixes PR33831.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Jul 18 2017, 7:40 PM
tejohnson accepted this revision.Jul 19 2017, 9:14 AM

LGTM

llvm/lib/LTO/LTO.cpp
1079 ↗(On Diff #107238)

Not for this patch, but as an aside - can dropLLVMMangingEscape be called unconditionally from within GlobalValue::getGUID, instead of callers needing to know when it must be invoked? I see that GlobalValue::getGlobalIdentifier also unconditionally does this (although not via dropLLVMMangingEscape - it should probably be refactored to just invoke that helper).

llvm/test/LTO/Resolution/X86/export-jumptable.ll
1 ↗(On Diff #107238)

Please document what this test is doing and looking for.

This revision is now accepted and ready to land.Jul 19 2017, 9:14 AM
pcc marked an inline comment as done.Jul 19 2017, 11:19 AM
pcc added inline comments.
llvm/lib/LTO/LTO.cpp
1079 ↗(On Diff #107238)

Maybe once we figure out what to do about GUIDs in general... as you know I'm not sure if we should be using them outside of PGO.

This revision was automatically updated to reflect the committed changes.