[PATCH 6/7] gdb/testsuite: Pass "symtab" to testcases that rely on minsyms

Pedro Alves <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Most tests that build a program with no debug information still need
minimal symbols, to be able to set breakpoints, run to main, or
resolve functions by name, etc.

On most targets the compiler and linker emit a (COFF/ELF/etc.) symbol
table by default.  On windows-msvc, though, lld-link does not emit a
COFF symbol table by default (nor when emitting PDB/CodeView debug
info).

This commit tweaks testcases to pass the new "symtab" option to
explicitly ask for a symbol table.

gdb.base/nodebug.exp was the one that made me start looking at this.
The rest I discovered by hacking gdb_compile to pass "-s" (strip
symtab) to GCC if no symtab or debug option was requested, and run the
testsuite with that on GNU/Linux.

Change-Id: Ia5b801186b81ef603f36dea097ad3c489db47768
---
 gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp        | 1 +
 gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp  | 1 +
 gdb/testsuite/gdb.arch/amd64-entry-value-param.exp         | 1 +
 gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp      | 2 +-
 gdb/testsuite/gdb.arch/amd64-entry-value.exp               | 1 +
 gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp      | 2 +-
 gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp         | 2 +-
 gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp           | 1 +
 gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp              | 1 +
 gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp    | 2 +-
 gdb/testsuite/gdb.arch/amd64-shadow-stack.exp              | 2 +-
 gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp              | 1 +
 gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp            | 1 +
 gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp              | 1 +
 gdb/testsuite/gdb.arch/amd64-tailcall-self.exp             | 2 +-
 gdb/testsuite/gdb.arch/i386-bp_permanent.exp               | 6 ++++--
 .../gdb.arch/i386-prologue-skip-cf-protection.exp          | 2 +-
 gdb/testsuite/gdb.base/break-entry.exp                     | 2 +-
 gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp    | 2 +-
 gdb/testsuite/gdb.base/ctf-constvars.exp                   | 1 +
 gdb/testsuite/gdb.base/ctf-ptype.exp                       | 1 +
 gdb/testsuite/gdb.base/cvexpr.exp                          | 1 +
 gdb/testsuite/gdb.base/dup-sect.exp                        | 2 +-
 gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl      | 1 +
 gdb/testsuite/gdb.base/info-shared.exp                     | 2 +-
 gdb/testsuite/gdb.base/info_minsym.exp                     | 4 ++--
 gdb/testsuite/gdb.base/jit-elf-fork.exp                    | 2 +-
 gdb/testsuite/gdb.base/jit-elf-so.exp                      | 2 +-
 gdb/testsuite/gdb.base/jit-elf.exp                         | 2 +-
 gdb/testsuite/gdb.base/list-nodebug.exp                    | 2 +-
 gdb/testsuite/gdb.base/morestack.exp                       | 4 ++--
 gdb/testsuite/gdb.base/msym-bp-shl.exp                     | 2 +-
 gdb/testsuite/gdb.base/msym-bp.exp                         | 2 +-
 gdb/testsuite/gdb.base/msym-lang.exp                       | 2 +-
 gdb/testsuite/gdb.base/nodebug.exp                         | 5 ++++-
 gdb/testsuite/gdb.base/psym-external-decl.exp              | 2 +-
 gdb/testsuite/gdb.base/solib-nodir.exp                     | 2 +-
 gdb/testsuite/gdb.base/whatis.exp                          | 1 +
 gdb/testsuite/gdb.compile/compile-cplus-print.exp          | 2 +-
 gdb/testsuite/gdb.compile/compile-cplus.exp                | 2 +-
 gdb/testsuite/gdb.compile/compile-ifunc.exp                | 2 +-
 gdb/testsuite/gdb.compile/compile.exp                      | 2 +-
 gdb/testsuite/gdb.cp/cmpd-minsyms.exp                      | 2 +-
 gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl               | 4 ++--
 gdb/testsuite/gdb.cp/nsalias.exp                           | 4 ++--
 gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp                   | 2 +-
 gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp | 2 +-
 gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp      | 2 +-
 gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp      | 2 +-
 gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp        | 2 +-
 gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl            | 2 +-
 gdb/testsuite/gdb.dwarf2/debug-names.exp                   | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp            | 7 ++++---
 gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp             | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp     | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp             | 3 ++-
 gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp        | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp         | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-restore.exp                   | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp             | 3 ++-
 gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp    | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp           | 2 +-
 gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp          | 2 +-
 gdb/testsuite/gdb.dwarf2/dwz.exp                           | 2 +-
 gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl                    | 2 +-
 gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp           | 2 +-
 gdb/testsuite/gdb.dwarf2/fission-call.exp                  | 2 +-
 gdb/testsuite/gdb.dwarf2/fission-reread.exp                | 2 +-
 gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp        | 2 +-
 gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp  | 2 +-
 gdb/testsuite/gdb.dwarf2/gdb-index-skeletonless-tu.exp     | 2 +-
 gdb/testsuite/gdb.dwarf2/implptr-64bit.exp                 | 2 +-
 gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp         | 2 +-
 gdb/testsuite/gdb.dwarf2/implref-array.exp                 | 2 +-
 gdb/testsuite/gdb.dwarf2/implref-const.exp                 | 2 +-
 gdb/testsuite/gdb.dwarf2/implref-global.exp                | 2 +-
 gdb/testsuite/gdb.dwarf2/implref-struct.exp                | 2 +-
 .../gdb.dwarf2/inlined_subroutine-inheritance.exp          | 2 +-
 gdb/testsuite/gdb.dwarf2/intbits.exp                       | 2 +-
 .../gdb.dwarf2/multi-piece-inherited-bitfield.exp          | 2 +-
 gdb/testsuite/gdb.dwarf2/multi-piece-primitive-field.exp   | 2 +-
 gdb/testsuite/gdb.dwarf2/pr13961.exp                       | 6 ++++--
 gdb/testsuite/gdb.dwarf2/self-spec.exp                     | 2 +-
 gdb/testsuite/gdb.dwarf2/varval.exp                        | 2 +-
 gdb/testsuite/gdb.guile/scm-breakpoint.exp                 | 2 +-
 gdb/testsuite/gdb.linespec/break-asm-file.exp              | 2 +-
 gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp             | 2 +-
 gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp             | 1 +
 gdb/testsuite/gdb.python/py-frame.exp                      | 2 +-
 gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp     | 2 +-
 gdb/testsuite/gdb.python/py-linetable.exp                  | 1 +
 gdb/testsuite/gdb.python/py-prettyprint-stub.exp           | 2 +-
 gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp       | 1 +
 gdb/testsuite/gdb.reverse/singlejmp-reverse.exp            | 4 ++--
 gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp         | 2 +-
 gdb/testsuite/gdb.rocm/displaced-stepping.exp              | 2 +-
 gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp        | 1 +
 gdb/testsuite/gdb.server/sysroot.exp                       | 4 +++-
 gdb/testsuite/gdb.threads/tls-nodebug-pie.exp              | 2 +-
 gdb/testsuite/gdb.threads/tls-nodebug.exp                  | 2 +-
 gdb/testsuite/gdb.threads/tls-var.exp                      | 2 +-
 gdb/testsuite/gdb.trace/entry-values.exp                   | 4 ++--
 gdb/testsuite/gdb.trace/tspeed.exp                         | 2 +-
 gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp        | 2 +-
 104 files changed, 126 insertions(+), 96 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
