https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c7d1ff4a9d95d6596c6c79684906b00412122e55

commit c7d1ff4a9d95d6596c6c79684906b00412122e55
Author:     Victor Perevertkin <[email protected]>
AuthorDate: Fri Apr 9 03:51:32 2021 +0300
Commit:     Victor Perevertkin <[email protected]>
CommitDate: Fri Apr 9 03:51:32 2021 +0300

    [SDK][NDK] Fix clang 12 compilation
---
 sdk/cmake/gcc.cmake       | 11 +++++++++--
 sdk/include/ndk/kefuncs.h |  2 --
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake
index d5436cea69f..9da30e09008 100644
--- a/sdk/cmake/gcc.cmake
+++ b/sdk/cmake/gcc.cmake
@@ -47,16 +47,23 @@ 
add_compile_options("$<$<NOT:$<COMPILE_LANGUAGE:CXX>>:-nostdinc>")
 
 add_compile_options(-mstackrealign)
 
-if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
     add_compile_options(-fno-aggressive-loop-optimizations)
     if (DBG)
         add_compile_options("$<$<COMPILE_LANGUAGE:C>:-Wold-style-declaration>")
     endif()
-else()
+elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
     add_compile_options("$<$<COMPILE_LANGUAGE:C>:-Wno-microsoft>")
     add_compile_options(-Wno-pragma-pack)
     add_compile_options(-fno-associative-math)
     add_compile_options(-fcommon)
+
+    if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)
+        # disable "libcall optimization"
+        # see 
https://mudongliang.github.io/2020/12/02/undefined-reference-to-stpcpy.html
+        add_compile_options(-fno-builtin-stpcpy)
+    endif()
+
     set(CMAKE_LINK_DEF_FILE_FLAG "")
     set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
     set(CMAKE_LINK_LIBRARY_SUFFIX "")
diff --git a/sdk/include/ndk/kefuncs.h b/sdk/include/ndk/kefuncs.h
index 5556a79fa56..323f9df6455 100644
--- a/sdk/include/ndk/kefuncs.h
+++ b/sdk/include/ndk/kefuncs.h
@@ -245,7 +245,6 @@ KeSignalCallDpcSynchronize(
 // ARC Configuration Functions. Only enabled if you have ARC Support
 //
 #ifdef _ARC_
-CODE_SEG("INIT")
 PCONFIGURATION_COMPONENT_DATA
 NTAPI
 KeFindConfigurationNextEntry(
@@ -256,7 +255,6 @@ KeFindConfigurationNextEntry(
     _In_ PCONFIGURATION_COMPONENT_DATA *NextLink
 );
 
-CODE_SEG("INIT")
 PCONFIGURATION_COMPONENT_DATA
 NTAPI
 KeFindConfigurationEntry(

Reply via email to