X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=CryptoPkg%2FLibrary%2FBaseCryptLib%2FSysCall%2FCrtWrapper.c;h=fb446b677044c35764c9e86bf1c7e8782ced1901;hp=79957cc89f780ce45a5fb11b4e15750e1f9b1989;hb=b7d320f8117ed2fffe001b1a0b7bfcd4f40fafc4;hpb=c61fb9c8a40f5999f89512bf33df57a2098928c1 diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c index 79957cc89f..fb446b6770 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c @@ -18,7 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. int errno = 0; FILE *stderr = NULL; -FILE *stdin = NULL; +FILE *stdin = NULL; FILE *stdout = NULL; typedef @@ -244,7 +244,10 @@ void qsort (void *base, size_t num, size_t width, int (*compare)(const void *, c ASSERT (base != NULL); ASSERT (compare != NULL); - Buffer = AllocatePool (width); + // + // Use CRT-style malloc to cover BS and RT memory allocation. + // + Buffer = malloc (width); ASSERT (Buffer != NULL); // @@ -252,7 +255,7 @@ void qsort (void *base, size_t num, size_t width, int (*compare)(const void *, c // QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, Buffer); - FreePool (Buffer); + free (Buffer); return; } @@ -330,11 +333,42 @@ void closelog (void) } +#ifdef __GNUC__ + +typedef +VOID +(EFIAPI *NoReturnFuncPtr)( + VOID + ) __attribute__((__noreturn__)); + + +STATIC +VOID +EFIAPI +NopFunction ( + VOID + ) +{ +} + + void exit (int e) { + NoReturnFuncPtr NoReturnFunc; + + NoReturnFunc = (NoReturnFuncPtr) NopFunction; + + NoReturnFunc (); +} + +#else +void exit (int e) +{ } +#endif + int fclose (FILE *f) { return 0;