diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2015-11-05 00:23:46 +0300 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2015-11-05 11:52:31 +0300 |
commit | cecbc6d2c087febb5850029122c8e27082b5bdcc (patch) | |
tree | 2fac03d2db83af251d8e51bcf2298e200949356e /src/Native/CMakeLists.txt | |
parent | df64a431473ed1a9672e73c7329dd117993d039d (diff) |
Fix few issues in PAL to fix the HelloWorld
With my latest changes, the HelloWorld stopped working. I had two problems
there. One was few simple bugs in the CPU cache details extraction.
The other was the fact that InterlockedXXX operations are implemented like this in PalRedhawk.h:
```C
EXTERN_C long __cdecl _InterlockedIncrement(long volatile *);
Int32 PalInterlockedIncrement(_Inout_ _Interlocked_operand_ Int32 volatile *pDst)
{
return _InterlockedIncrement((long volatile *)pDst);
}
```
The code is using long, which is 64 bits on 64 bit Unix. So it is casting 32 bit
pointer to 64 bit one and performing 64 bit ops. It both corrupts 32 bits after the
location where the pointer points and makes some InterlockedCompareExchange ops
incorrect.
So instead of relying in the _InterlockedXXX intrinsics that can only accept
int or long, I have moved the inline implementations into separate file, one
for windows and one for Unix and implemented all of the PalInterlockedXXX
using __sync_xxxxx functions.
Diffstat (limited to 'src/Native/CMakeLists.txt')
-rw-r--r-- | src/Native/CMakeLists.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt index 5dcb305f5..b5fed91a1 100644 --- a/src/Native/CMakeLists.txt +++ b/src/Native/CMakeLists.txt @@ -19,7 +19,7 @@ function(clr_unknown_arch) endfunction() if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64) - add_definitions(-DBIT64=1) + set(IS_64BIT_BUILD 1) elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l) add_definitions(-DBIT32=1) # Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang @@ -91,6 +91,10 @@ elseif(WIN32) endif() endif() +if(IS_64BIT_BUILD) + add_definitions(-DBIT64=1) +endif(IS_64BIT_BUILD) + if(WIN32) enable_language(ASM_MASM) else() |