]> git.ipfire.org Git - thirdparty/gcc.git/commit
[gdb/build] Fix gdbserver build with -fsanitize=thread
authorTom de Vries <tdevries@suse.de>
Mon, 27 Jun 2022 08:46:58 +0000 (10:46 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 27 Jun 2022 08:52:23 +0000 (10:52 +0200)
commit153689603fd6aeb95b20a86f3a04fc5b93b01b09
treedad5a797c9a636246a2c65db49ac8e04faf90d8b
parent2669cae081c852bc8bde1647d671aa66930cc556
[gdb/build] Fix gdbserver build with -fsanitize=thread

When building gdbserver with -fsanitize=thread (added to CFLAGS/CXXFLAGS) we
run into:
...
ld: ../libiberty/libiberty.a(safe-ctype.o): warning: relocation against \
  `__tsan_init' in read-only section `.text'
ld: ../libiberty/libiberty.a(safe-ctype.o): relocation R_X86_64_PC32 \
  against symbol `__tsan_init' can not be used when making a shared object; \
  recompile with -fPIC
ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[1]: *** [libinproctrace.so] Error 1
...
which looks similar to what is described in commit 78e49486944 ("[gdb/build]
Fix gdbserver build with -fsanitize=address").

The gdbserver component builds a shared library libinproctrace.so, which uses
libiberty and therefore requires the pic variant.  The gdbserver Makefile is
setup to use this variant, if available, but it's not there.

Fix this by listing gdbserver in the toplevel configure alongside libcc1, as a
component that needs the libiberty pic variant, setting:
...
extra_host_libiberty_configure_flags=--enable-shared
...

Tested on x86_64-linux.

ChangeLog:

2022-06-27  Tom de Vries  <tdevries@suse.de>

* configure.ac: Build libiberty pic variant for gdbserver.
* configure: Regenerate.
configure
configure.ac