From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id 98E393850856 for ; Mon, 27 Jun 2022 05:55:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 98E393850856 Received: by mail-qv1-xf2f.google.com with SMTP id 65so2717724qva.9 for ; Sun, 26 Jun 2022 22:55:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VQtZgRwM8GqSnkZ71Bnmrxx/ivU9SBfXJBcvFR6bdyE=; b=BDsB+YYWJ5vK0W3o6Xb50aaUXOuev88GHs685SAPEXJwLYFK88GJnv5f6FvvBMOv9r h3Vmbt9GcWloVfVeUah16Nso3EEytUaJR30Z7dM37eBZjS0HSUVkRqj4+cRI7RfYcn0w wWBisyFv6weD54pBQ8VN917RxO4mNQc8knOGpn/Y/zAw8tVRV+F2ZR/8f+dGcW/QkSlx lRB0LLVwklI55ordFUQQoWzErH18Pnli+ho6aZJYL/NcLrgP15jdWmszJoBdBQokhIAq Icw9mCkTeXT47eFXaAgV2DkIpYPm33qlerEBPzTFdx2J/pnID5BYSsILhXUs+aCyHRzt hw6A== X-Gm-Message-State: AJIora99o0D7t/qCVZXkrP/x4Ni6rwxqSi+Jmfq6WJTzSHK1AdYEBEG4 uPg6KnwtFjOSjy/JZzT7SChMtw1kOolK+T67Bhg= X-Google-Smtp-Source: AGRyM1sYLnO2EyQOaWyx86dT/edYlTAtVtDyl4m+jSs0EsVgxXeYm4K6jWhpg4VMMgiv5InSqtaKot0tc0WXY9NuiFY= X-Received: by 2002:a05:622a:d1:b0:306:5d28:f0a2 with SMTP id p17-20020a05622a00d100b003065d28f0a2mr8052670qtw.581.1656309348963; Sun, 26 Jun 2022 22:55:48 -0700 (PDT) MIME-Version: 1.0 References: <20220625090808.GA18353@delia.com> In-Reply-To: <20220625090808.GA18353@delia.com> From: Richard Biener Date: Mon, 27 Jun 2022 07:55:37 +0200 Message-ID: Subject: Re: [PATCH][gdb/build] Fix gdbserver build with -fsanitize=thread To: Tom de Vries Cc: GCC Patches , gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2022 05:55:55 -0000 On Sat, Jun 25, 2022 at 11:09 AM Tom de Vries via Gcc-patches wrote: > > Hi, > > 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. > > OK for trunk gcc? OK > Thanks, > - Tom > > [gdb/build] Fix gdbserver build with -fsanitize=thread > > --- > configure | 2 +- > configure.ac | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/configure b/configure > index 1badcb314f8..aac80b88d70 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 > diff --git a/configure.ac b/configure.ac > index 5b6e2048514..29f74d10b5a 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -2344,7 +2344,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