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 44A1921A02915 for ; Thu, 25 May 2017 13:01:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A44707F415; Thu, 25 May 2017 20:01:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A44707F415 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A44707F415 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 4918F17A48; Thu, 25 May 2017 20:01:52 +0000 (UTC) To: Ard Biesheuvel Cc: "Kinney, Michael D" , "Andrew Fish (afish@apple.com)" , "Wu, Hao A" , "edk2-devel@lists.01.org" , "Fan, Jeff" References: <1495581673-10788-1-git-send-email-michael.d.kinney@intel.com> <60f3303b-c333-101d-b6e5-806ab85075a9@redhat.com> <435e1d65-7710-f548-c591-558307e266bc@redhat.com> From: Laszlo Ersek Message-ID: <6c29e1f9-aaac-9485-1d63-5c4cd4f2d597@redhat.com> Date: Thu, 25 May 2017 22:01:51 +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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 25 May 2017 20:01:53 +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:01:54 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 05/25/17 21:55, Ard Biesheuvel wrote: > On 25 May 2017 at 11:06, Laszlo Ersek wrote: >> On 05/25/17 19:38, Kinney, Michael D wrote: >>> Laszlo, >>> >>> I think the equivalent flag for GCC builds is --whole-archive. >>> >>> I tried adding that flag to DLINK_FLAGS in GCC5, and I get the >>> following error building OVMF from edk2/master with >>> -D SOURCE_DEBUG_ENABLE set. >>> >>> DxeLoad.obj (symbol from plugin): In function `InstallIplPermanentMemoryPpis': >>> (.text+0x0): multiple definition of `mMemoryDiscoveredNotifyList' >>> SecPeiDebugAgentLib.obj (symbol from plugin):(.text+0x0): first defined here >>> collect2: error: ld returned 1 exit status >> >> Great find! That's the error message we should get. >> >> Unfortunately, after reading the "ld" manual on "--whole-archive", it >> seems that the complete object files will actually be copied into the >> resultant binary, even if several of their symbols will remain unused. I >> think that's quite sub-optimal. (I haven't verified this though.) What >> we'd like to get is (a) the full verification at link time, and (b) >> inclusion of *only* those symbols that are actually necessary. >> >> In your testing, when you build OVMF with and without "--whole-archive", >> do you see a difference in, say, the DXEFV footprint, when the build >> completes? >> >> (If so, then I wonder if we should add "--whole-archive" only to the >> NOOPT build... Not sure.) >> > > I haven't tried, but I would expect --gc-sections to deal with the > unused objects. Good point! (... After I read this option's description too, in the "ld" manual.) This ELF and PE/COFF stuff is way too complex for my taste. :/ Laszlo