aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2014-12-01 13:21:49 -0800
committerCary Coutant <ccoutant@google.com>2014-12-01 13:21:49 -0800
commitd8e603148f3cc4a953409f4a5afff9e4ea898830 (patch)
tree929f28d46f0d4668babda8c7f123437e152303ff /gold/layout.cc
parentef77750ef779ac887423f84bcc11a8de4dd0fe79 (diff)
downloadbinutils-d8e603148f3cc4a953409f4a5afff9e4ea898830.zip
binutils-d8e603148f3cc4a953409f4a5afff9e4ea898830.tar.gz
binutils-d8e603148f3cc4a953409f4a5afff9e4ea898830.tar.bz2
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.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index 4e60f8e..a0d7c59 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -2101,8 +2101,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());
}
@@ -2975,7 +2974,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