summaryrefslogtreecommitdiffstats
path: root/llvm/tools/gold/gold-plugin.cpp
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-05-22 21:11:35 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-05-22 21:11:35 +0000
commitb9f1b014e1aa47550e1e4bb0c0bf143fc01f6c20 (patch)
treebc118e09d2e6bd4199ceff8ed989cca30221d42c /llvm/tools/gold/gold-plugin.cpp
parentd4136e945ed7d057b4bb376eb6f5299c76d31614 (diff)
downloadbcm5719-llvm-b9f1b014e1aa47550e1e4bb0c0bf143fc01f6c20.tar.gz
bcm5719-llvm-b9f1b014e1aa47550e1e4bb0c0bf143fc01f6c20.zip
Infer relocation model from module flags in relocatable LTO link.
Fix for PR33096. llvm-svn: 303578
Diffstat (limited to 'llvm/tools/gold/gold-plugin.cpp')
-rw-r--r--llvm/tools/gold/gold-plugin.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 9b783d19a28..cf207d9dbbb 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -102,7 +102,7 @@ static ld_plugin_add_input_file add_input_file = nullptr;
static ld_plugin_set_extra_library_path set_extra_library_path = nullptr;
static ld_plugin_get_view get_view = nullptr;
static bool IsExecutable = false;
-static Optional<Reloc::Model> RelocationModel;
+static Optional<Reloc::Model> RelocationModel = None;
static std::string output_name = "";
static std::list<claimed_file> Modules;
static DenseMap<int, void *> FDToLeaderHandle;
@@ -282,6 +282,8 @@ ld_plugin_status onload(ld_plugin_tv *tv) {
case LDPT_LINKER_OUTPUT:
switch (tv->tv_u.tv_val) {
case LDPO_REL: // .o
+ IsExecutable = false;
+ break;
case LDPO_DYN: // .so
IsExecutable = false;
RelocationModel = Reloc::PIC_;
@@ -726,7 +728,7 @@ static std::unique_ptr<LTO> createLTO() {
Conf.Options.RelaxELFRelocations = false;
Conf.MAttrs = MAttrs;
- Conf.RelocModel = *RelocationModel;
+ Conf.RelocModel = RelocationModel;
Conf.CGOptLevel = getCGOptLevel();
Conf.DisableVerify = options::DisableVerify;
Conf.OptLevel = options::OptLevel;
OpenPOWER on IntegriCloud