Fix _GLOBAL_OFFSET_TABLE_ value for large GOTs (aarch64).
authorStephen Crane <sjc@immunant.com>
Thu, 10 May 2018 07:09:32 +0000 (00:09 -0700)
committerCary Coutant <ccoutant@gmail.com>
Thu, 10 May 2018 07:13:33 +0000 (00:13 -0700)
Gold resolves GOT-relative relocs relative to the GOT base +
0x8000 when the GOT is larger than 0x8000. However, previously
the _GLOBAL_OFFSET_TABLE_ symbol was set to GOT base + 0x8000
when the .got.plt was larger than 0x8000. This patch makes both
checks use the size of the .got section so that they agree when
to add 0x8000.

gold/ChangeLog
gold/aarch64.cc

index 26ccad19476cc6324f24f7a7866e8a55986f5d49..bad0f2989e1fade5af1660dc6892216ecc1a6d2a 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-10  Stephen Crane  <sjc@immunant.com>
+
+       * aarch64.cc (Target_aarch64::do_finalize_sections): Use size of
+       .got section for the _GLOBAL_OFFSET_TABLE_ symbol computation.
+
 2018-04-24  Cary Coutant  <ccoutant@gmail.com>
 
        PR gold/20642
index 8de9a26765e82a4c60d6cd93efed32fceadd486a..67f210876d3d6096bf606f9c536c577e8bcba591 100644 (file)
@@ -6965,11 +6965,11 @@ Target_aarch64<size, big_endian>::do_finalize_sections(
     }
 
   // Set the size of the _GLOBAL_OFFSET_TABLE_ symbol to the size of
-  // the .got.plt section.
+  // the .got section.
   Symbol* sym = this->global_offset_table_;
   if (sym != NULL)
     {
-      uint64_t data_size = this->got_plt_->current_data_size();
+      uint64_t data_size = this->got_->current_data_size();
       symtab->get_sized_symbol<size>(sym)->set_symsize(data_size);
 
       // If the .got section is more than 0x8000 bytes, we add