From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id BA3913841470; Mon, 27 Jun 2022 13:36:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA3913841470 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/build] Fix build breaker with --enable-shared X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 171fba11ab27089cffd6f85655ab987a937fea25 X-Git-Newrev: 95127faf50eef65b381dd1e5eb7c7db43915e54c Message-Id: <20220627133623.BA3913841470@sourceware.org> Date: Mon, 27 Jun 2022 13:36:23 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2022 13:36:23 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D95127faf50ee= f65b381dd1e5eb7c7db43915e54c commit 95127faf50eef65b381dd1e5eb7c7db43915e54c Author: Tom de Vries Date: Mon Jun 27 15:36:19 2022 +0200 [gdb/build] Fix build breaker with --enable-shared =20 When building gdb with --enable-shared, I run into: ... ld: build/zlib/libz.a(libz_a-inffast.o): relocation R_X86_64_32S agains= t \ `.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 ... =20 This is a regression since commit a08bdb159bb ("[gdb/build] Fix gdbserv= er build with -fsanitize=3Dthread"). =20 The problem is that a single case statement in configure is shared to h= andle special requirements for both the host libiberty and host zlib, which h= as the effect that only one is handled. =20 Fix this by handling libiberty and zlib each in its own case statement. =20 Build on x86_64-linux, with and without --enable-shared. =20 ChangeLog: =20 2022-06-27 Tom de Vries =20 * 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 aac80b88d70..be433ef6d5d 100755 --- a/configure +++ b/configure @@ -6962,13 +6962,18 @@ fi =20 # Sometimes we have special requirements for the host libiberty. extra_host_libiberty_configure_flags=3D -extra_host_zlib_configure_flags=3D 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=3D--enable-shared ;; +esac + + +# Sometimes we have special requirements for the host zlib. +extra_host_zlib_configure_flags=3D +case " $configdirs " in *" bfd "*) # When bfd is to be built as a shared library, the same applies to # zlib. @@ -6979,7 +6984,6 @@ case " $configdirs " in esac =20 =20 - # Produce a warning message for the subdirs we can't configure. # This isn't especially interesting in the Cygnus tree, but in the individ= ual # FSF releases, it's important to let people know when their machine isn't diff --git a/configure.ac b/configure.ac index 29f74d10b5a..1651cbf3b02 100644 --- a/configure.ac +++ b/configure.ac @@ -2342,13 +2342,18 @@ fi =20 # Sometimes we have special requirements for the host libiberty. extra_host_libiberty_configure_flags=3D -extra_host_zlib_configure_flags=3D 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=3D--enable-shared ;; +esac +AC_SUBST(extra_host_libiberty_configure_flags) + +# Sometimes we have special requirements for the host zlib. +extra_host_zlib_configure_flags=3D +case " $configdirs " in *" bfd "*) # When bfd is to be built as a shared library, the same applies to # zlib. @@ -2357,7 +2362,6 @@ case " $configdirs " in fi ;; esac -AC_SUBST(extra_host_libiberty_configure_flags) AC_SUBST(extra_host_zlib_configure_flags) =20 # Produce a warning message for the subdirs we can't configure.