binutils-gdb/gdb/testsuite/gdb.btrace
Tom de Vries 2f4132646d [gdb/testsuite] Don't pass -fPIC to gdb_compile_shlib
When running test-case gdb.base/info-shared.exp, I see in gdb.log:
...
Executing on host: \
  gcc ... -fPIC -fpic -c -o info-shared-solib1.c.o info-shared-solib1.c
...

The -fPIC comes from the test-case:
...
if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \
         [list additional_flags=-fPIC]] != "" } {
...
but the -fpic, which overrides the -fPIC comes from gdb_compile_shlib.

The proc gdb_compile_shlib adds the -fpic or similar dependent on platform
and compiler.  However, in some cases it doesn't add anything, which is
probably why all those test-case pass -fPIC.

Fix this by removing -fPIC from all the calls to gdb_compile_shlib, and
ensuring that gdb_compile_shlib takes care of adding it, if required.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-12-14  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (gdb_compile_shlib): Make sure it's not necessary to
	pass -fPIC.
	* gdb.ada/catch_ex_std.exp: Don't pass -fPIC to gdb_compile_shlib.
	* gdb.base/break-probes.exp: Same.
	* gdb.base/ctxobj.exp: Same.
	* gdb.base/dso2dso.exp: Same.
	* gdb.base/global-var-nested-by-dso.exp: Same.
	* gdb.base/info-shared.exp: Same.
	* gdb.base/jit-reader-simple.exp: Same.
	* gdb.base/print-file-var.exp: Same.
	* gdb.base/skip-solib.exp: Same.
	* gdb.btrace/dlopen.exp: Same.
2020-12-14 18:16:40 +01:00
..
buffer-size.exp
cpu.exp
data.c
data.exp
delta.exp
dlopen-dso.c
dlopen.c
dlopen.exp
enable-new-thread.c
enable-new-thread.exp
enable-running.c
enable-running.exp
enable.c
enable.exp
exception.cc
exception.exp
function_call_history.c
function_call_history.exp
gcore.exp
i686-record_goto.S
i686-tailcall-only.S
i686-tailcall.S
instruction_history.c
instruction_history.exp
instruction_history.S
multi-inferior.c
multi-inferior.exp
multi-thread-step.c
multi-thread-step.exp
nohist.exp
non-stop.c
non-stop.exp
reconnect.c
reconnect.exp
record_goto-step.exp
record_goto.c
record_goto.exp
rn-dl-bind.c
rn-dl-bind.exp
segv.c
segv.exp
step.exp
stepi.exp
tailcall-only.c
tailcall-only.exp
tailcall.c
tailcall.exp
tsx.c
tsx.exp
unknown_functions.c
unknown_functions.exp
vdso.c
vdso.exp
x86_64-record_goto.S
x86_64-tailcall-only.S
x86_64-tailcall.S
x86-tsx.S