Backport trunk patch for plumbing '--pic-veneer' for gold.

This patch is needed by Chromecast team, they need this to gold-link
ToT kernel. Hopefully, this be the last patch before binutils upgrade.

This absolutely should not affect prior testing results. It makes
--pic-vener a valid option under gold (the implementation has been
there long ago). And we don't have anypackage in chromeos land that
has this linker option on.

The original CL here -

    commit cdb061674c044636465e52a8c989b9011f2ec8ac
    Author: Han Shen <shenhan@google.com>
    Date:   Thu Jul 23 15:52:22 2015 -0700

        2015-07-23  Ian Coolidge  <icoolidge@google.com>

        Plumb --pic-veneer option for gold.

        gold/ChangeLog:
            * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub generation.
            * options.h (General_options): Add --pic-veneer option.

TEST=chromecast built kernel successfully
BUG=None

Change-Id: I5436f736d812d7807cd2df51cf005801ca33464f
Reviewed-on: https://chromium-review.googlesource.com/288287
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Han Shen <shenhan@chromium.org>
Tested-by: Han Shen <shenhan@chromium.org>
diff --git a/gold/ChangeLog b/gold/ChangeLog
index f9d973e..ea3f2d3 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,15 @@
+2015-07-23  Ian Coolidge  <icoolidge@google.com>
+
+       Plumb --pic-veneer option for gold.
+
+       This fixes ARM Linux gold link after
+       02e541d: ARM: 8323/1: force linker to use PIC veneers
+
+       gold/
+       * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
+       generation.
+       * options.h (General_options): Add --pic-veneer option.
+
 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
 
 	* aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
diff --git a/gold/arm.cc b/gold/arm.cc
index a7d9f5b..3433d10 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -4545,7 +4545,7 @@
   // This is a bit ugly but we want to avoid using a templated class for
   // big and little endianities.
   bool may_use_blx;
-  bool should_force_pic_veneer;
+  bool should_force_pic_veneer = parameters->options().pic_veneer();
   bool thumb2;
   bool thumb_only;
   if (parameters->target().is_big_endian())
@@ -4553,7 +4553,7 @@
       const Target_arm<true>* big_endian_target =
 	Target_arm<true>::default_target();
       may_use_blx = big_endian_target->may_use_v5t_interworking();
-      should_force_pic_veneer = big_endian_target->should_force_pic_veneer();
+      should_force_pic_veneer |= big_endian_target->should_force_pic_veneer();
       thumb2 = big_endian_target->using_thumb2();
       thumb_only = big_endian_target->using_thumb_only();
     }
@@ -4562,7 +4562,8 @@
       const Target_arm<false>* little_endian_target =
 	Target_arm<false>::default_target();
       may_use_blx = little_endian_target->may_use_v5t_interworking();
-      should_force_pic_veneer = little_endian_target->should_force_pic_veneer();
+      should_force_pic_veneer |=
+	little_endian_target->should_force_pic_veneer();
       thumb2 = little_endian_target->using_thumb2();
       thumb_only = little_endian_target->using_thumb_only();
     }
diff --git a/gold/options.h b/gold/options.h
index c9c8291..c1d99a6 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -994,6 +994,10 @@
 	      N_("Do not disable creation of position independent executable"
 		 " when data segment size is larger than the safe value"));
 
+  DEFINE_bool(pic_veneer, options::TWO_DASHES, '\0', false,
+	      N_("Force PIC sequences for ARM/Thumb interworking veneers"),
+	      NULL);
+
   DEFINE_bool(pipeline_knowledge, options::ONE_DASH, '\0', false,
 	      NULL, N_("(ARM only) Ignore for backward compatibility"));