[lld] r202217 - [PECOFF] Add a utility function to add DIR32 relocation.
Rui Ueyama
ruiu at google.com
Tue Feb 25 18:38:40 PST 2014
Author: ruiu
Date: Tue Feb 25 20:38:40 2014
New Revision: 202217
URL: http://llvm.org/viewvc/llvm-project?rev=202217&view=rev
Log:
[PECOFF] Add a utility function to add DIR32 relocation.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp
lld/trunk/lib/ReaderWriter/PECOFF/Pass.h
Modified: lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp?rev=202217&r1=202216&r2=202217&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/Pass.cpp Tue Feb 25 20:38:40 2014
@@ -16,13 +16,22 @@
namespace lld {
namespace pecoff {
+static void addReloc(COFFBaseDefinedAtom *atom, const Atom *target,
+ size_t offsetInAtom, Reference::KindValue relType) {
+ std::unique_ptr<COFFReference> ref(
+ new COFFReference(target, offsetInAtom, relType));
+ atom->addReference(std::move(ref));
+}
+
+void addDir32Reloc(COFFBaseDefinedAtom *atom, const Atom *target,
+ size_t offsetInAtom) {
+ addReloc(atom, target, offsetInAtom, llvm::COFF::IMAGE_REL_I386_DIR32);
+}
+
void addDir32NBReloc(COFFBaseDefinedAtom *atom, const Atom *target,
size_t offsetInAtom) {
- std::unique_ptr<COFFReference> ref(new COFFReference(
- target, offsetInAtom, llvm::COFF::IMAGE_REL_I386_DIR32NB));
- atom->addReference(std::move(ref));
+ addReloc(atom, target, offsetInAtom, llvm::COFF::IMAGE_REL_I386_DIR32NB);
}
} // end namespace pecoff
} // end namespace lld
-
Modified: lld/trunk/lib/ReaderWriter/PECOFF/Pass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/Pass.h?rev=202217&r1=202216&r2=202217&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/Pass.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/Pass.h Tue Feb 25 20:38:40 2014
@@ -15,6 +15,9 @@
namespace lld {
namespace pecoff {
+void addDir32Reloc(COFFBaseDefinedAtom *atom, const Atom *target,
+ size_t offsetInAtom = 0);
+
void addDir32NBReloc(COFFBaseDefinedAtom *atom, const Atom *target,
size_t offsetInAtom = 0);
More information about the llvm-commits
mailing list