index b67f676b716..47e6ea9c761 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
@@ -22,6 +22,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 # Make .c available on the host.
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
index 8043235eec8..4fa4b7580a9 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp
@@ -22,6 +22,7 @@ if {[info exists COMPILE]} {
     lappend opts optimize=-O2 dwarf5
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 # Make .c available on the host.
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
index 4c1d63ab5a3..49db4f0adf2 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param.exp
@@ -22,6 +22,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 # Make .c available on the host.
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
index cb789b541bc..ab6cc37d0cc 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
@@ -23,7 +23,7 @@ if {[is_remote host]} {
 }
 
 if { [prepare_for_testing_full "failed to prepare" \
-	  [list $testfile "c++" $srcfile {}]] } {
+	  [list $testfile {symtab c++} $srcfile {}]] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
index 997312ee437..0673bed9c81 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
@@ -24,6 +24,7 @@ if {[info exists COMPILE]} {
     lappend opts c++
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
index a48896d60a6..74e002e132b 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp
@@ -31,7 +31,7 @@ standard_testfile .S
 
 require is_x86_64_m64_target
 
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nopie}] } {
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nopie symtab}] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
index d3ad91ed64f..4c29ad7376e 100644
--- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
+++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp
@@ -27,7 +27,7 @@
 # run twice, and we restart gdb before testing each different command to
 # ensure that nothing is being cached.
 
-set opts {}
+set opts {symtab}
 standard_testfile .c
 
 require is_x86_64_m64_target
diff --git a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
index a2651898b0c..d47421c096e 100644
--- a/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
+++ b/gdb/testsuite/gdb.arch/amd64-optimout-repeat.exp
@@ -22,6 +22,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
index f402350acde..739b3050d08 100644
--- a/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
+++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
@@ -26,6 +26,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O0
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 if {[prepare_for_testing "failed to prepare" ${testfile} $srcfile $opts]} {
diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp
index 82e49e62290..229727858a3 100644
--- a/gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp
+++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp
@@ -25,7 +25,7 @@ save_vars { ::env(GLIBC_TUNABLES) } {
     append_environment GLIBC_TUNABLES "glibc.cpu.hwcaps" "SHSTK"
 
     if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
-	  additional_flags=-fcf-protection=return] } {
+	      {symtab additional_flags=-fcf-protection=return}] } {
 	return
     }
 
diff --git a/gdb/testsuite/gdb.arch/amd64-shadow-stack.exp b/gdb/testsuite/gdb.arch/amd64-shadow-stack.exp
index de5bce421c2..e711362ba21 100644
--- a/gdb/testsuite/gdb.arch/amd64-shadow-stack.exp
+++ b/gdb/testsuite/gdb.arch/amd64-shadow-stack.exp
@@ -30,7 +30,7 @@ save_vars { ::env(GLIBC_TUNABLES) } {
     append_environment GLIBC_TUNABLES "glibc.cpu.hwcaps" "SHSTK"
 
     if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
-	  additional_flags=-fcf-protection=return] } {
+	      {symtab additional_flags=-fcf-protection=return}] } {
 	return
     }
 
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
index c2cffe0793b..30fcba959ed 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-cxx.exp
@@ -24,6 +24,7 @@ if {[info exists COMPILE]} {
     lappend opts c++
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} "${srcfile} ${srcfile2}" $opts] } {
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
index 767602805b9..8c868bfcfec 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
@@ -22,6 +22,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 lappend opts nopie
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
index 7ae151c690f..85b68f22ed8 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp
@@ -22,6 +22,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 # Make .c available on the host.
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
index f1c6396d510..60b0e0cc8e9 100644
--- a/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-self.exp
@@ -17,7 +17,7 @@ standard_testfile .S
 
 require is_x86_64_m64_target
 
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {}] } {
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {symtab}] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
index 9805f562634..503b886a47f 100644
--- a/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
+++ b/gdb/testsuite/gdb.arch/i386-bp_permanent.exp
@@ -22,12 +22,14 @@ require {is_any_target "i?86-*-*" "x86_64-*-*"}
 
 standard_testfile
 
+set opts {symtab}
+
 # some targets have leading underscores on assembly symbols.
-set additional_flags [gdb_target_symbol_prefix_flags]
+lappend opts [gdb_target_symbol_prefix_flags]
 
 # Don't use "debug", so that we don't have line information for the assembly
 # fragments.
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list $additional_flags]] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $opts] != "" } {
     untested "failed to compile"
     return
 }
diff --git a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
index a860c577809..ab224605732 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue-skip-cf-protection.exp
@@ -75,7 +75,7 @@ with_test_prefix "skip-cf-protection-stackalign" {
     }
 
     if { [prepare_for_testing "failed to prepare" "${testfile}-stackalign" \
-	$srcfile2 [list optimize=-O0 additional_flags=-fcf-protection=full]] } {
+	$srcfile2 [list symtab optimize=-O0 additional_flags=-fcf-protection=full]] } {
 	return
     }
 
diff --git a/gdb/testsuite/gdb.base/break-entry.exp b/gdb/testsuite/gdb.base/break-entry.exp
index 2629d99c7ef..390db6d39f2 100644
--- a/gdb/testsuite/gdb.base/break-entry.exp
+++ b/gdb/testsuite/gdb.base/break-entry.exp
@@ -29,7 +29,7 @@ standard_testfile start.c
 
 require !use_gdb_stub
 
