]> granicus.if.org Git - llvm/commit
Support for taking the max of module flags when linking, use for PIE/PIC
authorTeresa Johnson <tejohnson@google.com>
Tue, 23 May 2017 00:08:00 +0000 (00:08 +0000)
committerTeresa Johnson <tejohnson@google.com>
Tue, 23 May 2017 00:08:00 +0000 (00:08 +0000)
commit1fd5bb9c53a36f22f7e97cdd6dbb891a53a20729
tree9b5e09c24f62fa965529e967f5580137d12babac
parent6135595faadff2bd15e63f687bddc7f7dd56cc4b
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303590 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Module.h
lib/IR/Module.cpp
lib/IR/Verifier.cpp
lib/Linker/IRMover.cpp
test/Linker/Inputs/module-flags-pic-2-b.ll
test/Linker/module-flags-pic-2-a.ll
test/Verifier/module-flags-1.ll