diff options
author | Rui Ueyama <ruiu@google.com> | 2015-08-06 16:19:35 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-08-06 16:19:35 +0000 |
commit | 251b0e268bef44159ad6916b972ba9c74ce51384 (patch) | |
tree | 841faf6ee22c2de7a7faed3f9dd81cd33f691d62 /lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp | |
parent | f77e909f0a19ffd3223e1afef14c4afa5959197a (diff) | |
download | bcm5719-llvm-251b0e268bef44159ad6916b972ba9c74ce51384.tar.gz bcm5719-llvm-251b0e268bef44159ad6916b972ba9c74ce51384.zip |
COFF: Remove the old COFF linker and make link an alias to link2.
It's time to remove old COFF linker because the new one is now complete.
llvm-svn: 244226
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp deleted file mode 100644 index a67416d82ae..00000000000 --- a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//===- lib/ReaderWriter/PECOFF/LoadConfigPass.cpp -------------------------===// -// -// The LLVM Linker -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// A Load Configuration is a data structure for x86 containing an address of the -// SEH handler table. The Data Directory in the file header points to a load -// configuration. Technically that indirection is not needed but exists for -// historical reasons. -// -// If the file being handled has .sxdata section containing SEH handler table, -// this pass will create a Load Configuration atom. -// -//===----------------------------------------------------------------------===// - -#include "Pass.h" -#include "LoadConfigPass.h" -#include "lld/Core/File.h" -#include "lld/Core/Pass.h" -#include "lld/Core/Simple.h" -#include "llvm/Object/COFF.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/Path.h" -#include <climits> -#include <ctime> -#include <utility> - -using llvm::object::coff_load_configuration32; - -namespace lld { -namespace pecoff { -namespace loadcfg { - -LoadConfigAtom::LoadConfigAtom(VirtualFile &file, const DefinedAtom *sxdata, - int count) - : COFFLinkerInternalAtom( - file, file.getNextOrdinal(), - std::vector<uint8_t>(sizeof(coff_load_configuration32))) { - addDir32Reloc( - this, sxdata, llvm::COFF::IMAGE_FILE_MACHINE_I386, - offsetof(llvm::object::coff_load_configuration32, SEHandlerTable)); - auto *data = getContents<llvm::object::coff_load_configuration32>(); - data->SEHandlerCount = count; -} - -} // namespace loadcfg - -std::error_code LoadConfigPass::perform(SimpleFile &file) { - if (_ctx.noSEH()) - return std::error_code(); - - // Find the first atom in .sxdata section. - const DefinedAtom *sxdata = nullptr; - int sectionSize = 0; - for (const DefinedAtom *atom : file.defined()) { - if (atom->customSectionName() == ".sxdata") { - if (!sxdata) - sxdata = atom; - sectionSize += sxdata->size(); - } - } - if (!sxdata) - return std::error_code(); - - auto *loadcfg = new (_alloc) - loadcfg::LoadConfigAtom(_file, sxdata, sectionSize / sizeof(uint32_t)); - file.addAtom(*loadcfg); - - return std::error_code(); -} - -} // namespace pecoff -} // namespace lld |