diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c deleted file mode 100644 index ea168841b617..000000000000 --- a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckGcc.c +++ /dev/null @@ -1,50 +0,0 @@ -/** @file - Base Stack Check library for GCC/clang. - - Use -fstack-protector-all compiler flag to make the compiler insert the - __stack_chk_guard "canary" value into the stack and check the value prior - to exiting the function. If the "canary" is overwritten __stack_chk_fail() - is called. This is GCC specific code. - - Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. - Copyright (c) 2012, Apple Inc. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include - -/// "canary" value that is inserted by the compiler into the stack frame. -VOID *__stack_chk_guard = (VOID *)0x0AFF; - -// If ASLR was enabled we could use -// void (*__stack_chk_guard)(void) = __stack_chk_fail; - -/** - Error path for compiler generated stack "canary" value check code. If the - stack canary has been overwritten this function gets called on exit of the - function. -**/ -VOID -__stack_chk_fail ( - VOID - ) -{ - UINT8 DebugPropertyMask; - - DEBUG ((DEBUG_ERROR, "STACK FAULT: Buffer Overflow at 0x%p.\n", RETURN_ADDRESS (0))); - - // - // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings even if - // BaseDebugLibNull is in use. - // - DebugPropertyMask = PcdGet8 (PcdDebugPropertyMask); - if ((DebugPropertyMask & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { - CpuBreakpoint (); - } else if ((DebugPropertyMask & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { - CpuDeadLoop (); - } -} diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf deleted file mode 100644 index b827645d72b9..000000000000 --- a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf +++ /dev/null @@ -1,39 +0,0 @@ -## @file -# Stack Check Library -# -# Stack Check Library -# -# Copyright (c) 2014, ARM Ltd. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = BaseStackCheckLib - MODULE_UNI_FILE = BaseStackCheckLib.uni - FILE_GUID = 5f6579f7-b648-4fdb-9f19-4c17e27e8eff - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = NULL - - -# -# VALID_ARCHITECTURES = ARM AARCH64 -# - -[Sources] - BaseStackCheckGcc.c | GCC - BaseStackCheckNull.c | MSFT - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - BaseLib - DebugLib - -[Pcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.uni b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.uni deleted file mode 100644 index 03b9d7cd5320..000000000000 --- a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.uni +++ /dev/null @@ -1,16 +0,0 @@ -// /** @file -// Stack Check Library -// -// Stack Check Library -// -// Copyright (c) 2014, ARM Ltd. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "Stack Check Library" - -#string STR_MODULE_DESCRIPTION #language en-US "Stack Check Library" - diff --git a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c b/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c deleted file mode 100644 index 32932002fa13..000000000000 --- a/MdePkg/Library/BaseStackCheckLib/BaseStackCheckNull.c +++ /dev/null @@ -1,9 +0,0 @@ -/** @file - This file is purely empty as a work around for BaseStackCheck to pass MSVC build. - - Copyright (c) 2018, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -extern int __BaseStackCheckNull; diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index 92809e4a7599..0f00172be100 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -197,7 +197,6 @@ [Components.ARM, Components.AARCH64] MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf - MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf MdePkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf [Components.RISCV64]