[PECOFF] Move a utility function used in a pass to Pass.cpp.

The file currently has only one function. Function that is useful both for
IdataPass and EdataPass will be added to that file.

llvm-svn: 197140
This commit is contained in:
Rui Ueyama 2013-12-12 10:01:14 +00:00
parent b5e774eb2c
commit d68304eeee
4 changed files with 54 additions and 7 deletions

View File

@ -1,6 +1,7 @@
add_lld_library(lldPECOFF
IdataPass.cpp
PECOFFLinkingContext.cpp
Pass.cpp
ReaderCOFF.cpp
ReaderImportHeader.cpp
WriterPECOFF.cpp

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "IdataPass.h"
#include "Pass.h"
#include "lld/Core/File.h"
#include "lld/Core/Pass.h"
@ -23,13 +24,6 @@
namespace lld {
namespace pecoff {
static void addDir32NBReloc(COFFBaseDefinedAtom *atom, const Atom *target,
size_t offsetInAtom = 0) {
atom->addReference(std::unique_ptr<COFFReference>(new COFFReference(
target, offsetInAtom, llvm::COFF::IMAGE_REL_I386_DIR32NB)));
}
namespace idata {
IdataAtom::IdataAtom(Context &context, std::vector<uint8_t> data)

View File

@ -0,0 +1,28 @@
//===- lib/ReaderWriter/PECOFF/Pass.cpp -----------------------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "Atoms.h"
#include "Pass.h"
#include "lld/Core/File.h"
#include "llvm/Support/COFF.h"
namespace lld {
namespace pecoff {
void addDir32NBReloc(coff::COFFBaseDefinedAtom *atom, const Atom *target,
size_t offsetInAtom) {
std::unique_ptr<coff::COFFReference> ref(new coff::COFFReference(
target, offsetInAtom, llvm::COFF::IMAGE_REL_I386_DIR32NB));
atom->addReference(std::move(ref));
}
} // end namespace pecoff
} // end namespace lld

View File

@ -0,0 +1,24 @@
//===- lib/ReaderWriter/PECOFF/Pass.h -------------------------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_PE_COFF_PASS_H
#define LLD_READER_WRITER_PE_COFF_PASS_H
#include "Atoms.h"
namespace lld {
namespace pecoff {
void addDir32NBReloc(coff::COFFBaseDefinedAtom *atom, const Atom *target,
size_t offsetInAtom = 0);
} // namespace pecoff
} // namespace lld
#endif