This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Secure PLT support
ClosedPublic

Authored by spetrovic on Jan 16 2018, 10:00 AM.

Details

Summary

This patch supports secure PLT mode for PowerPC 32 architecture. I'm planning to add patch that supports -msecure-plt option in clang also.

Diff Detail

Repository
rL LLVM

Event Timeline

spetrovic created this revision.Jan 16 2018, 10:00 AM
spetrovic updated this revision to Diff 131817.Jan 29 2018, 9:51 AM
spetrovic added a reviewer: jhibbits.
spetrovic updated this revision to Diff 136531.EditedMar 1 2018, 8:24 AM

Updated patch so it covers cases where we have just function call, without global variables as arguments or global variables used within function.

jhibbits added inline comments.Mar 1 2018, 10:02 AM
test/CodeGen/PowerPC/secure-plt.ll
38

Instead of providing this as NO-SECURE-PLT-NOT, such that you're saying it's *not* generating secure PLT, can you instead check for BSS-PLT, and use the BSS PLT asm? You could put this in the already existing ppc32-pic.ll and ppc32-pic-large.ll

spetrovic updated this revision to Diff 136765.Mar 2 2018, 9:10 AM
spetrovic marked an inline comment as done.

Can we get this patch in?

jhibbits added inline comments.Mar 12 2018, 7:51 AM
test/CodeGen/PowerPC/ppc32-pic-large.ll
14 ↗(On Diff #136765)

I meant instead of copying the same code into these two files and getting the same result as I already put in here, have two RUN lines in the ppc32-pic-large.ll/ppc32-pic.ll -- the existing RUN line, and an additional line to test secure-plt.

Then we'd have lines of LARGE-BSS and LARGE-BSS-SECUREPLT, or such.

The change you made here is effectively just duplicating the test I already wrote.

spetrovic added inline comments.Mar 12 2018, 10:08 AM
test/CodeGen/PowerPC/ppc32-pic-large.ll
14 ↗(On Diff #136765)

Since this solution doesn't support small pic mode, is it OK just to add secure plt checks in ppc32-pic-large.ll ?

jhibbits added inline comments.Mar 12 2018, 11:05 AM
test/CodeGen/PowerPC/ppc32-pic-large.ll
14 ↗(On Diff #136765)

That's fine with me.

spetrovic updated this revision to Diff 138166.Mar 13 2018, 6:09 AM
spetrovic marked an inline comment as done.

Is this patch OK to commit now ?

jhibbits accepted this revision.Mar 23 2018, 12:19 PM

Looks fine to me.

This revision is now accepted and ready to land.Mar 23 2018, 12:19 PM
joerg added a subscriber: joerg.Mar 23 2018, 12:54 PM

It should be kept in mind that secure PLT is desirable for certain cases with non-position independent code as well. Even in static binaries it can be desirable... But that is for a follow-up patch.

This revision was automatically updated to reflect the committed changes.