This is an archive of the discontinued LLVM Phabricator instance.

[cfi] Build __cfi_check as Thumb when applicable.
ClosedPublic

Authored by eugenis on Aug 28 2017, 6:23 PM.

Details

Summary

Cross-DSO CFI needs all __cfi_check exports to use the same encoding
(ARM vs Thumb).

Event Timeline

eugenis created this revision.Aug 28 2017, 6:23 PM
pcc accepted this revision.Aug 28 2017, 7:11 PM

LGTM

llvm/test/Transforms/CrossDSOCFI/thumb.ll
3

Maybe add a negative test?

This revision is now accepted and ready to land.Aug 28 2017, 7:11 PM
eugenis updated this revision to Diff 113145.Aug 29 2017, 1:19 PM

add a negative test

This revision was automatically updated to reflect the committed changes.

Not the way I'd have done this. What you probably need to do if adding a stub is propagate the features from the function you're cloning rather than constructing a new (and possibly incomplete) set of features from the target triple yourself.

There is nothing to propagate from: it's a new function, not a clone of any other.
I guess we could ask the frontend to emit a default set of target features?

Which isn't necessarily going to be valid either - particularly in the face of LTO.

What are you trying to accomplish here?

__cfi_check is a compiler-generated function (frontend inserts a stub, then LTO fills in the body). I want it to be built as Thumb, and never as ARM.

Have the front end generate all of the correct target features for your stub then rather than adding them in the backend?

Sounds good, I'll do that.