From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 2D0C8385841A; Wed, 7 Sep 2022 11:20:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2D0C8385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662549644; bh=CyW9lxh1cYg2MM+WvEGFwUhNaINP8PUtCflW15QbwBg=; h=From:To:Subject:Date:From; b=x4Viv1EAqkxGKP/IHJLwKy+mkzYwco1HNXmwE40EqiDE6BcXDTRcgQ7vZ0ASy+vsI 5K9w4lN0p9lVYB6qivIzae95SCE7L+9Fd+CMkX/xs8aYqSYGV9g5NkqFXW98cW6/+o ZKYyeJYXAFCVY94ddS9fL0oBzqRW2PVaOIiGnzrQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Tom de Vries To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2517] [gdb/build] Fix build breaker with --enable-shared X-Act-Checkin: gcc X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 22cefe5c22a90d20e2d9f629402b0522c03fa59c X-Git-Newrev: 04bb15e48ef8dd3d6a5ff30723c603cef3e0a3c6 Message-Id: <20220907112044.2D0C8385841A@sourceware.org> Date: Wed, 7 Sep 2022 11:20:44 +0000 (GMT) List-Id: https://gcc.gnu.org/g:04bb15e48ef8dd3d6a5ff30723c603cef3e0a3c6 commit r13-2517-g04bb15e48ef8dd3d6a5ff30723c603cef3e0a3c6 Author: Tom de Vries Date: Wed Sep 7 13:19:05 2022 +0200 [gdb/build] Fix build breaker with --enable-shared When building gdb with --enable-shared, I run into: ... ld: build/zlib/libz.a(libz_a-inffast.o): relocation R_X86_64_32S against \ `.rodata' can not be used when making a shared object; recompile with -fPIC ld: build/zlib/libz.a(libz_a-inflate.o): warning: relocation against \ `inflateResetKeep' in read-only section `.text' collect2: error: ld returned 1 exit status make[3]: *** [libbfd.la] Error 1 ... This is a regression since commit a08bdb159bb ("[gdb/build] Fix gdbserver build with -fsanitize=thread"). The problem is that a single case statement in configure is shared to handle special requirements for both the host libiberty and host zlib, which has the effect that only one is handled. Fix this by handling libiberty and zlib each in its own case statement. Build on x86_64-linux, with and without --enable-shared. ChangeLog: 2022-09-07 Tom de Vries * configure.ac: Set extra_host_libiberty_configure_flags and extra_host_zlib_configure_flags in separate case statements. * configure: Regenerate. Diff: --- configure | 8 ++++++-- configure.ac | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configure b/configure index e90b8df217d..e7604dc6ff0 100755 --- a/configure +++ b/configure @@ -9188,13 +9188,18 @@ fi # Sometimes we have special requirements for the host libiberty. extra_host_libiberty_configure_flags= -extra_host_zlib_configure_flags= case " $configdirs " in *" 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 ;; +esac + + +# Sometimes we have special requirements for the host zlib. +extra_host_zlib_configure_flags= +case " $configdirs " in *" bfd "*) # When bfd is to be built as a shared library, the same applies to # zlib. @@ -9205,7 +9210,6 @@ case " $configdirs " in esac - # Produce a warning message for the subdirs we can't configure. # This isn't especially interesting in the Cygnus tree, but in the individual # FSF releases, it's important to let people know when their machine isn't diff --git a/configure.ac b/configure.ac index 3ecb532138d..3cfd9b41fca 100644 --- a/configure.ac +++ b/configure.ac @@ -2439,13 +2439,18 @@ fi # Sometimes we have special requirements for the host libiberty. extra_host_libiberty_configure_flags= -extra_host_zlib_configure_flags= case " $configdirs " in *" 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 ;; +esac +AC_SUBST(extra_host_libiberty_configure_flags) + +# Sometimes we have special requirements for the host zlib. +extra_host_zlib_configure_flags= +case " $configdirs " in *" bfd "*) # When bfd is to be built as a shared library, the same applies to # zlib. @@ -2454,7 +2459,6 @@ case " $configdirs " in fi ;; esac -AC_SUBST(extra_host_libiberty_configure_flags) AC_SUBST(extra_host_zlib_configure_flags) # Produce a warning message for the subdirs we can't configure.