[gdb/testsuite] Fix shlib compilation with target board unix/-pie/-fPIE
When running test-case gdb.base/info-shared.exp with target board
unix/-pie/-fPIE, we run into:
...
spawn -ignore SIGHUP gcc -fno-stack-protector \
outputs/gdb.base/info-shared/info-shared-solib1.c.o \
-fdiagnostics-color=never -fPIC -shared -Wl,-soname,info-shared-solib1.so \
-lm -fPIE -pie -o outputs/gdb.base/info-shared/info-shared-solib1.so^M
ld: Scrt1.o: in function `_start':^M
start.S:104: undefined reference to `main'^M
collect2: error: ld returned 1 exit status^M
compiler exited with status 1
...
The intention of the -pie/-fPIE flags is to build and test PIE executables on
platforms where that is not the default. However, the flags clash with the
flags required to build shared libraries.
Fix this by filtering out PIE-related flags out of the multilib_flags settings
in compile_shared_lib.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-12-16 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_compile_shlib_1): Factor out of ...
(gdb_compile_shlib): ... here. Filter out PIE-related flags.