From afe723d42559e23adf7c7e6300847cd6fec9ca01 Mon Sep 17 00:00:00 2001 From: Hemant Kulkarni Date: Thu, 25 Feb 2016 18:56:01 +0000 Subject: [PATCH] Fix endianness issue on BE machines introduced by r261907 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261918 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-readobj/StreamWriter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/llvm-readobj/StreamWriter.cpp b/tools/llvm-readobj/StreamWriter.cpp index 555ac7b9ecc..0b0be59724a 100644 --- a/tools/llvm-readobj/StreamWriter.cpp +++ b/tools/llvm-readobj/StreamWriter.cpp @@ -27,9 +27,10 @@ const std::string to_string(uint64_t Value) { } const std::string to_hexString(const format_object_base &obj) { - char number[20] = {'0'}; - obj.print(number, 20); - return std::string(number); + std::string number; + llvm::raw_string_ostream stream(number); + stream << obj; + return stream.str(); } void StreamWriter::printBinaryImpl(StringRef Label, StringRef Str,