[PATCH] [lld][Core, Driver, ELF] Differentiate static and dynamic executables.

Shankar Kalpathi Easwaran shankarke at gmail.com
Mon Feb 11 18:47:09 PST 2013



================
Comment at: lib/Driver/Drivers.cpp:255
@@ +254,3 @@
+  StringRef outputType = args.getLastArgValue(core::OPT_output_type);
+  ret._outputKind = llvm::StringSwitch<OutputKind>(outputType)
+      .Case("static", OutputKind::StaticExecutable)
----------------
Does it make sense to add the NativeAtoms as one of the outputkind, or is there already one ?

================
Comment at: include/lld/Core/LinkerOptions.h:85-88
@@ -84,5 +84,6 @@
 
 enum OutputKind {
-  Executable,
+  StaticExecutable,
+  DynamicExecutable,
   Relocatable,
   Shared,
----------------
You might want to add a setOutputKind function too, for the linker to automatically set the option, when it figures out that a symbol was resolved from a shared library.

================
Comment at: lib/Driver/Drivers.cpp:260
@@ +259,3 @@
+      .Case("shared", OutputKind::Shared).Case("stubs", OutputKind::SharedStubs)
+      .Case("core", OutputKind::Core)
+      .Case("debug-symbols", OutputKind::DebugSymbols)
----------------
I dont think we need a Core output kind ?

================
Comment at: lib/ReaderWriter/ELF/X86_64/X86_64TargetInfo.cpp:287-292
@@ +286,8 @@
+      // Static code doesn't need PLTs.
+      const_cast<Reference &>(ref).setKind(R_X86_64_PC32);
+    // Handle IFUNC.
+    if (const DefinedAtom *da = dyn_cast_or_null<const DefinedAtom>(ref.target()))
+      if (da->contentType() == DefinedAtom::typeResolver)
+        return handleIFUNC(ref, da);
+    return error_code::success();
+  }
----------------
Indentation ?


http://llvm-reviews.chandlerc.com/D396



More information about the llvm-commits mailing list