-if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {additional_flags=-static}] } {
+if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {symtab additional_flags=-static}] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
index f430c51f946..a2afab54e04 100644
--- a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
+++ b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
@@ -28,7 +28,7 @@ require allow_cplus_tests
 standard_testfile .cc
 
 if {[build_executable_from_specs $testfile.exp $testfile \
-       {c++ ldflags=-Wl,--gc-sections} \
+       {symtab c++ ldflags=-Wl,--gc-sections} \
        $srcfile {debug c++ additional_flags=-ffunction-sections}]} {
     untested "failed to compile"
     return
diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp
index 9a98aaebe68..ca5eef3e2d9 100644
--- a/gdb/testsuite/gdb.base/ctf-constvars.exp
+++ b/gdb/testsuite/gdb.base/ctf-constvars.exp
@@ -33,6 +33,7 @@ set opts {}
 lappend opts additional_flags=-gctf
 lappend opts ldflags=-Wl,--ctf-variables
 lappend opts nowarnings
+lappend opts symtab
 
 if { [build_executable "failed to prepare" ${testfile} \
 	  [list $srcfile] $opts] } {
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
index aabe3c9187d..daf0aea8733 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -27,6 +27,7 @@ set opts {}
 lappend opts additional_flags=-gctf
 lappend opts ldflags=-Wl,--ctf-variables
 lappend opts nowarnings
+lappend opts symtab
 
 if { [prepare_for_testing "failed to prepare" ${testfile} \
 	  [list $srcfile] $opts] } {
diff --git a/gdb/testsuite/gdb.base/cvexpr.exp b/gdb/testsuite/gdb.base/cvexpr.exp
index 8660289addb..64105f53e2a 100644
--- a/gdb/testsuite/gdb.base/cvexpr.exp
+++ b/gdb/testsuite/gdb.base/cvexpr.exp
@@ -496,6 +496,7 @@ proc do_test {dir options} {
 }
 
 set ctf_opts {}
+lappend ctf_opts symtab
 lappend ctf_opts additional_flags=-gctf
 
 # Build up the set of debug formats for which we will run this test.
diff --git a/gdb/testsuite/gdb.base/dup-sect.exp b/gdb/testsuite/gdb.base/dup-sect.exp
index f341456e00e..9e980941175 100644
--- a/gdb/testsuite/gdb.base/dup-sect.exp
+++ b/gdb/testsuite/gdb.base/dup-sect.exp
@@ -36,7 +36,7 @@ standard_testfile .S
 set srcmainfile start.c
 set executable ${testfile}
 
-if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile}] {}] == -1} {
+if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile}] {symtab}] == -1} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
index b840766a7bb..24040de0b62 100644
--- a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
+++ b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl
@@ -64,6 +64,7 @@ proc start_nested_structs_test { lang types } {
     set flags $compile_flags
     lappend flags $lang
     lappend flags "additional_flags=-O2"
+    lappend flags symtab
 
     for {set n 0} {$n<[llength ${types}]} {incr n} {
 	set m [I2A ${n}]
diff --git a/gdb/testsuite/gdb.base/info-shared.exp b/gdb/testsuite/gdb.base/info-shared.exp
index 0e99eb96ef9..484dce4b8ff 100644
--- a/gdb/testsuite/gdb.base/info-shared.exp
+++ b/gdb/testsuite/gdb.base/info-shared.exp
@@ -43,7 +43,7 @@ set define1 -DSHLIB1_NAME=\"$binfile_lib1_target\"
 
 set cflags "$define1 $define2"
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
-	  [list additional_flags=$cflags shlib_load]] } {
+	  [list symtab additional_flags=$cflags shlib_load]] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/info_minsym.exp b/gdb/testsuite/gdb.base/info_minsym.exp
index 43e3fd14eb0..24fc250df69 100644
--- a/gdb/testsuite/gdb.base/info_minsym.exp
+++ b/gdb/testsuite/gdb.base/info_minsym.exp
@@ -22,8 +22,8 @@ set testfile info_minsym
 
 standard_testfile info_minsym.c
 
-# Compile the program without debugging information, to have minimal symbols.
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {c}]} {
+# Compile the program with "symtab" to have minimal symbols.
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {symtab c}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/jit-elf-fork.exp b/gdb/testsuite/gdb.base/jit-elf-fork.exp
index f9f516c571c..2f9951983c0 100644
--- a/gdb/testsuite/gdb.base/jit-elf-fork.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-fork.exp
@@ -31,7 +31,7 @@ set jit_solib_srcfile ${srcdir}/${subdir}/${jit_solib_basename}.c
 
 # Compile a shared library to use as JIT objects.
 set jit_solibs_target [compile_and_download_n_jit_so \
-		       $jit_solib_basename $jit_solib_srcfile 1]
+		       $jit_solib_basename $jit_solib_srcfile 1 {symtab}]
 if { $jit_solibs_target == -1 } {
     return
 }
diff --git a/gdb/testsuite/gdb.base/jit-elf-so.exp b/gdb/testsuite/gdb.base/jit-elf-so.exp
index 2a770d5df6e..0b4ab4ab7e2 100644
--- a/gdb/testsuite/gdb.base/jit-elf-so.exp
+++ b/gdb/testsuite/gdb.base/jit-elf-so.exp
@@ -150,7 +150,7 @@ if { [compile_jit_dlmain {shlib_load}] < 0 } {
 
 # Compile two shared libraries to use as JIT objects.
 set jit_solibs_target [compile_and_download_n_jit_so \
-		      $jit_solib_basename $jit_solib_srcfile 2]
+		      $jit_solib_basename $jit_solib_srcfile 2 {symtab}]
 if { $jit_solibs_target == -1 } {
     return
 }
diff --git a/gdb/testsuite/gdb.base/jit-elf.exp b/gdb/testsuite/gdb.base/jit-elf.exp
index 37ab1ea950a..8b4ed950cbd 100644
--- a/gdb/testsuite/gdb.base/jit-elf.exp
+++ b/gdb/testsuite/gdb.base/jit-elf.exp
@@ -136,7 +136,7 @@ proc one_jit_test {jit_solibs_target match_str reattach} {
 
 # Compile two shared libraries to use as JIT objects.
 set jit_solibs_target [compile_and_download_n_jit_so \
-		      $jit_solib_basename $jit_solib_srcfile 2]
+		      $jit_solib_basename $jit_solib_srcfile 2 {symtab}]
 if { $jit_solibs_target == -1 } {
     return
 }
