GCC 17 (upcoming release) is updating the type of
__stack_chk_guard from a void * to a uintptr_t.
This is only a type change, not a size change. However,
it does cause the GCC 17 build to fail because of the
type mismatch.
uintptr_t is defined as unsigned long, which is not
a type edk2 defines. It has the same size as UINTN
on a given system, but on 64 bit systems we have the
same type issue because UINTN is defined as unsigned long long,
not unsigned long.
To work around this and avoid defining a new type in edk2,
use the compiler built in __UINTPTR_TYPE__ which is the
underlying definition in GCC.
This is a backwards compatible change with previous versions
of GCC and CLANGDWARF but also fixes the upcoming definition
change for GCC 17.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
StackCheckLib defines the interface between a compiler
and the stack checking code. It is being converted from
a NULL library class to an actual library class to make
it easier to use for a platform and be easier to define
the expected interface with a compiler, so if there is
a compiler change it can be tracked and caught.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
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>