[PATCH] D19226: [X86] enable PIE for functions

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 09:07:57 PDT 2016


rnk added a comment.

Minor issues, I think this is basically ready


================
Comment at: ../llvmOrg/lib/Target/X86/X86Subtarget.h:559
@@ +558,3 @@
+  /// for the current subtarget.
+  /// isFast - indicate fastLowerCall, ignore NonLazyBind attribute
+  unsigned char classifyGlobalFunctionReference(const GlobalValue *GV,
----------------
Changing fastLowerCall seems nice, it keeps the complexity of what FastISel does local to itself.

================
Comment at: ../llvmOrg/test/CodeGen/X86/pie.ll:7
@@ +6,3 @@
+; CHECK-LABEL:  bar:
+; CHECK:  call{{l|q}}  foo
+; CHECK:  call{{l|q}}  weak_odr_foo{{$}}
----------------
Should this be foo{{$}}?

================
Comment at: ../llvmOrg/test/CodeGen/X86/pie.ll:9
@@ +8,3 @@
+; CHECK:  call{{l|q}}  weak_odr_foo{{$}}
+; CHECK:  call{{l|q}}  weak_foo{{$}}
+; CHECK:  call{{l|q}}  internal_foo{{$}}
----------------
Interesting. I would've expected a PLT call for such weak functions so that they can be provided by libraries, but it seems you cannot override a non-ODR weak function from an executable with GCC.

GCC generates a direct, non-PLT call in non-PIE mode, and a PLT call with -fPIE. I'm guessing they just don't do this optimization yet.


Repository:
  rL LLVM

http://reviews.llvm.org/D19226





More information about the llvm-commits mailing list