[PATCH] [lld][Core, Driver, ELF] Differentiate static and dynamic executables.
Michael Spencer
bigcheesegs at gmail.com
Tue Feb 12 11:44:21 PST 2013
================
Comment at: include/lld/Core/LinkerOptions.h:85-88
@@ -84,5 +84,6 @@
enum OutputKind {
- Executable,
+ StaticExecutable,
+ DynamicExecutable,
Relocatable,
Shared,
----------------
Shankar Kalpathi Easwaran wrote:
> 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.
I don't know of any linker with this behavior. Also, it was very intentional that options are const everywhere. It complicates things a lot if options can change during the link.
================
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)
----------------
Shankar Kalpathi Easwaran wrote:
> Does it make sense to add the NativeAtoms as one of the outputkind, or is there already one ?
Eventually.
================
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)
----------------
Shankar Kalpathi Easwaran wrote:
> I dont think we need a Core output kind ?
No idea. It was in the list.
================
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();
+ }
----------------
Shankar Kalpathi Easwaran wrote:
> Indentation ?
The indentation is correct.
http://llvm-reviews.chandlerc.com/D396
More information about the llvm-commits
mailing list