[ELF] Simplify compCtors and writeInt.

Reviewers: ruiu

Subscribers: emaste, arichardson, llvm-commits

Differential Revision: https://reviews.llvm.org/D44690

llvm-svn: 328009
This commit is contained in:
Fangrui Song 2018-03-20 18:07:25 +00:00
parent 29149d5cb7
commit 0e30731a6a
1 changed files with 3 additions and 6 deletions

View File

@ -25,7 +25,6 @@
using namespace llvm;
using namespace llvm::dwarf;
using namespace llvm::object;
using namespace llvm::support::endian;
using namespace llvm::ELF;
using namespace lld;
@ -213,11 +212,11 @@ static void writeInt(uint8_t *Buf, uint64_t Data, uint64_t Size) {
if (Size == 1)
*Buf = Data;
else if (Size == 2)
write16(Buf, Data, Config->Endianness);
write16(Buf, Data);
else if (Size == 4)
write32(Buf, Data, Config->Endianness);
write32(Buf, Data);
else if (Size == 8)
write64(Buf, Data, Config->Endianness);
write64(Buf, Data);
else
llvm_unreachable("unsupported Size argument");
}
@ -366,8 +365,6 @@ static bool compCtors(const InputSection *A, const InputSection *B) {
assert(Y.startswith(".ctors") || Y.startswith(".dtors"));
X = X.substr(6);
Y = Y.substr(6);
if (X.empty() && Y.empty())
return false;
return X < Y;
}