[llvm] r206446 - objdump: identify WoA WinCOFF/ARM correctly

Saleem Abdulrasool compnerd at compnerd.org
Wed Apr 16 23:17:23 PDT 2014


Author: compnerd
Date: Thu Apr 17 01:17:23 2014
New Revision: 206446

URL: http://llvm.org/viewvc/llvm-project?rev=206446&view=rev
Log:
objdump: identify WoA WinCOFF/ARM correctly

Since LLVM currently only supports WinCOFF, assume that the input is WinCOFF
rather than another type of COFF file (ECOFF/XCOFF).  If the architecture is
detected as thumb (e.g. the file has a IMAGE_FILE_MACHINE_ARMNT magic) then use
a triple of thumbv7-windows.

This allows for objdump to properly handle WoA object files without having to
specify the target triple manually.

Modified:
    llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp

Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=206446&r1=206445&r2=206446&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Thu Apr 17 01:17:23 2014
@@ -167,6 +167,12 @@ static const Target *getTarget(const Obj
       // the best we can do here is indicate that it is mach-o.
       if (Obj->isMachO())
         TheTriple.setObjectFormat(Triple::MachO);
+
+      if (Obj->isCOFF()) {
+        const auto COFFObj = dyn_cast<COFFObjectFile>(Obj);
+        if (COFFObj->getArch() == Triple::thumb)
+          TheTriple.setTriple("thumbv7-windows");
+      }
     }
   } else
     TheTriple.setTriple(Triple::normalize(TripleName));





More information about the llvm-commits mailing list