From 94b08e3bf0ee2aa8cb0dc42c2850ce2520500516 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 12 Jan 2016 01:33:23 +0000 Subject: [PATCH] Simplify. NFC. llvm-svn: 257432 --- lld/ELF/Driver.cpp | 5 ++--- lld/ELF/Writer.cpp | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 357d9db559e5..0b13ef136d92 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -177,10 +177,9 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->RPath = llvm::join(RPaths.begin(), RPaths.end(), ":"); if (auto *Arg = Args.getLastArg(OPT_m)) { + // Parse ELF{32,64}{LE,BE} and CPU type. StringRef S = Arg->getValue(); - std::pair P = parseEmulation(S); - Config->EKind = P.first; - Config->EMachine = P.second; + std::tie(Config->EKind, Config->EMachine) = parseEmulation(S); Config->Emulation = S; } diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index c4bfdaf65422..b8a2f4f80079 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -98,10 +98,7 @@ private: }; } // anonymous namespace -template static bool shouldUseRela() { - ELFKind K = cast>(Config->FirstElf)->getELFKind(); - return K == ELF64LEKind || K == ELF64BEKind; -} +template static bool shouldUseRela() { return ELFT::Is64Bits; } template void elf2::writeResult(SymbolTable *Symtab) { // Initialize output sections that are handled by Writer specially.