summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2014-12-02 08:25:17 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2014-12-02 18:55:42 +0800
commit8eebd7953384e6662ca926b003f2cdda8ccd3ee5 (patch)
treed876a25f077c0b44604ca4d22740c706abaa5fb5
parent5387e7a81fcd3e033a29eccece64e02f96e7f960 (diff)
downloadtoolchain_binutils-8eebd7953384e6662ca926b003f2cdda8ccd3ee5.tar.gz
toolchain_binutils-8eebd7953384e6662ca926b003f2cdda8ccd3ee5.tar.bz2
toolchain_binutils-8eebd7953384e6662ca926b003f2cdda8ccd3ee5.zip
Fix extraneous warning about executable stack.
PR gold/17578 notes that gold will print a warning about an executable stack when the -z execstack option is given, even when there is no --warn_execstack option. The warning is completely useless and unexpected, since the user explicitly requested an executable stack, and did not even ask for warnings. This patch fixes that, and adds an extra warning when --warn_execstack and -z noexecstack are both given and an input file requires an executable stack. gold/ PR gold/17578 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack is given. (Layout::create_executable_stack_info): Warn when -z noexecstack is given but some inputs require executable stack. Change-Id: I7b15682af81d3c52057473d347f83a768e087ffa
-rw-r--r--binutils-2.21/gold/ChangeLog9
-rw-r--r--binutils-2.21/gold/layout.cc12
-rw-r--r--binutils-2.24/gold/ChangeLog8
-rw-r--r--binutils-2.24/gold/layout.cc12
4 files changed, 35 insertions, 6 deletions
diff --git a/binutils-2.21/gold/ChangeLog b/binutils-2.21/gold/ChangeLog
index b04fc3b6..9c148e0c 100644
--- a/binutils-2.21/gold/ChangeLog
+++ b/binutils-2.21/gold/ChangeLog
@@ -1,3 +1,12 @@
+2014-12-01 Cary Coutant <ccoutant@google.com>
+
+ PR gold/17578
+ * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
+ is given.
+ (Layout::create_executable_stack_info): Warn when -z noexecstack is
+ given but some inputs require executable stack.
+
+
2010-12-01 Ian Lance Taylor <iant@google.com>
* testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
diff --git a/binutils-2.21/gold/layout.cc b/binutils-2.21/gold/layout.cc
index 5f7259cc..3f257a02 100644
--- a/binutils-2.21/gold/layout.cc
+++ b/binutils-2.21/gold/layout.cc
@@ -1643,8 +1643,7 @@ Layout::layout_gnu_stack(bool seen_gnu_stack, uint64_t gnu_stack_flags,
if ((gnu_stack_flags & elfcpp::SHF_EXECINSTR) != 0)
{
this->input_requires_executable_stack_ = true;
- if (parameters->options().warn_execstack()
- || parameters->options().is_stack_executable())
+ if (parameters->options().warn_execstack())
gold_warning(_("%s: requires executable stack"),
obj->name().c_str());
}
@@ -2465,7 +2464,14 @@ Layout::create_executable_stack_info()
{
bool is_stack_executable;
if (parameters->options().is_execstack_set())
- is_stack_executable = parameters->options().is_stack_executable();
+ {
+ is_stack_executable = parameters->options().is_stack_executable();
+ if (!is_stack_executable
+ && this->input_requires_executable_stack_
+ && parameters->options().warn_execstack())
+ gold_warning(_("one or more inputs require executable stack, "
+ "but -z noexecstack was given"));
+ }
else if (!this->input_with_gnu_stack_note_)
return;
else
diff --git a/binutils-2.24/gold/ChangeLog b/binutils-2.24/gold/ChangeLog
index dcf7ed41..089a34a8 100644
--- a/binutils-2.24/gold/ChangeLog
+++ b/binutils-2.24/gold/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-01 Cary Coutant <ccoutant@google.com>
+
+ PR gold/17578
+ * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
+ is given.
+ (Layout::create_executable_stack_info): Warn when -z noexecstack is
+ given but some inputs require executable stack.
+
2013-11-22 Cary Coutant <ccoutant@google.com>
* testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
diff --git a/binutils-2.24/gold/layout.cc b/binutils-2.24/gold/layout.cc
index 38fd272b..b0a90263 100644
--- a/binutils-2.24/gold/layout.cc
+++ b/binutils-2.24/gold/layout.cc
@@ -2086,8 +2086,7 @@ Layout::layout_gnu_stack(bool seen_gnu_stack, uint64_t gnu_stack_flags,
if ((gnu_stack_flags & elfcpp::SHF_EXECINSTR) != 0)
{
this->input_requires_executable_stack_ = true;
- if (parameters->options().warn_execstack()
- || parameters->options().is_stack_executable())
+ if (parameters->options().warn_execstack())
gold_warning(_("%s: requires executable stack"),
obj->name().c_str());
}
@@ -2958,7 +2957,14 @@ Layout::create_executable_stack_info()
{
bool is_stack_executable;
if (parameters->options().is_execstack_set())
- is_stack_executable = parameters->options().is_stack_executable();
+ {
+ is_stack_executable = parameters->options().is_stack_executable();
+ if (!is_stack_executable
+ && this->input_requires_executable_stack_
+ && parameters->options().warn_execstack())
+ gold_warning(_("one or more inputs require executable stack, "
+ "but -z noexecstack was given"));
+ }
else if (!this->input_with_gnu_stack_note_)
return;
else