diff options
| author | Taylor Beebe <taylor.d.beebe@gmail.com> | 2024-08-28 00:31:48 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-09-13 06:58:46 +0300 |
| commit | ac43bbacdef18a6fea6d978e096326ec0805885d (patch) | |
| tree | b7df070aa9c31205f5d123eff6542680094f968f /MdePkg/Library/StackCheckLibNull/StackCheckLibNullHostApplication.inf | |
| parent | 3a9da5f329ab9683bffc451502a2f0680568a71f (diff) | |
| download | edk2-ac43bbacdef18a6fea6d978e096326ec0805885d.tar.xz | |
MdePkg: Create Stack Check Null Libs
Add Null libs for Stack Check and Stack Check Failure Hook Lib that
allow a platform to opt out of stack checks and the stack check failure
hook lib.
StackCheckLib allows implementation (or in this case null implementation)
of stack checks on binaries. There is a Host Application specific version
of this null lib because MSVC host applications must not be linked against
our lib (so the file here is a no-op but that doesn't cause the build
system to fail the build for not building a file for MSVC) as it links
against the MSVC C runtime lib that provides the stack cookie definitions.
GCC host applications do not link against such a C runtime lib and must
be linked against our version.
StackCheckFailureHookLib lets a platform do custom functionality when a
stack check failure occurs (such as log it to a platform defined
mechanism). The null lib simply returns.
Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Diffstat (limited to 'MdePkg/Library/StackCheckLibNull/StackCheckLibNullHostApplication.inf')
| -rw-r--r-- | MdePkg/Library/StackCheckLibNull/StackCheckLibNullHostApplication.inf | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/MdePkg/Library/StackCheckLibNull/StackCheckLibNullHostApplication.inf b/MdePkg/Library/StackCheckLibNull/StackCheckLibNullHostApplication.inf new file mode 100644 index 0000000000..3e898263c2 --- /dev/null +++ b/MdePkg/Library/StackCheckLibNull/StackCheckLibNullHostApplication.inf @@ -0,0 +1,34 @@ +## @file
+# Null library instance for StackCheckLib which can be included
+# when a build needs to include stack check functions but does
+# not want to generate stack check failures. This instance is used
+# for HOST_APPLICATIONS specifically, as MSVC host applications link
+# to the C runtime lib that contains the stack cookie definitions, so
+# must link to a completely null version of this lib, whereas GCC host
+# host applications do not link to a C runtime lib that contains the stack
+# cookie definitions, so we must link against our version.
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+ INF_VERSION = 1.29
+ BASE_NAME = StackCheckLibNullHostApplication
+ FILE_GUID = 7EBE7BD1-0D92-4609-89AA-6EA3815CB844
+ MODULE_TYPE = HOST_APPLICATION
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = StackCheckLib|HOST_APPLICATION
+
+[Sources]
+ StackCheckLibHostApplicationMsvc.c | MSFT
+ StackCheckLibNullGcc.c | GCC
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[BuildOptions]
+ # We cannot build the GCC version with LTO (link time optimization) because we run into linker errors where
+ # the stack cookie variable has been optimized away, as it looks to GCC like the variable is not used, because
+ # the compiler inserts the usage. We do not worry about the MSVC version here as it is a no-op.
+ GCC:*_*_*_CC_FLAGS = -fno-lto
|
