diff options
-rw-r--r-- | src/ToolBox/SOS/Strike/strike.h | 11 | ||||
-rw-r--r-- | src/pal/inc/pal.h | 5 | ||||
-rw-r--r-- | src/pal/src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/pal/src/include/pal/palinternal.h | 8 |
4 files changed, 14 insertions, 11 deletions
diff --git a/src/ToolBox/SOS/Strike/strike.h b/src/ToolBox/SOS/Strike/strike.h index a23a3f17bb..d6bd54dc54 100644 --- a/src/ToolBox/SOS/Strike/strike.h +++ b/src/ToolBox/SOS/Strike/strike.h @@ -76,6 +76,16 @@ #ifndef PAL_STDCPP_COMPAT #include <malloc.h> #endif + +#ifdef FEATURE_PAL +#ifndef alloca +#define alloca __builtin_alloca +#endif +#ifndef _alloca +#define _alloca __builtin_alloca +#endif +#endif // FEATURE_PAL + #include <stddef.h> #ifndef FEATURE_PAL @@ -128,4 +138,3 @@ HRESULT SetNGENCompilerFlags(DWORD flags); #endif // __strike_h__ - diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index 0aa436504a..7801883c6c 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -6340,11 +6340,6 @@ PALIMPORT char * __cdecl _strdup(const char *); #endif //_MSC_VER #if defined(__GNUC__) && defined(PLATFORM_UNIX) -// we set -fno-builtin on the command line. This requires that if -// we use alloca, with either have to call __builtin_alloca, or -// ensure that the alloca call doesn't happen in code which is -// modifying the stack (such as "memset (alloca(x), y, z)" - #define alloca __builtin_alloca #endif // __GNUC__ diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 9828d30433..aa68d81e4f 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -68,7 +68,6 @@ endif() # turn off capability to remove unused functions (which was enabled in debug build with sanitizers) set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--no-gc-sections") -add_compile_options(-fno-builtin) add_compile_options(-fPIC) if(PAL_CMAKE_PLATFORM_ARCH_AMD64) diff --git a/src/pal/src/include/pal/palinternal.h b/src/pal/src/include/pal/palinternal.h index 070ffdf240..5b19ae6f1a 100644 --- a/src/pal/src/include/pal/palinternal.h +++ b/src/pal/src/include/pal/palinternal.h @@ -337,15 +337,15 @@ function_name() to call the system's implementation #undef _BitScanForward64 #endif -/* pal.h does "#define alloca _alloca", but we need access to the "real" - alloca */ -#undef alloca +/* pal.h defines alloca(3) as a compiler builtin. + Redefining it to native libc will result in undefined breakage because + a compiler is allowed to make assumptions about the stack and frame + pointers. */ /* Undef all functions and types previously defined so those functions and types could be mapped to the C runtime and socket implementation of the native OS */ #undef exit -#undef alloca #undef atexit #undef div #undef div_t |