https://git.reactos.org/?p=reactos.git;a=commitdiff;h=efe84ec41a0905dd980d3…
commit efe84ec41a0905dd980d309cec2f9c1583af8c34
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Dec 2 19:42:45 2024 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sun Jan 26 18:08:55 2025 +0200
[UCRT] Add "aliases" for some hacked clang builtins
---
sdk/lib/ucrt/stdlib/clang-hacks.s | 32 ++++++++++++++++++++++++++++++++
sdk/lib/ucrt/stdlib/stdlib.cmake | 7 +++++++
2 files changed, 39 insertions(+)
diff --git a/sdk/lib/ucrt/stdlib/clang-hacks.s b/sdk/lib/ucrt/stdlib/clang-hacks.s
new file mode 100644
index 00000000000..6c85fe9021a
--- /dev/null
+++ b/sdk/lib/ucrt/stdlib/clang-hacks.s
@@ -0,0 +1,32 @@
+
+#include <asm.inc>
+
+#ifdef _M_IX86
+.code
+#define SYM(name) _##name
+#else
+.code64
+#define SYM(name) name
+#endif
+
+MACRO(CREATE_ALIAS, alias, target)
+ EXTERN SYM(&target):PROC
+ PUBLIC SYM(&alias)
+ SYM(&alias):
+ jmp SYM(&target)
+ENDM
+
+ #undef _lrotl
+ CREATE_ALIAS _lrotl, ___lrotl
+ #undef _lrotr
+ CREATE_ALIAS _lrotr, ___lrotr
+ #undef _rotl
+ CREATE_ALIAS _rotl, ___rotl
+ #undef _rotl64
+ CREATE_ALIAS _rotl64, ___rotl64
+ #undef _rotr
+ CREATE_ALIAS _rotr, ___rotr
+ #undef _rotr64
+ CREATE_ALIAS _rotr64, ___rotr64
+
+END
diff --git a/sdk/lib/ucrt/stdlib/stdlib.cmake b/sdk/lib/ucrt/stdlib/stdlib.cmake
index fafbad26ea6..0558de48ace 100644
--- a/sdk/lib/ucrt/stdlib/stdlib.cmake
+++ b/sdk/lib/ucrt/stdlib/stdlib.cmake
@@ -22,3 +22,10 @@ list(APPEND UCRT_STDLIB_SOURCES
stdlib/rotl.cpp
stdlib/rotr.cpp
)
+
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ add_asm_files(UCRT_STRING_ASM stdlib/clang-hacks.s)
+ list(APPEND UCRT_STDLIB_SOURCES
+ ${UCRT_STRING_ASM}
+ )
+endif()