parent
7a963bf02c
commit
be34a9c24e
|
|
@ -1,47 +0,0 @@
|
|||
//===- lld/ReaderWriter/CoreLinkingContext.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_CORE_LINKER_CONTEXT_H
|
||||
#define LLD_READER_WRITER_CORE_LINKER_CONTEXT_H
|
||||
|
||||
#include "lld/Core/LinkingContext.h"
|
||||
#include "lld/Core/Reader.h"
|
||||
#include "lld/Core/Writer.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
||||
namespace lld {
|
||||
|
||||
class CoreLinkingContext : public LinkingContext {
|
||||
public:
|
||||
CoreLinkingContext();
|
||||
|
||||
enum {
|
||||
TEST_RELOC_CALL32 = 1,
|
||||
TEST_RELOC_PCREL32 = 2,
|
||||
TEST_RELOC_GOT_LOAD32 = 3,
|
||||
TEST_RELOC_GOT_USE32 = 4,
|
||||
TEST_RELOC_LEA32_WAS_GOT = 5,
|
||||
};
|
||||
|
||||
bool validateImpl(raw_ostream &diagnostics) override;
|
||||
void addPasses(PassManager &pm) override;
|
||||
|
||||
void addPassNamed(StringRef name) { _passNames.push_back(name); }
|
||||
|
||||
protected:
|
||||
Writer &writer() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Writer> _writer;
|
||||
std::vector<StringRef> _passNames;
|
||||
};
|
||||
|
||||
} // end namespace lld
|
||||
|
||||
#endif
|
||||
|
|
@ -6,7 +6,6 @@ if (MSVC)
|
|||
endif()
|
||||
|
||||
add_lld_library(lldReaderWriter
|
||||
CoreLinkingContext.cpp
|
||||
FileArchive.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
//===- lib/ReaderWriter/CoreLinkingContext.cpp ----------------------------===//
|
||||
//
|
||||
// The LLVM Linker
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "lld/Core/DefinedAtom.h"
|
||||
#include "lld/Core/File.h"
|
||||
#include "lld/Core/Pass.h"
|
||||
#include "lld/Core/PassManager.h"
|
||||
#include "lld/Core/Simple.h"
|
||||
#include "lld/ReaderWriter/CoreLinkingContext.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
||||
using namespace lld;
|
||||
|
||||
namespace {
|
||||
|
||||
class OrderPass : public Pass {
|
||||
public:
|
||||
/// Sorts atoms by position
|
||||
std::error_code perform(SimpleFile &file) override {
|
||||
SimpleFile::DefinedAtomRange defined = file.definedAtoms();
|
||||
std::sort(defined.begin(), defined.end(), DefinedAtom::compareByPosition);
|
||||
return std::error_code();
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
CoreLinkingContext::CoreLinkingContext() {}
|
||||
|
||||
bool CoreLinkingContext::validateImpl(raw_ostream &) {
|
||||
_writer = createWriterYAML(*this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CoreLinkingContext::addPasses(PassManager &pm) {
|
||||
for (StringRef name : _passNames) {
|
||||
(void)name;
|
||||
assert(name == "order" && "bad pass name");
|
||||
pm.add(llvm::make_unique<OrderPass>());
|
||||
}
|
||||
}
|
||||
|
||||
Writer &CoreLinkingContext::writer() const { return *_writer; }
|
||||
Loading…
Reference in New Issue