[PATCH] D18183: [ELF] - -pie/--pic-executable option implemented

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 11:23:44 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/Driver.cpp:150-151
@@ +149,4 @@
+      error("-shared and -pie may not be used together");
+    if (Config->Static)
+      error("-static and -pie may not be used together");
+  }
----------------
Why is -pie incompatible with -static?

================
Comment at: ELF/SymbolTable.cpp:21
@@ -20,2 +20,3 @@
 #include "Symbols.h"
+#include "Target.h"
 #include "llvm/Bitcode/ReaderWriter.h"
----------------
isPIO is a single line function. I don't think including the entire header file just for that function is a good idea.

================
Comment at: ELF/SymbolTable.cpp:127
@@ -124,3 +126,3 @@
   TargetOptions Options;
-  Reloc::Model R = Config->Shared ? Reloc::PIC_ : Reloc::Static;
+  Reloc::Model R = isPIO() ? Reloc::PIC_ : Reloc::Static;
   std::unique_ptr<TargetMachine> TM(
----------------
What does PIO stand for?

Anyways, I think this function is probably a bit too much. How about this: add Config->Pic and set it to true if either Config->Pie or Config->Shared.


http://reviews.llvm.org/D18183





More information about the llvm-commits mailing list