<div dir="ltr">Note that ASan bootstrap bot also reported a leak in a newly added test:<div><br></div><div><pre style="font-family:'Courier New',courier,monotype,monospace;color:rgb(0,0,0);font-size:medium"><span class="">Direct leak of 4096 byte(s) in 1 object(s) allocated from:
    #0 0x53c0f0 in operator new[](unsigned long) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:64
    #1 0x60e66b in SetBufferSize /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/raw_ostream.h:105:22
    #2 0x60e66b in llvm::formatted_raw_ostream::setStream(llvm::raw_ostream&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/FormattedStream.h:70
    #3 0x5dfe0e in formatted_raw_ostream /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/FormattedStream.h:91:5
    #4 0x5dfe0e in GNUStyle /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-readobj/ELFDumper.cpp:211
    #5 0x5dfe0e in ELFDumper /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-readobj/ELFDumper.cpp:1098
    #6 0x5dfe0e in createELFDumper<llvm::object::ELFType<llvm::support::endianness::little, false> > /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-readobj/ELFDumper.cpp:251
    #7 0x5dfe0e in llvm::createELFDumper(llvm::object::ObjectFile const*, llvm::StreamWriter&, std::__1::unique_ptr<llvm::ObjDumper, std::__1::default_delete<llvm::ObjDumper> >&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-readobj/ELFDumper.cpp:260
    #8 0x6cb286 in createDumper /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-readobj/llvm-readobj.cpp:299:12
    #9 0x6cb286 in dumpObject(llvm::object::ObjectFile const*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-readobj/llvm-readobj.cpp:310
    #10 0x6c6adc in dumpInput /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-readobj/llvm-readobj.cpp:443:5
    #11 0x6c6adc in for_each<std::__1::__wrap_iter<std::__1::basic_string<char> *>, void (*)(llvm::StringRef)> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/libcxx_build_asan/include/c++/v1/algorithm:853
    #12 0x6c6adc in main /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-readobj/llvm-readobj.cpp:464
    #13 0x7fbbe12f0ec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)</span></pre></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 10, 2016 at 10:25 AM, Teresa Johnson via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Unless it can be fixed very quickly that is the best option.<div><br></div><div>Thanks,</div><div>Teresa</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 10, 2016 at 10:23 AM, Hemant Kulkarni <span dir="ltr"><<a href="mailto:khemant@codeaurora.org" target="_blank">khemant@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I will revert the patch and fix it?<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">--<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Hemant Kulkarni<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><a href="mailto:khemant@codeaurora.org" target="_blank">khemant@codeaurora.org</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Teresa Johnson [mailto:<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>] <br><b>Sent:</b> Wednesday, February 10, 2016 12:19 PM<br><b>To:</b> Hemant Kulkarni<br><b>Cc:</b> llvm-commits<br><b>Subject:</b> Re: [llvm] r260391 - [llvm-readobj] Option to emit readelf like output<u></u><u></u></span></p><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">I am getting lots of compile failures in ELFDumper.cpp that appear to be due to this commit:<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><div><p class="MsoNormal">[29/42] Building CXX object tools/llvm...Files/llvm-readobj.dir/ELFDumper.cpp.o<u></u><u></u></p></div><div><p class="MsoNormal">FAILED: /usr/local/google/home/tejohnson/extra/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Werror -std=c++11 -fcolor-diagnostics -g -Itools/llvm-readobj -I/usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj -Iinclude -I/usr/local/google/home/tejohnson/llvm/llvm_10/include     -fno-exceptions -fno-rtti -MMD -MT tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o -MF "tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o.d" -o tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o -c /usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj/ELFDumper.cpp<u></u><u></u></p></div><div><p class="MsoNormal">/usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj/ELFDumper.cpp:49:29: error: '(anonymous namespace)::DumpStyle<llvm::object::ELFType<llvm::support::endianness::little, false> >' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor]<u></u><u></u></p></div><div><p class="MsoNormal">template <class ELFT> class DumpStyle;<u></u><u></u></p></div><div><p class="MsoNormal">                            ^<u></u><u></u></p></div><div><p class="MsoNormal">/usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj/ELFDumper.cpp:206:50: note: in instantiation of template class '(anonymous namespace)::DumpStyle<llvm::object::ELFType<llvm::support::endianness::little, false> >' requested here<u></u><u></u></p></div><div><p class="MsoNormal">template <typename ELFT> class GNUStyle : public DumpStyle<ELFT> {<u></u><u></u></p></div><div><p class="MsoNormal">                                                 ^<u></u><u></u></p></div><div><p class="MsoNormal">/usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj/ELFDumper.cpp:1098:30: note: in instantiation of template class '(anonymous namespace)::GNUStyle<llvm::object::ELFType<llvm::support::endianness::little, false> >' requested here<u></u><u></u></p></div><div><p class="MsoNormal">    ELFDumperStyle.reset(new GNUStyle<ELFT>(Writer));<u></u><u></u></p></div><div><p class="MsoNormal">                             ^<u></u><u></u></p></div><div><p class="MsoNormal">/usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj/ELFDumper.cpp:251:20: note: in instantiation of member function '(anonymous namespace)::ELFDumper<llvm::object::ELFType<llvm::support::endianness::little, false> >::ELFDumper' requested here<u></u><u></u></p></div><div><p class="MsoNormal">  Result.reset(new ELFDumper<ELFT>(Obj, Writer));<u></u><u></u></p></div><div><p class="MsoNormal">                   ^<u></u><u></u></p></div><div><p class="MsoNormal">/usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj/ELFDumper.cpp:260:12: note: in instantiation of function template specialization 'llvm::createELFDumper<llvm::object::ELFType<llvm::support::endianness::little, false> >' requested here<u></u><u></u></p></div><div><p class="MsoNormal">    return createELFDumper(ELFObj->getELFFile(), Writer, Result);<u></u><u></u></p></div><div><p class="MsoNormal">           ^<u></u><u></u></p></div><div><p class="MsoNormal">/usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj/ELFDumper.cpp:206:32: error: '(anonymous namespace)::GNUStyle<llvm::object::ELFType<llvm::support::endianness::little, false> >' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor]<u></u><u></u></p></div><div><p class="MsoNormal">template <typename ELFT> class GNUStyle : public DumpStyle<ELFT> {<u></u><u></u></p></div><div><p class="MsoNormal">                               ^<u></u><u></u></p></div><div><p class="MsoNormal">/usr/local/google/home/tejohnson/llvm/llvm_10/tools/llvm-readobj/ELFDumper.cpp:1098:30: note: in instantiation of template class '(anonymous namespace)::GNUStyle<llvm::object::ELFType<llvm::support::endianness::little, false> >' requested here<u></u><u></u></p></div><div><p class="MsoNormal">    ELFDumperStyle.reset(new GNUStyle<ELFT>(Writer));<u></u><u></u></p></div><div><p class="MsoNormal">                             ^<u></u><u></u></p></div><div><p class="MsoNormal">...<u></u><u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks,<u></u><u></u></p></div><div><p class="MsoNormal">Teresa<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Feb 10, 2016 at 9:51 AM, Hemant Kulkarni via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<u></u><u></u></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><p class="MsoNormal">Author: khemant<br>Date: Wed Feb 10 11:51:28 2016<br>New Revision: 260391<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=260391&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=260391&view=rev</a><br>Log:<br>[llvm-readobj] Option to emit readelf like output<br><br>New option --elf-output-style=LLVM or GNU<br>Enables -file-headers in readelf style when elf-output-style=GNU<br><br>Differential revision: <a href="http://reviews.llvm.org/D14128" target="_blank">http://reviews.llvm.org/D14128</a><br><br>Added:<br>    llvm/trunk/test/tools/llvm-readobj/gnu-file-headers.test<br>Modified:<br>    llvm/trunk/test/MC/Hexagon/basic.ll<br>    llvm/trunk/tools/llvm-readobj/ELFDumper.cpp<br>    llvm/trunk/tools/llvm-readobj/StreamWriter.cpp<br>    llvm/trunk/tools/llvm-readobj/StreamWriter.h<br>    llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp<br>    llvm/trunk/tools/llvm-readobj/llvm-readobj.h<br><br>Modified: llvm/trunk/test/MC/Hexagon/basic.ll<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Hexagon/basic.ll?rev=260391&r1=260390&r2=260391&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Hexagon/basic.ll?rev=260391&r1=260390&r2=260391&view=diff</a><br>==============================================================================<br>--- llvm/trunk/test/MC/Hexagon/basic.ll (original)<br>+++ llvm/trunk/test/MC/Hexagon/basic.ll Wed Feb 10 11:51:28 2016<br>@@ -4,4 +4,4 @@<br> ; OBJ: Format: ELF32-hexagon<br> ; OBJ: Arch: hexagon<br> ; OBJ: AddressSize: 32bit<br>-; OBJ: Machine: EM_HEXAGON<br>+; OBJ: Machine: EM_HEXAGON (0xA4)<br><br>Added: llvm/trunk/test/tools/llvm-readobj/gnu-file-headers.test<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/gnu-file-headers.test?rev=260391&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/gnu-file-headers.test?rev=260391&view=auto</a><br>==============================================================================<br>--- llvm/trunk/test/tools/llvm-readobj/gnu-file-headers.test (added)<br>+++ llvm/trunk/test/tools/llvm-readobj/gnu-file-headers.test Wed Feb 10 11:51:28 2016<br>@@ -0,0 +1,46 @@<br>+RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-i386 --elf-output-style=GNU \<br>+RUN:   | FileCheck %s -check-prefix ELF32<br>+RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-x86-64 --elf-output-style=GNU \<br>+RUN:   | FileCheck %s -check-prefix ELF64<br>+<br>+ELF32:      ELF Header:<br>+ELF32-NEXT:  Magic:   7f 45 4c 46 01 01 01 03 00 00 00 00 00 00 00 00<br>+ELF32-NEXT:  Class:                             ELF32<br>+ELF32-NEXT:  Data:                              2's complement, little endian<br>+ELF32-NEXT:  Version:                           1 (current)<br>+ELF32-NEXT:  OS/ABI:                            UNIX - GNU<br>+ELF32-NEXT:  ABI Version:                       0<br>+ELF32-NEXT:  Type:                              REL (Relocatable file)<br>+ELF32-NEXT:  Machine:                           Intel 80386<br>+ELF32-NEXT:  Version:                           0x1<br>+ELF32-NEXT:  Entry point address:               0x0<br>+ELF32-NEXT:  Start of program headers:          0 (bytes into file)<br>+ELF32-NEXT:  Start of section headers:          200 (bytes into file)<br>+ELF32-NEXT:  Flags:                             0x0<br>+ELF32-NEXT:  Size of this header:               52 (bytes)<br>+ELF32-NEXT:  Size of program headers:            0 (bytes)<br>+ELF32-NEXT:  Number of program headers:          0<br>+ELF32-NEXT:  Size of section headers:           40 (bytes)<br>+ELF32-NEXT:  Number of section headers:         10<br>+ELF32-NEXT:  Section header string table index: 7<br>+<br>+ELF64:     ELF Header:<br>+ELF64-NEXT:  Magic:   7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00<br>+ELF64-NEXT:  Class:                             ELF64<br>+ELF64-NEXT:  Data:                              2's complement, little endian<br>+ELF64-NEXT:  Version:                           1 (current)<br>+ELF64-NEXT:  OS/ABI:                            UNIX - GNU<br>+ELF64-NEXT:  ABI Version:                       0<br>+ELF64-NEXT:  Type:                              REL (Relocatable file)<br>+ELF64-NEXT:  Machine:                           Advanced Micro Devices X86-64<br>+ELF64-NEXT:  Version:                           0x1<br>+ELF64-NEXT:  Entry point address:               0x0<br>+ELF64-NEXT:  Start of program headers:          0 (bytes into file)<br>+ELF64-NEXT:  Start of section headers:          184 (bytes into file)<br>+ELF64-NEXT:  Flags:                             0x0<br>+ELF64-NEXT:  Size of this header:               64 (bytes)<br>+ELF64-NEXT:  Size of program headers:            0 (bytes)<br>+ELF64-NEXT:  Number of program headers:          0<br>+ELF64-NEXT:  Size of section headers:           64 (bytes)<br>+ELF64-NEXT:  Number of section headers:         10<br>+ELF64-NEXT:  Section header string table index: 7<br><br>Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=260391&r1=260390&r2=260391&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=260391&r1=260390&r2=260391&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)<br>+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Wed Feb 10 11:51:28 2016<br>@@ -29,6 +29,7 @@<br> #include "llvm/Support/MathExtras.h"<br> #include "llvm/Support/MipsABIFlags.h"<br> #include "llvm/Support/raw_ostream.h"<br>+#include "llvm/Support/FormattedStream.h"<br><br> using namespace llvm;<br> using namespace llvm::object;<br>@@ -37,8 +38,16 @@ using namespace ELF;<br> #define LLVM_READOBJ_ENUM_CASE(ns, enum) \<br>   case ns::enum: return #enum;<br><br>+#define ENUM_ENT(enum, altName) \<br>+  { #enum, altName, ELF::enum }<br>+<br>+#define ENUM_ENT_1(enum) \<br>+  { #enum, #enum, ELF::enum }<br>+<br> namespace {<br><br>+template <class ELFT> class DumpStyle;<br>+<br> template<typename ELFT><br> class ELFDumper : public ObjDumper {<br> public:<br>@@ -69,6 +78,7 @@ public:<br>   void printStackMap() const override;<br><br> private:<br>+  std::unique_ptr<DumpStyle<ELFT>> ELFDumperStyle;<br>   typedef ELFFile<ELFT> ELFO;<br>   typedef typename ELFO::Elf_Shdr Elf_Shdr;<br>   typedef typename ELFO::Elf_Sym Elf_Sym;<br>@@ -188,6 +198,40 @@ public:<br>   ArrayRef<Elf_Word> getShndxTable() { return ShndxTable; }<br> };<br><br>+template <typename ELFT> class DumpStyle {<br>+public:<br>+  virtual void printFileHeaders(const ELFFile<ELFT> *Obj) = 0;<br>+};<br>+<br>+template <typename ELFT> class GNUStyle : public DumpStyle<ELFT> {<br>+  formatted_raw_ostream OS;<br>+<br>+public:<br>+  typedef typename ELFFile<ELFT>::Elf_Ehdr Elf_Ehdr;<br>+  GNUStyle(StreamWriter &W) : OS(W.getOStream()) {}<br>+  void printFileHeaders(const ELFFile<ELFT> *Obj) override;<br>+<br>+private:<br>+  template <typename T, typename TEnum><br>+  std::string printEnum(T Value, ArrayRef<EnumEntry<TEnum>> EnumValues) {<br>+    for (const auto &EnumItem : EnumValues)<br>+      if (EnumItem.Value == Value)<br>+        return EnumItem.AltName;<br>+    return to_hexString(Value);<br>+  }<br>+};<br>+<br>+template <typename ELFT> class LLVMStyle : public DumpStyle<ELFT> {<br>+public:<br>+  typedef typename ELFFile<ELFT>::Elf_Ehdr Elf_Ehdr;<br>+  LLVMStyle(StreamWriter &W) : W(W) {}<br>+<br>+  void printFileHeaders(const ELFFile<ELFT> *Obj) override;<br>+<br>+private:<br>+  StreamWriter &W;<br>+};<br>+<br> template <class T> T errorOrDefault(ErrorOr<T> Val, T Default = T()) {<br>   if (!Val) {<br>     error(Val.getError());<br>@@ -516,226 +560,224 @@ static const typename ELFO::Elf_Shdr *fi<br> }<br><br> static const EnumEntry<unsigned> ElfClass[] = {<br>-  { "None",   ELF::ELFCLASSNONE },<br>-  { "32-bit", ELF::ELFCLASS32   },<br>-  { "64-bit", ELF::ELFCLASS64   },<br>+  {"None",   "none",   ELF::ELFCLASSNONE},<br>+  {"32-bit", "ELF32",  ELF::ELFCLASS32},<br>+  {"64-bit", "ELF64",  ELF::ELFCLASS64},<br> };<br><br> static const EnumEntry<unsigned> ElfDataEncoding[] = {<br>-  { "None",         ELF::ELFDATANONE },<br>-  { "LittleEndian", ELF::ELFDATA2LSB },<br>-  { "BigEndian",    ELF::ELFDATA2MSB },<br>+  {"None",         "none",                          ELF::ELFDATANONE},<br>+  {"LittleEndian", "2's complement, little endian", ELF::ELFDATA2LSB},<br>+  {"BigEndian",    "2's complement, big endian",    ELF::ELFDATA2MSB},<br> };<br><br> static const EnumEntry<unsigned> ElfObjectFileType[] = {<br>-  { "None",         ELF::ET_NONE },<br>-  { "Relocatable",  ELF::ET_REL  },<br>-  { "Executable",   ELF::ET_EXEC },<br>-  { "SharedObject", ELF::ET_DYN  },<br>-  { "Core",         ELF::ET_CORE },<br>+  {"None",         "NONE (none)",              ELF::ET_NONE},<br>+  {"Relocatable",  "REL (Relocatable file)",   ELF::ET_REL},<br>+  {"Executable",   "EXEC (Executable file)",   ELF::ET_EXEC},<br>+  {"SharedObject", "DYN (Shared object file)", ELF::ET_DYN},<br>+  {"Core",         "CORE (Core file)",         ELF::ET_CORE},<br> };<br><br> static const EnumEntry<unsigned> ElfOSABI[] = {<br>-  { "SystemV",      ELF::ELFOSABI_NONE         },<br>-  { "HPUX",         ELF::ELFOSABI_HPUX         },<br>-  { "NetBSD",       ELF::ELFOSABI_NETBSD       },<br>-  { "GNU/Linux",    ELF::ELFOSABI_LINUX        },<br>-  { "GNU/Hurd",     ELF::ELFOSABI_HURD         },<br>-  { "Solaris",      ELF::ELFOSABI_SOLARIS      },<br>-  { "AIX",          ELF::ELFOSABI_AIX          },<br>-  { "IRIX",         ELF::ELFOSABI_IRIX         },<br>-  { "FreeBSD",      ELF::ELFOSABI_FREEBSD      },<br>-  { "TRU64",        ELF::ELFOSABI_TRU64        },<br>-  { "Modesto",      ELF::ELFOSABI_MODESTO      },<br>-  { "OpenBSD",      ELF::ELFOSABI_OPENBSD      },<br>-  { "OpenVMS",      ELF::ELFOSABI_OPENVMS      },<br>-  { "NSK",          ELF::ELFOSABI_NSK          },<br>-  { "AROS",         ELF::ELFOSABI_AROS         },<br>-  { "FenixOS",      ELF::ELFOSABI_FENIXOS      },<br>-  { "CloudABI",     ELF::ELFOSABI_CLOUDABI     },<br>-  { "C6000_ELFABI", ELF::ELFOSABI_C6000_ELFABI },<br>-  { "C6000_LINUX" , ELF::ELFOSABI_C6000_LINUX  },<br>-  { "ARM",          ELF::ELFOSABI_ARM          },<br>-  { "Standalone"  , ELF::ELFOSABI_STANDALONE   }<br>+  {"SystemV",      "UNIX - System V",      ELF::ELFOSABI_NONE},<br>+  {"HPUX",         "UNIX - HP-UX",         ELF::ELFOSABI_HPUX},<br>+  {"NetBSD",       "UNIX - NetBSD",        ELF::ELFOSABI_NETBSD},<br>+  {"GNU/Linux",    "UNIX - GNU",           ELF::ELFOSABI_LINUX},<br>+  {"GNU/Hurd",     "GNU/Hurd",             ELF::ELFOSABI_HURD},<br>+  {"Solaris",      "UNIX - Solaris",       ELF::ELFOSABI_SOLARIS},<br>+  {"AIX",          "UNIX - AIX",           ELF::ELFOSABI_AIX},<br>+  {"IRIX",         "UNIX - IRIX",          ELF::ELFOSABI_IRIX},<br>+  {"FreeBSD",      "UNIX - FreeBSD",       ELF::ELFOSABI_FREEBSD},<br>+  {"TRU64",        "UNIX - TRU64",         ELF::ELFOSABI_TRU64},<br>+  {"Modesto",      "Novell - Modesto",     ELF::ELFOSABI_MODESTO},<br>+  {"OpenBSD",      "UNIX - OpenBSD",       ELF::ELFOSABI_OPENBSD},<br>+  {"OpenVMS",      "VMS - OpenVMS",        ELF::ELFOSABI_OPENVMS},<br>+  {"NSK",          "HP - Non-Stop Kernel", ELF::ELFOSABI_NSK},<br>+  {"AROS",         "AROS",                 ELF::ELFOSABI_AROS},<br>+  {"FenixOS",      "FenixOS",              ELF::ELFOSABI_FENIXOS},<br>+  {"CloudABI",     "CloudABI",             ELF::ELFOSABI_CLOUDABI},<br>+  {"C6000_ELFABI", "Bare-metal C6000",     ELF::ELFOSABI_C6000_ELFABI},<br>+  {"C6000_LINUX",  "Linux C6000",          ELF::ELFOSABI_C6000_LINUX},<br>+  {"ARM",          "ARM",                  ELF::ELFOSABI_ARM},<br>+  {"Standalone",   "Standalone App",       ELF::ELFOSABI_STANDALONE}<br> };<br><br> static const EnumEntry<unsigned> ElfMachineType[] = {<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_NONE         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_M32          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SPARC        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_386          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_68K          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_88K          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_IAMCU        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_860          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MIPS         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_S370         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MIPS_RS3_LE  ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PARISC       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_VPP500       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SPARC32PLUS  ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_960          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PPC          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PPC64        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_S390         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SPU          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_V800         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_FR20         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_RH32         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_RCE          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ARM          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ALPHA        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SH           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SPARCV9      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TRICORE      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ARC          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_H8_300       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_H8_300H      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_H8S          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_H8_500       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_IA_64        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MIPS_X       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_COLDFIRE     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_68HC12       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MMA          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PCP          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_NCPU         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_NDR1         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_STARCORE     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ME16         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ST100        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TINYJ        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_X86_64       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PDSP         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PDP10        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PDP11        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_FX66         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ST9PLUS      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ST7          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_68HC16       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_68HC11       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_68HC08       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_68HC05       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SVX          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ST19         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_VAX          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CRIS         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_JAVELIN      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_FIREPATH     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ZSP          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MMIX         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_HUANY        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PRISM        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_AVR          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_FR30         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_D10V         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_D30V         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_V850         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_M32R         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MN10300      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MN10200      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_PJ           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_OPENRISC     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ARC_COMPACT  ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_XTENSA       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_VIDEOCORE    ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TMM_GPP      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_NS32K        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TPC          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SNP1K        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ST200        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_IP2K         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MAX          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CR           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_F2MC16       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MSP430       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_BLACKFIN     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SE_C33       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SEP          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ARCA         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_UNICORE      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_EXCESS       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_DXP          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ALTERA_NIOS2 ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CRX          ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_XGATE        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_C166         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_M16C         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_DSPIC30F     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CE           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_M32C         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TSK3000      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_RS08         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SHARC        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ECOG2        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SCORE7       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_DSP24        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_VIDEOCORE3   ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_LATTICEMICO32),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SE_C17       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TI_C6000     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TI_C2000     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TI_C5500     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MMDSP_PLUS   ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CYPRESS_M8C  ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_R32C         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TRIMEDIA     ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_HEXAGON      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_8051         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_STXP7X       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_NDS32        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ECOG1        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ECOG1X       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MAXQ30       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_XIMO16       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MANIK        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CRAYNV2      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_RX           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_METAG        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_MCST_ELBRUS  ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ECOG16       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CR16         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ETPU         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_SLE9X        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_L10M         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_K10M         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_AARCH64      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_AVR32        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_STM8         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TILE64       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TILEPRO      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CUDA         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_TILEGX       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_CLOUDSHIELD  ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_COREA_1ST    ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_COREA_2ND    ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_ARC_COMPACT2 ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_OPEN8        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_RL78         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_VIDEOCORE5   ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_78KOR        ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_56800EX      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_AMDGPU       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, EM_WEBASSEMBLY  ),<br>+  ENUM_ENT(EM_NONE,          "None"),<br>+  ENUM_ENT(EM_M32,           "WE32100"),<br>+  ENUM_ENT(EM_SPARC,         "Sparc"),<br>+  ENUM_ENT(EM_386,           "Intel 80386"),<br>+  ENUM_ENT(EM_68K,           "MC68000"),<br>+  ENUM_ENT(EM_88K,           "MC88000"),<br>+  ENUM_ENT(EM_IAMCU,         "EM_IAMCU"),<br>+  ENUM_ENT(EM_860,           "Intel 80860"),<br>+  ENUM_ENT(EM_MIPS,          "MIPS R3000"),<br>+  ENUM_ENT(EM_S370,          "IBM System/370"),<br>+  ENUM_ENT(EM_MIPS_RS3_LE,   "MIPS R3000 little-endian"),<br>+  ENUM_ENT(EM_PARISC,        "HPPA"),<br>+  ENUM_ENT(EM_VPP500,        "Fujitsu VPP500"),<br>+  ENUM_ENT(EM_SPARC32PLUS,   "Sparc v8+"),<br>+  ENUM_ENT(EM_960,           "Intel 80960"),<br>+  ENUM_ENT(EM_PPC,           "PowerPC"),<br>+  ENUM_ENT(EM_PPC64,         "PowerPC64"),<br>+  ENUM_ENT(EM_S390,          "IBM S/390"),<br>+  ENUM_ENT(EM_SPU,           "SPU"),<br>+  ENUM_ENT(EM_V800,          "NEC V800 series"),<br>+  ENUM_ENT(EM_FR20,          "Fujistsu FR20"),<br>+  ENUM_ENT(EM_RH32,          "TRW RH-32"),<br>+  ENUM_ENT(EM_RCE,           "Motorola RCE"),<br>+  ENUM_ENT(EM_ARM,           "ARM"),<br>+  ENUM_ENT(EM_ALPHA,         "EM_ALPHA"),<br>+  ENUM_ENT(EM_SH,            "Hitachi SH"),<br>+  ENUM_ENT(EM_SPARCV9,       "Sparc v9"),<br>+  ENUM_ENT(EM_TRICORE,       "Siemens Tricore"),<br>+  ENUM_ENT(EM_ARC,           "ARC"),<br>+  ENUM_ENT(EM_H8_300,        "Hitachi H8/300"),<br>+  ENUM_ENT(EM_H8_300H,       "Hitachi H8/300H"),<br>+  ENUM_ENT(EM_H8S,           "Hitachi H8S"),<br>+  ENUM_ENT(EM_H8_500,        "Hitachi H8/500"),<br>+  ENUM_ENT(EM_IA_64,         "Intel IA-64"),<br>+  ENUM_ENT(EM_MIPS_X,        "Stanford MIPS-X"),<br>+  ENUM_ENT(EM_COLDFIRE,      "Motorola Coldfire"),<br>+  ENUM_ENT(EM_68HC12,        "Motorola MC68HC12 Microcontroller"),<br>+  ENUM_ENT(EM_MMA,           "Fujitsu Multimedia Accelerator"),<br>+  ENUM_ENT(EM_PCP,           "Siemens PCP"),<br>+  ENUM_ENT(EM_NCPU,          "Sony nCPU embedded RISC processor"),<br>+  ENUM_ENT(EM_NDR1,          "Denso NDR1 microprocesspr"),<br>+  ENUM_ENT(EM_STARCORE,      "Motorola Star*Core processor"),<br>+  ENUM_ENT(EM_ME16,          "Toyota ME16 processor"),<br>+  ENUM_ENT(EM_ST100,         "STMicroelectronics ST100 processor"),<br>+  ENUM_ENT(EM_TINYJ,         "Advanced Logic Corp. TinyJ embedded processor"),<br>+  ENUM_ENT(EM_X86_64,        "Advanced Micro Devices X86-64"),<br>+  ENUM_ENT(EM_PDSP,          "Sony DSP processor"),<br>+  ENUM_ENT(EM_PDP10,         "Digital Equipment Corp. PDP-10"),<br>+  ENUM_ENT(EM_PDP11,         "Digital Equipment Corp. PDP-11"),<br>+  ENUM_ENT(EM_FX66,          "Siemens FX66 microcontroller"),<br>+  ENUM_ENT(EM_ST9PLUS,       "STMicroelectronics ST9+ 8/16 bit microcontroller"),<br>+  ENUM_ENT(EM_ST7,           "STMicroelectronics ST7 8-bit microcontroller"),<br>+  ENUM_ENT(EM_68HC16,        "Motorola MC68HC16 Microcontroller"),<br>+  ENUM_ENT(EM_68HC11,        "Motorola MC68HC11 Microcontroller"),<br>+  ENUM_ENT(EM_68HC08,        "Motorola MC68HC08 Microcontroller"),<br>+  ENUM_ENT(EM_68HC05,        "Motorola MC68HC05 Microcontroller"),<br>+  ENUM_ENT(EM_SVX,           "Silicon Graphics SVx"),<br>+  ENUM_ENT(EM_ST19,          "STMicroelectronics ST19 8-bit microcontroller"),<br>+  ENUM_ENT(EM_VAX,           "Digital VAX"),<br>+  ENUM_ENT(EM_CRIS,          "Axis Communications 32-bit embedded processor"),<br>+  ENUM_ENT(EM_JAVELIN,       "Infineon Technologies 32-bit embedded cpu"),<br>+  ENUM_ENT(EM_FIREPATH,      "Element 14 64-bit DSP processor"),<br>+  ENUM_ENT(EM_ZSP,           "LSI Logic's 16-bit DSP processor"),<br>+  ENUM_ENT(EM_MMIX,          "Donald Knuth's educational 64-bit processor"),<br>+  ENUM_ENT(EM_HUANY,         "Harvard Universitys's machine-independent object format"),<br>+  ENUM_ENT(EM_PRISM,         "Vitesse Prism"),<br>+  ENUM_ENT(EM_AVR,           "Atmel AVR 8-bit microcontroller"),<br>+  ENUM_ENT(EM_FR30,          "Fujitsu FR30"),<br>+  ENUM_ENT(EM_D10V,          "Mitsubishi D10V"),<br>+  ENUM_ENT(EM_D30V,          "Mitsubishi D30V"),<br>+  ENUM_ENT(EM_V850,          "NEC v850"),<br>+  ENUM_ENT(EM_M32R,          "Renesas M32R (formerly Mitsubishi M32r)"),<br>+  ENUM_ENT(EM_MN10300,       "Matsushita MN10300"),<br>+  ENUM_ENT(EM_MN10200,       "Matsushita MN10200"),<br>+  ENUM_ENT(EM_PJ,            "picoJava"),<br>+  ENUM_ENT(EM_OPENRISC,      "OpenRISC 32-bit embedded processor"),<br>+  ENUM_ENT(EM_ARC_COMPACT,   "EM_ARC_COMPACT"),<br>+  ENUM_ENT(EM_XTENSA,        "Tensilica Xtensa Processor"),<br>+  ENUM_ENT(EM_VIDEOCORE,     "Alphamosaic VideoCore processor"),<br>+  ENUM_ENT(EM_TMM_GPP,       "Thompson Multimedia General Purpose Processor"),<br>+  ENUM_ENT(EM_NS32K,         "National Semiconductor 32000 series"),<br>+  ENUM_ENT(EM_TPC,           "Tenor Network TPC processor"),<br>+  ENUM_ENT(EM_SNP1K,         "EM_SNP1K"),<br>+  ENUM_ENT(EM_ST200,         "STMicroelectronics ST200 microcontroller"),<br>+  ENUM_ENT(EM_IP2K,          "Ubicom IP2xxx 8-bit microcontrollers"),<br>+  ENUM_ENT(EM_MAX,           "MAX Processor"),<br>+  ENUM_ENT(EM_CR,            "National Semiconductor CompactRISC"),<br>+  ENUM_ENT(EM_F2MC16,        "Fujitsu F2MC16"),<br>+  ENUM_ENT(EM_MSP430,        "Texas Instruments msp430 microcontroller"),<br>+  ENUM_ENT(EM_BLACKFIN,      "Analog Devices Blackfin"),<br>+  ENUM_ENT(EM_SE_C33,        "S1C33 Family of Seiko Epson processors"),<br>+  ENUM_ENT(EM_SEP,           "Sharp embedded microprocessor"),<br>+  ENUM_ENT(EM_ARCA,          "Arca RISC microprocessor"),<br>+  ENUM_ENT(EM_UNICORE,       "Unicore"),<br>+  ENUM_ENT(EM_EXCESS,        "eXcess 16/32/64-bit configurable embedded CPU"),<br>+  ENUM_ENT(EM_DXP,           "Icera Semiconductor Inc. Deep Execution Processor"),<br>+  ENUM_ENT(EM_ALTERA_NIOS2,  "Altera Nios"),<br>+  ENUM_ENT(EM_CRX,           "National Semiconductor CRX microprocessor"),<br>+  ENUM_ENT(EM_XGATE,         "Motorola XGATE embedded processor"),<br>+  ENUM_ENT(EM_C166,          "Infineon Technologies xc16x"),<br>+  ENUM_ENT(EM_M16C,          "Renesas M16C"),<br>+  ENUM_ENT(EM_DSPIC30F,      "Microchip Technology dsPIC30F Digital Signal Controller"),<br>+  ENUM_ENT(EM_CE,            "Freescale Communication Engine RISC core"),<br>+  ENUM_ENT(EM_M32C,          "Renesas M32C"),<br>+  ENUM_ENT(EM_TSK3000,       "Altium TSK3000 core"),<br>+  ENUM_ENT(EM_RS08,          "Freescale RS08 embedded processor"),<br>+  ENUM_ENT(EM_SHARC,         "EM_SHARC"),<br>+  ENUM_ENT(EM_ECOG2,         "Cyan Technology eCOG2 microprocessor"),<br>+  ENUM_ENT(EM_SCORE7,        "SUNPLUS S+Core"),<br>+  ENUM_ENT(EM_DSP24,         "New Japan Radio (NJR) 24-bit DSP Processor"),<br>+  ENUM_ENT(EM_VIDEOCORE3,    "Broadcom VideoCore III processor"),<br>+  ENUM_ENT(EM_LATTICEMICO32, "Lattice Mico32"),<br>+  ENUM_ENT(EM_SE_C17,        "Seiko Epson C17 family"),<br>+  ENUM_ENT(EM_TI_C6000,      "Texas Instruments TMS320C6000 DSP family"),<br>+  ENUM_ENT(EM_TI_C2000,      "Texas Instruments TMS320C2000 DSP family"),<br>+  ENUM_ENT(EM_TI_C5500,      "Texas Instruments TMS320C55x DSP family"),<br>+  ENUM_ENT(EM_MMDSP_PLUS,    "STMicroelectronics 64bit VLIW Data Signal Processor"),<br>+  ENUM_ENT(EM_CYPRESS_M8C,   "Cypress M8C microprocessor"),<br>+  ENUM_ENT(EM_R32C,          "Renesas R32C series microprocessors"),<br>+  ENUM_ENT(EM_TRIMEDIA,      "NXP Semiconductors TriMedia architecture family"),<br>+  ENUM_ENT(EM_HEXAGON,       "Qualcomm Hexagon"),<br>+  ENUM_ENT(EM_8051,          "Intel 8051 and variants"),<br>+  ENUM_ENT(EM_STXP7X,        "STMicroelectronics STxP7x family"),<br>+  ENUM_ENT(EM_NDS32,         "Andes Technology compact code size embedded RISC processor family"),<br>+  ENUM_ENT(EM_ECOG1,         "Cyan Technology eCOG1 microprocessor"),<br>+  ENUM_ENT(EM_ECOG1X,        "Cyan Technology eCOG1X family"),<br>+  ENUM_ENT(EM_MAXQ30,        "Dallas Semiconductor MAXQ30 Core microcontrollers"),<br>+  ENUM_ENT(EM_XIMO16,        "New Japan Radio (NJR) 16-bit DSP Processor"),<br>+  ENUM_ENT(EM_MANIK,         "M2000 Reconfigurable RISC Microprocessor"),<br>+  ENUM_ENT(EM_CRAYNV2,       "Cray Inc. NV2 vector architecture"),<br>+  ENUM_ENT(EM_RX,            "Renesas RX"),<br>+  ENUM_ENT(EM_METAG,         "Imagination Technologies Meta processor architecture"),<br>+  ENUM_ENT(EM_MCST_ELBRUS,   "MCST Elbrus general purpose hardware architecture"),<br>+  ENUM_ENT(EM_ECOG16,        "Cyan Technology eCOG16 family"),<br>+  ENUM_ENT(EM_CR16,          "Xilinx MicroBlaze"),<br>+  ENUM_ENT(EM_ETPU,          "Freescale Extended Time Processing Unit"),<br>+  ENUM_ENT(EM_SLE9X,         "Infineon Technologies SLE9X core"),<br>+  ENUM_ENT(EM_L10M,          "EM_L10M"),<br>+  ENUM_ENT(EM_K10M,          "EM_K10M"),<br>+  ENUM_ENT(EM_AARCH64,       "AArch64"),<br>+  ENUM_ENT(EM_AVR32,         "Atmel AVR 8-bit microcontroller"),<br>+  ENUM_ENT(EM_STM8,          "STMicroeletronics STM8 8-bit microcontroller"),<br>+  ENUM_ENT(EM_TILE64,        "Tilera TILE64 multicore architecture family"),<br>+  ENUM_ENT(EM_TILEPRO,       "Tilera TILEPro multicore architecture family"),<br>+  ENUM_ENT(EM_CUDA,          "NVIDIA CUDA architecture"),<br>+  ENUM_ENT(EM_TILEGX,        "Tilera TILE-Gx multicore architecture family"),<br>+  ENUM_ENT(EM_CLOUDSHIELD,   "EM_CLOUDSHIELD"),<br>+  ENUM_ENT(EM_COREA_1ST,     "EM_COREA_1ST"),<br>+  ENUM_ENT(EM_COREA_2ND,     "EM_COREA_2ND"),<br>+  ENUM_ENT(EM_ARC_COMPACT2,  "EM_ARC_COMPACT2"),<br>+  ENUM_ENT(EM_OPEN8,         "EM_OPEN8"),<br>+  ENUM_ENT(EM_RL78,          "Renesas RL78"),<br>+  ENUM_ENT(EM_VIDEOCORE5,    "Broadcom VideoCore V processor"),<br>+  ENUM_ENT(EM_78KOR,         "EM_78KOR"),<br>+  ENUM_ENT(EM_56800EX,       "EM_56800EX"),<br>+  ENUM_ENT(EM_AMDGPU,        "EM_AMDGPU"),<br>+  ENUM_ENT(EM_WEBASSEMBLY,   "EM_WEBASSEMBLY")<br> };<br><br> static const EnumEntry<unsigned> ElfSymbolBindings[] = {<br>-  { "Local",  ELF::STB_LOCAL        },<br>-  { "Global", ELF::STB_GLOBAL       },<br>-  { "Weak",   ELF::STB_WEAK         },<br>-  { "Unique", ELF::STB_GNU_UNIQUE   }<br>-};<br>+    {"Local",  "LOCAL",  ELF::STB_LOCAL},<br>+    {"Global", "GLOBAL", ELF::STB_GLOBAL},<br>+    {"Weak",   "WEAK",   ELF::STB_WEAK},<br>+    {"Unique", "UNIQUE", ELF::STB_GNU_UNIQUE}};<br><br> static const EnumEntry<unsigned> ElfSymbolTypes[] = {<br>-  { "None",      ELF::STT_NOTYPE    },<br>-  { "Object",    ELF::STT_OBJECT    },<br>-  { "Function",  ELF::STT_FUNC      },<br>-  { "Section",   ELF::STT_SECTION   },<br>-  { "File",      ELF::STT_FILE      },<br>-  { "Common",    ELF::STT_COMMON    },<br>-  { "TLS",       ELF::STT_TLS       },<br>-  { "GNU_IFunc", ELF::STT_GNU_IFUNC }<br>-};<br>+    {"None",      "NOTYPE",   ELF::STT_NOTYPE},<br>+    {"Object",    "OBJECT",   ELF::STT_OBJECT},<br>+    {"Function",  "FUNCTION", ELF::STT_FUNC},<br>+    {"Section",   "SECTION",  ELF::STT_SECTION},<br>+    {"File",      "FILE",     ELF::STT_FILE},<br>+    {"Common",    "COMMON",   ELF::STT_COMMON},<br>+    {"TLS",       "TLS",      ELF::STT_TLS},<br>+    {"GNU_IFunc", "IFUNC",    ELF::STT_GNU_IFUNC}};<br><br> static const EnumEntry<unsigned> AMDGPUSymbolTypes[] = {<br>   { "AMDGPU_HSA_KERNEL",            ELF::STT_AMDGPU_HSA_KERNEL },<br>@@ -801,19 +843,19 @@ static const char *getGroupType(uint32_t<br> }<br><br> static const EnumEntry<unsigned> ElfSectionFlags[] = {<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_WRITE           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_ALLOC           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_EXCLUDE         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_EXECINSTR       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_MERGE           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_STRINGS         ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_INFO_LINK       ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_LINK_ORDER      ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_OS_NONCONFORMING),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_GROUP           ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, SHF_TLS             ),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, XCORE_SHF_CP_SECTION),<br>-  LLVM_READOBJ_ENUM_ENT(ELF, XCORE_SHF_DP_SECTION),<br>+  ENUM_ENT(SHF_WRITE,            "W"),<br>+  ENUM_ENT(SHF_ALLOC,            "A"),<br>+  ENUM_ENT(SHF_EXCLUDE,          "E"),<br>+  ENUM_ENT(SHF_EXECINSTR,        "X"),<br>+  ENUM_ENT(SHF_MERGE,            "M"),<br>+  ENUM_ENT(SHF_STRINGS,          "S"),<br>+  ENUM_ENT(SHF_INFO_LINK,        "I"),<br>+  ENUM_ENT(SHF_LINK_ORDER,       "L"),<br>+  ENUM_ENT(SHF_OS_NONCONFORMING, "o"),<br>+  ENUM_ENT(SHF_GROUP,            "G"),<br>+  ENUM_ENT(SHF_TLS,              "T"),<br>+  ENUM_ENT_1(XCORE_SHF_CP_SECTION),<br>+  ENUM_ENT_1(XCORE_SHF_DP_SECTION),<br> };<br><br> static const EnumEntry<unsigned> ElfAMDGPUSectionFlags[] = {<br>@@ -1052,6 +1094,10 @@ ELFDumper<ELFT>::ELFDumper(const ELFFile<br>     }<br>     }<br>   }<br>+  if (opts::Output == opts::GNU)<br>+    ELFDumperStyle.reset(new GNUStyle<ELFT>(Writer));<br>+  else<br>+    ELFDumperStyle.reset(new LLVMStyle<ELFT>(Writer));<br> }<br><br> template <typename ELFT><br>@@ -1085,50 +1131,7 @@ typename ELFDumper<ELFT>::Elf_Rela_Range<br><br> template<class ELFT><br> void ELFDumper<ELFT>::printFileHeaders() {<br>-  const Elf_Ehdr *Header = Obj->getHeader();<br>-<br>-  {<br>-    DictScope D(W, "ElfHeader");<br>-    {<br>-      DictScope D(W, "Ident");<br>-      W.printBinary("Magic", makeArrayRef(Header->e_ident).slice(ELF::EI_MAG0,<br>-                                                                 4));<br>-      W.printEnum  ("Class", Header->e_ident[ELF::EI_CLASS],<br>-                      makeArrayRef(ElfClass));<br>-      W.printEnum  ("DataEncoding", Header->e_ident[ELF::EI_DATA],<br>-                      makeArrayRef(ElfDataEncoding));<br>-      W.printNumber("FileVersion", Header->e_ident[ELF::EI_VERSION]);<br>-<br>-      // Handle architecture specific OS/ABI values.<br>-      if (Header->e_machine == ELF::EM_AMDGPU &&<br>-          Header->e_ident[ELF::EI_OSABI] == ELF::ELFOSABI_AMDGPU_HSA)<br>-        W.printHex("OS/ABI", "AMDGPU_HSA", ELF::ELFOSABI_AMDGPU_HSA);<br>-      else<br>-        W.printEnum  ("OS/ABI", Header->e_ident[ELF::EI_OSABI],<br>-                      makeArrayRef(ElfOSABI));<br>-      W.printNumber("ABIVersion", Header->e_ident[ELF::EI_ABIVERSION]);<br>-      W.printBinary("Unused", makeArrayRef(Header->e_ident).slice(ELF::EI_PAD));<br>-    }<br>-<br>-    W.printEnum  ("Type", Header->e_type, makeArrayRef(ElfObjectFileType));<br>-    W.printEnum  ("Machine", Header->e_machine, makeArrayRef(ElfMachineType));<br>-    W.printNumber("Version", Header->e_version);<br>-    W.printHex   ("Entry", Header->e_entry);<br>-    W.printHex   ("ProgramHeaderOffset", Header->e_phoff);<br>-    W.printHex   ("SectionHeaderOffset", Header->e_shoff);<br>-    if (Header->e_machine == EM_MIPS)<br>-      W.printFlags("Flags", Header->e_flags, makeArrayRef(ElfHeaderMipsFlags),<br>-                   unsigned(ELF::EF_MIPS_ARCH), unsigned(ELF::EF_MIPS_ABI),<br>-                   unsigned(ELF::EF_MIPS_MACH));<br>-    else<br>-      W.printFlags("Flags", Header->e_flags);<br>-    W.printNumber("HeaderSize", Header->e_ehsize);<br>-    W.printNumber("ProgramHeaderEntrySize", Header->e_phentsize);<br>-    W.printNumber("ProgramHeaderCount", Header->e_phnum);<br>-    W.printNumber("SectionHeaderEntrySize", Header->e_shentsize);<br>-    W.printNumber("SectionHeaderCount", Header->e_shnum);<br>-    W.printNumber("StringTableSectionIndex", Header->e_shstrndx);<br>-  }<br>+  ELFDumperStyle->printFileHeaders(Obj);<br> }<br><br> template<class ELFT><br>@@ -2243,6 +2246,7 @@ template <class ELFT> void ELFDumper<ELF<br>               llvm::outs(),<br>               StackMapV1Parser<ELFT::TargetEndianness>(*StackMapContentsArray));<br> }<br>+<br> template <class ELFT> void ELFDumper<ELFT>::printGroupSections() {<br>   DictScope Lists(W, "Groups");<br>   uint32_t SectionIndex = 0;<br>@@ -2280,3 +2284,108 @@ template <class ELFT> void ELFDumper<ELF<br>   if (!HasGroups)<br>     W.startLine() << "There are no group sections in the file.\n";<br> }<br>+<br>+template <class ELFT><br>+void GNUStyle<ELFT>::printFileHeaders(const ELFFile<ELFT> *Obj) {<br>+  const Elf_Ehdr *e = Obj->getHeader();<br>+  OS << "ELF Header:\n";<br>+  OS << "  Magic:  ";<br>+  std::string Str;<br>+  auto printFields = [&](StringRef Str1, StringRef Str2) -> void {<br>+    OS.PadToColumn(2);<br>+    OS << Str1;<br>+    OS.PadToColumn(37);<br>+    OS << Str2 << "\n";<br>+    OS.flush();<br>+  };<br>+  for (int i = 0; i < ELF::EI_NIDENT; i++)<br>+    OS << format(" %02x", static_cast<int>(e->e_ident[i]));<br>+  OS << "\n";<br>+  Str = printEnum(e->e_ident[ELF::EI_CLASS], makeArrayRef(ElfClass));<br>+  printFields("Class:", Str);<br>+  Str = printEnum(e->e_ident[ELF::EI_DATA], makeArrayRef(ElfDataEncoding));<br>+  printFields("Data:", Str);<br>+  OS.PadToColumn(2);<br>+  OS << "Version:";<br>+  OS.PadToColumn(37);<br>+  OS << to_hexString(e->e_ident[ELF::EI_VERSION]);<br>+  if (e->e_version == ELF::EV_CURRENT)<br>+    OS << " (current)";<br>+  OS << "\n";<br>+  Str = printEnum(e->e_ident[ELF::EI_OSABI], makeArrayRef(ElfOSABI));<br>+  printFields("OS/ABI:", Str);<br>+  Str = "0x" + to_hexString(e->e_version);<br>+  Str = to_hexString(e->e_ident[ELF::EI_ABIVERSION]);<br>+  printFields("ABI Version:", Str);<br>+  Str = printEnum(e->e_type, makeArrayRef(ElfObjectFileType));<br>+  printFields("Type:", Str);<br>+  Str = printEnum(e->e_machine, makeArrayRef(ElfMachineType));<br>+  printFields("Machine:", Str);<br>+  Str = "0x" + to_hexString(e->e_version);<br>+  printFields("Version:", Str);<br>+  Str = "0x" + to_hexString(e->e_entry);<br>+  printFields("Entry point address:", Str);<br>+  Str = to_string(e->e_phoff) + " (bytes into file)";<br>+  printFields("Start of program headers:", Str);<br>+  Str = to_string(e->e_shoff) + " (bytes into file)";<br>+  printFields("Start of section headers:", Str);<br>+  Str = "0x" + to_hexString(e->e_flags);<br>+  printFields("Flags:", Str);<br>+  Str = to_string(e->e_ehsize) + " (bytes)";<br>+  printFields("Size of this header:", Str);<br>+  Str = to_string(e->e_phentsize) + " (bytes)";<br>+  printFields("Size of program headers:", Str);<br>+  Str = to_string(e->e_phnum);<br>+  printFields("Number of program headers:", Str);<br>+  Str = to_string(e->e_shentsize) + " (bytes)";<br>+  printFields("Size of section headers:", Str);<br>+  Str = to_string(e->e_shnum);<br>+  printFields("Number of section headers:", Str);<br>+  Str = to_string(e->e_shstrndx);<br>+  printFields("Section header string table index:", Str);<br>+}<br>+<br>+template <class ELFT><br>+void LLVMStyle<ELFT>::printFileHeaders(const ELFFile<ELFT> *Obj) {<br>+  const Elf_Ehdr *e = Obj->getHeader();<br>+  {<br>+    DictScope D(W, "ElfHeader");<br>+    {<br>+      DictScope D(W, "Ident");<br>+      W.printBinary("Magic", makeArrayRef(e->e_ident).slice(ELF::EI_MAG0, 4));<br>+      W.printEnum("Class", e->e_ident[ELF::EI_CLASS], makeArrayRef(ElfClass));<br>+      W.printEnum("DataEncoding", e->e_ident[ELF::EI_DATA],<br>+                  makeArrayRef(ElfDataEncoding));<br>+      W.printNumber("FileVersion", e->e_ident[ELF::EI_VERSION]);<br>+<br>+      // Handle architecture specific OS/ABI values.<br>+      if (e->e_machine == ELF::EM_AMDGPU &&<br>+          e->e_ident[ELF::EI_OSABI] == ELF::ELFOSABI_AMDGPU_HSA)<br>+        W.printHex("OS/ABI", "AMDGPU_HSA", ELF::ELFOSABI_AMDGPU_HSA);<br>+      else<br>+        W.printEnum("OS/ABI", e->e_ident[ELF::EI_OSABI],<br>+                    makeArrayRef(ElfOSABI));<br>+      W.printNumber("ABIVersion", e->e_ident[ELF::EI_ABIVERSION]);<br>+      W.printBinary("Unused", makeArrayRef(e->e_ident).slice(ELF::EI_PAD));<br>+    }<br>+<br>+    W.printEnum("Type", e->e_type, makeArrayRef(ElfObjectFileType));<br>+    W.printEnum("Machine", e->e_machine, makeArrayRef(ElfMachineType));<br>+    W.printNumber("Version", e->e_version);<br>+    W.printHex("Entry", e->e_entry);<br>+    W.printHex("ProgramHeaderOffset", e->e_phoff);<br>+    W.printHex("SectionHeaderOffset", e->e_shoff);<br>+    if (e->e_machine == EM_MIPS)<br>+      W.printFlags("Flags", e->e_flags, makeArrayRef(ElfHeaderMipsFlags),<br>+                   unsigned(ELF::EF_MIPS_ARCH), unsigned(ELF::EF_MIPS_ABI),<br>+                   unsigned(ELF::EF_MIPS_MACH));<br>+    else<br>+      W.printFlags("Flags", e->e_flags);<br>+    W.printNumber("HeaderSize", e->e_ehsize);<br>+    W.printNumber("ProgramHeaderEntrySize", e->e_phentsize);<br>+    W.printNumber("ProgramHeaderCount", e->e_phnum);<br>+    W.printNumber("SectionHeaderEntrySize", e->e_shentsize);<br>+    W.printNumber("SectionHeaderCount", e->e_shnum);<br>+    W.printNumber("StringTableSectionIndex", e->e_shstrndx);<br>+  }<br>+}<br><br>Modified: llvm/trunk/tools/llvm-readobj/StreamWriter.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/StreamWriter.cpp?rev=260391&r1=260390&r2=260391&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/StreamWriter.cpp?rev=260391&r1=260390&r2=260391&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/llvm-readobj/StreamWriter.cpp (original)<br>+++ llvm/trunk/tools/llvm-readobj/StreamWriter.cpp Wed Feb 10 11:51:28 2016<br>@@ -8,23 +8,22 @@ using namespace llvm::support;<br> namespace llvm {<br><br> raw_ostream &operator<<(raw_ostream &OS, const HexNumber& Value) {<br>-  uint64_t N = Value.Value;<br>-  // Zero is a special case.<br>-  if (N == 0)<br>-    return OS << "0x0";<br>-<br>-  char NumberBuffer[20];<br>-  char *EndPtr = NumberBuffer + sizeof(NumberBuffer);<br>-  char *CurPtr = EndPtr;<br>+  OS << "0x" << to_hexString(Value.Value);<br>+  return OS;<br>+}<br><br>-  while (N) {<br>-    uintptr_t X = N % 16;<br>-    *--CurPtr = (X < 10 ? '0' + X : 'A' + X - 10);<br>-    N /= 16;<br>-  }<br>+const std::string to_hexString(uint64_t Value, bool UpperCase) {<br>+  std::string number;<br>+  llvm::raw_string_ostream stream(number);<br>+  stream << format_hex_no_prefix(Value, 1, UpperCase);<br>+  return stream.str();<br>+}<br><br>-  OS << "0x";<br>-  return OS.write(CurPtr, EndPtr - CurPtr);<br>+const std::string to_string(uint64_t Value) {<br>+  std::string number;<br>+  llvm::raw_string_ostream stream(number);<br>+  stream << format_decimal(Value, 1);<br>+  return stream.str();<br> }<br><br> void StreamWriter::printBinaryImpl(StringRef Label, StringRef Str,<br><br>Modified: llvm/trunk/tools/llvm-readobj/StreamWriter.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/StreamWriter.h?rev=260391&r1=260390&r2=260391&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/StreamWriter.h?rev=260391&r1=260390&r2=260391&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/llvm-readobj/StreamWriter.h (original)<br>+++ llvm/trunk/tools/llvm-readobj/StreamWriter.h Wed Feb 10 11:51:28 2016<br>@@ -26,7 +26,17 @@ namespace llvm {<br> template<typename T><br> struct EnumEntry {<br>   StringRef Name;<br>+  // While Name suffices in most of the cases, in certain cases<br>+  // GNU style and LLVM style of ELFDumper do not<br>+  // display same string for same enum. The AltName if initialized appropriately<br>+  // will hold the string that GNU style emits.<br>+  // Example:<br>+  // "EM_X86_64" string on LLVM style for Elf_Ehdr->e_machine corresponds to<br>+  // "Advanced Micro Devices X86-64" on GNU style<br>+  StringRef AltName;<br>   T Value;<br>+  EnumEntry(StringRef N, StringRef A, T V) : Name(N), AltName(A), Value(V) {}<br>+  EnumEntry(StringRef N, T V) : Name(N), AltName(N), Value(V) {}<br> };<br><br> struct HexNumber {<br>@@ -49,6 +59,8 @@ struct HexNumber {<br> };<br><br> raw_ostream &operator<<(raw_ostream &OS, const HexNumber& Value);<br>+const std::string to_hexString(uint64_t Value, bool UpperCase = true);<br>+const std::string to_string(uint64_t Value);<br><br> class StreamWriter {<br> public:<br><br>Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=260391&r1=260390&r2=260391&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=260391&r1=260390&r2=260391&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)<br>+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Wed Feb 10 11:51:28 2016<br>@@ -233,6 +233,11 @@ namespace opts {<br>   cl::alias SectionGroupsShort("g", cl::desc("Alias for -elf-sections-groups"),<br>                                cl::aliasopt(SectionGroups));<br><br>+  cl::opt<OutpytStyleTy><br>+      Output("elf-output-style", cl::desc("Specify ELF dump style"),<br>+             cl::values(clEnumVal(LLVM, "LLVM default style"),<br>+                        clEnumVal(GNU, "GNU readelf style"), clEnumValEnd),<br>+             cl::init(LLVM));<br> } // namespace opts<br><br> namespace llvm {<br>@@ -305,14 +310,15 @@ static void dumpObject(const ObjectFile<br>   if (std::error_code EC = createDumper(Obj, Writer, Dumper))<br>     reportError(Obj->getFileName(), EC);<br><br>-  outs() << '\n';<br>-  outs() << "File: " << Obj->getFileName() << "\n";<br>-  outs() << "Format: " << Obj->getFileFormatName() << "\n";<br>-  outs() << "Arch: "<br>-         << Triple::getArchTypeName((llvm::Triple::ArchType)Obj->getArch())<br>-         << "\n";<br>-  outs() << "AddressSize: " << (8*Obj->getBytesInAddress()) << "bit\n";<br>-  Dumper->printLoadName();<br>+  if (opts::Output == opts::LLVM) {<br>+    outs() << '\n';<br>+    outs() << "File: " << Obj->getFileName() << "\n";<br>+    outs() << "Format: " << Obj->getFileFormatName() << "\n";<br>+    outs() << "Arch: " << Triple::getArchTypeName(<br>+                              (llvm::Triple::ArchType)Obj->getArch()) << "\n";<br>+    outs() << "AddressSize: " << (8 * Obj->getBytesInAddress()) << "bit\n";<br>+    Dumper->printLoadName();<br>+  }<br><br>   if (opts::FileHeaders)<br>     Dumper->printFileHeaders();<br><br>Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.h?rev=260391&r1=260390&r2=260391&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.h?rev=260391&r1=260390&r2=260391&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/llvm-readobj/llvm-readobj.h (original)<br>+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.h Wed Feb 10 11:51:28 2016<br>@@ -42,6 +42,8 @@ namespace opts {<br>   extern llvm::cl::opt<bool> CodeViewSubsectionBytes;<br>   extern llvm::cl::opt<bool> ARMAttributes;<br>   extern llvm::cl::opt<bool> MipsPLTGOT;<br>+  enum OutpytStyleTy { LLVM, GNU };<br>+  extern llvm::cl::opt<OutpytStyleTy> Output;<br> } // namespace opts<br><br> #define LLVM_READOBJ_ENUM_ENT(ns, enum) \<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td nowrap style="border:none;border-top:solid #d50f25 1.5pt;padding:0in 0in 0in 0in"><p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#555555">Teresa Johnson |<u></u><u></u></span></p></td><td nowrap style="border:none;border-top:solid #3369e8 1.5pt;padding:0in 0in 0in 0in"><p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#555555"> Software Engineer |<u></u><u></u></span></p></td><td nowrap style="border:none;border-top:solid #009939 1.5pt;padding:0in 0in 0in 0in"><p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#555555"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |<u></u><u></u></span></p></td><td nowrap style="border:none;border-top:solid #eeb211 1.5pt;padding:0in 0in 0in 0in"><p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#555555"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a><u></u><u></u></span></p></td></tr></tbody></table><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</div>
</div></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div>