Most module types have standardized entry point function prototypes. They are declared in headers like
- MdePkg/Include/Library/PeiCoreEntryPoint.h - MdePkg/Include/Library/PeimEntryPoint.h - MdePkg/Include/Library/DxeCoreEntryPoint.h - MdePkg/Include/Library/UefiDriverEntryPoint.h - MdePkg/Include/Library/UefiApplicationEntryPoint.h These header files also declare matching ProcessLibraryConstructorList() prototypes. The SEC module type does not have a standardized entry point prototype (aka parameter list), therefore no header file like the above ones exists for SEC. Consequently, no header file *declares* ProcessLibraryConstructorList() for SEC modules, even though AutoGen always *defines* ProcessLibraryConstructorList() with the same, empty, parameter list (i.e., just (VOID)). The lack of a central declaration is a problem because in SEC code, ProcessLibraryConstructorList() needs to be called manually, and those calls need a prototype. Most SEC modules in edk2 get around this by declaring ProcessLibraryConstructorList() manually, while some others use an incorrect (PEIM) prototype. Liming suggested in <https://bugzilla.tianocore.org/show_bug.cgi?id=991#c2> that AutoGen provide the declaration as well. Accompanying the upcoming BaseTools patch, document the feature in the Build spec. "INF_VERSION >= 1.30" reflects that the latest (draft) version of the INF specification, as of this writing, is commit a31e3c842bee / version 1.29. Cc: Bob Feng <bob.c.f...@intel.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Rebecca Cran <rebe...@bsdio.com> Cc: Yuwei Chen <yuwei.c...@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=991 Suggested-by: Liming Gao <gaolim...@byosoft.com.cn> Suggested-by: Michael D Kinney <michael.d.kin...@intel.com> Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- 8_pre-build_autogen_stage/83_auto-generated_code.md | 26 +++++++++++++++++++- README.md | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/8_pre-build_autogen_stage/83_auto-generated_code.md b/8_pre-build_autogen_stage/83_auto-generated_code.md index 3e1da3809000..8b20a6ace9f8 100644 --- a/8_pre-build_autogen_stage/83_auto-generated_code.md +++ b/8_pre-build_autogen_stage/83_auto-generated_code.md @@ -649,7 +649,31 @@ include_statement(AutoGen.h, " "); ``` -#### 8.3.6.5 AutoGen Epilogue +#### 8.3.6.5 `ProcessLibraryConstructorList` function declaration + +Entry point functions of non-library SEC modules do not have standardized +parameter lists, therefore edk2 does not offer an +`MdePkg/Include/Library/*EntryPoint.h` header file for such modules. +Consequently, `ProcessLibraryConstructorList` is not declared for them either, +despite the fact that they must call `ProcessLibraryConstructorList` explicitly. +Historically, each such module has declared `ProcessLibraryConstructorList` +internally for itself, compensating for the lack of a central declaration. + +The `ProcessLibraryConstructorList` function is declared in `AutoGen.h` for +non-library SEC modules, if `INF_VERSION` in the module's INF file is greater +than or equal to `1.30`. + +```c +include_statement (AutoGen.h, " + VOID + EFIAPI + ProcessLibraryConstructorList ( + VOID + ); +"); +``` + +#### 8.3.6.6 AutoGen Epilogue ```c #ifdef __cplusplus diff --git a/README.md b/README.md index 6d41f3a94fc2..7c7c2a60bd2d 100644 --- a/README.md +++ b/README.md @@ -231,3 +231,4 @@ Copyright (c) 2008-2017, Intel Corporation. All rights reserved. | | [#598](https://bugzilla.tianocore.org/show_bug.cgi?id=598) update supported operators in 8.2.4.6 Expressions | | | 1.29 | [#1453](https://bugzilla.tianocore.org/show_bug.cgi?id=1453) Update Build spec to remove EDK related contents | Mar 2019 | | 1.30 | [#1952](https://bugzilla.tianocore.org/show_bug.cgi?id=1952) Update Build spec to support HOST_APPLICATION MODULE_TYPE | July 2019 | +| 1.31 | [#991](https://bugzilla.tianocore.org/show_bug.cgi?id=991) generate ProcessLibraryConstructorList() declaration in AutoGen.h for SEC modules | February 2024 | -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115913): https://edk2.groups.io/g/devel/message/115913 Mute This Topic: https://groups.io/mt/104554007/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-