mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 10:20:03 +00:00
[CRT] Use alias names for rot functions when compiling with Clang-CL
Clang-CL does not support #pragma function like CL. The alternative to this approach is to disable all intrinsics for this single source file, but that is not trivial to do, as it can only be done by removing a compiler switch, which we have no CMake support for. Therefore this solution is simpler and as good.
This commit is contained in:
parent
0493e8e432
commit
dc77e7d379
|
@ -441,6 +441,10 @@ if(ARCH STREQUAL "i386")
|
|||
list(APPEND CRT_ASM_SOURCE
|
||||
except/i386/cpp.s)
|
||||
endif()
|
||||
if(USE_CLANG_CL)
|
||||
list(APPEND CRT_ASM_SOURCE
|
||||
stdlib/clang-alias.s)
|
||||
endif()
|
||||
elseif(ARCH STREQUAL "amd64")
|
||||
list(APPEND CRT_ASM_SOURCE
|
||||
except/amd64/seh.s
|
||||
|
|
22
sdk/lib/crt/stdlib/clang-alias.s
Normal file
22
sdk/lib/crt/stdlib/clang-alias.s
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <asm.inc>
|
||||
|
||||
.code
|
||||
|
||||
MACRO(DEFINE_ALIAS, alias, orig, type)
|
||||
EXTERN &orig:&type
|
||||
ALIAS <&alias> = <&orig>
|
||||
ENDM
|
||||
|
||||
#ifdef _M_X64
|
||||
DEFINE_ALIAS _rotl, __function_rotl
|
||||
DEFINE_ALIAS _rotr, __function_rotr
|
||||
DEFINE_ALIAS _lrotl, __function_lrotl
|
||||
DEFINE_ALIAS _lrotr, __function_lrotr
|
||||
#else
|
||||
DEFINE_ALIAS __rotl, ___function_rotl
|
||||
DEFINE_ALIAS __rotr, ___function_rotr
|
||||
DEFINE_ALIAS __lrotl, ___function_lrotl
|
||||
DEFINE_ALIAS __lrotr, ___function_lrotr
|
||||
#endif
|
||||
|
||||
END
|
|
@ -10,11 +10,18 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef __clang__
|
||||
#define _rotl __function_rotl
|
||||
#define _rotr __function_rotr
|
||||
#define _lrotl __function_lrotl
|
||||
#define _lrotr __function_lrotr
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma function(_rotr, _rotl, _rotr, _lrotl, _lrotr)
|
||||
#endif
|
||||
|
||||
unsigned int _rotr( unsigned int value, int shift );
|
||||
unsigned long _lrotr(unsigned long value, int shift);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -43,7 +50,6 @@ unsigned int _rotr( unsigned int value, int shift )
|
|||
return (value >> shift) | (value << (max_bits-shift));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue