1 //===-- llvm-readobj.h ----------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLVM_TOOLS_LLVM_READOBJ_LLVM_READOBJ_H 11 #define LLVM_TOOLS_LLVM_READOBJ_LLVM_READOBJ_H 12 13 #include "llvm/Support/CommandLine.h" 14 #include "llvm/Support/Compiler.h" 15 #include "llvm/Support/ErrorOr.h" 16 #include <string> 17 18 namespace llvm { 19 namespace object { 20 class RelocationRef; 21 } 22 23 // Various helper functions. 24 LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg); 25 void error(std::error_code ec); 26 template <class T> T unwrapOrError(ErrorOr<T> EO) { 27 if (EO) 28 return *EO; 29 reportError(EO.getError().message()); 30 } 31 bool relocAddressLess(object::RelocationRef A, 32 object::RelocationRef B); 33 } // namespace llvm 34 35 namespace opts { 36 extern llvm::cl::list<std::string> InputFilenames; 37 extern llvm::cl::opt<bool> FileHeaders; 38 extern llvm::cl::opt<bool> Sections; 39 extern llvm::cl::opt<bool> SectionRelocations; 40 extern llvm::cl::opt<bool> SectionSymbols; 41 extern llvm::cl::opt<bool> SectionData; 42 extern llvm::cl::opt<bool> Relocations; 43 extern llvm::cl::opt<bool> Symbols; 44 extern llvm::cl::opt<bool> DynamicSymbols; 45 extern llvm::cl::opt<bool> UnwindInfo; 46 extern llvm::cl::opt<bool> ExpandRelocs; 47 extern llvm::cl::opt<bool> CodeView; 48 extern llvm::cl::opt<bool> CodeViewSubsectionBytes; 49 extern llvm::cl::opt<bool> ARMAttributes; 50 extern llvm::cl::opt<bool> MipsPLTGOT; 51 enum OutpytStyleTy { LLVM, GNU }; 52 extern llvm::cl::opt<OutpytStyleTy> Output; 53 } // namespace opts 54 55 #define LLVM_READOBJ_ENUM_ENT(ns, enum) \ 56 { #enum, ns::enum } 57 58 #define LLVM_READOBJ_ENUM_CLASS_ENT(enum_class, enum) \ 59 { #enum, std::underlying_type<enum_class>::type(enum_class::enum) } 60 61 #endif 62