Liming, Michael,

On 09/03/14 00:56, Laszlo Ersek wrote:
> Calls to constructors of interdependent library instances are generated in
> the correct order only if all library instances in question have
> constructors. If some have no constructors, then the rest may see their
> constructors called out of order.
> 
> Cycle detection also only works when all library instances have
> constructors.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <[email protected]>
> ---
>  .../BaseOrderedCollectionRedBlackTreeLib.inf                   |  2 ++
>  .../BaseOrderedCollectionRedBlackTreeLib.c                     | 10 
> ++++++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git 
> a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
>  
> b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> index a68afc8..f846a79 100644
> --- 
> a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> +++ 
> b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> @@ -32,6 +32,8 @@
>    VERSION_STRING                 = 1.0
>    LIBRARY_CLASS                  = OrderedCollectionLib
>  
> +  CONSTRUCTOR                    = 
> BaseOrderedCollectionRedBlackTreeLibConstructor
> +
>  #
>  #  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
>  #
> diff --git 
> a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
>  
> b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
> index 8d18a4b..23ba8de 100644
> --- 
> a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
> +++ 
> b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
> @@ -1452,3 +1452,13 @@ RedBlackTreeValidate (
>    DEBUG ((DEBUG_VERBOSE, "%a: Tree=%p BlackHeight=%Ld Count=%Ld\n",
>      __FUNCTION__, Tree, (INT64)BlackHeight, (INT64)ForwardCount));
>  }
> +
> +
> +RETURN_STATUS
> +EFIAPI
> +BaseOrderedCollectionRedBlackTreeLibConstructor (
> +  VOID
> +  )
> +{
> +  return RETURN_SUCCESS;
> +}
> 

This patchset has the same goal as the following code in
"MdePkg/Library/UefiLib/UefiLib.c", found by Ard:

/**
  Empty constructor function that is required to resolve dependencies
between
  libraries.

    ** DO NOT REMOVE **

  @param  ImageHandle   The firmware allocated handle for the EFI image.
  @param  SystemTable   A pointer to the EFI System Table.

  @retval EFI_SUCCESS   The constructor executed correctly.

**/
EFI_STATUS
EFIAPI
UefiLibConstructor (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
  return EFI_SUCCESS;
}

Added in SVN r11181.

Thanks
Laszlo

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to