[gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed

When running test-case gdb.base/ctf-constvars.exp on openSUSE Tumbleweed (with
system gcc version 12, providing gcc -gctf support, enabling the ctf test-cases
in the gdb testsuite), I run into:
...
(gdb) print vox^M
'vox' has unknown type; cast it to its declared type^M
(gdb) FAIL: gdb.base/ctf-constvars.exp: print vox
...

There are two causes for this:
- the linker flags are missing --ctf-variables, so the information for variable
  vox is missing (reported in PR29468), and
- the executable contains some dwarf2 due to some linked-in glibc objects,
  so the ctf info is ignored (reported in PR29160).

By using:
- -Wl,--ctf-variable,
- -Wl,--strip-debug, and
we can make the test-case and some similar test-cases pass.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29160
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29468
7 files changed