summaryrefslogtreecommitdiff
path: root/include/llvm/Target/TargetOptions.h
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-04-08 17:51:45 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-04-08 17:51:45 +0000
commit253933ee9ef2c413ecd782efeacc5d7b9bcda09a (patch)
tree4dd402f01a78ae40c9d6569bc5fba37f5af64501 /include/llvm/Target/TargetOptions.h
parent34797136cb9fa9f450c0e1c47983482083979dd4 (diff)
downloadllvm-253933ee9ef2c413ecd782efeacc5d7b9bcda09a.tar.gz
llvm-253933ee9ef2c413ecd782efeacc5d7b9bcda09a.tar.bz2
llvm-253933ee9ef2c413ecd782efeacc5d7b9bcda09a.tar.xz
Teach LLVM about a PIE option which, when enabled on top of PIC, makes
optimizations which are valid for position independent code being linked into a single executable, but not for such code being linked into a shared library. I discussed the design of this with Eric Christopher, and the decision was to support an optional bit rather than a completely separate relocation model. Fundamentally, this is still PIC relocation, its just that certain optimizations are only valid under a PIC relocation model when the resulting code won't be in a shared library. The simplest path to here is to expose a single bit option in the TargetOptions. If folks have different/better designs, I'm all ears. =] I've included the first optimization based upon this: changing TLS models to the *Exec models when PIE is enabled. This is the LLVM component of PR12380 and is all of the hard work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetOptions.h')
-rw-r--r--include/llvm/Target/TargetOptions.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/llvm/Target/TargetOptions.h b/include/llvm/Target/TargetOptions.h
index 7730ab90e8..1c10059218 100644
--- a/include/llvm/Target/TargetOptions.h
+++ b/include/llvm/Target/TargetOptions.h
@@ -42,8 +42,8 @@ namespace llvm {
GuaranteedTailCallOpt(false), DisableTailCalls(false),
StackAlignmentOverride(0), RealignStack(true),
DisableJumpTables(false), EnableFastISel(false),
- EnableSegmentedStacks(false), TrapFuncName(""),
- FloatABIType(FloatABI::Default)
+ PositionIndependentExecutable(false), EnableSegmentedStacks(false),
+ TrapFuncName(""), FloatABIType(FloatABI::Default)
{}
/// PrintMachineCode - This flag is enabled when the -print-machineinstrs
@@ -164,6 +164,12 @@ namespace llvm {
/// compile time.
unsigned EnableFastISel : 1;
+ /// PositionIndependentExecutable - This flag indicates whether the code
+ /// will eventually be linked into a single executable, despite the PIC
+ /// relocation model being in use. It's value is undefined (and irrelevant)
+ /// if the relocation model is anything other than PIC.
+ unsigned PositionIndependentExecutable : 1;
+
unsigned EnableSegmentedStacks : 1;
/// getTrapFunctionName - If this returns a non-empty string, this means