]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/ChangeLog
[gdb/testsuite] Fix shlib compilation with target board unix/-pie/-fPIE
authorTom de Vries <tdevries@suse.de>
Wed, 16 Dec 2020 17:18:40 +0000 (18:18 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 16 Dec 2020 17:18:40 +0000 (18:18 +0100)
commit1e61189d0ab0905178002120eb0a380858ed6dc0
tree1e8cd234d0a30f2da93257d1e8d5d932d1cb599f
parentbfbe4b84606cb9b8ac6f51b473b1d351924080aa
[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.
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp