public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: edk2-devel-groups-io <devel@edk2.groups.io>
Cc: Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Rebecca Cran <rebecca@bsdio.com>,
	Yuwei Chen <yuwei.chen@intel.com>
Subject: [edk2-devel] [edk2-BuildSpecification PATCH 3/3] AutoGen.h: declare ProcessLibraryConstructorList() for SEC modules
Date: Sat, 24 Feb 2024 22:23:38 +0100	[thread overview]
Message-ID: <20240224212338.42671-4-lersek@redhat.com> (raw)
In-Reply-To: <20240224212338.42671-1-lersek@redhat.com>

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.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=991
Suggested-by: Liming Gao <gaoliming@byosoft.com.cn>
Suggested-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Laszlo Ersek <lersek@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/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-02-24 21:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-24 20:59 [edk2-devel] [v2] BaseTools/AutoGen: declare ProcessLibraryConstructorList() for SEC modules Laszlo Ersek
2024-02-24 21:05 ` [edk2-devel] [PATCH] " Laszlo Ersek
2024-02-25  3:32   ` [edk2-devel] 回复: " gaoliming via groups.io
2024-02-29 10:17     ` Laszlo Ersek
2024-02-24 21:23 ` [edk2-devel] [edk2-BuildSpecification PATCH 0/3] AutoGen.h: " Laszlo Ersek
2024-02-24 21:23   ` [edk2-devel] [edk2-BuildSpecification PATCH 1/3] README.md: fix revision history whitespace Laszlo Ersek
2024-02-24 21:23   ` [edk2-devel] [edk2-BuildSpecification PATCH 2/3] AutoGen.c: list the SEC module type for <CONSTRUCTOR>/<DESTRUCTOR> (VOID) Laszlo Ersek
2024-02-24 21:23   ` Laszlo Ersek [this message]
2024-02-24 21:49   ` [edk2-devel] [edk2-BuildSpecification PATCH 0/3] AutoGen.h: declare ProcessLibraryConstructorList() for SEC modules Laszlo Ersek
2024-03-01 12:53   ` 回复: " gaoliming via groups.io
2024-03-01 13:40     ` Laszlo Ersek
2024-02-24 21:28 ` [edk2-devel] [edk2-InfSpecification PATCH 0/2] README: INF_VERSION >= 1.30: declare ProcessLibraryCon...() " Laszlo Ersek
2024-02-24 21:28   ` [edk2-devel] [edk2-InfSpecification PATCH 1/2] README.md: fix revision history whitespace Laszlo Ersek
2024-02-24 21:28   ` [edk2-devel] [edk2-InfSpecification PATCH 2/2] README: INF_VERSION >= 1.30: declare ProcessLibraryCon...() for SEC modules Laszlo Ersek
2024-02-24 21:51   ` [edk2-devel] [edk2-InfSpecification PATCH 0/2] " Laszlo Ersek
2024-03-01 12:52   ` 回复: " gaoliming via groups.io
2024-03-01 13:46     ` Laszlo Ersek
2024-02-27 23:41 ` [edk2-devel] [v2] BaseTools/AutoGen: declare ProcessLibraryConstructorList() " Rebecca Cran
2024-03-02 18:14   ` Laszlo Ersek
2024-03-01 11:30 ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240224212338.42671-4-lersek@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox