summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-10-27 19:29:27 +0000
committerRui Ueyama <ruiu@google.com>2015-10-27 19:29:27 +0000
commit305a7d3f449f003acf4e76ca36c64008841b7a62 (patch)
tree21fdc9c418a49c2b6e44e0761c99987b781d6a6d
parent339428232a9247937028d2fc6e1bda0929fc51e6 (diff)
downloadbcm5719-llvm-305a7d3f449f003acf4e76ca36c64008841b7a62.tar.gz
bcm5719-llvm-305a7d3f449f003acf4e76ca36c64008841b7a62.zip
ELF2: Make parseEmulation side-effect free. NFC.
llvm-svn: 251440
-rw-r--r--lld/ELF/Driver.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 5a428801a38..96ebabeaba0 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -38,7 +38,6 @@ void lld::elf2::link(ArrayRef<const char *> Args) {
}
static std::pair<ELFKind, uint16_t> parseEmulation(StringRef S) {
- Config->Emulation = S;
if (S == "elf32btsmip")
return {ELF32BEKind, EM_MIPS};
if (S == "elf32ltsmip")
@@ -130,9 +129,11 @@ void LinkerDriver::createFiles(opt::InputArgList &Args) {
Config->RPath = llvm::join(RPaths.begin(), RPaths.end(), ":");
if (auto *Arg = Args.getLastArg(OPT_m)) {
- std::pair<ELFKind, uint16_t> P = parseEmulation(Arg->getValue());
+ StringRef S = Arg->getValue();
+ std::pair<ELFKind, uint16_t> P = parseEmulation(S);
Config->EKind = P.first;
Config->EMachine = P.second;
+ Config->Emulation = S;
}
Config->AllowMultipleDefinition = Args.hasArg(OPT_allow_multiple_definition);
OpenPOWER on IntegriCloud