[lld] r299590 - Inline a small function. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 14:08:47 PDT 2017


Author: ruiu
Date: Wed Apr  5 16:08:47 2017
New Revision: 299590

URL: http://llvm.org/viewvc/llvm-project?rev=299590&view=rev
Log:
Inline a small function. NFC.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=299590&r1=299589&r2=299590&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Apr  5 16:08:47 2017
@@ -1628,12 +1628,6 @@ template <class ELFT> typename ELFT::uin
   return 0;
 }
 
-template <class ELFT> static uint8_t getELFEncoding() {
-  if (ELFT::TargetEndianness == llvm::support::little)
-    return ELFDATA2LSB;
-  return ELFDATA2MSB;
-}
-
 static uint16_t getELFType() {
   if (Config->Pic)
     return ET_DYN;
@@ -1705,8 +1699,8 @@ template <class ELFT> void Writer<ELFT>:
 
   // Write the ELF header.
   auto *EHdr = reinterpret_cast<Elf_Ehdr *>(Buf);
-  EHdr->e_ident[EI_CLASS] = ELFT::Is64Bits ? ELFCLASS64 : ELFCLASS32;
-  EHdr->e_ident[EI_DATA] = getELFEncoding<ELFT>();
+  EHdr->e_ident[EI_CLASS] = Config->Is64 ? ELFCLASS64 : ELFCLASS32;
+  EHdr->e_ident[EI_DATA] = Config->IsLE ? ELFDATA2LSB : ELFDATA2MSB;
   EHdr->e_ident[EI_VERSION] = EV_CURRENT;
   EHdr->e_ident[EI_OSABI] = Config->OSABI;
   EHdr->e_type = getELFType();




More information about the llvm-commits mailing list