Andrew,

I agree in this specific case, making the global variable static
should also resolve this issue.

In general, we do not make module global variables static, so the 
module global can be shared across multiple source files in the 
module implementation.

Not sure why this issue has not been seen with other tool chains.

Mike

> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Tuesday, May 23, 2017 4:26 PM
> To: Kinney, Michael D <[email protected]>
> Cc: [email protected]; Fan, Jeff <[email protected]>; Wu, Hao A
> <[email protected]>; Laszlo Ersek <[email protected]>
> Subject: Re: [Patch] SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate 
> symbol
> 
> Mike,
> 
> Do the other compilers promote (or is that demote) to static? Would not 
> making these
> lib globals, and private functions static solve this class of issue?
> 
> Thanks,
> 
> Andrew Fish
> 
> > On May 23, 2017, at 4:21 PM, Michael Kinney <[email protected]> 
> > wrote:
> >
> > 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 <[email protected]>
> > Cc: Jeff Fan <[email protected]>
> > Cc: Hao Wu <[email protected]>
> > Cc: Laszlo Ersek <[email protected]>
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Michael D Kinney <[email protected]>
> > ---
> > .../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/SecPeiDebugAgentLib.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
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to