Page MenuHomePhabricator

Support for taking the max of module flags when linking, use for PIE/PIC
ClosedPublic

Authored by tejohnson on May 22 2017, 1:15 PM.

Details

Summary

Add Max ModFlagBehavior, which can be used to take the max of two
module flag values when merging modules. Use it for the PIE and PIC
levels.

This avoids an error when we try to import from a module built -fpic
into a module built -fPIC, for example. For both PIE and PIC levels,
this will be legal, since the code generation gets more conservative
as the level is increased. Therefore we can take the max instead of
somehow trying to block importing between modules compiled with
different levels.

Diff Detail

Repository
rL LLVM

Event Timeline

tejohnson created this revision.May 22 2017, 1:15 PM
pcc added inline comments.May 22 2017, 1:48 PM
lib/IR/Verifier.cpp
1287 ↗(On Diff #99797)

Please add test coverage for this verifier check.

tejohnson updated this revision to Diff 99809.May 22 2017, 1:57 PM

Added test of new verifier error message

tejohnson marked an inline comment as done.May 22 2017, 1:57 PM
pcc accepted this revision.May 22 2017, 4:00 PM

LGTM

This revision is now accepted and ready to land.May 22 2017, 4:00 PM
This revision was automatically updated to reflect the committed changes.