[lld] r226133 - [PECOFF] Remove an InputElement placeholder for the entry name.
Rui Ueyama
ruiu at google.com
Wed Jan 14 22:56:26 PST 2015
Author: ruiu
Date: Thu Jan 15 00:56:26 2015
New Revision: 226133
URL: http://llvm.org/viewvc/llvm-project?rev=226133&view=rev
Log:
[PECOFF] Remove an InputElement placeholder for the entry name.
Modified:
lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=226133&r1=226132&r2=226133&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Thu Jan 15 00:56:26 2015
@@ -336,9 +336,6 @@ public:
virtual bool hasInputGraph() { return !!_inputGraph; }
- void setEntryNode(SimpleFileNode *node) { _entryNode = node; }
- SimpleFileNode *getEntryNode() const { return _entryNode; }
-
void addLibraryFile(std::unique_ptr<FileNode> file);
void setModuleDefinitionFile(const std::string val) {
@@ -462,9 +459,6 @@ private:
// Microsoft Windows." This feature was somewhat useful before Windows 95.
ArrayRef<uint8_t> _dosStub;
- // The node containing the entry point file.
- SimpleFileNode *_entryNode;
-
// Name of the temporary file for lib.exe subcommand. For debugging
// only.
std::string _moduleDefinitionFile;
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=226133&r1=226132&r2=226133&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Thu Jan 15 00:56:26 2015
@@ -1423,11 +1423,6 @@ bool WinLinkDriver::parse(int argc, cons
// Add the library group to the input graph.
if (!isReadingDirectiveSection) {
- // The container for the entry point file.
- std::unique_ptr<SimpleFileNode> entry(new SimpleFileNode("<entry>"));
- ctx.setEntryNode(entry.get());
- ctx.getInputGraph().addInputElement(std::move(entry));
-
// Add a group-end marker.
ctx.getInputGraph().addInputElement(llvm::make_unique<GroupEnd>(0));
}
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=226133&r1=226132&r2=226133&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Thu Jan 15 00:56:26 2015
@@ -106,6 +106,14 @@ void PECOFFLinkingContext::addLibraryFil
bool PECOFFLinkingContext::createImplicitFiles(
std::vector<std::unique_ptr<File>> &) {
+ pecoff::ResolvableSymbols* syms = getResolvableSymsFile();
+
+ // Create a file for the entry point function.
+ std::unique_ptr<SimpleFileNode> entry(new SimpleFileNode("<entry>"));
+ entry->appendInputFile(
+ llvm::make_unique<pecoff::EntryPointFile>(*this, syms));
+ getInputGraph().addInputElementFront(std::move(entry));
+
// Create a file for __ImageBase.
auto fileNode = llvm::make_unique<SimpleFileNode>("Implicit Files");
fileNode->appendInputFile(
@@ -118,17 +126,12 @@ bool PECOFFLinkingContext::createImplici
llvm::make_unique<pecoff::LocallyImportedSymbolFile>(*this));
getInputGraph().addInputElement(std::move(impFileNode));
- pecoff::ResolvableSymbols* syms = getResolvableSymsFile();
-
// Create a file for dllexported symbols.
auto exportNode = llvm::make_unique<SimpleFileNode>("<export>");
exportNode->appendInputFile(
llvm::make_unique<pecoff::ExportedSymbolRenameFile>(*this, syms));
addLibraryFile(std::move(exportNode));
- // Create a file for the entry point function.
- getEntryNode()->appendInputFile(
- llvm::make_unique<pecoff::EntryPointFile>(*this, syms));
return true;
}
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=226133&r1=226132&r2=226133&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Thu Jan 15 00:56:26 2015
@@ -37,7 +37,7 @@ TEST_F(WinLinkParserTest, Basic) {
EXPECT_EQ(llvm::COFF::IMAGE_FILE_MACHINE_I386, _context.getMachineType());
EXPECT_EQ("a.exe", _context.outputPath());
EXPECT_EQ("start", _context.getEntrySymbolName());
- EXPECT_EQ(5, inputFileCount());
+ EXPECT_EQ(4, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
EXPECT_EQ("b.obj", inputFile(1));
EXPECT_EQ("c.obj", inputFile(2));
@@ -77,7 +77,7 @@ TEST_F(WinLinkParserTest, StartsWithHyph
parse("link.exe", "-subsystem:console", "-out:a.exe", "a.obj", nullptr));
EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _context.getSubsystem());
EXPECT_EQ("a.exe", _context.outputPath());
- EXPECT_EQ(3, inputFileCount());
+ EXPECT_EQ(2, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
}
@@ -86,7 +86,7 @@ TEST_F(WinLinkParserTest, UppercaseOptio
parse("link.exe", "/SUBSYSTEM:CONSOLE", "/OUT:a.exe", "a.obj", nullptr));
EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _context.getSubsystem());
EXPECT_EQ("a.exe", _context.outputPath());
- EXPECT_EQ(3, inputFileCount());
+ EXPECT_EQ(2, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
}
@@ -109,7 +109,7 @@ TEST_F(WinLinkParserTest, NoInputFiles)
TEST_F(WinLinkParserTest, NoFileExtension) {
EXPECT_TRUE(parse("link.exe", "foo", "bar", nullptr));
EXPECT_EQ("foo.exe", _context.outputPath());
- EXPECT_EQ(4, inputFileCount());
+ EXPECT_EQ(3, inputFileCount());
EXPECT_EQ("foo.obj", inputFile(0));
EXPECT_EQ("bar.obj", inputFile(1));
}
@@ -117,7 +117,7 @@ TEST_F(WinLinkParserTest, NoFileExtensio
TEST_F(WinLinkParserTest, NonStandardFileExtension) {
EXPECT_TRUE(parse("link.exe", "foo.o", nullptr));
EXPECT_EQ("foo.exe", _context.outputPath());
- EXPECT_EQ(3, inputFileCount());
+ EXPECT_EQ(2, inputFileCount());
EXPECT_EQ("foo.o", inputFile(0));
}
@@ -137,11 +137,11 @@ TEST_F(WinLinkParserTest, Libpath) {
TEST_F(WinLinkParserTest, InputOrder) {
EXPECT_TRUE(parse("link.exe", "a.lib", "b.obj", "c.obj", "a.lib", "d.obj",
nullptr));
- EXPECT_EQ(6, inputFileCount());
+ EXPECT_EQ(5, inputFileCount());
EXPECT_EQ("b.obj", inputFile(0));
EXPECT_EQ("c.obj", inputFile(1));
EXPECT_EQ("d.obj", inputFile(2));
- EXPECT_EQ("a.lib", inputFile(4));
+ EXPECT_EQ("a.lib", inputFile(3));
}
//
@@ -393,42 +393,42 @@ TEST_F(WinLinkParserTest, SectionMultipl
TEST_F(WinLinkParserTest, DefaultLib) {
EXPECT_TRUE(parse("link.exe", "/defaultlib:user32.lib",
"/defaultlib:kernel32", "a.obj", nullptr));
- EXPECT_EQ(5, inputFileCount());
+ EXPECT_EQ(4, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
- EXPECT_EQ("user32.lib", inputFile(2));
- EXPECT_EQ("kernel32.lib", inputFile(3));
+ EXPECT_EQ("user32.lib", inputFile(1));
+ EXPECT_EQ("kernel32.lib", inputFile(2));
}
TEST_F(WinLinkParserTest, DefaultLibDuplicates) {
EXPECT_TRUE(parse("link.exe", "/defaultlib:user32.lib",
"/defaultlib:user32.lib", "a.obj", nullptr));
- EXPECT_EQ(4, inputFileCount());
+ EXPECT_EQ(3, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
- EXPECT_EQ("user32.lib", inputFile(2));
+ EXPECT_EQ("user32.lib", inputFile(1));
}
TEST_F(WinLinkParserTest, NoDefaultLib) {
EXPECT_TRUE(parse("link.exe", "/defaultlib:user32.lib",
"/defaultlib:kernel32", "/nodefaultlib:user32.lib", "a.obj",
nullptr));
- EXPECT_EQ(4, inputFileCount());
+ EXPECT_EQ(3, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
- EXPECT_EQ("kernel32.lib", inputFile(2));
+ EXPECT_EQ("kernel32.lib", inputFile(1));
}
TEST_F(WinLinkParserTest, NoDefaultLibCase) {
EXPECT_TRUE(parse("link.exe", "/defaultlib:user32",
"/defaultlib:kernel32", "/nodefaultlib:USER32.LIB", "a.obj",
nullptr));
- EXPECT_EQ(4, inputFileCount());
+ EXPECT_EQ(3, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
- EXPECT_EQ("kernel32.lib", inputFile(2));
+ EXPECT_EQ("kernel32.lib", inputFile(1));
}
TEST_F(WinLinkParserTest, NoDefaultLibAll) {
EXPECT_TRUE(parse("link.exe", "/defaultlib:user32.lib",
"/defaultlib:kernel32", "/nodefaultlib", "a.obj", nullptr));
- EXPECT_EQ(3, inputFileCount());
+ EXPECT_EQ(2, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
}
@@ -436,9 +436,9 @@ TEST_F(WinLinkParserTest, DisallowLib) {
EXPECT_TRUE(parse("link.exe", "/defaultlib:user32.lib",
"/defaultlib:kernel32", "/disallowlib:user32.lib", "a.obj",
nullptr));
- EXPECT_EQ(4, inputFileCount());
+ EXPECT_EQ(3, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
- EXPECT_EQ("kernel32.lib", inputFile(2));
+ EXPECT_EQ("kernel32.lib", inputFile(1));
}
//
@@ -704,7 +704,7 @@ TEST_F(WinLinkParserTest, Ignore) {
"/safeseh:no", "/functionpadmin", "/maxilksize:1024",
"a.obj", nullptr));
EXPECT_EQ("", errorMessage());
- EXPECT_EQ(3, inputFileCount());
+ EXPECT_EQ(2, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
}
@@ -717,7 +717,7 @@ TEST_F(WinLinkParserTest, DashDash) {
"--", "b.obj", "-c.obj", nullptr));
EXPECT_EQ(llvm::COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI, _context.getSubsystem());
EXPECT_EQ("a.exe", _context.outputPath());
- EXPECT_EQ(5, inputFileCount());
+ EXPECT_EQ(4, inputFileCount());
EXPECT_EQ("a.obj", inputFile(0));
EXPECT_EQ("b.obj", inputFile(1));
EXPECT_EQ("-c.obj", inputFile(2));
More information about the llvm-commits
mailing list