[llvm] r240610 - libObject/COFF: Add a function to get pointers to relocation entries.
Rui Ueyama
ruiu at google.com
Wed Jun 24 17:07:39 PDT 2015
Author: ruiu
Date: Wed Jun 24 19:07:39 2015
New Revision: 240610
URL: http://llvm.org/viewvc/llvm-project?rev=240610&view=rev
Log:
libObject/COFF: Add a function to get pointers to relocation entries.
Modified:
llvm/trunk/include/llvm/Object/COFF.h
llvm/trunk/lib/Object/COFFObjectFile.cpp
Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=240610&r1=240609&r2=240610&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Wed Jun 24 19:07:39 2015
@@ -757,6 +757,9 @@ public:
llvm_unreachable("null symbol table pointer!");
}
+ iterator_range<const coff_relocation *>
+ getRelocations(const coff_section *Sec) const;
+
std::error_code getSectionName(const coff_section *Sec, StringRef &Res) const;
uint64_t getSectionSize(const coff_section *Sec) const;
std::error_code getSectionContents(const coff_section *Sec,
Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=240610&r1=240609&r2=240610&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Wed Jun 24 19:07:39 2015
@@ -16,6 +16,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/COFF.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -1029,6 +1030,15 @@ COFFObjectFile::getCOFFRelocation(const
return toRel(Reloc.getRawDataRefImpl());
}
+iterator_range<const coff_relocation *>
+COFFObjectFile::getRelocations(const coff_section *Sec) const {
+ const coff_relocation *I = getFirstReloc(Sec, Data, base());
+ const coff_relocation *E = I;
+ if (I)
+ E += getNumberOfRelocations(Sec, Data, base());
+ return make_range(I, E);
+}
+
#define LLVM_COFF_SWITCH_RELOC_TYPE_NAME(reloc_type) \
case COFF::reloc_type: \
Res = #reloc_type; \
More information about the llvm-commits
mailing list