From a08bdb159bb7401f266836ded2899a9015828c25 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 27 Jun 2022 12:47:26 +0200 Subject: [gdb/build] Fix gdbserver build with -fsanitize=thread [ Copied from gcc commit 153689603fd ("[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 * configure.ac: Build libiberty pic variant for gdbserver. * configure: Regenerate. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index 1badcb314f..aac80b88d7 100755 --- a/configure +++ b/configure @@ -6964,7 +6964,7 @@ fi extra_host_libiberty_configure_flags= extra_host_zlib_configure_flags= case " $configdirs " in - *" lto-plugin "* | *" libcc1 "*) + *" lto-plugin "* | *" libcc1 "* | *" gdbserver "*) # When these are to be built as shared libraries, the same applies to # libiberty. extra_host_libiberty_configure_flags=--enable-shared -- cgit v1.2.3