[lld] r219344 - [PECOFF] Remember DLL names given with /delayload option.
Rui Ueyama
ruiu at google.com
Wed Oct 8 14:38:11 PDT 2014
Author: ruiu
Date: Wed Oct 8 16:38:10 2014
New Revision: 219344
URL: http://llvm.org/viewvc/llvm-project?rev=219344&view=rev
Log:
[PECOFF] Remember DLL names given with /delayload option.
This is a step toward full support of /delayload.
Modified:
lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=219344&r1=219343&r2=219344&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Wed Oct 8 16:38:10 2014
@@ -226,6 +226,13 @@ public:
void setOutputImportLibraryPath(const std::string &val) { _implib = val; }
std::string getOutputImportLibraryPath() const;
+ void addDelayLoadDLL(StringRef dll) {
+ _delayLoadDLLs.insert(dll.lower());
+ }
+ bool isDelayLoadDLL(StringRef dll) const {
+ return _delayLoadDLLs.count(dll.lower()) == 1;
+ }
+
StringRef getOutputSectionName(StringRef sectionName) const;
bool addSectionRenaming(raw_ostream &diagnostics,
StringRef from, StringRef to);
@@ -366,6 +373,9 @@ private:
// /IMPLIB command line option.
std::string _implib;
+ // /DELAYLOAD option.
+ std::set<std::string> _delayLoadDLLs;
+
// The set to store /nodefaultlib arguments.
std::set<std::string> _noDefaultLibs;
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=219344&r1=219343&r2=219344&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Wed Oct 8 16:38:10 2014
@@ -1226,6 +1226,7 @@ bool WinLinkDriver::parse(int argc, cons
break;
case OPT_delayload:
+ ctx.addDelayLoadDLL(inputArg->getValue());
ctx.addInitialUndefinedSymbol(
ctx.is64Bit() ? "__delayLoadHelper2" : "___delayLoadHelper2 at 8");
break;
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=219344&r1=219343&r2=219344&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Wed Oct 8 16:38:10 2014
@@ -452,6 +452,18 @@ TEST_F(WinLinkParserTest, NoEntryError)
}
//
+// Tests for DELAYLOAD.
+//
+
+TEST_F(WinLinkParserTest, DelayLoad) {
+ EXPECT_TRUE(parse("link.exe", "/delayload:abc.dll", "/delayload:def.dll",
+ "a.obj", nullptr));
+ EXPECT_TRUE(_context.isDelayLoadDLL("abc.dll"));
+ EXPECT_TRUE(_context.isDelayLoadDLL("DEF.DLL"));
+ EXPECT_FALSE(_context.isDelayLoadDLL("xyz.dll"));
+}
+
+//
// Tests for SEH.
//
@@ -671,7 +683,7 @@ TEST_F(WinLinkParserTest, Ignore) {
// compatibility with link.exe.
EXPECT_TRUE(parse("link.exe", "/nologo", "/errorreport:prompt",
"/incremental", "/incremental:no", "/delay:unload",
- "/disallowlib:foo", "/delayload:user32", "/pdb:foo",
+ "/disallowlib:foo", "/pdb:foo",
"/pdbaltpath:bar", "/verbose", "/verbose:icf", "/wx",
"/wx:no", "/tlbid:1", "/tlbout:foo", "/idlout:foo",
"/ignore:4000", "/ignoreidl", "/implib:foo", "/safeseh",
More information about the llvm-commits
mailing list