Skip to content

Commit

Permalink
Use endian::write32le instead of endian::write.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295120 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rui314 committed Feb 14, 2017
1 parent 3afdebf commit d5265b3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/MC/WinCOFFObjectWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <vector>

using namespace llvm;
using llvm::support::endian::write32le;

#define DEBUG_TYPE "WinCOFFObjectWriter"

Expand Down Expand Up @@ -204,20 +205,15 @@ class WinCOFFObjectWriter : public MCObjectWriter {

} // end anonymous namespace

static inline void write_uint32_le(void *Data, uint32_t Value) {
support::endian::write<uint32_t, support::little, support::unaligned>(Data,
Value);
}

//------------------------------------------------------------------------------
// Symbol class implementation

// In the case that the name does not fit within 8 bytes, the offset
// into the string table is stored in the last 4 bytes instead, leaving
// the first 4 bytes as 0.
void COFFSymbol::set_name_offset(uint32_t Offset) {
write_uint32_le(Data.Name + 0, 0);
write_uint32_le(Data.Name + 4, Offset);
write32le(Data.Name + 0, 0);
write32le(Data.Name + 4, Offset);
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit d5265b3

Please sign in to comment.