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

Alexey Volkov avolkov.intel at gmail.com
Fri Jan 31 05:03:58 PST 2014


Hi rafael.espindola,

With this patch I introduced new gold plugin option "relocation-pic".
This option sets PIC dynamic model for generated code.
This mode is needed for executables on Android.

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

Files:
  tools/gold/gold-plugin.cpp

Index: tools/gold/gold-plugin.cpp
===================================================================
--- tools/gold/gold-plugin.cpp
+++ tools/gold/gold-plugin.cpp
@@ -80,6 +80,7 @@
   static std::string extra_library_path;
   static std::string triple;
   static std::string mcpu;
+  static bool relocation_pic = false;
   // Additional options to pass into the code generator.
   // Note: This array will contain all plugin options which are not claimed
   // as plugin exclusive to pass to the code generator.
@@ -101,6 +102,8 @@
       extra_library_path = opt.substr(strlen("extra_library_path="));
     } else if (opt.startswith("mtriple=")) {
       triple = opt.substr(strlen("mtriple="));
+    } else if (opt == "relocation-pic") {
+      relocation_pic = true;
     } else if (opt.startswith("obj-path=")) {
       obj_path = opt.substr(strlen("obj-path="));
     } else if (opt == "emit-llvm") {
@@ -412,6 +415,8 @@
   if (options::generate_api_file)
     api_file.close();
 
+  if (options::relocation_pic)
+    output_type = LTO_CODEGEN_PIC_MODEL_DYNAMIC;
   lto_codegen_set_pic_model(code_gen, output_type);
   lto_codegen_set_debug_model(code_gen, LTO_DEBUG_MODEL_DWARF);
   if (!options::mcpu.empty())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2668.1.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140131/b07c6709/attachment.bin>


More information about the llvm-commits mailing list