summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-12-12 03:21:45 +0000
committerRui Ueyama <ruiu@google.com>2013-12-12 03:21:45 +0000
commitd3199fdd2ebf5787c6a69e1b0435a384818c1816 (patch)
tree211919bd4a22a6c5439c2cd53349874d20881e8a
parent4cf5a16117b8519ef38f1ea67d90f5ef3c4633f2 (diff)
downloadbcm5719-llvm-d3199fdd2ebf5787c6a69e1b0435a384818c1816.tar.gz
bcm5719-llvm-d3199fdd2ebf5787c6a69e1b0435a384818c1816.zip
[PECOFF] Parse /dll command line option.
llvm-svn: 197123
-rw-r--r--lld/include/lld/ReaderWriter/PECOFFLinkingContext.h2
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp8
-rw-r--r--lld/unittests/DriverTests/WinLinkDriverTest.cpp3
3 files changed, 12 insertions, 1 deletions
diff --git a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
index 7bd20988b61..bec8c70c8d9 100644
--- a/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/PECOFFLinkingContext.h
@@ -250,7 +250,7 @@ protected:
private:
// The start address for the program. The default value for the executable is
- // 0x400000, but can be altered using -base command line option.
+ // 0x400000, but can be altered using /base command line option.
uint64_t _baseAddress;
uint64_t _stackReserve;
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index 4403876f66c..26fc124dabc 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -679,6 +679,14 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
ctx.setBaseAddress(addr);
break;
+ case OPT_dll:
+ // Parse /dll command line option
+ ctx.setImageType(PECOFFLinkingContext::IMAGE_DLL);
+ // Default base address of a DLL is 0x10000000.
+ if (!parsedArgs->getLastArg(OPT_base))
+ ctx.setBaseAddress(0x10000000);
+ break;
+
case OPT_stack: {
// Parse /stack command line option
uint64_t reserve;
diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
index 95ed663f6c9..cb056246ce8 100644
--- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp
+++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
@@ -45,6 +45,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_TRUE(_context.getInputSearchPaths().empty());
// Unspecified flags will have default values.
+ EXPECT_EQ(PECOFFLinkingContext::IMAGE_EXE, _context.getImageType());
EXPECT_EQ(6, _context.getMinOSVersion().majorVersion);
EXPECT_EQ(0, _context.getMinOSVersion().minorVersion);
EXPECT_EQ(0x400000U, _context.getBaseAddress());
@@ -377,6 +378,8 @@ TEST_F(WinLinkParserTest, DisallowLib) {
TEST_F(WinLinkParserTest, NoEntry) {
EXPECT_TRUE(parse("link.exe", "/noentry", "/dll", "a.obj", nullptr));
+ EXPECT_EQ(PECOFFLinkingContext::IMAGE_DLL, _context.getImageType());
+ EXPECT_EQ(0x10000000U, _context.getBaseAddress());
EXPECT_EQ("", _context.entrySymbolName());
}
OpenPOWER on IntegriCloud