diff --git a/gdb/testsuite/gdb.base/list-nodebug.exp b/gdb/testsuite/gdb.base/list-nodebug.exp
index c29905d94ba..fa9b84e49fa 100644
--- a/gdb/testsuite/gdb.base/list-nodebug.exp
+++ b/gdb/testsuite/gdb.base/list-nodebug.exp
@@ -20,7 +20,7 @@ standard_testfile .c -2.c
 
 if { [prepare_for_testing_full "failed to prepare" \
 	  [list \
-	       $testfile {} \
+	       $testfile {symtab} \
 	       $srcfile {} \
 	       $srcfile2 {debug}]] } {
     return
diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp
index 9b5ad145659..90423d4a9cc 100644
--- a/gdb/testsuite/gdb.base/morestack.exp
+++ b/gdb/testsuite/gdb.base/morestack.exp
@@ -19,9 +19,9 @@ require {have_compile_flag -fsplit-stack}
 
 standard_testfile
 
-set opts "additional_flags=-fsplit-stack"
+set opts {symtab additional_flags=-fsplit-stack}
 if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile \
-	  [list $opts]] } {
+	  $opts] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/msym-bp-shl.exp b/gdb/testsuite/gdb.base/msym-bp-shl.exp
index 2b29e550af4..ba93c8bcc66 100644
--- a/gdb/testsuite/gdb.base/msym-bp-shl.exp
+++ b/gdb/testsuite/gdb.base/msym-bp-shl.exp
@@ -40,7 +40,7 @@ proc test {debug} {
     if {$debug} {
 	set options "debug"
     } else {
-	set options ""
+	set options "symtab"
     }
 
     set bin ${binfile}-$debug
diff --git a/gdb/testsuite/gdb.base/msym-bp.exp b/gdb/testsuite/gdb.base/msym-bp.exp
index 18e16c581f7..0c2e861c7fd 100644
--- a/gdb/testsuite/gdb.base/msym-bp.exp
+++ b/gdb/testsuite/gdb.base/msym-bp.exp
@@ -36,7 +36,7 @@ proc test {debug} {
     if {$debug} {
 	set options "debug"
     } else {
-	set options ""
+	set options "symtab"
     }
 
     if { [prepare_for_testing "failed to prepare" $testfile-$debug \
diff --git a/gdb/testsuite/gdb.base/msym-lang.exp b/gdb/testsuite/gdb.base/msym-lang.exp
index 38521e4ebf7..2b57d0caef7 100644
--- a/gdb/testsuite/gdb.base/msym-lang.exp
+++ b/gdb/testsuite/gdb.base/msym-lang.exp
@@ -16,7 +16,7 @@
 standard_testfile msym-lang-main.c msym-lang.c
 
 if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile $srcfile2] \
-	 {c++}]} {
+	 {symtab c++}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp
index 76de3b82f97..bca1accf945 100644
--- a/gdb/testsuite/gdb.base/nodebug.exp
+++ b/gdb/testsuite/gdb.base/nodebug.exp
@@ -18,7 +18,10 @@
 
 standard_testfile .c
 
-set exec_opts {}
+# We need at least minsyms to be able to set breakpoints, run to them,
+# and call functions by name.
+set exec_opts {symtab}
+
 if {[have_compile_flag -std=c99]} {
     # Gcc 15 defaults to c23, which no longer supports unprototyped functions.
     # Use a c dialect that does support this.
diff --git a/gdb/testsuite/gdb.base/psym-external-decl.exp b/gdb/testsuite/gdb.base/psym-external-decl.exp
index bbe8a043fab..b8eec5e665b 100644
--- a/gdb/testsuite/gdb.base/psym-external-decl.exp
+++ b/gdb/testsuite/gdb.base/psym-external-decl.exp
@@ -23,7 +23,7 @@ set srcfiles [list $srcfile $srcfile2]
 
 if { [build_executable_from_specs \
 	  "failed to prepare" \
-	  $testfile [list] \
+	  $testfile [list symtab] \
 	  $srcfile [list debug] \
 	  $srcfile2 [list]] == -1 } {
     return
diff --git a/gdb/testsuite/gdb.base/solib-nodir.exp b/gdb/testsuite/gdb.base/solib-nodir.exp
index 4189e1abd5b..733545975fa 100644
--- a/gdb/testsuite/gdb.base/solib-nodir.exp
+++ b/gdb/testsuite/gdb.base/solib-nodir.exp
@@ -40,7 +40,7 @@ if { [build_executable "build library" ${binlibfile} ${srclibfile} \
 	  {debug shlib}] == -1
      || [gdb_gnu_strip_debug $binlibfile]
      || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != ""
-     || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {}] != "" } {
+     || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {symtab}] != "" } {
     untested "failed to compile"
     return
 }
diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp
index 545d50f308a..09dec9f0507 100644
--- a/gdb/testsuite/gdb.base/whatis.exp
+++ b/gdb/testsuite/gdb.base/whatis.exp
@@ -592,6 +592,7 @@ proc do_test {dir options} {
 set ctf_opts {}
 lappend ctf_opts additional_flags=-gctf
 lappend ctf_opts ldflags=-Wl,--ctf-variables
+lappend ctf_opts symtab
 
 # Build up the set of debug formats for which we will run this test.
 set specs { {dwarf {debug}} }
diff --git a/gdb/testsuite/gdb.compile/compile-cplus-print.exp b/gdb/testsuite/gdb.compile/compile-cplus-print.exp
index 9ad61184691..111296993a1 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus-print.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus-print.exp
@@ -21,7 +21,7 @@ require is_c_compiler_gcc
 
 require allow_compile_tests
 
-set options {}
+set options {symtab}
 if {[test_compiler_info gcc*]} {
     lappend options additional_flags=-g3
     lappend options additional_flags=-std=gnu++11
diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp
index 5db328feff6..eebc02dc0ce 100644
--- a/gdb/testsuite/gdb.compile/compile-cplus.exp
+++ b/gdb/testsuite/gdb.compile/compile-cplus.exp
@@ -21,7 +21,7 @@ require is_c_compiler_gcc
 
 require allow_compile_tests
 
-set options {}
+set options {symtab}
 if { [test_compiler_info gcc*] || [test_compiler_info clang*] } {
     lappend options additional_flags=-g3
     lappend options additional_flags=-std=gnu++11
diff --git a/gdb/testsuite/gdb.compile/compile-ifunc.exp b/gdb/testsuite/gdb.compile/compile-ifunc.exp
index e1cc7aee211..5368196ee36 100644
--- a/gdb/testsuite/gdb.compile/compile-ifunc.exp
+++ b/gdb/testsuite/gdb.compile/compile-ifunc.exp
@@ -31,7 +31,7 @@ if {[test_compiler_info gcc*]} {
 with_test_prefix "nodebug" {
 
     if { [prepare_for_testing "failed to prepare" "$testfile-nodebug" \
-	      $srcfile $flags] } {
+	      $srcfile [list symtab $flags]] } {
 	return
     }
 
diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp
index 5998f30180d..07fa6b30af7 100644
--- a/gdb/testsuite/gdb.compile/compile.exp
+++ b/gdb/testsuite/gdb.compile/compile.exp
@@ -20,7 +20,7 @@ require allow_compile_tests
 standard_testfile .c compile-shlib.c compile-constvar.S compile-nodebug.c
 
 require is_c_compiler_gcc
-set options {additional_flags=-g3}
+set options {symtab additional_flags=-g3}
 
 if { ![is_x86_64_m64_target] } {
     verbose "Skipping x86_64 LOC_CONST test."
diff --git a/gdb/testsuite/gdb.cp/cmpd-minsyms.exp b/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
index ccd7f5d692a..ffae762fe1f 100644
--- a/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
+++ b/gdb/testsuite/gdb.cp/cmpd-minsyms.exp
@@ -23,7 +23,7 @@ require allow_cplus_tests
 standard_testfile .cc
 
 # Do NOT compile with debug flag.
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {c++}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {symtab c++}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl b/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl
index f7aea3bd1df..de36b2ae929 100644
--- a/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl
+++ b/gdb/testsuite/gdb.cp/infcall-nodebug.exp.tcl
@@ -43,7 +43,7 @@ proc build_and_run_test { lang symbols } {
     if { $symbols == "debug" } {
 	set debug_flags "debug"
     } else {
-	set debug_flags ""
+	set debug_flags "symtab"
     }
 
     # Compile both files to objects, then link together.
@@ -64,7 +64,7 @@ proc build_and_run_test { lang symbols } {
 	return -1
     }
 
-    if { [gdb_compile "$main_o $lib_o" ${binfile} executable ""] != "" } {
+    if { [gdb_compile "$main_o $lib_o" ${binfile} executable symtab] != "" } {
 	untested "failed to compile"
 	return -1
     }
diff --git a/gdb/testsuite/gdb.cp/nsalias.exp b/gdb/testsuite/gdb.cp/nsalias.exp
index f3224b4339d..2d9c12dfc39 100644
--- a/gdb/testsuite/gdb.cp/nsalias.exp
+++ b/gdb/testsuite/gdb.cp/nsalias.exp
@@ -178,7 +178,7 @@ if {[gdb_compile $asm_file ${binfile}2.o object {}] != ""} {
 }
 
 if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \
-	 $binfile executable {c++}] != ""} {
+	 $binfile executable {symtab c++}] != ""} {
     return
 }
 
@@ -308,7 +308,7 @@ if {[gdb_compile $asm_file ${binfile}3.o object {}] != ""} {
 }
 
 if {[gdb_compile [list ${binfile}1.o ${binfile}3.o] \
-	 ${binfile}-r executable {c++}] != ""} {
+	 ${binfile}-r executable {symtab c++}] != ""} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp b/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp
index b3d2b3583d7..84171b88d83 100644
--- a/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp
+++ b/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp
@@ -37,7 +37,7 @@ if { [gdb_compile $s2 ${objfile2} object $opts] != "" } {
     return
 }
 
-set opts {}
+set opts {symtab}
 lappend opts "additional_flags=-Wl,-ctf-variables"
 if { [gdb_compile [list ${objfile} ${objfile2}] $binfile executable $opts] != "" } {
     unsupported "failed to link"
diff --git a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
index 0e7318bfd64..286d76975a2 100644
--- a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
@@ -69,7 +69,7 @@ Dwarf::assemble $asm_file {
     }
 }
 
-if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} {
+if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp b/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
index 5d31414ba29..4fd37b45bce 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
@@ -83,7 +83,7 @@ Dwarf::assemble {
 }
 
 if {[build_executable ${testfile}.exp $testfile "${asm_file} ${srcfile}" \
-	 [list ldflags=-nostartfiles]] == -1} {
+	 [list symtab ldflags=-nostartfiles]] == -1} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp
index 11294ae5a13..4d7dd56107f 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-duplicate-cu.exp
@@ -61,7 +61,7 @@ Dwarf::assemble {
 }
 
 if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
-	 [list ldflags=-nostartfiles]]} {
+	 [list symtab ldflags=-nostartfiles]]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
index c5eca54b55c..558e8d7d5b6 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
@@ -68,7 +68,7 @@ Dwarf::assemble {
 }
 
 if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
-	 [list ldflags=-nostartfiles]]} {
+	 [list symtab ldflags=-nostartfiles]]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
index bd48df6a894..ad19db12cdf 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
@@ -91,7 +91,7 @@ Dwarf::assemble {
 }
 
 if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
