summaryrefslogtreecommitdiffstats
path: root/lld/unittests/DriverTests/WinLinkDriverTest.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-03-14 05:59:16 +0000
committerRui Ueyama <ruiu@google.com>2014-03-14 05:59:16 +0000
commitaca3c7c6f4f27ac30b1e9e892c0b99311edd04cd (patch)
tree46043cb09f7b5bca1000704713c9ead24e619e27 /lld/unittests/DriverTests/WinLinkDriverTest.cpp
parentebffa9b4be04c9fd9f48f2822a6c6a1601b6c4dd (diff)
downloadbcm5719-llvm-aca3c7c6f4f27ac30b1e9e892c0b99311edd04cd.tar.gz
bcm5719-llvm-aca3c7c6f4f27ac30b1e9e892c0b99311edd04cd.zip
[PECOFF] Fix link order.
LLD fails to link symbol "_main" if the symbol is in a library file and the library file is given as a bare argument (i.e. not with /defaultlib option). It's because library files given as bare arguments are processed before other libraries given with /defaultlib, so when Linker finds msvcrtd needs a definition for "_main", the file providing the main function has already been processed and skipped. Linker don't revisit libraries if it's not given with /defaultlib. To fix it this patch change the way of command line handling; files end with ".lib" are treated as if they are given with /defaultlib. I don't believe it's 100% correct behavior but it's better than before. llvm-svn: 203892
Diffstat (limited to 'lld/unittests/DriverTests/WinLinkDriverTest.cpp')
-rw-r--r--lld/unittests/DriverTests/WinLinkDriverTest.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
index a8218a844ff..0313a6ceff8 100644
--- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp
+++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
@@ -137,14 +137,13 @@ TEST_F(WinLinkParserTest, Libpath) {
//
TEST_F(WinLinkParserTest, InputOrder) {
- EXPECT_TRUE(parse("link.exe", "b.lib", "b.obj", "c.obj", "a.lib", "a.obj",
+ EXPECT_TRUE(parse("link.exe", "a.lib", "b.obj", "c.obj", "a.lib", "d.obj",
nullptr));
- EXPECT_EQ(6, inputFileCount());
+ EXPECT_EQ(4, inputFileCount());
EXPECT_EQ("b.obj", inputFile(0));
EXPECT_EQ("c.obj", inputFile(1));
- EXPECT_EQ("a.obj", inputFile(2));
- EXPECT_EQ("b.lib", inputFile(3));
- EXPECT_EQ("a.lib", inputFile(4));
+ EXPECT_EQ("d.obj", inputFile(2));
+ EXPECT_EQ("a.lib", inputFile(3, 0));
}
//
OpenPOWER on IntegriCloud