From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from devianza.investici.org (devianza.investici.org [198.167.222.108]) by sourceware.org (Postfix) with ESMTPS id 50F343858C78 for ; Fri, 17 Feb 2023 11:32:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 50F343858C78 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=autistici.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=autistici.org Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by devianza.investici.org (Postfix) with ESMTP id 4PJ8nK6bclz6vJM; Fri, 17 Feb 2023 11:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1676633573; bh=pfWE0bwPdwA/apBwm/LjPGt2J1dma1UQgAI32v1tMnU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=H2xgPkqwZJMWkGsXtO0Lm5paTfdX+0aRh7IaLJP26/MFsj9V/VZYSycCYJW5VXB5I ruciz5e2OQ7GsJIZY+hdJfbJCN0l8e52GABKzYoe2QnbChpLYwdH7pRUq49oJ+a+Be 0RkBYFGIjObeY3uwBo/Ch/5Qfx1jeetnEdALBaFE= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: i.nixman@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4PJ8nK5ZpLz5w3C; Fri, 17 Feb 2023 11:32:53 +0000 (UTC) MIME-Version: 1.0 Date: Fri, 17 Feb 2023 11:32:53 +0000 From: i.nixman@autistici.org To: Jonathan Wakely Cc: Gcc Help Subject: Re: Extra import symbol in debug build In-Reply-To: References: <4f36cb6cb8e444073e1a9e253e861920@autistici.org> <82d48ece08fbe9d59cca0cebd8d04f58@autistici.org> <1fa9b2598357629dfaac5debd53708b3@autistici.org> User-Agent: Roundcube Webmail Message-ID: <1abbf26093a9b47c837b2d304b9fa15d@autistici.org> X-Sender: i.nixman@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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 2023-02-17 11:26, Jonathan Wakely wrote: > On Fri, 17 Feb 2023, 08:51 , wrote: > >> On 2023-02-16 20:08, Jonathan Wakely wrote: >> > On Thu, 16 Feb 2023, 18:39 , wrote: >> > >> >> On 2023-02-16 15:29, Jonathan Wakely wrote: >> >> > On Thu, 16 Feb 2023 at 15:25, i.nixman--- via Gcc-help >> >> > wrote: >> >> >> >> >> >> hello, >> >> >> >> >> >> >> >> >> I can successfully build the same C++ code using GCC-8.3.1 for Debug >> >> >> (-g >> >> >> -O0) and Release (-g -O2) build. >> >> >> I can successfully debug the Release-executable on a remote host, but >> >> >> I >> >> >> can't debug the Debug-executable on a remote host, because the >> >> >> Debug-executable imports an extra symbol >> >> >> _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv from libstdc++ which >> >> >> doesn't >> >> >> exist. >> >> > >> >> > It should exist, it has been there since GCC >> >> >> >> hmm... >> >> >> >> I just checked the two binaries using this cmd: >> >> >> >> > readelf -sW executable | grep >> >> > _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv >> >> >> >> it shows nothing for release build, and shows this for debug build: >> >> >> >> > 54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND >> >> > _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv >> >> > 199898: 0000000000000000 0 FUNC GLOBAL DEFAULT UND >> >> > _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv >> >> >> > >> > >> > This only shows that the function is inlined in the optimized build, >> > and >> > not in the debug build, so the debug one has an unresolved reference to >> > a >> > symbol defined in the libstdc++ dynamic library. This is completely >> > normal. >> > >> >> then I have two questions: >> >> 1. will the problem be solved by "pushing" a debug version of >> libstdc++ >> on the remote machine? >> > > You don't need a debug version, the symbol is present in all builds of > libstdc++. hmm.. but I can't confirm that using this cmd: readelf -sW /lib64/libstdc++.so.6 | grep _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv