This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH, GOLD, AArch64] default stack not executable
- From: Jim Wilson <jim dot wilson at linaro dot org>
- To: binutils at sourceware dot org
- Cc: Jim Wilson <jim dot wilson at linaro dot org>
- Date: Thu, 21 Sep 2017 13:26:15 -0700
- Subject: [PATCH, GOLD, AArch64] default stack not executable
- Authentication-results: sourceware.org; auth=none
For aarch64, ld.bfd makes the stack not executable when a GNU-stack note is
missing. Note that elf_backend_default_execstack is 0 in bfd/elfnn-aarch64.c.
However, ld.gold makes the stack executable when a GNU-stack note is missing.
Note that is_default_stack_executable is true in gold/aarch64.cc.
This appears to be a bug in gold. It also looks like 64-bit ppc gets this
wrong also, though I have not tested that.
The following patch fixes this for aarch64 by changing gold aarch64 to make
is_default_stack_executable false. This was tested with a make check, and
there were no regressions. It was also verified against a testcase using a
.s file with a missing GNU-stack note.
gold/
* aarch64.cc (Target_aarch64::aarch64_info): Set
is_default_stack_executable to false.
---
gold/aarch64.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index a72e2c3..4c6e920 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -3523,7 +3523,7 @@ const Target::Target_info Target_aarch64<64, false>::aarch64_info =
false, // has_make_symbol
false, // has_resolve
false, // has_code_fill
- true, // is_default_stack_executable
+ false, // is_default_stack_executable
true, // can_icf_inline_merge_sections
'\0', // wrap_char
"/lib/ld.so.1", // program interpreter
@@ -3551,7 +3551,7 @@ const Target::Target_info Target_aarch64<32, false>::aarch64_info =
false, // has_make_symbol
false, // has_resolve
false, // has_code_fill
- true, // is_default_stack_executable
+ false, // is_default_stack_executable
false, // can_icf_inline_merge_sections
'\0', // wrap_char
"/lib/ld.so.1", // program interpreter
@@ -3579,7 +3579,7 @@ const Target::Target_info Target_aarch64<64, true>::aarch64_info =
false, // has_make_symbol
false, // has_resolve
false, // has_code_fill
- true, // is_default_stack_executable
+ false, // is_default_stack_executable
true, // can_icf_inline_merge_sections
'\0', // wrap_char
"/lib/ld.so.1", // program interpreter
@@ -3607,7 +3607,7 @@ const Target::Target_info Target_aarch64<32, true>::aarch64_info =
false, // has_make_symbol
false, // has_resolve
false, // has_code_fill
- true, // is_default_stack_executable
+ false, // is_default_stack_executable
false, // can_icf_inline_merge_sections
'\0', // wrap_char
"/lib/ld.so.1", // program interpreter
--
2.7.4