gold/x86: Handle output without PLT
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 20 Jun 2016 19:28:20 +0000 (12:28 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 20 Jun 2016 19:28:32 +0000 (12:28 -0700)
If there is no PLT in output, return 0 for first_plt_entry_offset and
plt_entry_size.

PR gold/20245
* i386.cc (Target_i386::first_plt_entry_offset): Return 0 if
plt_ is NULL.
(Target_i386::plt_entry_size): Likewise.
(Target_x86_64<size>::first_plt_entry_offset): Likewise.
(Target_x86_64<size>::plt_entry_size): Likewise.

gold/ChangeLog
gold/i386.cc
gold/x86_64.cc

index a4c9d6c8fa0b3177732a1aed9ada70ae50799b44..ae2ccb3bb3c29e1b1c4e33c0b5356da187c7cbad 100644 (file)
@@ -1,3 +1,12 @@
+2016-06-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gold/20245
+       * i386.cc (Target_i386::first_plt_entry_offset): Return 0 if
+       plt_ is NULL.
+       (Target_i386::plt_entry_size): Likewise.
+       (Target_x86_64<size>::first_plt_entry_offset): Likewise.
+       (Target_x86_64<size>::plt_entry_size): Likewise.
+
 2016-06-20  Vladimir Radosavljevic  <Vladimir.Radosavljevic@imgtec.com>
 
         * mips.cc (Target_mips::Target_mips): Initialize rld_map_.
index 8aaa2a881aa49a3acf81eefb4d3cc857188a8b2b..87e6a6dde8bbcd8229797d2da6c294791a511565 100644 (file)
@@ -1565,6 +1565,8 @@ Target_i386::plt_entry_count() const
 unsigned int
 Target_i386::first_plt_entry_offset() const
 {
+  if (this->plt_ == NULL)
+    return 0;
   return this->plt_->first_plt_entry_offset();
 }
 
@@ -1573,6 +1575,8 @@ Target_i386::first_plt_entry_offset() const
 unsigned int
 Target_i386::plt_entry_size() const
 {
+  if (this->plt_ == NULL)
+    return 0;
   return this->plt_->get_plt_entry_size();
 }
 
index 81126efc84ed14513c303adc90df2e91ede996b8..d069957f5b9ce3569529844ef89c1871191d5a38 100644 (file)
@@ -1822,6 +1822,8 @@ template<int size>
 unsigned int
 Target_x86_64<size>::first_plt_entry_offset() const
 {
+  if (this->plt_ == NULL)
+    return 0;
   return this->plt_->first_plt_entry_offset();
 }
 
@@ -1831,6 +1833,8 @@ template<int size>
 unsigned int
 Target_x86_64<size>::plt_entry_size() const
 {
+  if (this->plt_ == NULL)
+    return 0;
   return this->plt_->get_plt_entry_size();
 }
 
This page took 0.028582 seconds and 4 git commands to generate.