From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 4BF70384B812 for ; Wed, 7 Sep 2022 11:06:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4BF70384B812 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 305AC1042; Wed, 7 Sep 2022 04:06:13 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6C2E23F7B4; Wed, 7 Sep 2022 04:06:06 -0700 (PDT) From: Richard Sandiford To: Tom de Vries via Gcc-patches Mail-Followup-To: Tom de Vries via Gcc-patches ,Tom de Vries , richard.sandiford@arm.com Cc: Tom de Vries Subject: Re: [PING^2][PATCH][gdb/build] Fix build breaker with --enabled-shared References: <20220627130323.GA7270@delia.com> <247a3c89-35e9-e1f3-0c60-b371c12e2043@suse.de> <557d86be-4768-4bf3-74ae-e2c9f78da857@suse.de> <676d0347-6292-2348-0845-80b65d4196c5@suse.de> Date: Wed, 07 Sep 2022 12:06:05 +0100 In-Reply-To: <676d0347-6292-2348-0845-80b65d4196c5@suse.de> (Tom de Vries via Gcc-patches's message of "Tue, 6 Sep 2022 14:58:53 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-47.5 required=5.0 tests=BAYES_00,BODY_8BITS,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tom de Vries via Gcc-patches writes: > On 7/12/22 15:42, Tom de Vries wrote: >> [ dropped gdb-patches, since already applied there. ] >>=20 >> On 6/27/22 15:38, Tom de Vries wrote: >>> On 6/27/22 15:03, Tom de Vries wrote: >>>> Hi, >>>> >>>> When building gdb with --enabled-shared, I run into: >>>> ... >>>> ld: build/zlib/libz.a(libz_a-inffast.o): relocation R_X86_64_32S=20 >>>> against \ >>>> =C2=A0=C2=A0 `.rodata' can not be used when making a shared object; re= compile=20 >>>> with -fPIC >>>> ld: build/zlib/libz.a(libz_a-inflate.o): warning: relocation against \ >>>> =C2=A0=C2=A0 `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=20 >>>> gdbserver >>>> build with -fsanitize=3Dthread"). >>>> >>>> The problem is that a single case statement in configure is shared to= =20 >>>> handle >>>> special requirements for both the host libiberty and host zlib, which= =20 >>>> 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. >>>> >>>> OK for gcc trunk? >>>> >>=20 > > Ping^2. OK, thanks. (Not really my area, but since noone else has commented...) Richard > Thanks, > - Tom > >>> To fix the buildbot breakage, I already pushed to the gdb repo. >>> >>> Thanks, >>> - Tom >>> >>>> >>>> [gdb/build] Fix build breaker with --enabled-shared >>>> >>>> ChangeLog: >>>> >>>> 2022-06-27=C2=A0 Tom de Vries=C2=A0 >>>> >>>> =C2=A0=C2=A0=C2=A0=C2=A0* configure.ac: Set extra_host_libiberty_confi= gure_flags and >>>> =C2=A0=C2=A0=C2=A0=C2=A0extra_host_zlib_configure_flags in separate ca= se statements. >>>> =C2=A0=C2=A0=C2=A0=C2=A0* configure: Regenerate. >>>> >>>> --- >>>> =C2=A0 configure=C2=A0=C2=A0=C2=A0 | 8 ++++++-- >>>> =C2=A0 configure.ac | 8 ++++++-- >>>> =C2=A0 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 >>>> =C2=A0 # Sometimes we have special requirements for the host libiberty. >>>> =C2=A0 extra_host_libiberty_configure_flags=3D >>>> -extra_host_zlib_configure_flags=3D >>>> =C2=A0 case " $configdirs " in >>>> =C2=A0=C2=A0=C2=A0 *" lto-plugin "* | *" libcc1 "* | *" gdbserver "*) >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # When these are to be built as shared = libraries, the same=20 >>>> applies to >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # libiberty. >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 extra_host_libiberty_configure_flags=3D= --enable-shared >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; >>>> +esac >>>> + >>>> + >>>> +# Sometimes we have special requirements for the host zlib. >>>> +extra_host_zlib_configure_flags=3D >>>> +case " $configdirs " in >>>> =C2=A0=C2=A0=C2=A0 *" bfd "*) >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # When bfd is to be built as a shared l= ibrary, the same applies to >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # zlib. >>>> @@ -6979,7 +6984,6 @@ case " $configdirs " in >>>> =C2=A0 esac >>>> - >>>> =C2=A0 # Produce a warning message for the subdirs we can't configure. >>>> =C2=A0 # This isn't especially interesting in the Cygnus tree, but in = the=20 >>>> individual >>>> =C2=A0 # FSF releases, it's important to let people know when their=20 >>>> 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 >>>> =C2=A0 # Sometimes we have special requirements for the host libiberty. >>>> =C2=A0 extra_host_libiberty_configure_flags=3D >>>> -extra_host_zlib_configure_flags=3D >>>> =C2=A0 case " $configdirs " in >>>> =C2=A0=C2=A0=C2=A0 *" lto-plugin "* | *" libcc1 "* | *" gdbserver "*) >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # When these are to be built as shared = libraries, the same=20 >>>> applies to >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # libiberty. >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 extra_host_libiberty_configure_flags=3D= --enable-shared >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; >>>> +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 >>>> =C2=A0=C2=A0=C2=A0 *" bfd "*) >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # When bfd is to be built as a shared l= ibrary, the same applies to >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # zlib. >>>> @@ -2357,7 +2362,6 @@ case " $configdirs " in >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fi >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; >>>> =C2=A0 esac >>>> -AC_SUBST(extra_host_libiberty_configure_flags) >>>> =C2=A0 AC_SUBST(extra_host_zlib_configure_flags) >>>> =C2=A0 # Produce a warning message for the subdirs we can't configure.