On openSUSE Tumbleweed (with ld 2.39) I get for test-case
gdb.base/nested-subp2.exp:
...
gdb compile failed, ld: warning: tmp.o: requires executable stack \
(because the .note.GNU-stack section is executable)
...
Fix this by compiling with -Wl,--no-warn-execstack.
Likewise in gdb.base/nested-subp3.exp
Tested on x86_64-linux.
return -1
}
+set flags {}
+lappend flags debug
+lappend flags additional_flags=-std=gnu99
+
+set ld_flags additional_flags=-Wl,--no-warn-execstack
+if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \
+ $ld_flags] } {
+ lappend flags $ld_flags
+}
+
if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \
- [standard_output_file "${testcase}"] \
- executable \
- [list debug "additional_flags=-std=gnu99"]] != "" } {
+ [standard_output_file "${testcase}"] \
+ executable $flags] != "" } {
return -1
}
return -1
}
+set flags {}
+lappend flags debug
+lappend flags additional_flags=-std=gnu99
+
+set ld_flags additional_flags=-Wl,--no-warn-execstack
+if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \
+ $ld_flags] } {
+ lappend flags $ld_flags
+}
+
if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \
- [standard_output_file "${testcase}"] \
- executable \
- [list debug "additional_flags=-std=gnu99"]] != "" } {
+ [standard_output_file "${testcase}"] \
+ executable $flags] != "" } {
return -1
}