From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id EFBDD3858D38 for ; Wed, 11 Jan 2023 16:20:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFBDD3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 4BBCF1E112; Wed, 11 Jan 2023 11:20:50 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1673454050; bh=gVoaIjBA99PPyrOWPcfQmlmTTeDt81ymcdAhyu5phtU=; h=Date:Subject:To:References:From:In-Reply-To:From; b=uvY7HzgFTKdjqJaGuI+9UjBr23abyVLWMn8fZH+MEfbptXYPcSSXQ4tQ17xKKU04e 7thAL2EM7FQXVl8dcmBBAi2HY1q5hPJrMrKXMxMfPIp1RFmSM4Vv+k8lG4NHA9s8AU C0IB3/dS8bGpDnCPUgIXLeKURJTPKm6oRieB8FXc= Message-ID: <7d3e66c6-0665-df09-fc08-0fba2bd23d80@simark.ca> Date: Wed, 11 Jan 2023 11:20:49 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [pushed] [gdb/testsuite] Fix gdb.threads/dlopen-libpthread.exp for upstream glibc Content-Language: en-US To: Tom de Vries , gdb-patches@sourceware.org References: <20221230155407.5917-1-tdevries@suse.de> <7bb6a09d-b915-c855-804d-4c3b13e38b37@simark.ca> <174dba84-bac5-af4c-cd2b-85257f57b025@suse.de> <01243e5b-137f-9ac0-8235-8f51df07902e@simark.ca> <55245ed9-0ac8-9d53-0c0d-56972d982666@suse.de> From: Simon Marchi In-Reply-To: <55245ed9-0ac8-9d53-0c0d-56972d982666@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP 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: On 1/11/23 04:17, Tom de Vries via Gdb-patches wrote: > On 1/10/23 19:05, Simon Marchi wrote: >>> Attached patch fixes things. >>> >>> WDYT? >>> >>> Thanks, >>> - Tom >> >> >> Here: >> >>> # We link the exec without -lpthread, but libpthread.so may already be loaded at main >>> # due to LD_PRELOAD. >>> set libpthread_maybe_preloaded 0 >>> set binfile [standard_output_file $executable] >>> if { [has_dependency $binfile libpthread\\.so] == 1 } { >>> set libpthread_maybe_preloaded 1 >>> } >> >> Ok, so this works because ldd is influenced by LD_PRELOAD, I didn't >> know. >> > > Yes, while lddtree is not, which had me confused for a while. > >>> >>> # We link the shlib with -lpthread, but since glibc 2.34 libpthread has been >>> # merged with libc, so libpthread.so may not be a dependency. >>> set libpthread_missing 0 >>> if { [has_dependency $binfile libpthread\\.so] == 0 } { >>> set libpthread_missing 1 >>> } >> >> The two has_dependency calls use $binfile. Should one of them use >> $binfile_lib? The second one I think. > > Yes, thanks for catching this. > > I'll commit after another build & test cycle. Hmm, I still see the failure. I think the second has_dependency doesn't work. It returns 1 when it shouldn't, because of the dlopen-libpthread.so.d line: output of ldd /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/dlopen-libpthread/dlopen-libpthread.so is linux-vdso.so.1 (0x00007ffc809ee000)^M libc.so.6 => /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/dlopen-libpthread/dlopen-libpthread.so.d/libc.so.6 (0x00007f0a5cf03000)^M /lib64/ld-linux-x86-64.so.2 (0x00007f0a5d132000)^M This directory is created by build_executable_own_libs in lib/prelink-support.exp (used by the test). Tweaking the regexp to include a forward slash makes it work for me: diff --git a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp index 134265ff470..c97e0284475 100644 --- a/gdb/testsuite/gdb.threads/dlopen-libpthread.exp +++ b/gdb/testsuite/gdb.threads/dlopen-libpthread.exp @@ -68,14 +68,14 @@ if { !$have_probe } { # due to LD_PRELOAD. set libpthread_maybe_preloaded 0 set binfile [standard_output_file $executable] -if { [has_dependency $binfile libpthread\\.so] == 1 } { +if { [has_dependency $binfile /libpthread\\.so] == 1 } { set libpthread_maybe_preloaded 1 } # We link the shlib with -lpthread, but since glibc 2.34 libpthread has been # merged with libc, so libpthread.so may not be a dependency. set libpthread_missing 0 -if { [has_dependency $binfile_lib libpthread\\.so] == 0 } { +if { [has_dependency $binfile_lib /libpthread\\.so] == 0 } { set libpthread_missing 1 } Simon