diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-05-22 21:11:35 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-05-22 21:11:35 +0000 |
commit | 49f70ccea4b9adb7f25bc16d2c4d17271102b2ce (patch) | |
tree | 1c90d3b84e3fe1a863e4cdabad2082f6897eaff0 /tools/gold | |
parent | 0897ebf6585ccfe3f76da7b6611af685f0bafc0e (diff) |
Infer relocation model from module flags in relocatable LTO link.
Fix for PR33096.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303578 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold')
-rw-r--r-- | tools/gold/gold-plugin.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 9b783d19a283..cf207d9dbbb3 100644 --- a/tools/gold/gold-plugin.cpp +++ b/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; |