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.
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. Thanks, Mike > -----Original Message----- > From: Fan, Jeff > Sent: Tuesday, May 23, 2017 7:48 PM > To: Kinney, Michael D <michael.d.kin...@intel.com>; edk2-devel@lists.01.org > Cc: Wu, Hao A <hao.a...@intel.com>; Kinney, Michael D > <michael.d.kin...@intel.com>; Laszlo Ersek <ler...@redhat.com>; Andrew Fish > <af...@apple.com> > Subject: RE: [edk2] [Patch] SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix > duplicate symbol > > Reviewed-by: Jeff Fan <jeff....@intel.com> > > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Michael > Kinney > Sent: Wednesday, May 24, 2017 7:21 AM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A; Kinney, Michael D; Laszlo Ersek; Andrew Fish; Fan, Jeff > Subject: [edk2] [Patch] SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate > symbol > > https://bugzilla.tianocore.org/show_bug.cgi?id=573 > > The SecPeiDebugAgentLib uses the global variable mMemoryDiscoveredNotifyList > for > a PPI notification on the Memory Discovered PPI. This same variable name is > used > in the DxeIplPeim for the same PPI notification. > > The XCODE5 tool chain detects this duplicate symbol when the OVMF platform is > built with the flag -D SOURCE_DEBUG_ENABLE. > > The fix is to rename this global variable in the SecPeiDebugAgentLib library. > > Cc: Andrew Fish <af...@apple.com> > Cc: Jeff Fan <jeff....@intel.com> > Cc: Hao Wu <hao.a...@intel.com> > Cc: Laszlo Ersek <ler...@redhat.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com> > --- > .../Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c | 4 > ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git > a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c > b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c > index b717e33..9f5223a 100644 > --- > a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c > +++ b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebu > +++ gAgentLib.c > @@ -32,7 +32,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR > mVectorHandoffInf > } > }; > > -GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR > mMemoryDiscoveredNotifyList[1] = { > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR > +mDebugAgentMemoryDiscoveredNotifyList[1] = { > { > (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), > &gEfiPeiMemoryDiscoveredPpiGuid, > @@ -554,7 +554,7 @@ InitializeDebugAgent ( > // Register for a callback once memory has been initialized. > // If memery has been ready, the callback funtion will be invoked > immediately > // > - Status = PeiServicesNotifyPpi (&mMemoryDiscoveredNotifyList[0]); > + Status = PeiServicesNotifyPpi > + (&mDebugAgentMemoryDiscoveredNotifyList[0]); > if (EFI_ERROR (Status)) { > DEBUG ((EFI_D_ERROR, "DebugAgent: Failed to register memory discovered > callback function!\n")); > CpuDeadLoop (); > -- > 2.6.3.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel