[PATCH] COFF: Read linker directives from bitcode files.

Peter Collingbourne peter at pcc.me.uk
Fri Jun 5 18:51:54 PDT 2015


================
Comment at: COFF/SymbolTable.cpp:44
@@ +43,3 @@
+std::error_code SymbolTable::addDirectives(StringRef Dir) {
+  if (!Dir.empty()) {
+    std::vector<std::unique_ptr<InputFile>> Libs;
----------------
ruiu wrote:
> I'd reverse the condition to return early.
Done

================
Comment at: COFF/SymbolTable.cpp:81
@@ -77,3 +80,3 @@
 
-  // TODO: Handle linker directives.
-  return std::error_code();
+  // Add any linker directives from the module flags metadata.
+  return addDirectives(File->getDirectives());
----------------
ruiu wrote:
> I'm wondering what kind of command line options compiled bitcode would actually contain. Is that /defaultlib option? Can you give me an example?
Yes, /defaultlib. For example, if I compile an empty translation unit with clang-cl, I'll see IR like this:

```
!llvm.module.flags = !{!0, !...}

!0 = !{i32 6, !"Linker Options", !1}
!1 = !{!2, !3}
!2 = !{!"/DEFAULTLIB:libcmt.lib"}
!3 = !{!"/DEFAULTLIB:oldnames.lib"}
```

http://reviews.llvm.org/D10285

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list