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

Michael Spencer bigcheesegs at gmail.com
Wed Feb 13 12:17:47 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:
> Michael Spencer wrote:
> > 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.
> Linkers do operate this way. They dont have any default and the option changes as you are reading them.
> 
> See below :-
> 
> $gcc -c 1.c
> $ld 1.o
> $file a.out
> a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
> $ld 1.o /lib/libc.so.6
> $file a.out
> a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
> 
> There was no default, as soon as the linker saw that there was a shared library in the linkline, it made the final executable a dynamic executable versus a static one.
Hmm, I'll deal with this later.

================
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:
> Michael Spencer wrote:
> > Shankar Kalpathi Easwaran wrote:
> > > I dont think we need a Core output kind ?
> > No idea. It was in the list.
> I think we should add things that we are currently supporting and add new outputkinds when there is support. What do you think ?
This is an internal interface, so it doesn't really matter.


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



More information about the llvm-commits mailing list