From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id 0420F385842C for ; Thu, 25 Nov 2021 14:38:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0420F385842C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 0F8CC72C8DC; Thu, 25 Nov 2021 17:38:53 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 043467CC8DD; Thu, 25 Nov 2021 17:38:52 +0300 (MSK) Date: Thu, 25 Nov 2021 17:38:52 +0300 From: "Dmitry V. Levin" To: Mark Wielaard Cc: Florian Weimer , elfutils-devel@sourceware.org Subject: Re: [PATCH] tests: Add -ldl to dwfl_proc_attach_LDFLAGS Message-ID: <20211125143852.GA11359@altlinux.org> References: <20211118212341.19077-1-mark@klomp.org> <20211118222026.GB2074@altlinux.org> <87czmwaxqs.fsf@oldenburg.str.redhat.com> <20211119221217.GA18221@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2021 14:38:56 -0000 On Sat, Nov 20, 2021 at 03:18:27PM +0100, Mark Wielaard wrote: > Hi, > > On Sat, Nov 20, 2021 at 01:12:17AM +0300, Dmitry V. Levin wrote: > > On Fri, Nov 19, 2021 at 05:58:19PM +0100, Florian Weimer wrote: > > > It may have to do with --as-needed that some builds use. If there are > > > no pending undefined references, some linkers drop earlier shared object > > > references with --as-needed (similar to what happens with static > > > archives). > > > > > > The GCC LTO plugin results in ld looking at more objects in greater > > > detail for some reason. Without LTO and --as-needed, you probably don't > > > get a dlopen export (if you do not link with -E) because indirect > > > dependencies are not consulted, breaking the valgrind workaround because > > > there is no interposition. > > > > Thanks. I suppose adding -rdynamic to dwfl_proc_attach_LDFLAGS should be > > a more correct fix. > > That works. But I don't really understand why. If I understand correctly, -rdynamic makes sure the dlopen symbol is exported by dwfl-proc-attach executable and interposes other dlopen symbols exported by libdl or libc. Without -rdynamic, there is a change that dlopen defined in dwfl-proc-attach.c is optimized out. > Does the attached patch look OK to you? Yes, thanks. -- ldv