From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5FAB421A02908 for ; Thu, 25 May 2017 13:28:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1C253024A3; Thu, 25 May 2017 20:28:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B1C253024A3 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B1C253024A3 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-147.phx2.redhat.com [10.3.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14ECF173D9; Thu, 25 May 2017 20:28:13 +0000 (UTC) To: Ard Biesheuvel , "Kinney, Michael D" , Felix Poludov Cc: "Fan, Jeff" , "edk2-devel@lists.01.org" , "Wu, Hao A" , Andrew Fish References: <1495581673-10788-1-git-send-email-michael.d.kinney@intel.com> <542CF652F8836A4AB8DBFAAD40ED192A4C5E94B8@shsmsx102.ccr.corp.intel.com> From: Laszlo Ersek Message-ID: Date: Thu, 25 May 2017 22:28:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 25 May 2017 20:28:15 +0000 (UTC) Subject: Re: [Patch] SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate symbol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 May 2017 20:28:16 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 05/25/17 22:11, Ard Biesheuvel wrote: > On 25 May 2017 at 13:06, Kinney, Michael D wrote: >> Laszlo and Andrew, >> >> With the information that has been collected on this thread, I >> still think this patch in its original form is a good change >> to resolve the this one specific duplicate symbol issue for all >> tool chains. 'static' can not be mixed with >> GLOBAL_REMOVE_IF_UNREFERENCED for MSFT tool chains, so renaming >> the global variable is the easiest way to remove the duplicate. >> > > GLOBAL_REMOVE_IF_UNREFERENCED itself is problematic imo. I think it > was Felix who reported on this recently? > > STATIC is really the only sensible way to deal with this for symbols > that are only referenced by a single compilation unit. > >> I will continue to work on ways to detect duplicate symbols for >> all tool chains and will enter a Bugzilla issue to for that >> feature. >> >> In addition, the idea of detecting if a library is exporting more >> than the library class defines is another good feature to consider >> and I will enter a Bugzilla issue for that one as well. >> >> If we can find ways to both restrict the symbols exported by a >> library and strip all symbols that are unused, then we can have >> additional Bugzilla issues to perform that clean up on each >> library instance that is exporting more than the library class. >> > > A static library is nothing more than an archive containing a > collection of object files. Sadly, that implies that we cannot > distinguish between symbols that may only be referenced by other > objects in the same static library and symbols that are exported to > the library client. Do we know for a fact that, with /OPT:REF, VS does not strip unused *static* variables and functions? I mean, is it certain that *replacing* GLOBAL_REMOVE_IF_UNREFERENCED with STATIC in this case would lead to a size increase? If that's the case, then I'm fine if we go ahead with this patch, I'd just like to request that Mike please file some of those BZs, and please reference them from the commit message (as the longer term solution), before committing the patch. Thanks Laszlo