From 620f3332521b7912e24032bed4e1764562a674ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Fri, 9 Apr 2021 14:59:33 +0200 Subject: [PATCH] [CRT] Fix rot functions aliases in non-x86 clang builds --- sdk/lib/crt/stdlib/rot.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sdk/lib/crt/stdlib/rot.c b/sdk/lib/crt/stdlib/rot.c index 51a6a6c0218..cb82df097fd 100644 --- a/sdk/lib/crt/stdlib/rot.c +++ b/sdk/lib/crt/stdlib/rot.c @@ -11,25 +11,27 @@ #include #ifdef __clang__ -#define _rotl __function_rotl -#define _rotr __function_rotr -#define _lrotl __function_lrotl -#define _lrotr __function_lrotr +# 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) +# pragma function(_rotr, _rotl, _rotr, _lrotl, _lrotr) #endif #if defined (__clang__) && !defined(_MSC_VER) -#define ASM_ALIAS __asm__ -#else -#define ASM_ALIAS(x) +# ifdef _M_IX86 +unsigned int _rotr( unsigned int value, int shift ) __asm__("__rotr"); +unsigned long _lrotr(unsigned long value, int shift) __asm__("__lrotr"); +unsigned int _rotl( unsigned int value, int shift ) __asm__("__rotl"); +unsigned long _lrotl( unsigned long value, int shift ) __asm__("__lrotl"); +# else +unsigned int _rotr( unsigned int value, int shift ) __asm__("_rotr"); +unsigned long _lrotr(unsigned long value, int shift) __asm__("_lrotr"); +unsigned int _rotl( unsigned int value, int shift ) __asm__("_rotl"); +unsigned long _lrotl( unsigned long value, int shift ) __asm__("_lrotl"); +# endif #endif - -unsigned int _rotr( unsigned int value, int shift ) ASM_ALIAS("__rotr"); -unsigned long _lrotr(unsigned long value, int shift) ASM_ALIAS("__lrotr"); -unsigned int _rotl( unsigned int value, int shift ) ASM_ALIAS("__rotl"); -unsigned long _lrotl( unsigned long value, int shift ) ASM_ALIAS("__lrotl"); - /* * @implemented */