MC: Pack MCSymbol::Index in with the bitfield in MCSymbol
[oota-llvm.git] / tools / llvm-objdump / llvm-objdump.cpp
index 365d2ff5e37ea85de5a6d847634540e66c816b76..e442ac050fcea2011b020a42142056cb8bf8ebff 100644 (file)
@@ -194,7 +194,7 @@ static const Target *getTarget(const ObjectFile *Obj = nullptr) {
   return TheTarget;
 }
 
-void llvm::DumpBytes(StringRef bytes) {
+void llvm::DumpBytes(ArrayRef<uint8_t> bytes) {
   static const char hex_rep[] = "0123456789abcdef";
   SmallString<64> output;
 
@@ -274,7 +274,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
 
   int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
   std::unique_ptr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
-      AsmPrinterVariant, *AsmInfo, *MII, *MRI, *STI));
+      Triple(TripleName), AsmPrinterVariant, *AsmInfo, *MII, *MRI));
   if (!IP) {
     errs() << "error: no instruction printer for target " << TripleName
       << '\n';
@@ -399,10 +399,9 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
           outs() << format("%8" PRIx64 ":", SectionAddr + Index);
           if (!NoShowRawInsn) {
             outs() << "\t";
-            DumpBytes(StringRef(
-                reinterpret_cast<const char *>(Bytes.data()) + Index, Size));
+            DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, Size));
           }
-          IP->printInst(&Inst, outs(), "");
+          IP->printInst(&Inst, outs(), "", *STI);
           outs() << CommentStream.str();
           Comments.clear();
           outs() << "\n";
@@ -630,6 +629,7 @@ void llvm::PrintSymbolTable(const ObjectFile *o) {
     bool Weak = Flags & SymbolRef::SF_Weak;
     bool Absolute = Flags & SymbolRef::SF_Absolute;
     bool Common = Flags & SymbolRef::SF_Common;
+    bool Hidden = Flags & SymbolRef::SF_Hidden;
 
     if (Common) {
       uint32_t Alignment;
@@ -684,8 +684,11 @@ void llvm::PrintSymbolTable(const ObjectFile *o) {
       outs() << SectionName;
     }
     outs() << '\t'
-           << format("%08" PRIx64 " ", Size)
-           << Name
+           << format("%08" PRIx64 " ", Size);
+    if (Hidden) {
+      outs() << ".hidden ";
+    }
+    outs() << Name
            << '\n';
   }
 }
@@ -897,6 +900,7 @@ int main(int argc, char **argv) {
       && !(InfoPlist && MachOOpt)
       && !(DylibsUsed && MachOOpt)
       && !(DylibId && MachOOpt)
+      && !(ObjcMetaData && MachOOpt)
       && !(DumpSections.size() != 0 && MachOOpt)) {
     cl::PrintHelpMessage();
     return 2;