[gdb/testsuite] Fix gdb.base/nested-subp{2,3}.exp with recent ld
authorTom de Vries <tdevries@suse.de>
Wed, 12 Oct 2022 14:50:16 +0000 (16:50 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 12 Oct 2022 14:50:16 +0000 (16:50 +0200)
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.

gdb/testsuite/gdb.base/nested-subp2.exp
gdb/testsuite/gdb.base/nested-subp3.exp

index efc8dc5c25b22327043b2b72949b96b32ef9f08d..7716e7c8ace44a25b96841ef047ca7e65fd13067 100644 (file)
@@ -29,10 +29,19 @@ if ![support_nested_function_tests] {
     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
 }
 
index fc87631c342d6d5dc6d2589a913aeed82bc15a83..b547b8efd35707427aec6dcfcf2990e0cedb4934 100644 (file)
@@ -29,10 +29,19 @@ if ![support_nested_function_tests] {
     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
 }