diff mbox

[edk2,10/12] OvmfPkg: SerializeVariablesLib: add constructor

Message ID 1409698598-9766-10-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek Sept. 2, 2014, 10:56 p.m. UTC
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 <lersek@redhat.com>
---
 .../Library/SerializeVariablesLib/SerializeVariablesLib.inf    |  2 ++
 OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c  | 10 ++++++++++
 2 files changed, 12 insertions(+)
diff mbox

Patch

diff --git a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
index b0c12b0..baec28e 100644
--- a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
+++ b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
@@ -22,6 +22,8 @@ 
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = SerializeVariablesLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER UEFI_DRIVER
 
+  CONSTRUCTOR                    = DxeSerializeVariablesLibConstructor
+
 [Sources]
   SerializeVariablesLib.c
 
diff --git a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
index 19569b2..dfff3a2 100644
--- a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
+++ b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
@@ -868,3 +868,13 @@  SerializeVariablesToBuffer (
   return RETURN_SUCCESS;
 }
 
+
+EFI_STATUS
+EFIAPI
+DxeSerializeVariablesLibConstructor (
+  IN EFI_HANDLE       ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  return EFI_SUCCESS;
+}