LLVM API Documentation
00001 //===- ObjectFile.h - File format independent object file -------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares a file format independent ObjectFile class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_OBJECT_OBJECTFILE_H 00015 #define LLVM_OBJECT_OBJECTFILE_H 00016 00017 #include "llvm/ADT/StringRef.h" 00018 #include "llvm/Object/Binary.h" 00019 #include "llvm/Support/DataTypes.h" 00020 #include "llvm/Support/ErrorHandling.h" 00021 #include "llvm/Support/MemoryBuffer.h" 00022 #include <cstring> 00023 #include <vector> 00024 00025 namespace llvm { 00026 namespace object { 00027 00028 class ObjectFile; 00029 00030 union DataRefImpl { 00031 struct { 00032 // ELF needs this for relocations. This entire union should probably be a 00033 // char[max(8, sizeof(uintptr_t))] and require the impl to cast. 00034 uint16_t a, b; 00035 uint32_t c; 00036 } w; 00037 struct { 00038 uint32_t a, b; 00039 } d; 00040 uintptr_t p; 00041 DataRefImpl() { 00042 std::memset(this, 0, sizeof(DataRefImpl)); 00043 } 00044 }; 00045 00046 template<class content_type> 00047 class content_iterator { 00048 content_type Current; 00049 public: 00050 content_iterator(content_type symb) 00051 : Current(symb) {} 00052 00053 const content_type* operator->() const { 00054 return &Current; 00055 } 00056 00057 const content_type &operator*() const { 00058 return Current; 00059 } 00060 00061 bool operator==(const content_iterator &other) const { 00062 return Current == other.Current; 00063 } 00064 00065 bool operator!=(const content_iterator &other) const { 00066 return !(*this == other); 00067 } 00068 00069 content_iterator& increment(error_code &err) { 00070 content_type next; 00071 if (error_code ec = Current.getNext(next)) 00072 err = ec; 00073 else 00074 Current = next; 00075 return *this; 00076 } 00077 }; 00078 00079 inline bool operator==(const DataRefImpl &a, const DataRefImpl &b) { 00080 // Check bitwise identical. This is the only legal way to compare a union w/o 00081 // knowing which member is in use. 00082 return std::memcmp(&a, &b, sizeof(DataRefImpl)) == 0; 00083 } 00084 00085 inline bool operator<(const DataRefImpl &a, const DataRefImpl &b) { 00086 // Check bitwise identical. This is the only legal way to compare a union w/o 00087 // knowing which member is in use. 00088 return std::memcmp(&a, &b, sizeof(DataRefImpl)) < 0; 00089 } 00090 00091 class SymbolRef; 00092 00093 /// RelocationRef - This is a value type class that represents a single 00094 /// relocation in the list of relocations in the object file. 00095 class RelocationRef { 00096 DataRefImpl RelocationPimpl; 00097 const ObjectFile *OwningObject; 00098 00099 public: 00100 RelocationRef() : OwningObject(NULL) { } 00101 00102 RelocationRef(DataRefImpl RelocationP, const ObjectFile *Owner); 00103 00104 bool operator==(const RelocationRef &Other) const; 00105 00106 error_code getNext(RelocationRef &Result) const; 00107 00108 error_code getAddress(uint64_t &Result) const; 00109 error_code getOffset(uint64_t &Result) const; 00110 error_code getSymbol(SymbolRef &Result) const; 00111 error_code getType(uint64_t &Result) const; 00112 00113 /// @brief Indicates whether this relocation should hidden when listing 00114 /// relocations, usually because it is the trailing part of a multipart 00115 /// relocation that will be printed as part of the leading relocation. 00116 error_code getHidden(bool &Result) const; 00117 00118 /// @brief Get a string that represents the type of this relocation. 00119 /// 00120 /// This is for display purposes only. 00121 error_code getTypeName(SmallVectorImpl<char> &Result) const; 00122 00123 /// @brief Get a string that represents the calculation of the value of this 00124 /// relocation. 00125 /// 00126 /// This is for display purposes only. 00127 error_code getValueString(SmallVectorImpl<char> &Result) const; 00128 00129 DataRefImpl getRawDataRefImpl() const; 00130 const ObjectFile *getObjectFile() const; 00131 }; 00132 typedef content_iterator<RelocationRef> relocation_iterator; 00133 00134 /// SectionRef - This is a value type class that represents a single section in 00135 /// the list of sections in the object file. 00136 class SectionRef { 00137 friend class SymbolRef; 00138 DataRefImpl SectionPimpl; 00139 const ObjectFile *OwningObject; 00140 00141 public: 00142 SectionRef() : OwningObject(NULL) { } 00143 00144 SectionRef(DataRefImpl SectionP, const ObjectFile *Owner); 00145 00146 bool operator==(const SectionRef &Other) const; 00147 bool operator<(const SectionRef &Other) const; 00148 00149 error_code getNext(SectionRef &Result) const; 00150 00151 error_code getName(StringRef &Result) const; 00152 error_code getAddress(uint64_t &Result) const; 00153 error_code getSize(uint64_t &Result) const; 00154 error_code getContents(StringRef &Result) const; 00155 00156 /// @brief Get the alignment of this section as the actual value (not log 2). 00157 error_code getAlignment(uint64_t &Result) const; 00158 00159 // FIXME: Move to the normalization layer when it's created. 00160 error_code isText(bool &Result) const; 00161 error_code isData(bool &Result) const; 00162 error_code isBSS(bool &Result) const; 00163 error_code isRequiredForExecution(bool &Result) const; 00164 error_code isVirtual(bool &Result) const; 00165 error_code isZeroInit(bool &Result) const; 00166 error_code isReadOnlyData(bool &Result) const; 00167 00168 error_code containsSymbol(SymbolRef S, bool &Result) const; 00169 00170 relocation_iterator begin_relocations() const; 00171 relocation_iterator end_relocations() const; 00172 00173 DataRefImpl getRawDataRefImpl() const; 00174 }; 00175 typedef content_iterator<SectionRef> section_iterator; 00176 00177 /// SymbolRef - This is a value type class that represents a single symbol in 00178 /// the list of symbols in the object file. 00179 class SymbolRef { 00180 friend class SectionRef; 00181 DataRefImpl SymbolPimpl; 00182 const ObjectFile *OwningObject; 00183 00184 public: 00185 SymbolRef() : OwningObject(NULL) { } 00186 00187 enum Type { 00188 ST_Unknown, // Type not specified 00189 ST_Data, 00190 ST_Debug, 00191 ST_File, 00192 ST_Function, 00193 ST_Other 00194 }; 00195 00196 enum Flags { 00197 SF_None = 0, 00198 SF_Undefined = 1U << 0, // Symbol is defined in another object file 00199 SF_Global = 1U << 1, // Global symbol 00200 SF_Weak = 1U << 2, // Weak symbol 00201 SF_Absolute = 1U << 3, // Absolute symbol 00202 SF_ThreadLocal = 1U << 4, // Thread local symbol 00203 SF_Common = 1U << 5, // Symbol has common linkage 00204 SF_FormatSpecific = 1U << 31 // Specific to the object file format 00205 // (e.g. section symbols) 00206 }; 00207 00208 SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner); 00209 00210 bool operator==(const SymbolRef &Other) const; 00211 bool operator<(const SymbolRef &Other) const; 00212 00213 error_code getNext(SymbolRef &Result) const; 00214 00215 error_code getName(StringRef &Result) const; 00216 /// Returns the symbol virtual address (i.e. address at which it will be 00217 /// mapped). 00218 error_code getAddress(uint64_t &Result) const; 00219 error_code getFileOffset(uint64_t &Result) const; 00220 /// @brief Get the alignment of this symbol as the actual value (not log 2). 00221 error_code getAlignment(uint32_t &Result) const; 00222 error_code getSize(uint64_t &Result) const; 00223 error_code getType(SymbolRef::Type &Result) const; 00224 00225 /// Returns the ascii char that should be displayed in a symbol table dump via 00226 /// nm for this symbol. 00227 error_code getNMTypeChar(char &Result) const; 00228 00229 /// Get symbol flags (bitwise OR of SymbolRef::Flags) 00230 error_code getFlags(uint32_t &Result) const; 00231 00232 /// @brief Get section this symbol is defined in reference to. Result is 00233 /// end_sections() if it is undefined or is an absolute symbol. 00234 error_code getSection(section_iterator &Result) const; 00235 00236 /// @brief Get value of the symbol in the symbol table. 00237 error_code getValue(uint64_t &Val) const; 00238 00239 DataRefImpl getRawDataRefImpl() const; 00240 }; 00241 typedef content_iterator<SymbolRef> symbol_iterator; 00242 00243 /// LibraryRef - This is a value type class that represents a single library in 00244 /// the list of libraries needed by a shared or dynamic object. 00245 class LibraryRef { 00246 friend class SectionRef; 00247 DataRefImpl LibraryPimpl; 00248 const ObjectFile *OwningObject; 00249 00250 public: 00251 LibraryRef() : OwningObject(NULL) { } 00252 00253 LibraryRef(DataRefImpl LibraryP, const ObjectFile *Owner); 00254 00255 bool operator==(const LibraryRef &Other) const; 00256 bool operator<(const LibraryRef &Other) const; 00257 00258 error_code getNext(LibraryRef &Result) const; 00259 00260 // Get the path to this library, as stored in the object file. 00261 error_code getPath(StringRef &Result) const; 00262 00263 DataRefImpl getRawDataRefImpl() const; 00264 }; 00265 typedef content_iterator<LibraryRef> library_iterator; 00266 00267 const uint64_t UnknownAddressOrSize = ~0ULL; 00268 00269 /// ObjectFile - This class is the base class for all object file types. 00270 /// Concrete instances of this object are created by createObjectFile, which 00271 /// figures out which type to create. 00272 class ObjectFile : public Binary { 00273 virtual void anchor(); 00274 ObjectFile() LLVM_DELETED_FUNCTION; 00275 ObjectFile(const ObjectFile &other) LLVM_DELETED_FUNCTION; 00276 00277 protected: 00278 ObjectFile(unsigned int Type, MemoryBuffer *source); 00279 00280 const uint8_t *base() const { 00281 return reinterpret_cast<const uint8_t *>(Data->getBufferStart()); 00282 } 00283 00284 // These functions are for SymbolRef to call internally. The main goal of 00285 // this is to allow SymbolRef::SymbolPimpl to point directly to the symbol 00286 // entry in the memory mapped object file. SymbolPimpl cannot contain any 00287 // virtual functions because then it could not point into the memory mapped 00288 // file. 00289 // 00290 // Implementations assume that the DataRefImpl is valid and has not been 00291 // modified externally. It's UB otherwise. 00292 friend class SymbolRef; 00293 virtual error_code getSymbolNext(DataRefImpl Symb, SymbolRef &Res) const = 0; 00294 virtual error_code getSymbolName(DataRefImpl Symb, StringRef &Res) const = 0; 00295 virtual error_code getSymbolAddress(DataRefImpl Symb, uint64_t &Res) const = 0; 00296 virtual error_code getSymbolFileOffset(DataRefImpl Symb, uint64_t &Res)const=0; 00297 virtual error_code getSymbolAlignment(DataRefImpl Symb, uint32_t &Res) const; 00298 virtual error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const = 0; 00299 virtual error_code getSymbolType(DataRefImpl Symb, 00300 SymbolRef::Type &Res) const = 0; 00301 virtual error_code getSymbolNMTypeChar(DataRefImpl Symb, char &Res) const = 0; 00302 virtual error_code getSymbolFlags(DataRefImpl Symb, 00303 uint32_t &Res) const = 0; 00304 virtual error_code getSymbolSection(DataRefImpl Symb, 00305 section_iterator &Res) const = 0; 00306 virtual error_code getSymbolValue(DataRefImpl Symb, uint64_t &Val) const = 0; 00307 00308 // Same as above for SectionRef. 00309 friend class SectionRef; 00310 virtual error_code getSectionNext(DataRefImpl Sec, SectionRef &Res) const = 0; 00311 virtual error_code getSectionName(DataRefImpl Sec, StringRef &Res) const = 0; 00312 virtual error_code getSectionAddress(DataRefImpl Sec, uint64_t &Res) const =0; 00313 virtual error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const = 0; 00314 virtual error_code getSectionContents(DataRefImpl Sec, StringRef &Res)const=0; 00315 virtual error_code getSectionAlignment(DataRefImpl Sec, uint64_t &Res)const=0; 00316 virtual error_code isSectionText(DataRefImpl Sec, bool &Res) const = 0; 00317 virtual error_code isSectionData(DataRefImpl Sec, bool &Res) const = 0; 00318 virtual error_code isSectionBSS(DataRefImpl Sec, bool &Res) const = 0; 00319 virtual error_code isSectionRequiredForExecution(DataRefImpl Sec, 00320 bool &Res) const = 0; 00321 // A section is 'virtual' if its contents aren't present in the object image. 00322 virtual error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const = 0; 00323 virtual error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const = 0; 00324 virtual error_code isSectionReadOnlyData(DataRefImpl Sec, bool &Res) const =0; 00325 virtual error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb, 00326 bool &Result) const = 0; 00327 virtual relocation_iterator getSectionRelBegin(DataRefImpl Sec) const = 0; 00328 virtual relocation_iterator getSectionRelEnd(DataRefImpl Sec) const = 0; 00329 00330 00331 // Same as above for RelocationRef. 00332 friend class RelocationRef; 00333 virtual error_code getRelocationNext(DataRefImpl Rel, 00334 RelocationRef &Res) const = 0; 00335 virtual error_code getRelocationAddress(DataRefImpl Rel, 00336 uint64_t &Res) const =0; 00337 virtual error_code getRelocationOffset(DataRefImpl Rel, 00338 uint64_t &Res) const =0; 00339 virtual error_code getRelocationSymbol(DataRefImpl Rel, 00340 SymbolRef &Res) const = 0; 00341 virtual error_code getRelocationType(DataRefImpl Rel, 00342 uint64_t &Res) const = 0; 00343 virtual error_code getRelocationTypeName(DataRefImpl Rel, 00344 SmallVectorImpl<char> &Result) const = 0; 00345 virtual error_code getRelocationValueString(DataRefImpl Rel, 00346 SmallVectorImpl<char> &Result) const = 0; 00347 virtual error_code getRelocationHidden(DataRefImpl Rel, bool &Result) const { 00348 Result = false; 00349 return object_error::success; 00350 } 00351 00352 // Same for LibraryRef 00353 friend class LibraryRef; 00354 virtual error_code getLibraryNext(DataRefImpl Lib, LibraryRef &Res) const = 0; 00355 virtual error_code getLibraryPath(DataRefImpl Lib, StringRef &Res) const = 0; 00356 00357 public: 00358 00359 virtual symbol_iterator begin_symbols() const = 0; 00360 virtual symbol_iterator end_symbols() const = 0; 00361 00362 virtual symbol_iterator begin_dynamic_symbols() const = 0; 00363 virtual symbol_iterator end_dynamic_symbols() const = 0; 00364 00365 virtual section_iterator begin_sections() const = 0; 00366 virtual section_iterator end_sections() const = 0; 00367 00368 virtual library_iterator begin_libraries_needed() const = 0; 00369 virtual library_iterator end_libraries_needed() const = 0; 00370 00371 /// @brief The number of bytes used to represent an address in this object 00372 /// file format. 00373 virtual uint8_t getBytesInAddress() const = 0; 00374 00375 virtual StringRef getFileFormatName() const = 0; 00376 virtual /* Triple::ArchType */ unsigned getArch() const = 0; 00377 00378 /// For shared objects, returns the name which this object should be 00379 /// loaded from at runtime. This corresponds to DT_SONAME on ELF and 00380 /// LC_ID_DYLIB (install name) on MachO. 00381 virtual StringRef getLoadName() const = 0; 00382 00383 /// @returns Pointer to ObjectFile subclass to handle this type of object. 00384 /// @param ObjectPath The path to the object file. ObjectPath.isObject must 00385 /// return true. 00386 /// @brief Create ObjectFile from path. 00387 static ObjectFile *createObjectFile(StringRef ObjectPath); 00388 static ObjectFile *createObjectFile(MemoryBuffer *Object); 00389 00390 static inline bool classof(const Binary *v) { 00391 return v->isObject(); 00392 } 00393 00394 public: 00395 static ObjectFile *createCOFFObjectFile(MemoryBuffer *Object); 00396 static ObjectFile *createELFObjectFile(MemoryBuffer *Object); 00397 static ObjectFile *createMachOObjectFile(MemoryBuffer *Object); 00398 }; 00399 00400 // Inline function definitions. 00401 inline SymbolRef::SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner) 00402 : SymbolPimpl(SymbolP) 00403 , OwningObject(Owner) {} 00404 00405 inline bool SymbolRef::operator==(const SymbolRef &Other) const { 00406 return SymbolPimpl == Other.SymbolPimpl; 00407 } 00408 00409 inline bool SymbolRef::operator<(const SymbolRef &Other) const { 00410 return SymbolPimpl < Other.SymbolPimpl; 00411 } 00412 00413 inline error_code SymbolRef::getNext(SymbolRef &Result) const { 00414 return OwningObject->getSymbolNext(SymbolPimpl, Result); 00415 } 00416 00417 inline error_code SymbolRef::getName(StringRef &Result) const { 00418 return OwningObject->getSymbolName(SymbolPimpl, Result); 00419 } 00420 00421 inline error_code SymbolRef::getAddress(uint64_t &Result) const { 00422 return OwningObject->getSymbolAddress(SymbolPimpl, Result); 00423 } 00424 00425 inline error_code SymbolRef::getFileOffset(uint64_t &Result) const { 00426 return OwningObject->getSymbolFileOffset(SymbolPimpl, Result); 00427 } 00428 00429 inline error_code SymbolRef::getAlignment(uint32_t &Result) const { 00430 return OwningObject->getSymbolAlignment(SymbolPimpl, Result); 00431 } 00432 00433 inline error_code SymbolRef::getSize(uint64_t &Result) const { 00434 return OwningObject->getSymbolSize(SymbolPimpl, Result); 00435 } 00436 00437 inline error_code SymbolRef::getNMTypeChar(char &Result) const { 00438 return OwningObject->getSymbolNMTypeChar(SymbolPimpl, Result); 00439 } 00440 00441 inline error_code SymbolRef::getFlags(uint32_t &Result) const { 00442 return OwningObject->getSymbolFlags(SymbolPimpl, Result); 00443 } 00444 00445 inline error_code SymbolRef::getSection(section_iterator &Result) const { 00446 return OwningObject->getSymbolSection(SymbolPimpl, Result); 00447 } 00448 00449 inline error_code SymbolRef::getType(SymbolRef::Type &Result) const { 00450 return OwningObject->getSymbolType(SymbolPimpl, Result); 00451 } 00452 00453 inline error_code SymbolRef::getValue(uint64_t &Val) const { 00454 return OwningObject->getSymbolValue(SymbolPimpl, Val); 00455 } 00456 00457 inline DataRefImpl SymbolRef::getRawDataRefImpl() const { 00458 return SymbolPimpl; 00459 } 00460 00461 00462 /// SectionRef 00463 inline SectionRef::SectionRef(DataRefImpl SectionP, 00464 const ObjectFile *Owner) 00465 : SectionPimpl(SectionP) 00466 , OwningObject(Owner) {} 00467 00468 inline bool SectionRef::operator==(const SectionRef &Other) const { 00469 return SectionPimpl == Other.SectionPimpl; 00470 } 00471 00472 inline bool SectionRef::operator<(const SectionRef &Other) const { 00473 return SectionPimpl < Other.SectionPimpl; 00474 } 00475 00476 inline error_code SectionRef::getNext(SectionRef &Result) const { 00477 return OwningObject->getSectionNext(SectionPimpl, Result); 00478 } 00479 00480 inline error_code SectionRef::getName(StringRef &Result) const { 00481 return OwningObject->getSectionName(SectionPimpl, Result); 00482 } 00483 00484 inline error_code SectionRef::getAddress(uint64_t &Result) const { 00485 return OwningObject->getSectionAddress(SectionPimpl, Result); 00486 } 00487 00488 inline error_code SectionRef::getSize(uint64_t &Result) const { 00489 return OwningObject->getSectionSize(SectionPimpl, Result); 00490 } 00491 00492 inline error_code SectionRef::getContents(StringRef &Result) const { 00493 return OwningObject->getSectionContents(SectionPimpl, Result); 00494 } 00495 00496 inline error_code SectionRef::getAlignment(uint64_t &Result) const { 00497 return OwningObject->getSectionAlignment(SectionPimpl, Result); 00498 } 00499 00500 inline error_code SectionRef::isText(bool &Result) const { 00501 return OwningObject->isSectionText(SectionPimpl, Result); 00502 } 00503 00504 inline error_code SectionRef::isData(bool &Result) const { 00505 return OwningObject->isSectionData(SectionPimpl, Result); 00506 } 00507 00508 inline error_code SectionRef::isBSS(bool &Result) const { 00509 return OwningObject->isSectionBSS(SectionPimpl, Result); 00510 } 00511 00512 inline error_code SectionRef::isRequiredForExecution(bool &Result) const { 00513 return OwningObject->isSectionRequiredForExecution(SectionPimpl, Result); 00514 } 00515 00516 inline error_code SectionRef::isVirtual(bool &Result) const { 00517 return OwningObject->isSectionVirtual(SectionPimpl, Result); 00518 } 00519 00520 inline error_code SectionRef::isZeroInit(bool &Result) const { 00521 return OwningObject->isSectionZeroInit(SectionPimpl, Result); 00522 } 00523 00524 inline error_code SectionRef::isReadOnlyData(bool &Result) const { 00525 return OwningObject->isSectionReadOnlyData(SectionPimpl, Result); 00526 } 00527 00528 inline error_code SectionRef::containsSymbol(SymbolRef S, bool &Result) const { 00529 return OwningObject->sectionContainsSymbol(SectionPimpl, S.SymbolPimpl, 00530 Result); 00531 } 00532 00533 inline relocation_iterator SectionRef::begin_relocations() const { 00534 return OwningObject->getSectionRelBegin(SectionPimpl); 00535 } 00536 00537 inline relocation_iterator SectionRef::end_relocations() const { 00538 return OwningObject->getSectionRelEnd(SectionPimpl); 00539 } 00540 00541 inline DataRefImpl SectionRef::getRawDataRefImpl() const { 00542 return SectionPimpl; 00543 } 00544 00545 /// RelocationRef 00546 inline RelocationRef::RelocationRef(DataRefImpl RelocationP, 00547 const ObjectFile *Owner) 00548 : RelocationPimpl(RelocationP) 00549 , OwningObject(Owner) {} 00550 00551 inline bool RelocationRef::operator==(const RelocationRef &Other) const { 00552 return RelocationPimpl == Other.RelocationPimpl; 00553 } 00554 00555 inline error_code RelocationRef::getNext(RelocationRef &Result) const { 00556 return OwningObject->getRelocationNext(RelocationPimpl, Result); 00557 } 00558 00559 inline error_code RelocationRef::getAddress(uint64_t &Result) const { 00560 return OwningObject->getRelocationAddress(RelocationPimpl, Result); 00561 } 00562 00563 inline error_code RelocationRef::getOffset(uint64_t &Result) const { 00564 return OwningObject->getRelocationOffset(RelocationPimpl, Result); 00565 } 00566 00567 inline error_code RelocationRef::getSymbol(SymbolRef &Result) const { 00568 return OwningObject->getRelocationSymbol(RelocationPimpl, Result); 00569 } 00570 00571 inline error_code RelocationRef::getType(uint64_t &Result) const { 00572 return OwningObject->getRelocationType(RelocationPimpl, Result); 00573 } 00574 00575 inline error_code RelocationRef::getTypeName(SmallVectorImpl<char> &Result) 00576 const { 00577 return OwningObject->getRelocationTypeName(RelocationPimpl, Result); 00578 } 00579 00580 inline error_code RelocationRef::getValueString(SmallVectorImpl<char> &Result) 00581 const { 00582 return OwningObject->getRelocationValueString(RelocationPimpl, Result); 00583 } 00584 00585 inline error_code RelocationRef::getHidden(bool &Result) const { 00586 return OwningObject->getRelocationHidden(RelocationPimpl, Result); 00587 } 00588 00589 inline DataRefImpl RelocationRef::getRawDataRefImpl() const { 00590 return RelocationPimpl; 00591 } 00592 00593 inline const ObjectFile *RelocationRef::getObjectFile() const { 00594 return OwningObject; 00595 } 00596 00597 // Inline function definitions. 00598 inline LibraryRef::LibraryRef(DataRefImpl LibraryP, const ObjectFile *Owner) 00599 : LibraryPimpl(LibraryP) 00600 , OwningObject(Owner) {} 00601 00602 inline bool LibraryRef::operator==(const LibraryRef &Other) const { 00603 return LibraryPimpl == Other.LibraryPimpl; 00604 } 00605 00606 inline bool LibraryRef::operator<(const LibraryRef &Other) const { 00607 return LibraryPimpl < Other.LibraryPimpl; 00608 } 00609 00610 inline error_code LibraryRef::getNext(LibraryRef &Result) const { 00611 return OwningObject->getLibraryNext(LibraryPimpl, Result); 00612 } 00613 00614 inline error_code LibraryRef::getPath(StringRef &Result) const { 00615 return OwningObject->getLibraryPath(LibraryPimpl, Result); 00616 } 00617 00618 } // end namespace object 00619 } // end namespace llvm 00620 00621 #endif