[PATCH] Introduce new gold plugin option "relocation-pic"

Alexey Volkov avolkov.intel at gmail.com
Mon Apr 28 08:24:26 PDT 2014


I updated patch with the comment and rebase it to current trunk.

http://reviews.llvm.org/D2668

Files:
  lib/Driver/Tools.cpp
  test/Driver/gold-lto.c

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -6915,7 +6915,10 @@
     ToolChain.getTriple().getEnvironment() == llvm::Triple::Android;
   const bool IsPIE =
     !Args.hasArg(options::OPT_shared) &&
-    (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
+    !Args.hasArg(options::OPT_static) &&
+    (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault() ||
+     // On Android every code is PIC so every executable is PIE
+     isAndroid);
 
   ArgStringList CmdArgs;
 
Index: test/Driver/gold-lto.c
===================================================================
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -19,3 +19,8 @@
 // CHECK-ARM-V7A: "-plugin" "{{.*}}/LLVMgold.so"
 // CHECK-ARM-V7A: "-plugin-opt=mcpu=cortex-a8"
 // CHECK-ARM-V7A: "-plugin-opt=foo"
+//
+// RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
+// RUN:     | FileCheck %s --check-prefix=CHECK-X86-ANDROID
+// CHECK-X86-ANDROID: "-pie"
+// CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2668.8890.patch
Type: text/x-patch
Size: 1111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140428/aad877e7/attachment.bin>


More information about the llvm-commits mailing list