diff options
author | Teresa Johnson <tejohnson@google.com> | 2017-05-23 00:08:00 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2017-05-23 00:08:00 +0000 |
commit | 2db1369c1f007559a350356cf49a143afc6f3c5c (patch) | |
tree | f0ee91092bd6dd0fb0426dd05fc682b2be8879d1 /llvm/lib/IR/Module.cpp | |
parent | 0c7d4d7e2142d83a0dc939dba6939a6bff0715b9 (diff) | |
download | bcm5719-llvm-2db1369c1f007559a350356cf49a143afc6f3c5c.tar.gz bcm5719-llvm-2db1369c1f007559a350356cf49a143afc6f3c5c.zip |
Support for taking the max of module flags when linking, use for PIE/PIC
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.
Reviewers: tmsriram, pcc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33418
llvm-svn: 303590
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r-- | llvm/lib/IR/Module.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index 12c258d95f5..95673e515a5 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -481,7 +481,7 @@ PICLevel::Level Module::getPICLevel() const { } void Module::setPICLevel(PICLevel::Level PL) { - addModuleFlag(ModFlagBehavior::Error, "PIC Level", PL); + addModuleFlag(ModFlagBehavior::Max, "PIC Level", PL); } PIELevel::Level Module::getPIELevel() const { @@ -495,7 +495,7 @@ PIELevel::Level Module::getPIELevel() const { } void Module::setPIELevel(PIELevel::Level PL) { - addModuleFlag(ModFlagBehavior::Error, "PIE Level", PL); + addModuleFlag(ModFlagBehavior::Max, "PIE Level", PL); } void Module::setProfileSummary(Metadata *M) { |