diff options
author | Rui Ueyama <ruiu@google.com> | 2017-02-25 02:43:01 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-02-25 02:43:01 +0000 |
commit | 28eada105f5ee1414cf20f6fde5e4a609bb3f407 (patch) | |
tree | 77aa7283995364df2a62112eec2e1bf23ffbc407 | |
parent | c416e99d423ac8c96254985ef8f154d74240235c (diff) | |
download | bcm5719-llvm-28eada105f5ee1414cf20f6fde5e4a609bb3f407.tar.gz bcm5719-llvm-28eada105f5ee1414cf20f6fde5e4a609bb3f407.zip |
Factor out more code. NFC.
llvm-svn: 296232
-rw-r--r-- | lld/ELF/Driver.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 740c35cf1fe..821d14a13d0 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -354,17 +354,15 @@ static bool getArg(opt::InputArgList &Args, unsigned K1, unsigned K2, return Default; } -static std::vector<StringRef> getSearchPaths(opt::InputArgList &Args) { +static std::vector<StringRef> getArgs(opt::InputArgList &Args, int Id) { std::vector<StringRef> V; - for (auto *Arg : Args.filtered(OPT_L)) + for (auto *Arg : Args.filtered(Id)) V.push_back(Arg->getValue()); return V; } static std::string getRPath(opt::InputArgList &Args) { - std::vector<StringRef> V; - for (auto *Arg : Args.filtered(OPT_rpath)) - V.push_back(Arg->getValue()); + std::vector<StringRef> V = getArgs(Args, OPT_rpath); return llvm::join(V.begin(), V.end(), ":"); } @@ -533,6 +531,7 @@ static std::vector<StringRef> getLines(MemoryBufferRef MB) { // Initializes Config members by the command line options. void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->AllowMultipleDefinition = Args.hasArg(OPT_allow_multiple_definition); + Config->AuxiliaryList = getArgs(Args, OPT_auxiliary); Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic); Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions); Config->DefineCommon = getArg(Args, OPT_define_common, OPT_no_define_common, @@ -573,7 +572,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->RPath = getRPath(Args); Config->Relocatable = Args.hasArg(OPT_relocatable); Config->SaveTemps = Args.hasArg(OPT_save_temps); - Config->SearchPaths = getSearchPaths(Args); + Config->SearchPaths = getArgs(Args, OPT_L); Config->SectionStartMap = getSectionStartMap(Args); Config->Shared = Args.hasArg(OPT_shared); Config->SingleRoRx = Args.hasArg(OPT_no_rosegment); @@ -586,6 +585,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->ThinLTOJobs = getInteger(Args, OPT_thinlto_jobs, -1u); Config->Threads = getArg(Args, OPT_threads, OPT_no_threads, true); Config->Trace = Args.hasArg(OPT_trace); + Config->Undefined = getArgs(Args, OPT_undefined); Config->UnresolvedSymbols = getUnresolvedSymbolPolicy(Args); Config->Verbose = Args.hasArg(OPT_verbose); Config->WarnCommon = Args.hasArg(OPT_warn_common); @@ -648,14 +648,9 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { } } - for (auto *Arg : Args.filtered(OPT_auxiliary)) - Config->AuxiliaryList.push_back(Arg->getValue()); if (!Config->Shared && !Config->AuxiliaryList.empty()) error("-f may not be used without -shared"); - for (auto *Arg : Args.filtered(OPT_undefined)) - Config->Undefined.push_back(Arg->getValue()); - for (auto *Arg : Args.filtered(OPT_dynamic_list)) if (Optional<MemoryBufferRef> Buffer = readFile(Arg->getValue())) readDynamicList(*Buffer); |