llvm-objdump: don't print relocations in non-relocatable files.
[oota-llvm.git] / include / llvm / Object / ELFObjectFile.h
index 0ca4c7cb1733ac9979dd94c1d748b57a412cfa62..8a9e12576558005f3393526c15005ac8e4d9b2d7 100644 (file)
@@ -224,6 +224,8 @@ public:
 
   std::pair<symbol_iterator, symbol_iterator>
   getELFDynamicSymbolIterators() const override;
+
+  bool isRelocatableObject() const override;
 };
 
 // Use an alignment of 2 for the typedefs since that is the worst case for
@@ -945,6 +947,10 @@ ELFObjectFile<ELFT>::getELFDynamicSymbolIterators() const {
   return std::make_pair(dynamic_symbol_begin(), dynamic_symbol_end());
 }
 
+template <class ELFT> bool ELFObjectFile<ELFT>::isRelocatableObject() const {
+  return EF.getHeader()->e_type == ELF::ET_REL;
+}
+
 inline std::error_code getELFRelocationAddend(const RelocationRef R,
                                               int64_t &Addend) {
   const ObjectFile *Obj = R.getObjectFile();