[PATCH] D13238: [ELF2] Add -Bstatic and -Bdynamic command line switches

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 08:34:41 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/Driver.cpp:92-102
@@ -90,2 +91,13 @@
 
+// Runs the linker script or adds the file to the symbol table
+// depending on its type.
+static void addInputFile(SymbolTable *Symtab, StringRef Path) {
+  MemoryBufferRef MB = openFile(Path);
+  if (isLinkerScript(MB))
+    // readLinkerScript may add files to the symbol table.
+    readLinkerScript(Symtab, MB);
+  else
+    Symtab->addFile(createFile(MB));
+}
+
 void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
----------------
Delete this.

================
Comment at: ELF/Driver.cpp:142-145
@@ +141,6 @@
+    case OPT_l:
+      addInputFile(&Symtab, searchLibrary(Arg->getValue()));
+      break;
+    case OPT_INPUT:
+      addInputFile(&Symtab, Arg->getValue());
+      break;
----------------
Sync after r249023 and use Driver::addFile() instead.

================
Comment at: ELF/Options.td:42-47
@@ -41,2 +41,8 @@
 
+def Bdynamic: Flag<["-"], "Bdynamic">,
+     HelpText<"Link against shared libraries">;
+
+def Bstatic: Flag<["-"], "Bstatic">,
+     HelpText<"Do not link against shared libraries">;
+
 def sysroot : Joined<["--"], "sysroot=">,
----------------
Sort them alphabetically.

================
Comment at: ELF/Options.td:52-61
@@ -45,7 +51,12 @@
 // Aliases
 def alias_L : Joined<["--"], "library-path=">, Alias<L>;
 def alias_discard_all: Flag<["-"], "x">, Alias<discard_all>;
 def alias_discard_locals: Flag<["-"], "X">, Alias<discard_locals>;
 def alias_entry : Separate<["-"], "e">, Alias<entry>;
 def alias_l : Joined<["--"], "library=">, Alias<l>;
+def alias_Bdynamic_dy: Flag<["-"], "dy">, Alias<Bdynamic>;
+def alias_Bdynamic_call_shared: Flag<["-"], "call_shared">, Alias<Bdynamic>;
+def alias_Bstatic_dn: Flag<["-"], "dn">, Alias<Bstatic>;
+def alias_Bstatic_non_shared: Flag<["-"], "non_shared">, Alias<Bstatic>;
+def alias_Bstatic_static: Flag<["-"], "static">, Alias<Bstatic>;
 
----------------
Ditto


http://reviews.llvm.org/D13238





More information about the llvm-commits mailing list