[ELF] - -pie/--pic-executable option implemented

-pie
--pic-executable

Create a position independent executable.  This is currently only
 supported on ELF platforms.  Position independent executables are
 similar to shared libraries in that they are relocated by the
 dynamic linker to the virtual address the OS chooses for them
 (which can vary between invocations).  Like normal dynamically
 linked executables they can be executed and symbols defined in the
 executable cannot be overridden by shared libraries.

Differential revision: http://reviews.llvm.org/D18183

llvm-svn: 263693
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index a8b1f9b..377eed4 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -82,7 +82,7 @@
     return !Symtab.getSharedFiles().empty() && !Config->DynamicLinker.empty();
   }
   bool isOutputDynamic() const {
-    return !Symtab.getSharedFiles().empty() || Config->Shared;
+    return !Symtab.getSharedFiles().empty() || Config->Pic;
   }
 
   void ensureBss();
@@ -417,7 +417,7 @@
         continue;
       }
 
-      bool Dynrel = Config->Shared && !Target->isRelRelative(Type) &&
+      bool Dynrel = Config->Pic && !Target->isRelRelative(Type) &&
                     !Target->isSizeRel(Type);
       if (Preemptible || Dynrel) {
         uint32_t DynType;
@@ -466,8 +466,7 @@
     // We can however do better than just copying the incoming relocation. We
     // can process some of it and and just ask the dynamic linker to add the
     // load address.
-    if (!Config->Shared || Target->isRelRelative(Type) ||
-        Target->isSizeRel(Type))
+    if (!Config->Pic || Target->isRelRelative(Type) || Target->isSizeRel(Type))
       continue;
 
     uintX_t Addend = getAddend<ELFT>(RI);
@@ -1439,7 +1438,7 @@
 }
 
 static uint16_t getELFType() {
-  if (Config->Shared)
+  if (Config->Pic)
     return ET_DYN;
   if (Config->Relocatable)
     return ET_REL;