-	 [list ldflags=-nostartfiles]]} {
+	 [list symtab ldflags=-nostartfiles]]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names.exp b/gdb/testsuite/gdb.dwarf2/debug-names.exp
index 39bdd3d59e8..e61c20a9142 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names.exp
@@ -64,7 +64,7 @@ Dwarf::assemble {
 }
 
 if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
-	 [list ldflags=-nostartfiles]]} {
+	 [list symtab ldflags=-nostartfiles]]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp b/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp
index 6e729f8c6ec..4a1065da0ae 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.exp
@@ -17,12 +17,13 @@ load_lib dwarf.exp
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
 
+set opts {symtab}
+
 # Some targets have leading underscores on assembly symbols.
-set additional_flags [gdb_target_symbol_prefix_flags_asm]
+lappend opts [gdb_target_symbol_prefix_flags_asm]
 
 standard_testfile .S
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
-	$additional_flags]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp b/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
index f8da14c0a5a..bb77533df6d 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
@@ -158,7 +158,7 @@ Dwarf::assemble $asm_file {
 }
 
 if {[prepare_for_testing "failed to prepare" $testfile \
-	 "${asm_file} ${srcfile}" {}]} {
+	 "${asm_file} ${srcfile}" {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
index a659ae7171a..a16463ef71f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
@@ -26,7 +26,7 @@ require dwarf2_support
 standard_testfile .S -main.c
 
 if { [prepare_for_testing "failed to prepare" ${testfile} \
-	  [list $srcfile2 $srcfile] {}] } {
+	  [list $srcfile2 $srcfile] {symtab}] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
index 6b01e1d2880..633d18d9204 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
@@ -392,7 +392,8 @@ puts -nonewline $f "\
 
 close $f
 
-set opts {}
+set opts {symtab}
+
 # Base directory.
 lappend opts "additional_flags=-DBDIR=\"${srcabsdir}\""
 # Incorrect directory which should never be visible from GDB.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp
index 15bb0f704cd..4fca3c8591f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp
@@ -28,7 +28,7 @@ set executable ${testfile}
 
 if {[prepare_for_testing_full "failed to prepare" \
 	 [list \
-	      $testfile c++ \
+	      $testfile {c++ symtab} \
 	      $testfile-main.cc {c++} \
 	      $srcfile {}]]} {
     return
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
index 81a0f2fb45d..480fb862c3e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
@@ -40,7 +40,7 @@ lappend flags \
 set executable ${testfile}
 
 if { [prepare_for_testing_full "failed to prepare" \
-	  [list $testfile {} \
+	  [list $testfile {symtab} \
 	       $srcfile [concat $flags {}]  \
 	       $srcfile2 {} \
 	       $srcfile3 {debug}]] == -1 } {
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restore.exp b/gdb/testsuite/gdb.dwarf2/dw2-restore.exp
index e0c334f80cc..4eacd961772 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-restore.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-restore.exp
@@ -19,7 +19,7 @@
 require is_x86_64_m64_target
 standard_testfile .S
 
-set opts [list {additional_flags=-nostdlib}]
+set opts {symtab additional_flags=-nostdlib}
 
 # Clang's integrated assembler doesn't support .func or .endfunc.
 if { [test_compiler_info clang*] } {
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
index 276793325d6..e2e87e4904b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
@@ -45,7 +45,8 @@ if {[is_ilp32_target]} {
 
 if { [build_executable ${testfile}.exp ${executable} \
 	  "${testfile}.c ${testfile}.S" \
-	  [list additional_flags=-DINLINED \
+	  [list symtab \
+		additional_flags=-DINLINED \
 		additional_flags=-DPTRBITS=$ptrbits]] == -1 } {
     return
 }
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
index 0b2d7f64f75..f5e09337d63 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
@@ -90,7 +90,7 @@ Dwarf::assemble $asm_file {
 }
 
 if { [prepare_for_testing "failed to prepare" $testfile \
-	  "${asm_file} ${srcfile}" {}] } {
+	  "${asm_file} ${srcfile}" {symtab}] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
index 7c7c2a20432..4d334649e79 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
@@ -62,7 +62,7 @@ Dwarf::assemble $asm_file {
 }
 
 if { [prepare_for_testing "failed to prepare" $testfile \
-	  "${asm_file} ${srcfile}" {}] } {
+	  "${asm_file} ${srcfile}" {symtab}] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp
index fe0974fd8f4..7300b0c2737 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp
@@ -92,7 +92,7 @@ Dwarf::assemble $asm_file {
 }
 
 if {[prepare_for_testing "failed to prepare" $testfile \
-	 "${asm_file} ${srcfile} ${srcfile2}" {}]} {
+	 "${asm_file} ${srcfile} ${srcfile2}" {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/dwz.exp b/gdb/testsuite/gdb.dwarf2/dwz.exp
index 96dab6cf930..ae1437fe109 100644
--- a/gdb/testsuite/gdb.dwarf2/dwz.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwz.exp
@@ -80,7 +80,7 @@ Dwarf::assemble $asm_file {
     }
 }
 
-if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl b/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl
index 2308ab67acf..4c0c0580df5 100644
--- a/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.tcl
@@ -177,7 +177,7 @@ foreach_with_prefix testname $tests {
 	set objs [list ${binfile}1.o ${binfile}6.o]
     }
 
-    if {[gdb_compile $objs ${binfile}-$testname executable {quiet}] != ""} {
+    if {[gdb_compile $objs ${binfile}-$testname executable {symtab quiet}] != ""} {
 	unsupported "compilation failed"
 	continue
     }
diff --git a/gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp b/gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp
index 999c01c7179..d6420ffdc25 100644
--- a/gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp
+++ b/gdb/testsuite/gdb.dwarf2/entry-value-typedef.exp
@@ -27,7 +27,7 @@ if { [istarget "x86_64-*-linux*"] && [is_lp64_target] } {
 
 standard_testfile -$suffix.S
 
-if {[gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" executable {c++}] != ""} {
+if {[gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" executable {symtab c++}] != ""} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/fission-call.exp b/gdb/testsuite/gdb.dwarf2/fission-call.exp
index f7cfb6296e8..99708b5d3e0 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-call.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-call.exp
@@ -107,7 +107,7 @@ Dwarf::assemble $asm_file {
 }
 
 set obj [standard_output_file "${testfile}-dw.o"]
-if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {} \
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {symtab} \
 	 [list $asm_file {split-dwo} $obj] \
 	 [list $srcfile {}]]} {
     return
diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
index 80cf179a538..998f9faf696 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp
@@ -29,7 +29,7 @@ standard_testfile .S
 set obj [standard_output_file "${testfile}.o"]
 set dwo [standard_output_file "${testfile}.dwo"]
 
-set exec_options {}
+set exec_options {symtab}
 if { $additional_flags != "" } {
     lappend exec_options $additional_flags
 }
diff --git a/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp b/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp
index 858265b3afa..f039e517e86 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-with-type-unit.exp
@@ -77,7 +77,7 @@ Dwarf::assemble $asm_file {
 }
 
 set obj [standard_output_file "${testfile}-dw.o"]
-if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {} \
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {symtab} \
 	 [list $asm_file {split-dwo} $obj] \
 	 [list $srcfile {}]]} {
     return
diff --git a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
index 6f5045f545d..0c2723edc6b 100644
--- a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
+++ b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.exp
@@ -101,7 +101,7 @@ Dwarf::assemble $dwarf_asm {
 }
 
 if { [build_executable ${testfile}.exp ${testfile} "$srcfile $dwarf_asm" \
-      {additional_flags=-nostdlib additional_flags=-static}] != 0 } {
+      {symtab additional_flags=-nostdlib additional_flags=-static}] != 0 } {
     untested "failed to compile"
     return
 }
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-skeletonless-tu.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-skeletonless-tu.exp
index 1bd2a6981e5..ce4c7913548 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-skeletonless-tu.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-skeletonless-tu.exp
@@ -77,7 +77,7 @@ Dwarf::assemble $asm_file {
 }
 
 set obj [standard_output_file "${testfile}-dw.o"]
-if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {} \
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {symtab} \
 	 [list $asm_file {split-dwo} $obj] \
 	 [list $srcfile {}]]} {
     return
diff --git a/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
index 59b91fad6fa..fa07296ba04 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
@@ -123,7 +123,7 @@ proc test_1 { name dwarf_version offset_size addr_size ref_addr_size two_cu } {
     }
 
     # 32-bit targets do not support any of the testcases; keep quiet there.
-    set opts {quiet}
+    set opts {symtab quiet}
     set executable ${testfile}-${name}
     if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" $opts]} {
 	return -1
diff --git a/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
index ac4f0491198..06d2e882eae 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp
@@ -76,7 +76,7 @@ Dwarf::assemble $asm_file {
     }
 }
 
-if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} {
+if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/implref-array.exp b/gdb/testsuite/gdb.dwarf2/implref-array.exp
index dfa676de693..d3edc04efc4 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-array.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-array.exp
@@ -113,7 +113,7 @@ Dwarf::assemble ${asm_file} {
     }
 }
 
-if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/implref-const.exp b/gdb/testsuite/gdb.dwarf2/implref-const.exp
index 0d79e05f8ef..587f59cf75d 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-const.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-const.exp
@@ -92,7 +92,7 @@ Dwarf::assemble ${asm_file} {
     }
 }
 
-if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/implref-global.exp b/gdb/testsuite/gdb.dwarf2/implref-global.exp
index 4c2466756e3..67869519a21 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-global.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-global.exp
@@ -92,7 +92,7 @@ Dwarf::assemble ${asm_file} {
     }
 }
 
-if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/implref-struct.exp b/gdb/testsuite/gdb.dwarf2/implref-struct.exp
index d62f426ed73..c38bc0fea3c 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-struct.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-struct.exp
@@ -129,7 +129,7 @@ Dwarf::assemble ${asm_file} {
     }
 }
 
-if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp b/gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp
index be97260c0b5..1734bfc53e3 100644
--- a/gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp
+++ b/gdb/testsuite/gdb.dwarf2/inlined_subroutine-inheritance.exp
@@ -201,7 +201,7 @@ Dwarf::assemble $asm_file {
 }
 
 if {[prepare_for_testing "failed to prepare" $testfile \
-	 "${asm_file} ${srcfile}" {}]} {
+	 "${asm_file} ${srcfile}" {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/intbits.exp b/gdb/testsuite/gdb.dwarf2/intbits.exp
index 46e45aeb861..47c0bc53f01 100644
--- a/gdb/testsuite/gdb.dwarf2/intbits.exp
+++ b/gdb/testsuite/gdb.dwarf2/intbits.exp
@@ -195,7 +195,7 @@ Dwarf::assemble ${asm_file} {
 }
 
 if {[prepare_for_testing "failed to prepare" ${executable} \
-	 [list ${asm_file} ${srcfile}] {}]} {
+	 [list ${asm_file} ${srcfile}] {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/multi-piece-inherited-bitfield.exp b/gdb/testsuite/gdb.dwarf2/multi-piece-inherited-bitfield.exp
index 427828f7178..d72c226f71d 100644
--- a/gdb/testsuite/gdb.dwarf2/multi-piece-inherited-bitfield.exp
+++ b/gdb/testsuite/gdb.dwarf2/multi-piece-inherited-bitfield.exp
@@ -133,7 +133,7 @@ Dwarf::assemble ${asm_file} {
 
 # Now compile both C source and generated DWARF assembly.
 if {[prepare_for_testing "failed to prepare" ${testfile} \
-	 [list ${asm_file} ${srcfile}] {}]} {
+	 [list ${asm_file} ${srcfile}] {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/multi-piece-primitive-field.exp b/gdb/testsuite/gdb.dwarf2/multi-piece-primitive-field.exp
index 4d6b3fcb6c1..ac6de94487a 100644
--- a/gdb/testsuite/gdb.dwarf2/multi-piece-primitive-field.exp
+++ b/gdb/testsuite/gdb.dwarf2/multi-piece-primitive-field.exp
@@ -162,7 +162,7 @@ Dwarf::assemble ${asm_file} {
 
 # Now compile both C source and generated DWARF assembly.
 if {[prepare_for_testing "failed to prepare" ${testfile} \
-	 [list ${asm_file} ${srcfile}] {}]} {
+	 [list ${asm_file} ${srcfile}] {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.exp b/gdb/testsuite/gdb.dwarf2/pr13961.exp
index 46bcdd70b0e..d89d1943377 100644
--- a/gdb/testsuite/gdb.dwarf2/pr13961.exp
+++ b/gdb/testsuite/gdb.dwarf2/pr13961.exp
@@ -20,13 +20,15 @@ load_lib dwarf.exp
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
 
+set opts {symtab}
+
 # Some targets have leading underscores on assembly symbols.
-set additional_flags [gdb_target_symbol_prefix_flags_asm]
+lappend opts [gdb_target_symbol_prefix_flags_asm]
 
 standard_testfile .S
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
-	${additional_flags}] == -1 } {
+	$opts] == -1 } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp
index b51c7e41a8b..fbdb8e50a52 100644
--- a/gdb/testsuite/gdb.dwarf2/self-spec.exp
+++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp
@@ -52,7 +52,7 @@ Dwarf::assemble $asm_file {
     }
 }
 
-if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/varval.exp b/gdb/testsuite/gdb.dwarf2/varval.exp
index 032e3d11c0e..f9a24a62bc8 100644
--- a/gdb/testsuite/gdb.dwarf2/varval.exp
+++ b/gdb/testsuite/gdb.dwarf2/varval.exp
@@ -314,7 +314,7 @@ proc setup_exec { arg_bad } {
 	}
     }
 
-    if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
+    if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {symtab}]} {
 	return -1
     }
 }
diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
index 60764a986c1..1b526f4f646 100644
--- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp
+++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
@@ -531,7 +531,7 @@ proc_with_prefix test_bkpt_probe {} {
     global decimal hex testfile srcfile
 
     if { [prepare_for_testing "failed to prepare" ${testfile}-probes \
-	    ${srcfile} {additional_flags=-DUSE_PROBES}] } {
+	    ${srcfile} {symtab additional_flags=-DUSE_PROBES}] } {
 	return -1
     }
 
diff --git a/gdb/testsuite/gdb.linespec/break-asm-file.exp b/gdb/testsuite/gdb.linespec/break-asm-file.exp
index 6b86dd5b4cd..a9df431b305 100644
--- a/gdb/testsuite/gdb.linespec/break-asm-file.exp
+++ b/gdb/testsuite/gdb.linespec/break-asm-file.exp
@@ -42,7 +42,7 @@ if  {[gdb_compile ${srcdir}/${subdir}/$asm_file1 ${binfile}3.o \
 }
 
 if  {[gdb_compile [list ${binfile}1.o ${binfile}2.o ${binfile}3.o] \
-	  "${binfile}" executable {}] != ""} {
+	  "${binfile}" executable {symtab}] != ""} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
index 94f42fe77ab..7e59b003cf8 100644
--- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
+++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
@@ -38,7 +38,7 @@ set objmainfile [standard_output_file ${testfile}-main.o]
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $objsfile object {}] != ""
      || [gdb_compile "${srcdir}/${subdir}/${srcfile2}" $objfuncfile object {}] != ""
      || [gdb_compile "${srcdir}/${subdir}/${srcfile3}" $objmainfile object {debug}] != ""
-     || [gdb_compile "$objfuncfile $objsfile $objmainfile" $binfile executable {}] != "" } {
+     || [gdb_compile "$objfuncfile $objsfile $objmainfile" $binfile executable {symtab}] != "" } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
index adcd713453c..47f4574cd1b 100644
--- a/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.mi/mi2-amd64-entry-value.exp
@@ -25,6 +25,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 if {[build_executable ${testfile}.exp ${binfile} ${srcfile} $opts]} {
diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
index aebec651964..97d3262fa42 100644
--- a/gdb/testsuite/gdb.python/py-frame.exp
+++ b/gdb/testsuite/gdb.python/py-frame.exp
@@ -237,7 +237,7 @@ foreach_with_prefix stop_at_level { None 0 1 2 } {
 }
 
 # Compile again without debug info.
-if { [prepare_for_testing "failed to prepare" ${testfile}-nodebug ${srcfile} {}] } {
+if { [prepare_for_testing "failed to prepare" ${testfile}-nodebug ${srcfile} {symtab}] } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
index 8a4bf001a69..ef5fb424750 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
@@ -23,7 +23,7 @@ require is_x86_64_m64_target
 
 # We cannot use prepare_for_testing as we have to set the safe-patch
 # to check objfile and progspace printers.
-if {[build_executable $testfile.exp $testfile $srcfile {}] == -1} {
+if {[build_executable $testfile.exp $testfile $srcfile {symtab}] == -1} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.python/py-linetable.exp b/gdb/testsuite/gdb.python/py-linetable.exp
index 5290c4a9bea..e5b987380a2 100644
--- a/gdb/testsuite/gdb.python/py-linetable.exp
+++ b/gdb/testsuite/gdb.python/py-linetable.exp
@@ -24,6 +24,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
diff --git a/gdb/testsuite/gdb.python/py-prettyprint-stub.exp b/gdb/testsuite/gdb.python/py-prettyprint-stub.exp
index 491e8c36959..387dbd9144a 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint-stub.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint-stub.exp
@@ -26,7 +26,7 @@ set srcfiles [list $srcfile $srcfile2]
 
 if { [build_executable_from_specs \
 	  "failed to prepare" \
-	  $testfile {c++} \
+	  $testfile {c++ symtab} \
 	  $srcfile {c++ debug} \
 	  $srcfile2 {c++}] == -1 } {
     return
diff --git a/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp b/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp
index c3289fa4c6f..5757c4a44df 100644
--- a/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/amd64-tailcall-reverse.exp
@@ -24,6 +24,7 @@ if {[info exists COMPILE]} {
     lappend opts debug optimize=-O2
 } else {
     require is_x86_64_m64_target
+    lappend opts symtab
 }
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
diff --git a/gdb/testsuite/gdb.reverse/singlejmp-reverse.exp b/gdb/testsuite/gdb.reverse/singlejmp-reverse.exp
index dfa8ac179f0..ae4cc1ff6a0 100644
--- a/gdb/testsuite/gdb.reverse/singlejmp-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/singlejmp-reverse.exp
@@ -20,7 +20,7 @@ set executable ${testfile}
 
 if {[info exists COMPILE]} {
     # make check RUNTESTFLAGS="gdb.reverse/singlejmp-reverse.exp COMPILE=1"
-    if { [build_executable_from_specs ${testfile}.exp $executable {} \
+    if { [build_executable_from_specs ${testfile}.exp $executable {symtab} \
 				      ${testfile}.c {debug optimize=-O2} \
 				      ${testfile}-nodebug.c {optimize=-O2} \
 				      ] == -1 } {
@@ -29,7 +29,7 @@ if {[info exists COMPILE]} {
 } else {
     require is_x86_64_m64_target
     if { [build_executable ${testfile}.exp ${testfile} \
-	      [list ${srcfile} ${srcfile2}] {}] == -1 } {
+	      [list ${srcfile} ${srcfile2}] {symtab}] == -1 } {
 	return
     }
 }
diff --git a/gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp b/gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp
index 039a208a5fa..60865e49730 100644
--- a/gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp
+++ b/gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp
@@ -22,7 +22,7 @@ standard_testfile .cpp
 
 require allow_hipcc_tests
 
-if {[build_executable "failed to prepare" $testfile $srcfile {hip}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {hip symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.rocm/displaced-stepping.exp b/gdb/testsuite/gdb.rocm/displaced-stepping.exp
index 383972bbb33..ac4ecac8d96 100644
--- a/gdb/testsuite/gdb.rocm/displaced-stepping.exp
+++ b/gdb/testsuite/gdb.rocm/displaced-stepping.exp
@@ -23,7 +23,7 @@ require allow_hipcc_tests
 
 # Since GDB doesn't yet understand DWARF expressions generated by the HIP
 # compiler, purposefully generate the binary without debug info.
-if {[build_executable "failed to prepare" $testfile $srcfile {hip}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {hip symtab}]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp
index ca104e1cb07..4c91a62bd33 100644
--- a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp
+++ b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp
@@ -31,6 +31,7 @@ set binfile_execee "$binfile-execee"
 # Compile two versions of execer, one that uses fork and one that uses vfork.
 foreach_with_prefix fork_func { fork vfork } {
     set opts {}
+    lappend opts symtab
     lappend opts additional_flags=-DFORK=$fork_func
     lappend opts additional_flags=-DEXECEE=[quote_for_host $::binfile_execee]
 
diff --git a/gdb/testsuite/gdb.server/sysroot.exp b/gdb/testsuite/gdb.server/sysroot.exp
index 7e4a796e879..c4f30587cdc 100644
--- a/gdb/testsuite/gdb.server/sysroot.exp
+++ b/gdb/testsuite/gdb.server/sysroot.exp
@@ -23,7 +23,9 @@ load_lib gdbserver-support.exp
 require allow_gdbserver_tests
 
 standard_testfile
-if {[build_executable "failed to prepare" $testfile $srcfile "additional_flags=--no-builtin"] == -1} {
+
+set opts {symtab "additional_flags=--no-builtin"}
+if {[build_executable "failed to prepare" $testfile $srcfile $opts] == -1} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp b/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
index 5e9c4ddd2e8..131a58b5475 100644
--- a/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
+++ b/gdb/testsuite/gdb.threads/tls-nodebug-pie.exp
@@ -16,7 +16,7 @@
 standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
-	 {pie}] != "" } {
+	 {pie symtab}] != "" } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.threads/tls-nodebug.exp b/gdb/testsuite/gdb.threads/tls-nodebug.exp
index e02788700d8..2b1c5a84885 100644
--- a/gdb/testsuite/gdb.threads/tls-nodebug.exp
+++ b/gdb/testsuite/gdb.threads/tls-nodebug.exp
@@ -22,7 +22,7 @@ if {[istarget "*-*-linux"]} {
     set target_cflags ""
 }
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {symtab}] != "" } {
     return
 }
 
diff --git a/gdb/testsuite/gdb.threads/tls-var.exp b/gdb/testsuite/gdb.threads/tls-var.exp
index 28d0886c6bf..4e6816eef51 100644
--- a/gdb/testsuite/gdb.threads/tls-var.exp
+++ b/gdb/testsuite/gdb.threads/tls-var.exp
@@ -21,7 +21,7 @@ set executable ${testfile}
 
 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${objfile} object {debug}] != ""
      || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objmainfile} object {}] != ""
-     || [gdb_compile_pthreads "${objfile} ${objmainfile}" ${binfile} executable {}] != ""} {
+     || [gdb_compile_pthreads "${objfile} ${objmainfile}" ${binfile} executable {symtab}] != ""} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index 251acc10bfe..0ad4496f6d2 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -25,7 +25,7 @@ if  {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
 }
 
 if  {[gdb_compile [list ${binfile}1.o] \
-	  "${binfile}1" executable {}] != ""} {
+	  "${binfile}1" executable {symtab}] != ""} {
     return
 }
 
@@ -159,7 +159,7 @@ if  {[gdb_compile $asm_file ${binfile}2.o object {}] != ""} {
 }
 
 if  {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \
-	  "${binfile}" executable {}] != ""} {
+	  "${binfile}" executable {symtab}] != ""} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp
index 16bfdf2304d..89c4e933028 100644
--- a/gdb/testsuite/gdb.trace/tspeed.exp
+++ b/gdb/testsuite/gdb.trace/tspeed.exp
@@ -26,7 +26,7 @@ standard_testfile
 set executable $testfile
 
 # Check that the target supports trace.
-if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {symtab}] != "" } {
     untested "failed to compile"
     return
 }
diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
index f85f7b19c34..b7e3a4df1a8 100644
--- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
+++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
@@ -288,7 +288,7 @@ if  { [gdb_compile ${asm_file} ${binfile}2.o object {}] != "" } {
 }
 
 if  { [gdb_compile [list ${binfile}1.o ${binfile}2.o] ${binfile} \
-	   executable {}] != "" } {
+	   executable {symtab}] != "" } {
     return
 }
 
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.