diff options
author | Rui Ueyama <ruiu@google.com> | 2014-10-17 22:03:54 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2014-10-17 22:03:54 +0000 |
commit | 2845fb29d8ec227b2dedf83fa606eceaea443ccf (patch) | |
tree | e08f9754b29e54217a4d4556aa7ff59212a52296 /lld/lib/ReaderWriter/PECOFF/Pass.cpp | |
parent | 39e4bb3bc5fb4872eb1efeb14cf278ba76aaa7a4 (diff) | |
download | bcm5719-llvm-2845fb29d8ec227b2dedf83fa606eceaea443ccf.tar.gz bcm5719-llvm-2845fb29d8ec227b2dedf83fa606eceaea443ccf.zip |
[PECOFF] Emit x64 delay-import wrapper function
Previously we supported x86 only. This patch is to support x64.
The array of pointers to delay-loaded functions points the
DLL delay loading function at start-up. When a function is called
for the first time, the delay loading function gets called and
then rewrite the function pointer array.
llvm-svn: 220096
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/Pass.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/PECOFF/Pass.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/Pass.cpp b/lld/lib/ReaderWriter/PECOFF/Pass.cpp index 55c3ef8770e..255eebd90bf 100644 --- a/lld/lib/ReaderWriter/PECOFF/Pass.cpp +++ b/lld/lib/ReaderWriter/PECOFF/Pass.cpp @@ -23,6 +23,22 @@ static void addReloc(COFFBaseDefinedAtom *atom, const Atom *target, target, offsetInAtom, relType, arch)); } +void addDir64Reloc(COFFBaseDefinedAtom *atom, const Atom *target, + llvm::COFF::MachineTypes machine, size_t offsetInAtom) { + switch (machine) { + case llvm::COFF::IMAGE_FILE_MACHINE_I386: + addReloc(atom, target, offsetInAtom, Reference::KindArch::x86, + llvm::COFF::IMAGE_REL_I386_DIR32); + return; + case llvm::COFF::IMAGE_FILE_MACHINE_AMD64: + addReloc(atom, target, offsetInAtom, Reference::KindArch::x86_64, + llvm::COFF::IMAGE_REL_AMD64_ADDR64); + return; + default: + llvm_unreachable("unsupported machine type"); + } +} + void addDir32Reloc(COFFBaseDefinedAtom *atom, const Atom *target, llvm::COFF::MachineTypes machine, size_t offsetInAtom) { switch (machine) { |