[PATCH] [ELF] Implement semantic action for ENTRY linker script command
Davide Italiano
davide at freebsd.org
Sat Jan 31 16:59:17 PST 2015
Hi rafaelauler, ruiu, Bigcheese,
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7319
Files:
lib/Driver/GnuLdDriver.cpp
unittests/DriverTests/GnuLdDriverTest.cpp
Index: lib/Driver/GnuLdDriver.cpp
===================================================================
--- lib/Driver/GnuLdDriver.cpp
+++ lib/Driver/GnuLdDriver.cpp
@@ -289,6 +289,8 @@
return ec;
if (auto *searchDir = dyn_cast<script::SearchDir>(c))
ctx.addSearchPath(searchDir->getSearchPath());
+ if (auto *entrySymbol = dyn_cast<script::Entry>(c))
+ ctx.setEntrySymbolName(entrySymbol->getEntryName());
}
return std::error_code();
}
Index: unittests/DriverTests/GnuLdDriverTest.cpp
===================================================================
--- unittests/DriverTests/GnuLdDriverTest.cpp
+++ unittests/DriverTests/GnuLdDriverTest.cpp
@@ -191,3 +191,16 @@
EXPECT_EQ((size_t)2, searchPaths.size());
EXPECT_EQ("/foo/bar", searchPaths[1]);
}
+
+TEST_F(GnuLdParserTest, LinkerScriptEntry) {
+ parse("ld", "a.o", nullptr);
+ std::unique_ptr<MemoryBuffer> mb = MemoryBuffer::getMemBuffer(
+ "ENTRY(blah)", "foo.so");
+ std::string s;
+ raw_string_ostream out(s);
+ std::error_code ec = GnuLdDriver::evalLinkerScript(
+ *_context, std::move(mb), out);
+ EXPECT_FALSE(ec);
+ StringRef entrySymbol = _context->entrySymbolName();
+ EXPECT_EQ("blah", entrySymbol);
+}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7319.19105.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150201/c7481b89/attachment.bin>
More information about the llvm-commits
mailing list