diff options
author | Rui Ueyama <ruiu@google.com> | 2014-04-06 21:15:05 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2014-04-06 21:15:05 +0000 |
commit | c141c8c59ad90c0ca4e65294e85dea2f3074bf4d (patch) | |
tree | 682eaa90b8daf157fccb8418083c4a62d76822c9 /lld/unittests/DriverTests | |
parent | 2f5d6ae73fa4b810be69b2b6e421600d0872be43 (diff) | |
download | bcm5719-llvm-c141c8c59ad90c0ca4e65294e85dea2f3074bf4d.tar.gz bcm5719-llvm-c141c8c59ad90c0ca4e65294e85dea2f3074bf4d.zip |
[ELF] Fix driver bug.
GNU LD-comptaible driver wrongly requires a space after '=' for a few
options such as "-init=<symbol>" or "-entry=<symbol>". This patch is
to fix that bug and add a few tests for it.
llvm-svn: 205693
Diffstat (limited to 'lld/unittests/DriverTests')
-rw-r--r-- | lld/unittests/DriverTests/GnuLdDriverTest.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lld/unittests/DriverTests/GnuLdDriverTest.cpp b/lld/unittests/DriverTests/GnuLdDriverTest.cpp index 3e01a032a16..f1b63904e62 100644 --- a/lld/unittests/DriverTests/GnuLdDriverTest.cpp +++ b/lld/unittests/DriverTests/GnuLdDriverTest.cpp @@ -40,6 +40,43 @@ TEST_F(GnuLdParserTest, Empty) { EXPECT_EQ("No input files\n", errorMessage()); } +// --entry + +TEST_F(GnuLdParserTest, Entry) { + EXPECT_TRUE(parse("ld", "--start-group", "--end-group", "--entry", "foo", + nullptr)); + EXPECT_EQ("foo", _context->entrySymbolName()); +} + +TEST_F(GnuLdParserTest, EntryShort) { + EXPECT_TRUE(parse("ld", "--start-group", "--end-group", "-e", "foo", + nullptr)); + EXPECT_EQ("foo", _context->entrySymbolName()); +} + +TEST_F(GnuLdParserTest, EntryJoined) { + EXPECT_TRUE(parse("ld", "--start-group", "--end-group", "--entry=foo", + nullptr)); + EXPECT_EQ("foo", _context->entrySymbolName()); +} + +// --init + +TEST_F(GnuLdParserTest, Init) { + EXPECT_TRUE(parse("ld", "--start-group", "--end-group", "-init", "foo", + "-init", "bar", nullptr)); + EXPECT_EQ(2, _context->initFunctions().size()); + EXPECT_EQ("foo", _context->initFunctions()[0]); + EXPECT_EQ("bar", _context->initFunctions()[1]); +} + +TEST_F(GnuLdParserTest, InitJoined) { + EXPECT_TRUE(parse("ld", "--start-group", "--end-group", "-init=foo", + nullptr)); + EXPECT_EQ(1, _context->initFunctions().size()); + EXPECT_EQ("foo", _context->initFunctions()[0]); +} + // --soname TEST_F(GnuLdParserTest, SOName) { |