summaryrefslogtreecommitdiffstats
path: root/lld/unittests/DriverTests
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-07-23 00:57:57 +0000
committerRui Ueyama <ruiu@google.com>2014-07-23 00:57:57 +0000
commita27bb08e7380151e3ddea3eeff9d618fe25675f7 (patch)
tree1364844ba28e6f93da4712855f2666b845bbd7ae /lld/unittests/DriverTests
parent7e9808f7de23e0136d3c8b5dea7d31d745933454 (diff)
downloadbcm5719-llvm-a27bb08e7380151e3ddea3eeff9d618fe25675f7.tar.gz
bcm5719-llvm-a27bb08e7380151e3ddea3eeff9d618fe25675f7.zip
[PECOFF] Fix entry point functions selection
On Windows there are four "main" functions -- main, wmain, WinMain, or wWinMain. Their parameter types are diffferent. The standard library provides four different entry functions (i.e. {w,}{WinMain,main}CRTStartup) for them. You need to use the right entry routine for your "main" function. If you give an /entry option, the specified name is used unconditionally. Otherwise, the linker needs to select the right one based on user-supplied entry point function. This can be done after the linker reads all the input files. This patch moves the code to determine the entry point function from the driver to a virtual input file. It also implements the correct logic for the entry point function selection. llvm-svn: 213713
Diffstat (limited to 'lld/unittests/DriverTests')
-rw-r--r--lld/unittests/DriverTests/WinLinkDriverTest.cpp26
1 files changed, 1 insertions, 25 deletions
diff --git a/lld/unittests/DriverTests/WinLinkDriverTest.cpp b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
index 2246d82856e..2f74da790d4 100644
--- a/lld/unittests/DriverTests/WinLinkDriverTest.cpp
+++ b/lld/unittests/DriverTests/WinLinkDriverTest.cpp
@@ -38,7 +38,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _context.getSubsystem());
EXPECT_EQ(llvm::COFF::IMAGE_FILE_MACHINE_I386, _context.getMachineType());
EXPECT_EQ("a.exe", _context.outputPath());
- EXPECT_EQ("_start", _context.entrySymbolName());
+ EXPECT_EQ("start", _context.getEntrySymbolName());
EXPECT_EQ(4, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
EXPECT_EQ("b.obj", inputFile(1));
@@ -684,27 +684,3 @@ TEST_F(WinLinkParserTest, DashDash) {
EXPECT_EQ("b.obj", inputFile(1));
EXPECT_EQ("-c.obj", inputFile(2));
}
-
-//
-// Tests for entry symbol name.
-//
-
-TEST_F(WinLinkParserTest, DefEntryNameConsole) {
- EXPECT_TRUE(parse("link.exe", "/subsystem:console", "a.obj", nullptr));
- EXPECT_EQ("_mainCRTStartup", _context.entrySymbolName());
-}
-
-TEST_F(WinLinkParserTest, DefEntryNameWindows) {
- EXPECT_TRUE(parse("link.exe", "/subsystem:windows", "a.obj", nullptr));
- EXPECT_EQ("_WinMainCRTStartup", _context.entrySymbolName());
-}
-
-TEST_F(WinLinkParserTest, DefEntryNameDll32) {
- EXPECT_TRUE(parse("link.exe", "/dll", "/machine:x86", "a.obj", nullptr));
- EXPECT_EQ("__DllMainCRTStartup@12", _context.entrySymbolName());
-}
-
-TEST_F(WinLinkParserTest, DefEntryNameDll64) {
- EXPECT_TRUE(parse("link.exe", "/dll", "/machine:x64", "a.obj", nullptr));
- EXPECT_EQ("_DllMainCRTStartup", _context.entrySymbolName());
-}
OpenPOWER on IntegriCloud