Blame binutils-2.28-gold.patch

473d23a
diff -rup ../binutils-2.27/gold/aarch64.cc gold/aarch64.cc
473d23a
--- ../binutils-2.27/gold/aarch64.cc	2016-09-26 11:22:18.728811436 +0100
473d23a
+++ gold/aarch64.cc	2016-11-03 15:05:31.000000000 +0000
473d23a
@@ -6026,6 +6026,23 @@ Target_aarch64<size, big_endian>::Scan::
473d23a
       }
473d23a
       break;
473d23a
 
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G0:        // 263
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G0_NC:     // 264
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G1:        // 265
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G1_NC:     // 266
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G2:        // 267
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G2_NC:     // 268
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G3:        // 269
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G0:        // 270
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G1:        // 271
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G2:        // 272
473d23a
+      if (parameters->options().output_is_position_independent())
473d23a
+	{
473d23a
+	  gold_error(_("%s: unsupported reloc %u in pos independent link."),
473d23a
+		     object->name().c_str(), r_type);
473d23a
+	}
473d23a
+      break;
473d23a
+
473d23a
     case elfcpp::R_AARCH64_LD_PREL_LO19:        // 273
473d23a
     case elfcpp::R_AARCH64_ADR_PREL_LO21:       // 274
473d23a
     case elfcpp::R_AARCH64_ADR_PREL_PG_HI21:    // 275
473d23a
@@ -6311,6 +6328,23 @@ Target_aarch64<size, big_endian>::Scan::
473d23a
 	}
473d23a
       break;
473d23a
 
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G0:        // 263
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G0_NC:     // 264
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G1:        // 265
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G1_NC:     // 266
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G2:        // 267
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G2_NC:     // 268
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G3:        // 269
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G0:        // 270
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G1:        // 271
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G2:        // 272
473d23a
+      if (parameters->options().output_is_position_independent())
473d23a
+	{
473d23a
+	  gold_error(_("%s: unsupported reloc %u in pos independent link."),
473d23a
+		     object->name().c_str(), r_type);
473d23a
+	}
473d23a
+      break;
473d23a
+
473d23a
     case elfcpp::R_AARCH64_LD_PREL_LO19:        // 273
473d23a
     case elfcpp::R_AARCH64_ADR_PREL_LO21:       // 274
473d23a
     case elfcpp::R_AARCH64_ADR_PREL_PG_HI21:    // 275
473d23a
@@ -6993,6 +7027,23 @@ Target_aarch64<size, big_endian>::Reloca
473d23a
 	view, object, psymval, addend, address, reloc_property);
473d23a
       break;
473d23a
 
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G0:
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G0_NC:
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G1:
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G1_NC:
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G2:
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G2_NC:
473d23a
+    case elfcpp::R_AARCH64_MOVW_UABS_G3:
473d23a
+      reloc_status = Reloc::template rela_general<32>(
473d23a
+	view, object, psymval, addend, reloc_property);
473d23a
+      break;
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G0:
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G1:
473d23a
+    case elfcpp::R_AARCH64_MOVW_SABS_G2:
473d23a
+      reloc_status = Reloc::movnz(view, psymval->value(object, addend),
473d23a
+				  reloc_property);
473d23a
+      break;
473d23a
+
473d23a
     case elfcpp::R_AARCH64_LD_PREL_LO19:
473d23a
       reloc_status = Reloc::template pcrela_general<32>(
473d23a
 	  view, object, psymval, addend, address, reloc_property);
473d23a
@@ -8075,7 +8126,7 @@ Target_aarch64<size, big_endian>::is_err
473d23a
     typename elfcpp::Swap<32,big_endian>::Valtype insn2)
