From 404df5bbd56fc05c3ba477243b27e87642c1d5e7 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 25 Dec 2014 18:22:22 +0000 Subject: Pull in r214284 from upstream llvm trunk (by Hal Finkel): [PowerPC] Add JMP_SLOT relocation definitions This will be required by upcoming patches for LLDB support. Patch by Justin Hibbits! Pull in r221510 from upstream llvm trunk (by Justin Hibbits): Add Position-independent Code model Module API. Summary: This makes PIC levels a Module flag attribute, which can be queried by the backend. The flag is named `PIC Level`, and can have a value of: 0 - Backend-default 1 - Small-model (-fpic) 2 - Large-model (-fPIC) These match the `-pic-level' command line argument for clang, and the value of the preprocessor macro `__PIC__'. Test Plan: New flags tests specific for the 'PIC Level' module flag. Tests to be added as part of a future commit for PowerPC, which will use this new API. Reviewers: rafael, echristo Reviewed By: rafael, echristo Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D5882 Pull in r221791 from upstream llvm trunk (by Justin Hibbits): Add support for small-model PIC for PowerPC. Summary: Large-model was added first. With the addition of support for multiple PIC models in LLVM, now add small-model PIC for 32-bit PowerPC, SysV4 ABI. This generates more optimal code, for shared libraries with less than about 16380 data objects. Test Plan: Test cases added or updated Reviewers: joerg, hfinkel Reviewed By: hfinkel Subscribers: jholewinski, mcrosier, emaste, llvm-commits Differential Revision: http://reviews.llvm.org/D5399 Together, these changes implement small-model PIC support for PowerPC. Thanks to Justin Hibbits and Roman Divacky for their assistance in getting this working. --- contrib/llvm/lib/IR/Module.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'contrib/llvm/lib/IR/Module.cpp') diff --git a/contrib/llvm/lib/IR/Module.cpp b/contrib/llvm/lib/IR/Module.cpp index f1b1f9a2acc8..58584bd19a1f 100644 --- a/contrib/llvm/lib/IR/Module.cpp +++ b/contrib/llvm/lib/IR/Module.cpp @@ -461,3 +461,16 @@ Comdat *Module::getOrInsertComdat(StringRef Name) { Entry.second.Name = &Entry; return &Entry.second; } + +PICLevel::Level Module::getPICLevel() const { + Value *Val = getModuleFlag("PIC Level"); + + if (Val == NULL) + return PICLevel::Default; + + return static_cast(cast(Val)->getZExtValue()); +} + +void Module::setPICLevel(PICLevel::Level PL) { + addModuleFlag(ModFlagBehavior::Error, "PIC Level", PL); +} -- cgit v1.2.3