[lld] r218103 - ReaderWriter: print magic in hex

Saleem Abdulrasool compnerd at compnerd.org
Thu Sep 18 23:09:19 PDT 2014


Author: compnerd
Date: Fri Sep 19 01:09:18 2014
New Revision: 218103

URL: http://llvm.org/viewvc/llvm-project?rev=218103&view=rev
Log:
ReaderWriter: print magic in hex

When we encounter an unknown machine type, we print out the machine type magic.
However, we would print out the magic in decimal rather than hex.  Perform this
conversion to make it easier to identify what machine is unsupported.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=218103&r1=218102&r2=218103&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Fri Sep 19 01:09:18 2014
@@ -14,6 +14,7 @@
 #include "lld/ReaderWriter/PECOFFLinkingContext.h"
 #include "lld/ReaderWriter/Reader.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
@@ -825,7 +826,8 @@ std::error_code FileCOFF::getReferenceAr
     result = Reference::KindArch::all;
     return std::error_code();
   }
-  llvm::errs() << "Unsupported machine type: " << _obj->getMachine() << '\n';
+  llvm::errs() << "Unsupported machine type: 0x"
+               << llvm::utohexstr(_obj->getMachine()) << '\n';
   return llvm::object::object_error::parse_failed;
 }
 





More information about the llvm-commits mailing list