473d23a
 {
473d23a
   uint32_t rt;
473d23a
-  uint32_t rt2;
473d23a
+  uint32_t rt2 = 0;
473d23a
   uint32_t rn;
473d23a
   uint32_t rm;
473d23a
   uint32_t ra;
473d23a
diff -rup ../binutils-2.27/gold/aarch64-reloc.def gold/aarch64-reloc.def
473d23a
--- ../binutils-2.27/gold/aarch64-reloc.def	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/aarch64-reloc.def	2016-11-03 14:38:22.000000000 +0000
473d23a
@@ -43,6 +43,20 @@ ARD(PREL32                       , STATI
473d23a
 ARD(PREL16                       , STATIC ,  DATA       ,   Y,  -1,   15,16               ,    0,0  , Symbol::RELATIVE_REF ,                         DATA  )
473d23a
 // Above is from Table 4-6, Data relocations, 257-262.
473d23a
 
473d23a
+ARD(MOVW_UABS_G0                 , STATIC ,  AARCH64    ,   Y,   0,    0,16               ,    0,15 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+ARD(MOVW_UABS_G0_NC              , STATIC ,  AARCH64    ,   Y,   0,    0,0                ,    0,15 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+ARD(MOVW_UABS_G1                 , STATIC ,  AARCH64    ,   Y,   0,    0,32               ,   16,31 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+ARD(MOVW_UABS_G1_NC              , STATIC ,  AARCH64    ,   Y,   0,    0,0                ,   16,31 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+ARD(MOVW_UABS_G2                 , STATIC ,  AARCH64    ,   Y,   0,    0,48               ,   32,47 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+ARD(MOVW_UABS_G2_NC              , STATIC ,  AARCH64    ,   Y,   0,    0,0                ,   32,47 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+ARD(MOVW_UABS_G3                 , STATIC ,  AARCH64    ,   Y,   0,    0,0                ,   48,63 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+// Above is from Table 4-7, Group relocations to create a 16-, 32-, 48-, or 64-bit unsigned data value or address inline.
473d23a
+
473d23a
+ARD(MOVW_SABS_G0                 , STATIC ,  AARCH64    ,   Y,   0,   16,16               ,    0,15 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+ARD(MOVW_SABS_G1                 , STATIC ,  AARCH64    ,   Y,   0,   32,32               ,   16,31 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+ARD(MOVW_SABS_G2                 , STATIC ,  AARCH64    ,   Y,   0,   48,48               ,   32,47 , Symbol::ABSOLUTE_REF ,                         MOVW  )
473d23a
+// Above is from Table 4-8, Group relocations to create a 16, 32, 48, or 64 bit signed data or offset value inline.
473d23a
+
473d23a
 ARD(LD_PREL_LO19		 , STATIC ,  AARCH64    ,   Y,  -1,   20,20		  ,    2,20 , Symbol::RELATIVE_REF , 			     LDST  )
473d23a
 ARD(ADR_PREL_LO21		 , STATIC ,  AARCH64    ,   Y,  -1,   20,20		  ,    0,20 , Symbol::RELATIVE_REF , 			     ADR   )
473d23a
 ARD(ADR_PREL_PG_HI21             , STATIC ,  AARCH64    ,   Y,  -1,   32,32               ,   12,32 , Symbol::RELATIVE_REF ,                         ADRP  )
473d23a
diff -rup ../binutils-2.27/gold/aarch64-reloc-property.cc gold/aarch64-reloc-property.cc
473d23a
--- ../binutils-2.27/gold/aarch64-reloc-property.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/aarch64-reloc-property.cc	2016-11-03 15:05:32.000000000 +0000
473d23a
@@ -59,17 +59,51 @@ template<>
473d23a
 bool
473d23a
 rvalue_checkup<0, 0>(int64_t) { return true; }
473d23a
 
473d23a
+namespace
473d23a
+{
473d23a
+
473d23a
 template<int L, int U>
473d23a
-uint64_t
473d23a
-rvalue_bit_select(uint64_t x)
473d23a
+class Rvalue_bit_select_impl
473d23a
 {
473d23a
-  if (U == 63) return x >> L;
473d23a
-  return (x & (((uint64_t)1 << (U+1)) - 1)) >> L;
473d23a
-}
473d23a
+public:
473d23a
+  static uint64_t
473d23a
+  calc(uint64_t x)
473d23a
+  {
473d23a
+    return (x & ((1ULL << (U+1)) - 1)) >> L;
473d23a
+  }
473d23a
+};
473d23a
+
473d23a
+template<int L>
473d23a
+class Rvalue_bit_select_impl<L, 63>
473d23a
+{
473d23a
+public:
473d23a
+  static uint64_t
473d23a
+  calc(uint64_t x)
473d23a
+  {
473d23a
+    return x >> L;
473d23a
+  }
473d23a
+};
473d23a
 
473d23a
+// By our convention, L=U=0 means that the whole value should be retrieved.
473d23a
 template<>
473d23a
+class Rvalue_bit_select_impl<0, 0>
473d23a
+{
473d23a
+public:
473d23a
+  static uint64_t
473d23a
+  calc(uint64_t x)
473d23a
+  {
473d23a
+    return x;
473d23a
+  }
473d23a
+};
473d23a
+
473d23a
+} // End anonymous namespace.
473d23a
+
473d23a
+template<int L, int U>
473d23a
 uint64_t
473d23a
-rvalue_bit_select<0, 0>(uint64_t x) { return x; }
473d23a
+rvalue_bit_select(uint64_t x)
473d23a
+{
473d23a
+  return Rvalue_bit_select_impl<L, U>::calc(x);
473d23a
+}
473d23a
 
473d23a
 AArch64_reloc_property::AArch64_reloc_property(
473d23a
     unsigned int code,
473d23a
diff -rup ../binutils-2.27/gold/arm.cc gold/arm.cc
473d23a
--- ../binutils-2.27/gold/arm.cc	2016-09-26 11:22:18.629810833 +0100
473d23a
+++ gold/arm.cc	2016-11-03 15:05:33.000000000 +0000
473d23a
@@ -2128,8 +2128,36 @@ class Target_arm : public Sized_target<3
473d23a
       stub_tables_(), stub_factory_(Stub_factory::get_instance()),
473d23a
       should_force_pic_veneer_(false),
473d23a
       arm_input_section_map_(), attributes_section_data_(NULL),
473d23a
-      fix_cortex_a8_(false), cortex_a8_relocs_info_()
473d23a
-  { }
473d23a
+      fix_cortex_a8_(false), cortex_a8_relocs_info_(),
473d23a
+      target1_reloc_(elfcpp::R_ARM_ABS32),
473d23a
+      // This can be any reloc type but usually is R_ARM_GOT_PREL.
473d23a
+      target2_reloc_(elfcpp::R_ARM_GOT_PREL)
473d23a
+  {
473d23a
+    if (parameters->options().user_set_target1_rel())
473d23a
+      {
473d23a
+	// FIXME: This is not strictly compatible with ld, which allows both
473d23a
+	// --target1-abs and --target-rel to be given.
473d23a
+	if (parameters->options().user_set_target1_abs())
473d23a
+	  gold_error(_("Cannot use both --target1-abs and --target1-rel."));
473d23a
+	else
473d23a
+	  this->target1_reloc_ = elfcpp::R_ARM_REL32;
473d23a
+      }
473d23a
+    // We don't need to handle --target1-abs because target1_reloc_ is set
473d23a
+    // to elfcpp::R_ARM_ABS32 in the member initializer list.
473d23a
+
473d23a
+    if (parameters->options().user_set_target2())
473d23a
+      {
473d23a
+	const char* target2 = parameters->options().target2();
473d23a
+	if (strcmp(target2, "rel") == 0)
473d23a
+	  this->target2_reloc_ = elfcpp::R_ARM_REL32;
473d23a
+	else if (strcmp(target2, "abs") == 0)
473d23a
+	  this->target2_reloc_ = elfcpp::R_ARM_ABS32;
473d23a
+	else if (strcmp(target2, "got-rel") == 0)
473d23a
+	  this->target2_reloc_ = elfcpp::R_ARM_GOT_PREL;
473d23a
+	else
473d23a
+	  gold_unreachable();
473d23a
+      }
473d23a
+  }
473d23a
 
473d23a
   // Whether we force PCI branch veneers.
473d23a
   bool
473d23a
@@ -2391,8 +2419,8 @@ class Target_arm : public Sized_target<3
473d23a
   rel_irelative_section(Layout*);
473d23a
 
473d23a
   // Map platform-specific reloc types
473d23a
-  static unsigned int
473d23a
-  get_real_reloc_type(unsigned int r_type);
473d23a
+  unsigned int
473d23a
+  get_real_reloc_type(unsigned int r_type) const;
473d23a
 
473d23a
   //
473d23a
   // Methods to support stub-generations.
473d23a
@@ -3002,6 +3030,11 @@ class Target_arm : public Sized_target<3
473d23a
   bool fix_cortex_a8_;
473d23a
   // Map addresses to relocs for Cortex-A8 erratum.
473d23a
   Cortex_a8_relocs_info cortex_a8_relocs_info_;
473d23a
+  // What R_ARM_TARGET1 maps to. It can be R_ARM_REL32 or R_ARM_ABS32.
473d23a
+  unsigned int target1_reloc_;
473d23a
+  // What R_ARM_TARGET2 maps to. It should be one of R_ARM_REL32, R_ARM_ABS32
473d23a
+  // and R_ARM_GOT_PREL.
473d23a
+  unsigned int target2_reloc_;
473d23a
 };
473d23a
 
473d23a
 template<bool big_endian>
473d23a
@@ -6639,6 +6672,80 @@ Arm_relobj<big_endian>::do_relocate_sect
473d23a
 	      section_address,
473d23a
 	      section_size);
473d23a
 	}
473d23a
+	// BE8 swapping
473d23a
+	if (parameters->options().be8())
473d23a
+	  {
473d23a
+	    section_size_type  span_start, span_end;
473d23a
+	    elfcpp::Shdr<32, big_endian>
473d23a
+	      shdr(pshdrs + i * elfcpp::Elf_sizes<32>::shdr_size);
473d23a
+	    Mapping_symbol_position section_start(i, 0);
473d23a
+	    typename Mapping_symbols_info::const_iterator p =
473d23a
+	      this->mapping_symbols_info_.lower_bound(section_start);
473d23a
+	    unsigned char* view = (*pviews)[i].view;
473d23a
+	    Arm_address view_address = (*pviews)[i].address;
473d23a
+	    section_size_type view_size = (*pviews)[i].view_size;
473d23a
+	    while (p != this->mapping_symbols_info_.end()
473d23a
+		   && p->first.first == i)
473d23a
+	      {
473d23a
+		typename Mapping_symbols_info::const_iterator next =
473d23a
+		  this->mapping_symbols_info_.upper_bound(p->first);
473d23a
+
473d23a
+		// Only swap arm or thumb code.
473d23a
+		if ((p->second == 'a') || (p->second == 't'))
473d23a
+		  {
473d23a
+		    Output_section* os = this->output_section(i);
473d23a
+		    gold_assert(os != NULL);
473d23a
+		    Arm_address section_address =
473d23a
+		      this->simple_input_section_output_address(i, os);
473d23a
+		    span_start = convert_to_section_size_type(p->first.second);
473d23a
+		    if (next != this->mapping_symbols_info_.end()
473d23a
+		        && next->first.first == i)
473d23a
+		      span_end =
473d23a
+			convert_to_section_size_type(next->first.second);
473d23a
+		    else
473d23a
+		      span_end =
473d23a
+			convert_to_section_size_type(shdr.get_sh_size());
473d23a
+		    unsigned char* section_view =
473d23a
+		      view + (section_address - view_address);
473d23a
+		    uint64_t section_size = this->section_size(i);
473d23a
+
473d23a
+		    gold_assert(section_address >= view_address
473d23a
+				&& ((section_address + section_size)
473d23a
+				    <= (view_address + view_size)));
473d23a
+
473d23a
+		    // Set Output view for swapping
473d23a
+		    unsigned char *oview = section_view + span_start;
473d23a
+		    unsigned int index = 0;
473d23a
+		    if (p->second == 'a')
473d23a
+		      {
473d23a
+			while (index + 3 < (span_end - span_start))
473d23a
+			  {
473d23a
+			    typedef typename elfcpp::Swap<32, big_endian>
473d23a
+						     ::Valtype Valtype;
473d23a
+			    Valtype* wv =
473d23a
+			      reinterpret_cast<Valtype*>(oview+index);
473d23a
+			    uint32_t val = elfcpp::Swap<32, false>::readval(wv);
473d23a
+			    elfcpp::Swap<32, true>::writeval(wv, val);
473d23a
+			    index += 4;
473d23a
+			  }
473d23a
+		      }
473d23a
+		    else if (p->second == 't')
473d23a
+		      {
473d23a
+		        while (index + 1 < (span_end - span_start))
473d23a
+			  {
473d23a
+			    typedef typename elfcpp::Swap<16, big_endian>
473d23a
+						     ::Valtype Valtype;
473d23a
+			    Valtype* wv =
473d23a
+			      reinterpret_cast<Valtype*>(oview+index);
473d23a
+			    uint16_t val = elfcpp::Swap<16, false>::readval(wv);
473d23a
+			    elfcpp::Swap<16, true>::writeval(wv, val);
473d23a
+			    index += 2;
473d23a
+			   }
473d23a
+		      }
473d23a
+	          }
473d23a
+	        p = next;
473d23a
+	      }
473d23a
+	  }
473d23a
     }
473d23a
 }
473d23a
 
473d23a
@@ -7785,7 +7892,18 @@ Output_data_plt_arm_standard<big_endian>
473d23a
   const size_t num_first_plt_words = (sizeof(first_plt_entry)
473d23a
 				      / sizeof(first_plt_entry[0]));
473d23a
   for (size_t i = 0; i < num_first_plt_words - 1; i++)
473d23a
-    elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
473d23a
+    {
473d23a
+      if (parameters->options().be8())
473d23a
+	{
473d23a
+	  elfcpp::Swap<32, false>::writeval(pov + i * 4,
473d23a
+					    first_plt_entry[i]);
473d23a
+	}
473d23a
+      else
473d23a
+	{
473d23a
+	  elfcpp::Swap<32, big_endian>::writeval(pov + i * 4,
473d23a
+						 first_plt_entry[i]);
473d23a
+	}
473d23a
+    }
473d23a
   // Last word in first PLT entry is &GOT[0] - .
473d23a
   elfcpp::Swap<32, big_endian>::writeval(pov + 16,
473d23a
 					 got_address - (plt_address + 16));
473d23a
@@ -7846,11 +7964,21 @@ Output_data_plt_arm_short<big_endian>::d
473d23a
     gold_error(_("PLT offset too large, try linking with --long-plt"));
473d23a
 
473d23a
   uint32_t plt_insn0 = plt_entry[0] | ((offset >> 20) & 0xff);
473d23a
-  elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
473d23a
   uint32_t plt_insn1 = plt_entry[1] | ((offset >> 12) & 0xff);
473d23a
-  elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
473d23a
   uint32_t plt_insn2 = plt_entry[2] | (offset & 0xfff);
473d23a
-  elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
473d23a
+
473d23a
+  if (parameters->options().be8())
473d23a
+    {
473d23a
+      elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
473d23a
+      elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
473d23a
+      elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
473d23a
+    }
473d23a
+  else
473d23a
+    {
473d23a
+      elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
473d23a
+      elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
473d23a
+      elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
473d23a
+    }
473d23a
 }
473d23a
 
473d23a
 // This class generates long (16-byte) entries, for arbitrary displacements.
473d23a
@@ -7906,13 +8034,24 @@ Output_data_plt_arm_long<big_endian>::do
473d23a
 		    - (plt_address + plt_offset + 8));
473d23a
 
473d23a
   uint32_t plt_insn0 = plt_entry[0] | (offset >> 28);
473d23a
-  elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
473d23a
   uint32_t plt_insn1 = plt_entry[1] | ((offset >> 20) & 0xff);
473d23a
-  elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
473d23a
   uint32_t plt_insn2 = plt_entry[2] | ((offset >> 12) & 0xff);
473d23a
-  elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
473d23a
   uint32_t plt_insn3 = plt_entry[3] | (offset & 0xfff);
473d23a
-  elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
473d23a
+
473d23a
+  if (parameters->options().be8())
473d23a
+    {
473d23a
+      elfcpp::Swap<32, false>::writeval(pov, plt_insn0);
473d23a
+      elfcpp::Swap<32, false>::writeval(pov + 4, plt_insn1);
473d23a
+      elfcpp::Swap<32, false>::writeval(pov + 8, plt_insn2);
473d23a
+      elfcpp::Swap<32, false>::writeval(pov + 12, plt_insn3);
473d23a
+    }
473d23a
+  else
473d23a
+    {
473d23a
+      elfcpp::Swap<32, big_endian>::writeval(pov, plt_insn0);
473d23a
+      elfcpp::Swap<32, big_endian>::writeval(pov + 4, plt_insn1);
473d23a
+      elfcpp::Swap<32, big_endian>::writeval(pov + 8, plt_insn2);
473d23a
+      elfcpp::Swap<32, big_endian>::writeval(pov + 12, plt_insn3);
473d23a
+    }
473d23a
 }
473d23a
 
473d23a
 // Write out the PLT.  This uses the hand-coded instructions above,
473d23a
@@ -8414,7 +8553,7 @@ Target_arm<big_endian>::Scan::local(Symb
473d23a
   if (is_discarded)
473d23a
     return;
473d23a
 
473d23a
-  r_type = get_real_reloc_type(r_type);
473d23a
+  r_type = target->get_real_reloc_type(r_type);
473d23a
 
473d23a
   // A local STT_GNU_IFUNC symbol may require a PLT entry.
473d23a
   bool is_ifunc = lsym.get_st_type() == elfcpp::STT_GNU_IFUNC;
473d23a
@@ -8820,7 +8959,7 @@ Target_arm<big_endian>::Scan::global(Sym
473d23a
       && this->reloc_needs_plt_for_ifunc(object, r_type))
473d23a
     target->make_plt_entry(symtab, layout, gsym);
473d23a
 
473d23a
-  r_type = get_real_reloc_type(r_type);
473d23a
+  r_type = target->get_real_reloc_type(r_type);
473d23a
   switch (r_type)
473d23a
     {
473d23a
     case elfcpp::R_ARM_NONE:
473d23a
@@ -9446,7 +9585,7 @@ Target_arm<big_endian>::Relocate::reloca
473d23a
 
473d23a
   const elfcpp::Rel<32, big_endian> rel(preloc);
473d23a
   unsigned int r_type = elfcpp::elf_r_type<32>(rel.get_r_info());
473d23a
-  r_type = get_real_reloc_type(r_type);
473d23a
+  r_type = target->get_real_reloc_type(r_type);
473d23a
   const Arm_reloc_property* reloc_property =
473d23a
     arm_reloc_property_table->get_implemented_static_reloc_property(r_type);
473d23a
   if (reloc_property == NULL)
473d23a
@@ -10156,7 +10295,9 @@ Target_arm<big_endian>::Classify_reloc::
473d23a
     unsigned int r_type,
473d23a
     Relobj* object)
473d23a
 {
473d23a
-  r_type = get_real_reloc_type(r_type);
473d23a
+  Target_arm<big_endian>* arm_target =
473d23a
+      Target_arm<big_endian>::default_target();
473d23a
+  r_type = arm_target->get_real_reloc_type(r_type);
473d23a
   const Arm_reloc_property* arp =
473d23a
       arm_reloc_property_table->get_implemented_static_reloc_property(r_type);
473d23a
   if (arp != NULL)
473d23a
@@ -10580,17 +10721,15 @@ Target_arm<big_endian>::do_dynsym_value(
473d23a
 //
473d23a
 template<bool big_endian>
473d23a
 unsigned int
473d23a
-Target_arm<big_endian>::get_real_reloc_type(unsigned int r_type)
473d23a
+Target_arm<big_endian>::get_real_reloc_type(unsigned int r_type) const
473d23a
 {
473d23a
   switch (r_type)
473d23a
     {
473d23a
     case elfcpp::R_ARM_TARGET1:
473d23a
-      // This is either R_ARM_ABS32 or R_ARM_REL32;
473d23a
-      return elfcpp::R_ARM_ABS32;
473d23a
+      return this->target1_reloc_;
473d23a
 
473d23a
     case elfcpp::R_ARM_TARGET2:
473d23a
-      // This can be any reloc type but usually is R_ARM_GOT_PREL
473d23a
-      return elfcpp::R_ARM_GOT_PREL;
473d23a
+      return this->target2_reloc_;
473d23a
 
473d23a
     default:
473d23a
       return r_type;
473d23a
@@ -10683,7 +10822,14 @@ Target_arm<big_endian>::do_adjust_elf_he
473d23a
     e_ident[elfcpp::EI_OSABI] = 0;
473d23a
   e_ident[elfcpp::EI_ABIVERSION] = 0;
473d23a
 
473d23a
-  // FIXME: Do EF_ARM_BE8 adjustment.
473d23a
+  // Do EF_ARM_BE8 adjustment.
473d23a
+  if (parameters->options().be8() && !big_endian)
473d23a
+    gold_error("BE8 images only valid in big-endian mode.");
473d23a
+  if (parameters->options().be8())
473d23a
+    {
473d23a
+      flags |= elfcpp::EF_ARM_BE8;
473d23a
+      this->set_processor_specific_flags(flags);
473d23a
+    }
473d23a
 
473d23a
   // If we're working in EABI_VER5, set the hard/soft float ABI flags
473d23a
   // as appropriate.
473d23a
diff -rup ../binutils-2.27/gold/configure gold/configure
473d23a
--- ../binutils-2.27/gold/configure	2016-09-26 11:22:19.027813254 +0100
473d23a
+++ gold/configure	2016-11-03 14:38:22.000000000 +0000
473d23a
@@ -609,6 +609,7 @@ GOLD_LDFLAGS
473d23a
 WARN_CXXFLAGS
473d23a
 WARN_WRITE_STRINGS
473d23a
 NO_WERROR
473d23a
+WARN_CFLAGS_FOR_BUILD
473d23a
 WARN_CFLAGS
473d23a
 IFUNC_STATIC_FALSE
473d23a
 IFUNC_STATIC_TRUE
473d23a
@@ -6723,8 +6724,12 @@ fi
473d23a
 # Set the 'development' global.
473d23a
 . $srcdir/../bfd/development.sh
473d23a
 
473d23a
+# Set acp_cpp_for_build variable
473d23a
+ac_cpp_for_build="$CC_FOR_BUILD -E $CPPFLAGS_FOR_BUILD"
473d23a
+
473d23a
 # Default set of GCC warnings to enable.
473d23a
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
473d23a
+GCC_WARN_CFLAGS_FOR_BUILD="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
473d23a
 
473d23a
 # Add -Wshadow if the compiler is a sufficiently recent version of GCC.
473d23a
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
473d23a
@@ -6769,6 +6774,36 @@ fi
473d23a
 rm -f conftest*
473d23a
 
473d23a
 
473d23a
+# Verify CC_FOR_BUILD to be compatible with waring flags
473d23a
+
473d23a
+# Add -Wshadow if the compiler is a sufficiently recent version of GCC.
473d23a
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
473d23a
+/* end confdefs.h.  */
473d23a
+__GNUC__
473d23a
+_ACEOF
473d23a
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
473d23a
+  $EGREP "^[0-3]$" >/dev/null 2>&1; then :
473d23a
+
473d23a
+else
473d23a
+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wshadow"
473d23a
+fi
473d23a
+rm -f conftest*
473d23a
+
473d23a
+
473d23a
+# Add -Wstack-usage if the compiler is a sufficiently recent version of GCC.
473d23a
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
473d23a
+/* end confdefs.h.  */
473d23a
+__GNUC__
473d23a
+_ACEOF
473d23a
+if (eval "$ac_cpp_for_build conftest.$ac_ext") 2>&5 |
473d23a
+  $EGREP "^[0-4]$" >/dev/null 2>&1; then :
473d23a
+
473d23a
+else
473d23a
+  GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wstack-usage=262144"
473d23a
+fi
473d23a
+rm -f conftest*
473d23a
+
473d23a
+
473d23a
 # Check whether --enable-werror was given.
473d23a
 if test "${enable_werror+set}" = set; then :
473d23a
   enableval=$enable_werror; case "${enableval}" in
473d23a
@@ -6784,6 +6819,7 @@ case "${host}" in
473d23a
   *-*-mingw32*)
473d23a
     if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
473d23a
       GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
473d23a
+      GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Wno-format"
473d23a
     fi
473d23a
     ;;
473d23a
   *) ;;
473d23a
@@ -6797,25 +6833,32 @@ fi
473d23a
 NO_WERROR=
473d23a
 if test "${ERROR_ON_WARNING}" = yes ; then
473d23a
     GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
473d23a
+    GCC_WARN_CFLAGS_FOR_BUILD="$GCC_WARN_CFLAGS_FOR_BUILD -Werror"
473d23a
     NO_WERROR="-Wno-error"
473d23a
 fi
473d23a
 
473d23a
 if test "${GCC}" = yes ; then
473d23a
   WARN_CFLAGS="${GCC_WARN_CFLAGS}"
473d23a
+  WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}"
473d23a
 fi
473d23a
 
473d23a
 # Check whether --enable-build-warnings was given.
473d23a
 if test "${enable_build_warnings+set}" = set; then :
473d23a
   enableval=$enable_build_warnings; case "${enableval}" in
473d23a
-  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
473d23a
+  yes)	WARN_CFLAGS="${GCC_WARN_CFLAGS}"
473d23a
+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD}";;
473d23a
   no)	if test "${GCC}" = yes ; then
473d23a
 	  WARN_CFLAGS="-w"
473d23a
+      WARN_CFLAGS_FOR_BUILD="-w"
473d23a
 	fi;;
473d23a
   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
473d23a
-        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
473d23a
+        WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}"
473d23a
+        WARN_CFLAGS_FOR_BUILD="${GCC_WARN_CFLAGS_FOR_BUILD} ${t}";;
473d23a
   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
473d23a
-        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
473d23a
-  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
473d23a
+        WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}"
473d23a
+        WARN_CFLAGS_FOR_BUILD="${t} ${GCC_WARN_CFLAGS_FOR_BUILD}";;
473d23a
+  *)    WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`
473d23a
+        WARN_CFLAGS_FOR_BUILD=`echo "${enableval}" | sed -e "s/,/ /g"`;;
473d23a
 esac
473d23a
 fi
473d23a
 
473d23a
diff -rup ../binutils-2.27/gold/debug.h gold/debug.h
473d23a
--- ../binutils-2.27/gold/debug.h	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/debug.h	2016-11-03 15:05:05.000000000 +0000
473d23a
@@ -39,10 +39,11 @@ const int DEBUG_FILES = 0x4;
473d23a
 const int DEBUG_RELAXATION = 0x8;
473d23a
 const int DEBUG_INCREMENTAL = 0x10;
473d23a
 const int DEBUG_LOCATION = 0x20;
473d23a
+const int DEBUG_TARGET = 0x40;
473d23a
 
473d23a
 const int DEBUG_ALL = (DEBUG_TASK | DEBUG_SCRIPT | DEBUG_FILES
473d23a
 		       | DEBUG_RELAXATION | DEBUG_INCREMENTAL
473d23a
-		       | DEBUG_LOCATION);
473d23a
+		       | DEBUG_LOCATION | DEBUG_TARGET);
473d23a
 
473d23a
 // Convert a debug string to the appropriate enum.
473d23a
 inline int
473d23a
@@ -57,6 +58,7 @@ debug_string_to_enum(const char* arg)
473d23a
     { "relaxation", DEBUG_RELAXATION },
473d23a
     { "incremental", DEBUG_INCREMENTAL },
473d23a
     { "location", DEBUG_LOCATION },
473d23a
+    { "target", DEBUG_TARGET },
473d23a
     { "all", DEBUG_ALL }
473d23a
   };
473d23a
 
473d23a
@@ -70,11 +72,11 @@ debug_string_to_enum(const char* arg)
473d23a
 // Print a debug message if TYPE is enabled.  This is a macro so that
473d23a
 // we only evaluate the arguments if necessary.
473d23a
 
473d23a
-#define gold_debug(TYPE, FORMAT, ...)				\
473d23a
+#define gold_debug(TYPE, ...)					\
473d23a
   do								\
473d23a
     {								\
473d23a
       if (is_debugging_enabled(TYPE))				\
473d23a
-	parameters->errors()->debug(FORMAT, __VA_ARGS__);	\
473d23a
+	parameters->errors()->debug(__VA_ARGS__);		\
473d23a
     }								\
473d23a
   while (0)
473d23a
 
473d23a
diff -rup ../binutils-2.27/gold/i386.cc gold/i386.cc
473d23a
--- ../binutils-2.27/gold/i386.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/i386.cc	2016-11-03 15:05:40.000000000 +0000
473d23a
@@ -2794,8 +2794,11 @@ Target_i386::Relocate::relocate(const Re
473d23a
 	   && r_type != elfcpp::R_386_PC32)
473d23a
 	  || gsym == NULL
473d23a
 	  || strcmp(gsym->name(), "___tls_get_addr") != 0)
473d23a
-	gold_error_at_location(relinfo, relnum, rel.get_r_offset(),
473d23a
-			       _("missing expected TLS relocation"));
473d23a
+	{
473d23a
+	  gold_error_at_location(relinfo, relnum, rel.get_r_offset(),
473d23a
+				 _("missing expected TLS relocation"));
473d23a
+	  this->skip_call_tls_get_addr_ = false;
473d23a
+	}
473d23a
       else
473d23a
 	{
473d23a
 	  this->skip_call_tls_get_addr_ = false;
473d23a
diff -rup ../binutils-2.27/gold/icf.cc gold/icf.cc
473d23a
--- ../binutils-2.27/gold/icf.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/icf.cc	2016-11-03 15:05:40.000000000 +0000
473d23a
@@ -590,6 +590,7 @@ match_sections(unsigned int iteration_nu
473d23a
                std::vector<unsigned int>* num_tracked_relocs,
473d23a
                std::vector<unsigned int>* kept_section_id,
473d23a
                const std::vector<Section_id>& id_section,
473d23a
+	       const std::vector<uint64_t>& section_addraligns,
473d23a
                std::vector<bool>* is_secn_or_group_unique,
473d23a
                std::vector<std::string>* section_contents)
473d23a
 {
473d23a
@@ -630,13 +631,7 @@ match_sections(unsigned int iteration_nu
473d23a
         {
473d23a
           if ((*kept_section_id)[i] != i)
473d23a
             {
473d23a
-              // This section is already folded into something.  See
473d23a
-              // if it should point to a different kept section.
473d23a
-              unsigned int kept_section = (*kept_section_id)[i];
473d23a
-              if (kept_section != (*kept_section_id)[kept_section])
473d23a
-                {
473d23a
-                  (*kept_section_id)[i] = (*kept_section_id)[kept_section];
473d23a
-                }
473d23a
+              // This section is already folded into something.
473d23a
               continue;
473d23a
             }
473d23a
           this_secn_contents = get_section_contents(false, secn, i, NULL,
473d23a
@@ -671,7 +666,25 @@ match_sections(unsigned int iteration_nu
473d23a
                          this_secn_contents.c_str(),
473d23a
                          this_secn_contents.length()) != 0)
473d23a
                   continue;
473d23a
-              (*kept_section_id)[i] = kept_section;
473d23a
+
473d23a
+	      // Check section alignment here.
473d23a
+	      // The section with the larger alignment requirement
473d23a
+	      // should be kept.  We assume alignment can only be 
473d23a
+	      // zero or postive integral powers of two.
473d23a
+	      uint64_t align_i = section_addraligns[i];
473d23a
+	      uint64_t align_kept = section_addraligns[kept_section];
473d23a
+	      if (align_i <= align_kept)
473d23a
+		{
473d23a
+		  (*kept_section_id)[i] = kept_section;
473d23a
+		}
473d23a
+	      else
473d23a
+		{
473d23a
+		  (*kept_section_id)[kept_section] = i;
473d23a
+		  it->second = i;
473d23a
+		  full_section_contents[kept_section].swap(
473d23a
+		      full_section_contents[i]);
473d23a
+		}
473d23a
+
473d23a
               converged = false;
473d23a
               break;
473d23a
             }
473d23a
@@ -688,6 +701,26 @@ match_sections(unsigned int iteration_nu
473d23a
         (*is_secn_or_group_unique)[i] = true;
473d23a
     }
473d23a
 
473d23a
+  // If a section was folded into another section that was later folded
473d23a
+  // again then the former has to be updated.
473d23a
+  for (unsigned int i = 0; i < id_section.size(); i++)
473d23a
+    {
473d23a
+      // Find the end of the folding chain
473d23a
+      unsigned int kept = i;
473d23a
+      while ((*kept_section_id)[kept] != kept)
473d23a
+        {
473d23a
+          kept = (*kept_section_id)[kept];
473d23a
+        }
473d23a
+      // Update every element of the chain
473d23a
+      unsigned int current = i;
473d23a
+      while ((*kept_section_id)[current] != kept)
473d23a
+        {
473d23a
+          unsigned int next = (*kept_section_id)[current];
473d23a
+          (*kept_section_id)[current] = kept;
473d23a
+          current = next;
473d23a
+        }
473d23a
+    }
473d23a
+
473d23a
   return converged;
473d23a
 }
473d23a
 
473d23a
@@ -719,6 +752,7 @@ Icf::find_identical_sections(const Input
473d23a
 {
473d23a
   unsigned int section_num = 0;
473d23a
   std::vector<unsigned int> num_tracked_relocs;
473d23a
+  std::vector<uint64_t> section_addraligns;
473d23a
   std::vector<bool> is_secn_or_group_unique;
473d23a
   std::vector<std::string> section_contents;
473d23a
   const Target& target = parameters->target();
473d23a
@@ -759,6 +793,7 @@ Icf::find_identical_sections(const Input
473d23a
           this->section_id_[Section_id(*p, i)] = section_num;
473d23a
           this->kept_section_id_.push_back(section_num);
473d23a
           num_tracked_relocs.push_back(0);
473d23a
+	  section_addraligns.push_back((*p)->section_addralign(i));
473d23a
           is_secn_or_group_unique.push_back(false);
473d23a
           section_contents.push_back("");
473d23a
           section_num++;
473d23a
@@ -779,8 +814,8 @@ Icf::find_identical_sections(const Input
473d23a
       num_iterations++;
473d23a
       converged = match_sections(num_iterations, symtab,
473d23a
                                  &num_tracked_relocs, &this->kept_section_id_,
473d23a
-                                 this->id_section_, &is_secn_or_group_unique,
473d23a
-                                 &section_contents);
473d23a
+                                 this->id_section_, section_addraligns,
473d23a
+                                 &is_secn_or_group_unique, &section_contents);
473d23a
     }
473d23a
 
473d23a
   if (parameters->options().print_icf_sections())
473d23a
diff -rup ../binutils-2.27/gold/layout.cc gold/layout.cc
473d23a
--- ../binutils-2.27/gold/layout.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/layout.cc	2016-11-03 15:05:42.000000000 +0000
473d23a
@@ -2135,7 +2135,7 @@ void
473d23a
 Layout::create_notes()
473d23a
 {
473d23a
   this->create_gold_note();
473d23a
-  this->create_executable_stack_info();
473d23a
+  this->create_stack_segment();
473d23a
   this->create_build_id();
473d23a
 }
473d23a
 
473d23a
@@ -2785,7 +2785,7 @@ Layout::finalize(const Input_objects* in
473d23a
       if (load_seg != NULL)
473d23a
 	ehdr_start->set_output_segment(load_seg, Symbol::SEGMENT_START);
473d23a
       else
473d23a
-        ehdr_start->set_undefined();
473d23a
+	ehdr_start->set_undefined();
473d23a
     }
473d23a
 
473d23a
   // Set the file offsets of all the non-data sections we've seen so
473d23a
@@ -2985,25 +2985,29 @@ Layout::create_gold_note()
473d23a
 // executable.  Otherwise, if at least one input file a
473d23a
 // .note.GNU-stack section, and some input file has no .note.GNU-stack
473d23a
 // section, we use the target default for whether the stack should be
473d23a
-// executable.  Otherwise, we don't generate a stack note.  When
473d23a
-// generating a object file, we create a .note.GNU-stack section with
473d23a
-// the appropriate marking.  When generating an executable or shared
473d23a
-// library, we create a PT_GNU_STACK segment.
473d23a
+// executable.  If -z stack-size was used to set a p_memsz value for
473d23a
+// PT_GNU_STACK, we generate the segment regardless.  Otherwise, we
473d23a
+// don't generate a stack note.  When generating a object file, we
473d23a
+// create a .note.GNU-stack section with the appropriate marking.
473d23a
+// When generating an executable or shared library, we create a
473d23a
+// PT_GNU_STACK segment.
473d23a
 
473d23a
 void
473d23a
-Layout::create_executable_stack_info()
473d23a
+Layout::create_stack_segment()
473d23a
 {
473d23a
   bool is_stack_executable;
473d23a
   if (parameters->options().is_execstack_set())
473d23a
     {
473d23a
       is_stack_executable = parameters->options().is_stack_executable();
473d23a
       if (!is_stack_executable
473d23a
-          && this->input_requires_executable_stack_
473d23a
-          && parameters->options().warn_execstack())
473d23a
+	  && this->input_requires_executable_stack_
473d23a
+	  && parameters->options().warn_execstack())
473d23a
 	gold_warning(_("one or more inputs require executable stack, "
473d23a
-	               "but -z noexecstack was given"));
473d23a
+		       "but -z noexecstack was given"));
473d23a
     }
473d23a
-  else if (!this->input_with_gnu_stack_note_)
473d23a
+  else if (!this->input_with_gnu_stack_note_
473d23a
+	   && (!parameters->options().user_set_stack_size()
473d23a
+	       || parameters->options().relocatable()))
473d23a
     return;
473d23a
   else
473d23a
     {
473d23a
@@ -3032,7 +3036,12 @@ Layout::create_executable_stack_info()
473d23a
       int flags = elfcpp::PF_R | elfcpp::PF_W;
473d23a
       if (is_stack_executable)
473d23a
 	flags |= elfcpp::PF_X;
473d23a
-      this->make_output_segment(elfcpp::PT_GNU_STACK, flags);
473d23a
+      Output_segment* seg =
473d23a
+	this->make_output_segment(elfcpp::PT_GNU_STACK, flags);
473d23a
+      seg->set_size(parameters->options().stack_size());
473d23a
+      // BFD lets targets override this default alignment, but the only
473d23a
+      // targets that do so are ones that Gold does not support so far.
473d23a
+      seg->set_minimum_p_align(16);
473d23a
     }
473d23a
 }
473d23a
 
473d23a
@@ -3718,7 +3727,9 @@ Layout::set_segment_offsets(const Target
473d23a
        p != this->segment_list_.end();
473d23a
        ++p)
473d23a
     {
473d23a
-      if ((*p)->type() != elfcpp::PT_LOAD)
473d23a
+      // PT_GNU_STACK was set up correctly when it was created.
473d23a
+      if ((*p)->type() != elfcpp::PT_LOAD
473d23a
+	  && (*p)->type() != elfcpp::PT_GNU_STACK)
473d23a
 	(*p)->set_offset((*p)->type() == elfcpp::PT_GNU_RELRO
473d23a
 			 ? increase_relro
473d23a
 			 : 0);
473d23a
diff -rup ../binutils-2.27/gold/layout.h gold/layout.h
473d23a
--- ../binutils-2.27/gold/layout.h	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/layout.h	2016-11-03 15:05:12.000000000 +0000
473d23a
@@ -1037,9 +1037,9 @@ class Layout
473d23a
   void
473d23a
   create_gold_note();
473d23a
 
473d23a
-  // Record whether the stack must be executable.
473d23a
+  // Record whether the stack must be executable, and a user-supplied size.
473d23a
   void
473d23a
-  create_executable_stack_info();
473d23a
+  create_stack_segment();
473d23a
 
473d23a
   // Create a build ID note if needed.
473d23a
   void
473d23a
diff -rup ../binutils-2.27/gold/Makefile.in gold/Makefile.in
473d23a
--- ../binutils-2.27/gold/Makefile.in	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/Makefile.in	2016-11-03 14:38:22.000000000 +0000
473d23a
@@ -87,8 +87,8 @@ subdir = .
473d23a
 DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
473d23a
 	$(srcdir)/Makefile.am $(top_srcdir)/configure \
473d23a
 	$(am__configure_deps) $(srcdir)/config.in \
473d23a
-	$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in \
473d23a
-	ftruncate.c pread.c mremap.c ffsll.c yyscript.h yyscript.c \
473d23a
+	$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in ffsll.c \
473d23a
+	mremap.c ftruncate.c pread.c yyscript.h yyscript.c \
473d23a
 	$(srcdir)/../depcomp $(srcdir)/../ylwrap
473d23a
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
473d23a
 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
473d23a
@@ -409,6 +409,7 @@ TARGETOBJS = @TARGETOBJS@
473d23a
 USE_NLS = @USE_NLS@
473d23a
 VERSION = @VERSION@
473d23a
 WARN_CFLAGS = @WARN_CFLAGS@
473d23a
+WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@
473d23a
 WARN_CXXFLAGS = @WARN_CXXFLAGS@
473d23a
 WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@
473d23a
 XGETTEXT = @XGETTEXT@
473d23a
diff -rup ../binutils-2.27/gold/options.h gold/options.h
473d23a
--- ../binutils-2.27/gold/options.h	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/options.h	2016-11-03 15:05:13.000000000 +0000
473d23a
@@ -647,7 +647,7 @@ class General_options
473d23a
   DEFINE_bool(apply_dynamic_relocs, options::TWO_DASHES, '\0', true,
473d23a
 	      N_("Apply link-time values for dynamic relocations (default)"),
473d23a
 	      N_("(aarch64 only) Do not apply link-time values "
473d23a
-	         "for dynamic relocations"));
473d23a
+		 "for dynamic relocations"));
473d23a
 
473d23a
   DEFINE_bool(as_needed, options::TWO_DASHES, '\0', false,
473d23a
 	      N_("Only set DT_NEEDED for shared libraries if used"),
473d23a
@@ -674,6 +674,9 @@ class General_options
473d23a
   DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
473d23a
 		    N_("alias for -Bstatic"), NULL, true);
473d23a
 
473d23a
+  DEFINE_bool(be8,options::TWO_DASHES, '\0', false,
473d23a
+	      N_("Output BE8 format image"), NULL);
473d23a
+
473d23a
   DEFINE_bool(Bgroup, options::ONE_DASH, '\0', false,
473d23a
 	      N_("Use group name lookup rules for shared library"), NULL);
473d23a
 
473d23a
@@ -1152,6 +1155,17 @@ class General_options
473d23a
   DEFINE_string(sysroot, options::TWO_DASHES, '\0', "",
473d23a
 		N_("Set target system root directory"), N_("DIR"));
473d23a
 
473d23a
+  DEFINE_bool(target1_rel, options::TWO_DASHES, '\0', false,
473d23a
+	      N_("(ARM only) Force R_ARM_TARGET1 type to R_ARM_REL32"),
473d23a
+	      NULL);
473d23a
+  DEFINE_bool(target1_abs, options::TWO_DASHES, '\0', false,
473d23a
+	      N_("(ARM only) Force R_ARM_TARGET1 type to R_ARM_ABS32"),
473d23a
+	      NULL);
473d23a
+  DEFINE_enum(target2, options::TWO_DASHES, '\0', NULL,
473d23a
+	      N_("(ARM only) Set R_ARM_TARGET2 relocation type"),
473d23a
+	      N_("[rel, abs, got-rel"),
473d23a
+	      {"rel", "abs", "got-rel"});
473d23a
+
473d23a
   DEFINE_bool(trace, options::TWO_DASHES, 't', false,
473d23a
 	      N_("Print the name of each input file"), NULL);
473d23a
 
473d23a
@@ -1293,7 +1307,7 @@ class General_options
473d23a
 	      N_("Mark output as requiring executable stack"), NULL);
473d23a
   DEFINE_bool(global, options::DASH_Z, '\0', false,
473d23a
 	      N_("Make symbols in DSO available for subsequently loaded "
473d23a
-	         "objects"), NULL);
473d23a
+		 "objects"), NULL);
473d23a
   DEFINE_bool(initfirst, options::DASH_Z, '\0', false,
473d23a
 	      N_("Mark DSO to be initialized first at runtime"),
473d23a
 	      NULL);
473d23a
@@ -1339,6 +1353,8 @@ class General_options
473d23a
   DEFINE_bool(relro, options::DASH_Z, '\0', DEFAULT_LD_Z_RELRO,
473d23a
 	      N_("Where possible mark variables read-only after relocation"),
473d23a
 	      N_("Don't mark variables read-only after relocation"));
473d23a
+  DEFINE_uint64(stack_size, options::DASH_Z, '\0', 0,
473d23a
+		N_("Set PT_GNU_STACK segment p_memsz to SIZE"), N_("SIZE"));
473d23a
   DEFINE_bool(text, options::DASH_Z, '\0', false,
473d23a
 	      N_("Do not permit relocations in read-only segments"),
473d23a
 	      N_("Permit relocations in read-only segments (default)"));
473d23a
diff -rup ../binutils-2.27/gold/output.cc gold/output.cc
473d23a
--- ../binutils-2.27/gold/output.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/output.cc	2016-11-03 15:05:44.000000000 +0000
473d23a
@@ -4398,7 +4398,7 @@ Output_segment::set_section_addresses(co
473d23a
   this->offset_ = orig_off;
473d23a
 
473d23a
   off_t off = 0;
473d23a
-  uint64_t ret;
473d23a
+  uint64_t ret = 0;
473d23a
   for (int i = 0; i < static_cast<int>(ORDER_MAX); ++i)
473d23a
     {
473d23a
       if (i == static_cast<int>(ORDER_RELRO_LAST))
473d23a
diff -rup ../binutils-2.27/gold/output.h gold/output.h
473d23a
--- ../binutils-2.27/gold/output.h	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/output.h	2016-11-03 15:05:14.000000000 +0000
473d23a
@@ -2499,7 +2499,7 @@ class Output_data_got : public Output_da
473d23a
   // entry.
473d23a
   bool
473d23a
   add_local(Relobj* object, unsigned int sym_index, unsigned int got_type,
473d23a
-            uint64_t addend);
473d23a
+	    uint64_t addend);
473d23a
 
473d23a
   // Like add_local, but use the PLT offset of the local symbol if it
473d23a
   // has one.
473d23a
@@ -2643,7 +2643,7 @@ class Output_data_got : public Output_da
473d23a
 
473d23a
     // Create a local symbol entry plus addend.
473d23a
     Got_entry(Relobj* object, unsigned int local_sym_index,
473d23a
-        bool use_plt_or_tls_offset, uint64_t addend)
473d23a
+	bool use_plt_or_tls_offset, uint64_t addend)
473d23a
       : local_sym_index_(local_sym_index),
473d23a
 	use_plt_or_tls_offset_(use_plt_or_tls_offset), addend_(addend)
473d23a
     {
473d23a
@@ -4796,6 +4796,13 @@ class Output_segment
473d23a
       this->min_p_align_ = align;
473d23a
   }
473d23a
 
473d23a
+  // Set the memory size of this segment.
473d23a
+  void
473d23a
+  set_size(uint64_t size)
473d23a
+  {
473d23a
+    this->memsz_ = size;
473d23a
+  }
473d23a
+
473d23a
   // Set the offset of this segment based on the section.  This should
473d23a
   // only be called for a non-PT_LOAD segment.
473d23a
   void
473d23a
diff -rup ../binutils-2.27/gold/powerpc.cc gold/powerpc.cc
473d23a
--- ../binutils-2.27/gold/powerpc.cc	2016-09-26 11:22:18.717811369 +0100
473d23a
+++ gold/powerpc.cc	2016-11-03 15:05:45.000000000 +0000
473d23a
@@ -2439,9 +2439,8 @@ class Stub_control
473d23a
   // the stubbed branches.
473d23a
   Stub_control(int32_t size, bool no_size_errors)
473d23a
     : state_(NO_GROUP), stub_group_size_(abs(size)),
473d23a
-      stub14_group_size_(abs(size) >> 10),
473d23a
       stubs_always_before_branch_(size < 0),
473d23a
-      suppress_size_errors_(no_size_errors),
473d23a
+      suppress_size_errors_(no_size_errors), group_size_(0),
473d23a
       group_end_addr_(0), owner_(NULL), output_section_(NULL)
473d23a
   {
473d23a
   }
473d23a
@@ -2479,24 +2478,28 @@ class Stub_control
473d23a
 
473d23a
   State state_;
473d23a
   uint32_t stub_group_size_;
473d23a
-  uint32_t stub14_group_size_;
473d23a
   bool stubs_always_before_branch_;
473d23a
   bool suppress_size_errors_;
473d23a
+  // Current max size of group.  Starts at stub_group_size_ but is
473d23a
+  // reduced to stub_group_size_/1024 on seeing a section with
473d23a
+  // external conditional branches.
473d23a
+  uint32_t group_size_;
473d23a
   uint64_t group_end_addr_;
473d23a
+  // owner_ and output_section_ specify the section to which stubs are
473d23a
+  // attached.  The stubs are placed at the end of this section.
473d23a
   const Output_section::Input_section* owner_;
473d23a
   Output_section* output_section_;
473d23a
 };
473d23a
 
473d23a
 // Return true iff input section can be handled by current stub
473d23a
-// group.
473d23a
+// group.  Sections are presented to this function in reverse order,
473d23a
+// so the first section is the tail of the group.
473d23a
 
473d23a
 bool
473d23a
 Stub_control::can_add_to_stub_group(Output_section* o,
473d23a
 				    const Output_section::Input_section* i,
473d23a
 				    bool has14)
473d23a
 {
473d23a
-  uint32_t group_size
473d23a
-    = has14 ? this->stub14_group_size_ : this->stub_group_size_;
473d23a
   bool whole_sec = o->order() == ORDER_INIT || o->order() == ORDER_FINI;
473d23a
   uint64_t this_size;
473d23a
   uint64_t start_addr = o->address();
473d23a
@@ -2510,46 +2513,90 @@ Stub_control::can_add_to_stub_group(Outp
473d23a
       start_addr += i->relobj()->output_section_offset(i->shndx());
473d23a
       this_size = i->data_size();
473d23a
     }
473d23a
-  uint64_t end_addr = start_addr + this_size;
473d23a
-  bool toobig = this_size > group_size;
473d23a
 
473d23a
-  if (toobig && !this->suppress_size_errors_)
473d23a
+  uint32_t group_size = this->stub_group_size_;
473d23a
+  if (has14)
473d23a
+    this->group_size_ = group_size = group_size >> 10;
473d23a
+
473d23a
+  if (this_size > group_size && !this->suppress_size_errors_)
473d23a
     gold_warning(_("%s:%s exceeds group size"),
473d23a
 		 i->relobj()->name().c_str(),
473d23a
 		 i->relobj()->section_name(i->shndx()).c_str());
473d23a
 
473d23a
-  if (this->state_ != HAS_STUB_SECTION
473d23a
-      && (!whole_sec || this->output_section_ != o)
473d23a
-      && (this->state_ == NO_GROUP
473d23a
-	  || this->group_end_addr_ - end_addr < group_size))
473d23a
-    {
473d23a
-      this->owner_ = i;
473d23a
-      this->output_section_ = o;
473d23a
-    }
473d23a
-
473d23a
-  if (this->state_ == NO_GROUP)
473d23a
-    {
473d23a
-      this->state_ = FINDING_STUB_SECTION;
473d23a
-      this->group_end_addr_ = end_addr;
473d23a
-    }
473d23a
-  else if (this->group_end_addr_ - start_addr < group_size)
473d23a
-    ;
473d23a
-  // Adding this section would make the group larger than GROUP_SIZE.
473d23a
-  else if (this->state_ == FINDING_STUB_SECTION
473d23a
-	   && !this->stubs_always_before_branch_
473d23a
-	   && !toobig)
473d23a
-    {
473d23a
-      // But wait, there's more!  Input sections up to GROUP_SIZE
473d23a
-      // bytes before the stub table can be handled by it too.
473d23a
-      this->state_ = HAS_STUB_SECTION;
473d23a
-      this->group_end_addr_ = end_addr;
473d23a
+  gold_debug(DEBUG_TARGET, "maybe add%s %s:%s size=%#llx total=%#llx",
473d23a
+	     has14 ? " 14bit" : "",
473d23a
+	     i->relobj()->name().c_str(),
473d23a
+	     i->relobj()->section_name(i->shndx()).c_str(),
473d23a
+	     (long long) this_size,
473d23a
+	     (long long) this->group_end_addr_ - start_addr);
473d23a
+
473d23a
+  uint64_t end_addr = start_addr + this_size;
473d23a
+  if (this->state_ == HAS_STUB_SECTION)
473d23a
+    {
473d23a
+      // Can we add this section, which is before the stubs, to the
473d23a
+      // group?
473d23a
+      if (this->group_end_addr_ - start_addr <= this->group_size_)
473d23a
+	return true;
473d23a
     }
473d23a
   else
473d23a
     {
473d23a
-      this->state_ = NO_GROUP;
473d23a
-      return false;
473d23a
+      // Stubs are added at the end of "owner_".
473d23a
+      // The current section can always be the stub owner, except when
473d23a
+      // whole_sec is true and the current section isn't the last of
473d23a
+      // the pasted sections.  (This restriction for the whole_sec
473d23a
+      // case is just to simplify the corner case mentioned in
473d23a
+      // group_sections.)
473d23a
+      // Note that "owner_" itself is not necessarily part of the
473d23a
+      // group of sections served by these stubs!
473d23a
+      if (!whole_sec || this->output_section_ != o)
473d23a
+	{
473d23a
+	  this->owner_ = i;
473d23a
+	  this->output_section_ = o;
473d23a
+	}
473d23a
+
473d23a
+      if (this->state_ == FINDING_STUB_SECTION)
473d23a
+	{
473d23a
+	  if (this->group_end_addr_ - start_addr <= this->group_size_)
473d23a
+	    return true;
473d23a
+	  // The group after the stubs has reached maximum size.
473d23a
+	  // Now see about adding sections before the stubs to the
473d23a
+	  // group.  If the current section has a 14-bit branch and
473d23a
+	  // the group after the stubs exceeds group_size_ (because
473d23a
+	  // they didn't have 14-bit branches), don't add sections
473d23a
+	  // before the stubs:  The size of stubs for such a large
473d23a
+	  // group may exceed the reach of a 14-bit branch.
473d23a
+	  if (!this->stubs_always_before_branch_
473d23a
+	      && this_size <= this->group_size_
473d23a
+	      && this->group_end_addr_ - end_addr <= this->group_size_)
473d23a
+	    {
473d23a
+	      gold_debug(DEBUG_TARGET, "adding before stubs");
473d23a
+	      this->state_ = HAS_STUB_SECTION;
473d23a
+	      this->group_end_addr_ = end_addr;
473d23a
+	      return true;
473d23a
+	    }
473d23a
+	}
473d23a
+      else if (this->state_ == NO_GROUP)
473d23a
+	{
473d23a
+	  // Only here on very first use of Stub_control
473d23a
+	  this->state_ = FINDING_STUB_SECTION;
473d23a
+	  this->group_size_ = group_size;
473d23a
+	  this->group_end_addr_ = end_addr;
473d23a
+	  return true;
473d23a
+	}
473d23a
+      else
473d23a
+	gold_unreachable();
473d23a
     }
473d23a
-  return true;
473d23a
+
473d23a
+  gold_debug(DEBUG_TARGET, "nope, didn't fit\n");
473d23a
+
473d23a
+  // The section fails to fit in the current group.  Set up a few
473d23a
+  // things for the next group.  owner_ and output_section_ will be
473d23a
+  // set later after we've retrieved those values for the current
473d23a
+  // group.
473d23a
+  this->state_ = FINDING_STUB_SECTION;
473d23a
+  this->group_size_ = group_size;
473d23a
+  this->group_end_addr_ = end_addr;
473d23a
+  return false;
473d23a
 }
473d23a
 
473d23a
 // Look over all the input sections, deciding where to place stubs.
473d23a
@@ -2887,7 +2934,7 @@ Target_powerpc<size, big_endian>::do_rel
473d23a
 	}
473d23a
       this->stub_tables_.clear();
473d23a
       this->stub_group_size_ = this->stub_group_size_ / 4 * 3;
473d23a
-      gold_info(_("%s: stub group size is too large; retrying with %d"),
473d23a
+      gold_info(_("%s: stub group size is too large; retrying with %#x"),
473d23a
 		program_name, this->stub_group_size_);
473d23a
       this->group_sections(layout, task, true);
473d23a
     }
473d23a
@@ -2982,7 +3029,13 @@ Target_powerpc<size, big_endian>::do_rel
473d23a
 	      Stub_table<size, big_endian>* stub_table
473d23a
 		= static_cast<Stub_table<size, big_endian>*>(
473d23a
 		    i->relaxed_input_section());
473d23a
-	      off += stub_table->set_address_and_size(os, off);
473d23a
+	      Address stub_table_size = stub_table->set_address_and_size(os, off);
473d23a
+	      off += stub_table_size;
473d23a
+	      // After a few iterations, set current stub table size
473d23a
+	      // as min size threshold, so later stub tables can only
473d23a
+	      // grow in size.
473d23a
+	      if (pass >= 4)
473d23a
+		stub_table->set_min_size_threshold(stub_table_size);
473d23a
 	    }
473d23a
 	  else
473d23a
 	    off += i->data_size();
473d23a
@@ -3634,8 +3687,8 @@ class Stub_table : public Output_relaxed
473d23a
       targ_(targ), plt_call_stubs_(), long_branch_stubs_(),
473d23a
       orig_data_size_(owner->current_data_size()),
473d23a
       plt_size_(0), last_plt_size_(0),
473d23a
-      branch_size_(0), last_branch_size_(0), eh_frame_added_(false),
473d23a
-      need_save_res_(false)
473d23a
+      branch_size_(0), last_branch_size_(0), min_size_threshold_(0),
473d23a
+      eh_frame_added_(false), need_save_res_(false)
473d23a
   {
473d23a
     this->set_output_section(output_section);
473d23a
 
473d23a
@@ -3726,6 +3779,11 @@ class Stub_table : public Output_relaxed
473d23a
       off = align_address(off, this->stub_align());
473d23a
     // Include original section size and alignment padding in size
473d23a
     my_size += off - start_off;
473d23a
+    // Ensure new size is always larger than min size
473d23a
+    // threshold. Alignment requirement is included in "my_size", so
473d23a
+    // increase "my_size" does not invalidate alignment.
473d23a
+    if (my_size < this->min_size_threshold_)
473d23a
+      my_size = this->min_size_threshold_;
473d23a
     this->reset_address_and_file_offset();
473d23a
     this->set_current_data_size(my_size);
473d23a
     this->set_address_and_file_offset(os->address() + start_off,
473d23a
@@ -3751,6 +3809,9 @@ class Stub_table : public Output_relaxed
473d23a
   plt_size() const
473d23a
   { return this->plt_size_; }
473d23a
 
473d23a
+  void set_min_size_threshold(Address min_size)
473d23a
+  { this->min_size_threshold_ = min_size; }
473d23a
+
473d23a
   bool
473d23a
   size_update()
473d23a
   {
473d23a
@@ -4015,6 +4076,13 @@ class Stub_table : public Output_relaxed
473d23a
   section_size_type orig_data_size_;
473d23a
   // size of stubs
473d23a
   section_size_type plt_size_, last_plt_size_, branch_size_, last_branch_size_;
473d23a
+  // Some rare cases cause (PR/20529) fluctuation in stub table
473d23a
+  // size, which leads to an endless relax loop. This is to be fixed
473d23a
+  // by, after the first few iterations, allowing only increase of
473d23a
+  // stub table size. This variable sets the minimal possible size of
473d23a
+  // a stub table, it is zero for the first few iterations, then
473d23a
+  // increases monotonically.
473d23a
+  Address min_size_threshold_;
473d23a
   // Whether .eh_frame info has been created for this stub section.
473d23a
   bool eh_frame_added_;
473d23a
   // Set if this stub group needs a copy of out-of-line register
473d23a
@@ -6024,7 +6092,7 @@ Target_powerpc<size, big_endian>::Scan::
473d23a
 	  ppc_object->set_opd_discard(reloc.get_r_offset());
473d23a
 	  break;
473d23a
 	}
473d23a
-      // Fall thru
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_PPC64_UADDR64:
473d23a
     case elfcpp::R_POWERPC_ADDR32:
473d23a
     case elfcpp::R_POWERPC_UADDR32:
473d23a
@@ -6131,7 +6199,7 @@ Target_powerpc<size, big_endian>::Scan::
473d23a
 		      || gsym->is_preemptible())))
473d23a
 	    target->make_plt_entry(symtab, layout, gsym);
473d23a
 	}
473d23a
-      // Fall thru
473d23a
+      // Fall through.
473d23a
 
473d23a
     case elfcpp::R_PPC64_REL64:
473d23a
     case elfcpp::R_POWERPC_REL32:
473d23a
@@ -7521,6 +7589,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
       if (size != 64)
473d23a
 	// R_PPC_TLSGD, R_PPC_TLSLD, R_PPC_EMB_RELST_LO, R_PPC_EMB_RELST_HI
473d23a
 	break;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_POWERPC_TPREL16:
473d23a
     case elfcpp::R_POWERPC_TPREL16_LO:
473d23a
     case elfcpp::R_POWERPC_TPREL16_HI:
473d23a
@@ -7544,6 +7613,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
 	// R_PPC_EMB_NADDR32, R_PPC_EMB_NADDR16, R_PPC_EMB_NADDR16_LO
473d23a
 	// R_PPC_EMB_NADDR16_HI, R_PPC_EMB_NADDR16_HA, R_PPC_EMB_SDAI16
473d23a
 	break;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_POWERPC_DTPREL16:
473d23a
     case elfcpp::R_POWERPC_DTPREL16_LO:
473d23a
     case elfcpp::R_POWERPC_DTPREL16_HI:
473d23a
@@ -7572,6 +7642,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
     case elfcpp::R_POWERPC_ADDR14_BRTAKEN:
473d23a
     case elfcpp::R_POWERPC_REL14_BRTAKEN:
473d23a
       branch_bit = 1 << 21;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_POWERPC_ADDR14_BRNTAKEN:
473d23a
     case elfcpp::R_POWERPC_REL14_BRNTAKEN:
473d23a
       {
473d23a
@@ -7936,6 +8007,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
 	  maybe_dq_reloc = true;
473d23a
 	  break;
473d23a
 	}
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_POWERPC_ADDR16:
473d23a
     case elfcpp::R_POWERPC_REL16:
473d23a
     case elfcpp::R_PPC64_TOC16:
473d23a
@@ -7970,6 +8042,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
       if (size == 32)
473d23a
 	// R_PPC_EMB_MRKREF, R_PPC_EMB_RELST_LO, R_PPC_EMB_RELST_HA
473d23a
 	goto unsupp;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_POWERPC_ADDR16_HI:
473d23a
     case elfcpp::R_POWERPC_REL16_HI:
473d23a
     case elfcpp::R_PPC64_TOC16_HI:
473d23a
@@ -7990,6 +8063,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
       if (size == 32)
473d23a
 	// R_PPC_EMB_RELSEC16, R_PPC_EMB_RELST_HI, R_PPC_EMB_BIT_FLD
473d23a
 	goto unsupp;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_POWERPC_ADDR16_HA:
473d23a
     case elfcpp::R_POWERPC_REL16_HA:
473d23a
     case elfcpp::R_PPC64_TOC16_HA:
473d23a
@@ -8012,6 +8086,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
       if (size == 32)
473d23a
 	// R_PPC_EMB_NADDR16_LO
473d23a
 	goto unsupp;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_PPC64_ADDR16_HIGHER:
473d23a
     case elfcpp::R_PPC64_TPREL16_HIGHER:
473d23a
       Reloc::addr16_hi2(view, value);
473d23a
@@ -8021,6 +8096,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
       if (size == 32)
473d23a
 	// R_PPC_EMB_NADDR16_HI
473d23a
 	goto unsupp;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_PPC64_ADDR16_HIGHERA:
473d23a
     case elfcpp::R_PPC64_TPREL16_HIGHERA:
473d23a
       Reloc::addr16_ha2(view, value);
473d23a
@@ -8030,6 +8106,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
       if (size == 32)
473d23a
 	// R_PPC_EMB_NADDR16_HA
473d23a
 	goto unsupp;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_PPC64_ADDR16_HIGHEST:
473d23a
     case elfcpp::R_PPC64_TPREL16_HIGHEST:
473d23a
       Reloc::addr16_hi3(view, value);
473d23a
@@ -8039,6 +8116,7 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
       if (size == 32)
473d23a
 	// R_PPC_EMB_SDAI16
473d23a
 	goto unsupp;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_PPC64_ADDR16_HIGHESTA:
473d23a
     case elfcpp::R_PPC64_TPREL16_HIGHESTA:
473d23a
       Reloc::addr16_ha3(view, value);
473d23a
@@ -8049,11 +8127,13 @@ Target_powerpc<size, big_endian>::Reloca
473d23a
       if (size == 32)
473d23a
 	// R_PPC_EMB_NADDR32, R_PPC_EMB_NADDR16
473d23a
 	goto unsupp;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_PPC64_TPREL16_DS:
473d23a
     case elfcpp::R_PPC64_TPREL16_LO_DS:
473d23a
       if (size == 32)
473d23a
 	// R_PPC_TLSGD, R_PPC_TLSLD
473d23a
 	break;
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_PPC64_ADDR16_DS:
473d23a
     case elfcpp::R_PPC64_ADDR16_LO_DS:
473d23a
     case elfcpp::R_PPC64_TOC16_DS:
473d23a
diff -rup ../binutils-2.27/gold/resolve.cc gold/resolve.cc
473d23a
--- ../binutils-2.27/gold/resolve.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/resolve.cc	2016-11-03 15:05:47.000000000 +0000
473d23a
@@ -193,6 +193,7 @@ symbol_to_bits(elfcpp::STB binding, bool
473d23a
       // table.
473d23a
       gold_error(_("invalid STB_LOCAL symbol in external symbols"));
473d23a
       bits = global_flag;
473d23a
+      break;
473d23a
 
473d23a
     default:
473d23a
       // Any target which wants to handle STB_LOOS, etc., needs to
473d23a
diff -rup ../binutils-2.27/gold/script.cc gold/script.cc
473d23a
--- ../binutils-2.27/gold/script.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/script.cc	2016-11-03 15:05:47.000000000 +0000
473d23a
@@ -1755,6 +1755,7 @@ script_keyword_parsecodes[] =
473d23a
   { "FLOAT", FLOAT },
473d23a
   { "FORCE_COMMON_ALLOCATION", FORCE_COMMON_ALLOCATION },
473d23a
   { "GROUP", GROUP },
473d23a
+  { "HIDDEN", HIDDEN },
473d23a
   { "HLL", HLL },
473d23a
   { "INCLUDE", INCLUDE },
473d23a
   { "INFO", INFO },
473d23a
diff -rup ../binutils-2.27/gold/script-sections.cc gold/script-sections.cc
473d23a
--- ../binutils-2.27/gold/script-sections.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/script-sections.cc	2016-11-03 15:05:48.000000000 +0000
473d23a
@@ -1503,7 +1503,7 @@ class Input_section_info
473d23a
  private:
473d23a
   // Input section, can be a relaxed section.
473d23a
   Output_section::Input_section input_section_;
473d23a
-  // Name of the section. 
473d23a
+  // Name of the section.
473d23a
   std::string section_name_;
473d23a
   // Section size.
473d23a
   uint64_t size_;
473d23a
@@ -1545,7 +1545,7 @@ Input_section_sorter::get_init_priority(
473d23a
   // GCC uses the following section names for the init_priority
473d23a
   // attribute with numerical values 101 and 65535 inclusive. A
473d23a
   // lower value means a higher priority.
473d23a
-  // 
473d23a
+  //
473d23a
   // 1: .init_array.NNNN/.fini_array.NNNN: Where NNNN is the
473d23a
   //    decimal numerical value of the init_priority attribute.
473d23a
   //    The order of execution in .init_array is forward and
473d23a
@@ -1666,7 +1666,7 @@ Output_section_element_input::set_sectio
473d23a
   while (p != input_sections->end())
473d23a
     {
473d23a
       Relobj* relobj = p->relobj();
473d23a
-      unsigned int shndx = p->shndx();      
473d23a
+      unsigned int shndx = p->shndx();
473d23a
       Input_section_info isi(*p);
473d23a
 
473d23a
       // Calling section_name and section_addralign is not very
473d23a
@@ -1758,7 +1758,7 @@ Output_section_element_input::set_sectio
473d23a
 
473d23a
 	  uint64_t this_subalign = sis.addralign();
473d23a
 	  if (!sis.is_input_section())
473d23a
-	    sis.output_section_data()->finalize_data_size();	
473d23a
+	    sis.output_section_data()->finalize_data_size();
473d23a
 	  uint64_t data_size = sis.data_size();
473d23a
 	  if (this_subalign < subalign)
473d23a
 	    {
473d23a
@@ -2029,7 +2029,7 @@ class Output_section_definition : public
473d23a
   void
473d23a
   set_section_vma(Expression* address)
473d23a
   { this->address_ = address; }
473d23a
-  
473d23a
+
473d23a
   void
473d23a
   set_section_lma(Expression* address)
473d23a
   { this->load_address_ = address; }
473d23a
@@ -2037,7 +2037,7 @@ class Output_section_definition : public
473d23a
   const std::string&
473d23a
   get_section_name() const
473d23a
   { return this->name_; }
473d23a
-  
473d23a
+
473d23a
  private:
473d23a
   static const char*
473d23a
   script_section_type_name(Script_section_type);
473d23a
@@ -2402,9 +2402,9 @@ Output_section_definition::set_section_a
473d23a
   uint64_t old_load_address = *load_address;
473d23a
 
473d23a
   // If input section sorting is requested via --section-ordering-file or
473d23a
-  // linker plugins, then do it here.  This is important because we want 
473d23a
+  // linker plugins, then do it here.  This is important because we want
473d23a
   // any sorting specified in the linker scripts, which will be done after
473d23a
-  // this, to take precedence.  The final order of input sections is then 
473d23a
+  // this, to take precedence.  The final order of input sections is then
473d23a
   // guaranteed to be according to the linker script specification.
473d23a
   if (this->output_section_ != NULL
473d23a
       && this->output_section_->input_section_order_specified())
473d23a
@@ -2495,7 +2495,7 @@ Output_section_definition::set_section_a
473d23a
 	    // The LMA address was explicitly set to the given region.
473d23a
 	    laddr = lma_region->get_current_address()->eval(symtab, layout,
473d23a
 							    false);
473d23a
-	  else 
473d23a
+	  else
473d23a
 	    {
473d23a
 	      // We are not going to use the discovered lma_region, so
473d23a
 	      // make sure that we do not update it in the code below.
473d23a
@@ -2987,9 +2987,9 @@ Orphan_output_section::set_section_addre
473d23a
   address = align_address(address, this->os_->addralign());
473d23a
 
473d23a
   // If input section sorting is requested via --section-ordering-file or
473d23a
-  // linker plugins, then do it here.  This is important because we want 
473d23a
+  // linker plugins, then do it here.  This is important because we want
473d23a
   // any sorting specified in the linker scripts, which will be done after
473d23a
-  // this, to take precedence.  The final order of input sections is then 
473d23a
+  // this, to take precedence.  The final order of input sections is then
473d23a
   // guaranteed to be according to the linker script specification.
473d23a
   if (this->os_ != NULL
473d23a
       && this->os_->input_section_order_specified())
473d23a
@@ -3023,7 +3023,7 @@ Orphan_output_section::set_section_addre
473d23a
     {
473d23a
       uint64_t addralign = p->addralign();
473d23a
       if (!p->is_input_section())
473d23a
-	p->output_section_data()->finalize_data_size();	
473d23a
+	p->output_section_data()->finalize_data_size();
473d23a
       uint64_t size = p->data_size();
473d23a
       address = align_address(address, addralign);
473d23a
       this->os_->add_script_input_section(*p);
473d23a
@@ -3605,7 +3605,7 @@ Output_segment*
473d23a
 Script_sections::set_section_addresses(Symbol_table* symtab, Layout* layout)
473d23a
 {
473d23a
   gold_assert(this->saw_sections_clause_);
473d23a
-	 
473d23a
+
473d23a
   // Implement ONLY_IF_RO/ONLY_IF_RW constraints.  These are a pain
473d23a
   // for our representation.
473d23a
   for (Sections_elements::iterator p = this->sections_elements_->begin();
473d23a
@@ -3674,7 +3674,7 @@ Script_sections::set_section_addresses(S
473d23a
       Output_section* os = (*p)->get_output_section();
473d23a
 
473d23a
       // Handle -Ttext, -Tdata and -Tbss options.  We do this by looking for
473d23a
-      // the special sections by names and doing dot assignments. 
473d23a
+      // the special sections by names and doing dot assignments.
473d23a
       if (use_tsection_options
473d23a
 	  && os != NULL
473d23a
 	  && (os->flags() & elfcpp::SHF_ALLOC) != 0)
473d23a
@@ -3703,7 +3703,7 @@ Script_sections::set_section_addresses(S
473d23a
 
473d23a
       (*p)->set_section_addresses(symtab, layout, &dot_value, &dot_alignment,
473d23a
 				  &load_address);
473d23a
-    } 
473d23a
+    }
473d23a
 
473d23a
   if (this->phdrs_elements_ != NULL)
473d23a
     {
473d23a
@@ -3890,7 +3890,7 @@ Script_sections::create_segments(Layout*
473d23a
   layout->get_allocated_sections(&sections);
473d23a
 
473d23a
   // Sort the sections by address.
473d23a
-  std::stable_sort(sections.begin(), sections.end(), 
473d23a
+  std::stable_sort(sections.begin(), sections.end(),
473d23a
 		   Sort_output_sections(this->sections_elements_));
473d23a
 
473d23a
   this->create_note_and_tls_segments(layout, &sections);
473d23a
@@ -4217,7 +4217,7 @@ Script_sections::attach_sections_using_p
473d23a
   // Output sections in the script which do not list segments are
473d23a
   // attached to the same set of segments as the immediately preceding
473d23a
   // output section.
473d23a
-  
473d23a
+
473d23a
   String_list* phdr_names = NULL;
473d23a
   bool load_segments_only = false;
473d23a
   for (Sections_elements::const_iterator p = this->sections_elements_->begin();
473d23a
@@ -4262,7 +4262,7 @@ Script_sections::attach_sections_using_p
473d23a
       // filtering.
473d23a
       if (old_phdr_names != phdr_names)
473d23a
 	load_segments_only = false;
473d23a
-		
473d23a
+
473d23a
       // If this is an orphan section--one that was not explicitly
473d23a
       // mentioned in the linker script--then it should not inherit
473d23a
       // any segment type other than PT_LOAD.  Otherwise, e.g., the
473d23a
@@ -4459,6 +4459,7 @@ Script_sections::release_segments()
473d23a
 	   ++p)
473d23a
 	(*p)->release_segment();
473d23a
     }
473d23a
+  this->segments_created_ = false;
473d23a
 }
473d23a
 
473d23a
 // Print the SECTIONS clause to F for debugging.
473d23a
diff -rup ../binutils-2.27/gold/sparc.cc gold/sparc.cc
473d23a
--- ../binutils-2.27/gold/sparc.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/sparc.cc	2016-11-03 15:05:48.000000000 +0000
473d23a
@@ -2150,6 +2150,7 @@ Target_sparc<size, big_endian>::Scan::ch
473d23a
 	case elfcpp::R_SPARC_RELATIVE:
473d23a
 	case elfcpp::R_SPARC_IRELATIVE:
473d23a
 	case elfcpp::R_SPARC_COPY:
473d23a
+	case elfcpp::R_SPARC_32:
473d23a
 	case elfcpp::R_SPARC_64:
473d23a
 	case elfcpp::R_SPARC_GLOB_DAT:
473d23a
 	case elfcpp::R_SPARC_JMP_SLOT:
473d23a
@@ -2304,7 +2305,7 @@ Target_sparc<size, big_endian>::Scan::lo
473d23a
 				       reloc.get_r_addend(), is_ifunc);
473d23a
 	  break;
473d23a
 	}
473d23a
-      /* Fall through.  */
473d23a
+      // Fall through.
473d23a
 
473d23a
     case elfcpp::R_SPARC_HIX22:
473d23a
     case elfcpp::R_SPARC_LOX10:
473d23a
@@ -2814,6 +2815,7 @@ Target_sparc<size, big_endian>::Scan::gl
473d23a
 	  // and code transform the GOT load into an addition.
473d23a
 	  break;
473d23a
 	}
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_SPARC_GOT10:
473d23a
     case elfcpp::R_SPARC_GOT13:
473d23a
     case elfcpp::R_SPARC_GOT22:
473d23a
@@ -3353,6 +3355,7 @@ Target_sparc<size, big_endian>::Relocate
473d23a
 	  gdop_valid = true;
473d23a
 	  break;
473d23a
 	}
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_SPARC_GOT10:
473d23a
     case elfcpp::R_SPARC_GOT13:
473d23a
     case elfcpp::R_SPARC_GOT22:
473d23a
@@ -3468,6 +3471,13 @@ Target_sparc<size, big_endian>::Relocate
473d23a
       Reloc::lo10(view, object, psymval, addend);
473d23a
       break;
473d23a
 
473d23a
+    case elfcpp::R_SPARC_GOTDATA_OP_LOX10:
473d23a
+      if (gdop_valid)
473d23a
+	{
473d23a
+	  Reloc::gdop_lox10(view, got_offset);
473d23a
+	  break;
473d23a
+	}
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_SPARC_GOT10:
473d23a
       Reloc::lo10(view, got_offset, addend);
473d23a
       break;
473d23a
@@ -3486,13 +3496,6 @@ Target_sparc<size, big_endian>::Relocate
473d23a
 	}
473d23a
       break;
473d23a
 
473d23a
-    case elfcpp::R_SPARC_GOTDATA_OP_LOX10:
473d23a
-      if (gdop_valid)
473d23a
-	{
473d23a
-	  Reloc::gdop_lox10(view, got_offset);
473d23a
-	  break;
473d23a
-	}
473d23a
-      /* Fall through.  */
473d23a
     case elfcpp::R_SPARC_GOT13:
473d23a
       Reloc::rela32_13(view, got_offset, addend);
473d23a
       break;
473d23a
@@ -3503,7 +3506,7 @@ Target_sparc<size, big_endian>::Relocate
473d23a
 	  Reloc::gdop_hix22(view, got_offset);
473d23a
 	  break;
473d23a
 	}
473d23a
-      /* Fall through.  */
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_SPARC_GOT22:
473d23a
       Reloc::hi22(view, got_offset, addend);
473d23a
       break;
473d23a
diff -rup ../binutils-2.27/gold/symtab.cc gold/symtab.cc
473d23a
--- ../binutils-2.27/gold/symtab.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/symtab.cc	2016-11-03 15:05:49.000000000 +0000
473d23a
@@ -882,6 +882,7 @@ Symbol_table::define_default_version(Siz
473d23a
 	;
473d23a
       else if (pdef->second->is_from_dynobj()
473d23a
 	       && sym->is_from_dynobj()
473d23a
+	       && pdef->second->is_defined()
473d23a
 	       && pdef->second->object() != sym->object())
473d23a
         ;
473d23a
       else
473d23a
@@ -1325,6 +1326,9 @@ Symbol_table::add_from_relobj(
473d23a
       res = this->add_from_object(relobj, name, name_key, ver, ver_key,
473d23a
 				  is_default_version, *psym, st_shndx,
473d23a
 				  is_ordinary, orig_st_shndx);
473d23a
+
473d23a
+      if (res == NULL)
473d23a
+	continue;
473d23a
       
473d23a
       if (is_forced_local)
473d23a
 	this->force_local(res);
473d23a
@@ -1406,6 +1410,9 @@ Symbol_table::add_from_pluginobj(
473d23a
 		              is_default_version, *sym, st_shndx,
473d23a
 			      is_ordinary, st_shndx);
473d23a
 
473d23a
+  if (res == NULL)
473d23a
+    return NULL;
473d23a
+
473d23a
   if (is_forced_local)
473d23a
     this->force_local(res);
473d23a
 
473d23a
@@ -1602,6 +1609,9 @@ Symbol_table::add_from_dynobj(
473d23a
 	    }
473d23a
 	}
473d23a
 
473d23a
+      if (res == NULL)
473d23a
+	continue;
473d23a
+
473d23a
       // Note that it is possible that RES was overridden by an
473d23a
       // earlier object, in which case it can't be aliased here.
473d23a
       if (st_shndx != elfcpp::SHN_UNDEF
473d23a
@@ -1640,7 +1650,6 @@ Symbol_table::add_from_incrobj(
473d23a
 
473d23a
   Stringpool::Key ver_key = 0;
473d23a
   bool is_default_version = false;
473d23a
-  bool is_forced_local = false;
473d23a
 
473d23a
   Stringpool::Key name_key;
473d23a
   name = this->namepool_.add(name, true, &name_key);
473d23a
@@ -1650,9 +1659,6 @@ Symbol_table::add_from_incrobj(
473d23a
 		              is_default_version, *sym, st_shndx,
473d23a
 			      is_ordinary, st_shndx);
473d23a
 
473d23a
-  if (is_forced_local)
473d23a
-    this->force_local(res);
473d23a
-
473d23a
   return res;
473d23a
 }
473d23a
 
473d23a
diff -rup ../binutils-2.27/gold/tilegx.cc gold/tilegx.cc
473d23a
--- ../binutils-2.27/gold/tilegx.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/tilegx.cc	2016-11-03 15:05:50.000000000 +0000
473d23a
@@ -4428,6 +4428,7 @@ Target_tilegx<size, big_endian>::Relocat
473d23a
       psymval = &symval;
473d23a
       always_apply_relocation = true;
473d23a
       addend = 0;
473d23a
+      // Fall through.
473d23a
 
473d23a
     // when under PIC mode, these relocations are deferred to rtld
473d23a
     case elfcpp::R_TILEGX_IMM16_X0_HW0:
473d23a
@@ -4618,6 +4619,7 @@ Target_tilegx<size, big_endian>::Relocat
473d23a
                 got_type = GOT_TYPE_TLS_OFFSET;
473d23a
                 have_got_offset = true;
473d23a
               }
473d23a
+	      // Fall through.
473d23a
             do_update_value:
473d23a
               if (have_got_offset) {
473d23a
                 if (gsym != NULL) {
473d23a
@@ -4647,10 +4649,8 @@ Target_tilegx<size, big_endian>::Relocat
473d23a
               } // else if (opt_t == tls::TLSOPT_TO_LE)
473d23a
                 //   both GD/IE are turned into LE, which
473d23a
                 //   is absolute relocation.
473d23a
-                //
473d23a
-                //  |  go through
473d23a
-                //  |
473d23a
-                //  V
473d23a
+                // Fall through.
473d23a
+
473d23a
             // LE
473d23a
             //
473d23a
             // tp
473d23a
diff -rup ../binutils-2.27/gold/x86_64.cc gold/x86_64.cc
473d23a
--- ../binutils-2.27/gold/x86_64.cc	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/x86_64.cc	2016-11-03 15:05:52.000000000 +0000
473d23a
@@ -2361,7 +2361,7 @@ Target_x86_64<size>::Scan::check_non_pic
473d23a
 	      && !gsym->is_undefined()
473d23a
 	      && !gsym->is_preemptible()))
473d23a
 	return;
473d23a
-      /* Fall through.  */
473d23a
+      // Fall through.
473d23a
     case elfcpp::R_X86_64_32:
473d23a
       // R_X86_64_32 is OK for x32.
473d23a
       if (size == 32 && r_type == elfcpp::R_X86_64_32)
473d23a
@@ -3505,6 +3505,7 @@ Target_x86_64<size>::Relocate::relocate(
473d23a
   if (this->skip_call_tls_get_addr_)
473d23a
     {
473d23a
       if ((r_type != elfcpp::R_X86_64_PLT32
473d23a
+	   && r_type != elfcpp::R_X86_64_GOTPCREL
473d23a
 	   && r_type != elfcpp::R_X86_64_GOTPCRELX
473d23a
 	   && r_type != elfcpp::R_X86_64_PLT32_BND
473d23a
 	   && r_type != elfcpp::R_X86_64_PC32_BND
473d23a
@@ -3514,6 +3515,7 @@ Target_x86_64<size>::Relocate::relocate(
473d23a
 	{
473d23a
 	  gold_error_at_location(relinfo, relnum, rela.get_r_offset(),
473d23a
 				 _("missing expected TLS relocation"));
473d23a
+	  this->skip_call_tls_get_addr_ = false;
473d23a
 	}
473d23a
       else
473d23a
 	{
473d23a
diff -rup ../binutils-2.27/gold/yyscript.y gold/yyscript.y
473d23a
--- ../binutils-2.27/gold/yyscript.y	2016-08-03 08:36:53.000000000 +0100
473d23a
+++ gold/yyscript.y	2016-11-03 15:05:59.000000000 +0000
473d23a
@@ -137,6 +137,7 @@
473d23a
 %token FORCE_COMMON_ALLOCATION
473d23a
 %token GLOBAL		/* global */
473d23a
 %token GROUP
473d23a
+%token HIDDEN
473d23a
 %token HLL
473d23a
 %token INCLUDE
473d23a
 %token INHIBIT_COMMON_ALLOCATION
473d23a
@@ -864,6 +865,8 @@ assignment:
473d23a
 	      Expression_ptr e = script_exp_binary_bitwise_or(s, $3);
473d23a
 	      script_set_symbol(closure, $1.value, $1.length, e, 0, 0);
473d23a
 	    }
473d23a
+	| HIDDEN '(' string '=' parse_exp ')'
473d23a
+	    { script_set_symbol(closure, $3.value, $3.length, $5, 0, 1); }
473d23a
 	| PROVIDE '(' string '=' parse_exp ')'
473d23a
 	    { script_set_symbol(closure, $3.value, $3.length, $5, 1, 0); }
473d23a
 	| PROVIDE_HIDDEN '(' string '=' parse_exp ')'