]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/testsuite: remove unnecessary -Wl,-soname,NAME build flags
authorAndrew Burgess <aburgess@redhat.com>
Tue, 14 May 2024 10:29:49 +0000 (11:29 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 14 May 2024 15:51:50 +0000 (16:51 +0100)
commitc2b915e2a5cdb2ef79124e1a558f67959c78cc62
treefdd1516d9578b32203e9dbdd8215be2ddf29f5eb
parent4ac16d6607c045d2c4fa4b3712eb8f617af09e1b
gdb/testsuite: remove unnecessary -Wl,-soname,NAME build flags

While working on another patch I needed to pass -Wl,-soname,NAME as a
compiler flag.  I initially looked for other tests that did this, and
found a few examples, so I copied what they did.

But when I checked the gdb.log file I noticed that we were actually
getting -Wl,-soname passed twice.

I tracked the repeated option to 'proc gdb_compile_shlib_1' in
lib/gdb.exp.  It turns out that we always add -Wl,-soname when
compiling a shared library.

Here's an example of a build command from gdb.base/prelink.exp:

  builtin_spawn -ignore SIGHUP gcc -fno-stack-protector \
    /tmp/build/gdb/testsuite/outputs/gdb.base/prelink/prelink-lib.c.o \
    -fdiagnostics-color=never -shared -g \
    -Wl,-soname,prelink.so -Wl,-soname,prelink.so -lm \
    -o /tmp/build/gdb/testsuite/outputs/gdb.base/prelink/prelink.so

Notice that '-Wl,-soname,prelink.so' is repeated.

I believe that all of the places where tests add '-Wl,-soname,NAME' as
a build option, are unnecessary.

In this commit I propose we remove them all.

As part of this change I've switched from calling gdb_compile_shlib
directly, to instead call build_executable and adding the 'shlib'
flag.

I've tested with gcc and clang and see no changes in the test results
after this commit.  All the compile commands still have -Wl,-soname
added, but now it's only added once, from within lib/gdb.exp.

There should be no change in what is tested after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.base/break-interp.exp
gdb/testsuite/gdb.base/prelink.exp
gdb/testsuite/gdb.base/solib-nodir.exp
gdb/testsuite/gdb.threads/tls-sepdebug.exp