This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] PR gold/20245: Handle output without PLT
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Cc: Cary Coutant <ccoutant at gmail dot com>
- Date: Mon, 20 Jun 2016 05:20:34 -0700
- Subject: [PATCH] PR gold/20245: Handle output without PLT
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
If there is no PLT in output, return 0 for first_plt_entry_offset and
plt_entry_size.
Tested on x86. OK for trunk?
H.J.
---
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/i386.cc | 4 ++++
gold/x86_64.cc | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/gold/i386.cc b/gold/i386.cc
index 8aaa2a8..87e6a6d 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -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();
}
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 81126ef..d069957 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -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();
}
--
2.5.5