[PATCH] [lld][PECOFF] Add WinLinkDriver and PECOFFTargetInfo.
Rui Ueyama
ruiu at google.com
Fri May 24 21:21:32 PDT 2013
Microsoft's PE and COFF spec says:
This specification describes the structure of executable (image) files and object files under the Windows family of operating systems. These files are referred to as Portable Executable (PE) and Common Object File Format (COFF) files, respectively.
http://msdn.microsoft.com/en-us/library/windows/hardware/gg463119.aspx
My understanding is PE is executable format and COFF is object file format. PE is actually an extension to COFF with a few additional headers, and sometimes referred to as PE/COFF. lld reads COFF object files and outputs PE (or PE/COFF) file, so reader is ReaderCOFF and writer is WriterPECOFF, I think.
================
Comment at: lib/Driver/WinLinkDriver.cpp:77-98
@@ +76,24 @@
+
+bool WinLinkDriver::parse(int argc, const char *argv[],
+ PECOFFTargetInfo &info, raw_ostream &diagnostics) {
+ // Arguments after "--" are interpreted as filenames even if they start with
+ // a hyphen or a slash. This is not compatible with link.exe but useful for
+ // us to test lld on Unix for testing.
+ int doubleDashPosition = findDoubleDash(argv);
+ int argEnd = (doubleDashPosition > 0) ? doubleDashPosition : argc;
+
+ // Parse command line options using WinLinkOptions.td
+ std::unique_ptr<llvm::opt::InputArgList> parsedArgs;
+ WinLinkOptTable table;
+ unsigned missingIndex;
+ unsigned missingCount;
+ parsedArgs.reset(
+ table.ParseArgs(&argv[1], &argv[argEnd], missingIndex, missingCount));
+ if (missingCount) {
+ diagnostics << "error: missing arg value for '"
+ << parsedArgs->getArgString(missingIndex) << "' expected "
+ << missingCount << " argument(s).\n";
+ return nullptr;
+ }
+
+ // Copy mllvm
----------------
Shankar Kalpathi Easwaran wrote:
> --help functionality is missing here.
Done.
================
Comment at: lib/ReaderWriter/PECOFF/PECOFFTargetInfo.cpp:35-43
@@ +34,11 @@
+
+ErrorOr<Reference::Kind>
+PECOFFTargetInfo::relocKindFromString(StringRef str) const {
+ return make_error_code(yaml_reader_error::illegal_value);
+}
+
+ErrorOr<std::string>
+PECOFFTargetInfo::stringFromRelocKind(Reference::Kind kind) const {
+ return make_error_code(yaml_reader_error::illegal_value);
+}
+
----------------
Shankar Kalpathi Easwaran wrote:
> no relocations ?
For now, yes. It's not capable of linking.
http://llvm-reviews.chandlerc.com/D865
BRANCH
coff
ARCANIST PROJECT
lld
More information about the llvm-commits
mailing list