Skip to content

[compiler-rt] freadlink fix 2 for #83679. #110372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

devnexen
Copy link
Member

using __MAC_OS_X_VERSION_MIN_REQUIRED instead.

@devnexen
Copy link
Member Author

cc @expcov would it be possible for you to test this branch please ?

@llvmbot
Copy link
Member

llvmbot commented Sep 28, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: David CARLIER (devnexen)

Changes

using __MAC_OS_X_VERSION_MIN_REQUIRED instead.


Full diff: https://github.com/llvm/llvm-project/pull/110372.diff

1 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h (+6-5)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index d4cc380f641b82..09f7cac29fc9ae 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -606,13 +606,14 @@
 // FIXME: also available from musl 1.2.5
 #define SANITIZER_INTERCEPT_PREADV2 (SI_LINUX && __GLIBC_PREREQ(2, 26))
 #define SANITIZER_INTERCEPT_PWRITEV2 (SI_LINUX && __GLIBC_PREREQ(2, 26))
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
-    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130000
-#  define SI_MAC_DEPLOYMENT_BELOW_13_00 1
+#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000
+#  define SI_MAC_OS_DEPLOYMENT_MIN_13_00 1
 #else
-#  define SI_MAC_DEPLOYMENT_BELOW_13_00 0
+#  define SI_MAC_OS_DEPLOYMENT_MIN_13_00 0
 #endif
-#define SANITIZER_INTERCEPT_FREADLINK (SI_MAC && !SI_MAC_DEPLOYMENT_BELOW_13_00)
+#define SANITIZER_INTERCEPT_FREADLINK (SI_MAC && SI_MAC_OS_DEPLOYMENT_MIN_13_00)
+#else
+#
 
 // This macro gives a way for downstream users to override the above
 // interceptor macros irrespective of the platform they are on. They have

Copy link

github-actions bot commented Sep 28, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@devnexen devnexen force-pushed the freadlink_macos_fix2 branch 2 times, most recently from f9a4089 to 542a385 Compare September 28, 2024 16:14
using __MAC_OS_X_VERSION_MIN_REQUIRED instead.
@devnexen devnexen force-pushed the freadlink_macos_fix2 branch from 542a385 to ad82ed6 Compare September 28, 2024 16:18
@expcov
Copy link

expcov commented Sep 28, 2024

@devnexen I have successfully built libclang_rt on the freadlink_macos_fix2 branch.
However, an error occurs during the build of runtimes-clobber.

[100%] Built target yaml2obj
[100%] Built target llvm_gtest
[100%] Built target llvm_gtest_main
[100%] Built target runtimes-clobber
[100%] Performing configure step for 'runtimes'
Not searching for unused variables given on the command line.
loading initial cache file /Users/kenji/develop/expcov/freadlink_macos_fix2/build/projects/runtimes/tmp/runtimes-cache-Release.cmake
-- Warning: Did not find file Compiler/-ASM
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
CMake Error at /Users/kenji/develop/expcov/freadlink_macos_fix2/llvm/cmake/modules/CheckProblematicConfigurations.cmake:14 (if):
  if given arguments:

    "STREQUAL" "MSVC"

  Unknown arguments specified
Call Stack (most recent call first):
  /Users/kenji/develop/expcov/freadlink_macos_fix2/llvm/cmake/modules/HandleLLVMOptions.cmake:10 (include)
  CMakeLists.txt:166 (include)


-- Configuring incomplete, errors occurred!
make[2]: *** [runtimes/runtimes-stamps/runtimes-configure] Error 1
make[1]: *** [runtimes/CMakeFiles/runtimes.dir/all] Error 2
make: *** [all] Error 2

I think the following fixes are needed to correct this problem.

diff --git a/llvm/cmake/modules/CheckProblematicConfigurations.cmake b/llvm/cmake/modules/CheckProblematicConfigurations.cmake
index e133873d756c..c39414fc385b 100644
--- a/llvm/cmake/modules/CheckProblematicConfigurations.cmake
+++ b/llvm/cmake/modules/CheckProblematicConfigurations.cmake
@@ -11,7 +11,7 @@ endmacro()
 
 # MSVC and /arch:AVX is untested and have created problems before. See:
 # https://github.com/llvm/llvm-project/issues/54645
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
   string(TOLOWER "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" _FLAGS)
   if(_FLAGS MATCHES "/arch:avx[0-9]*")
     log_problematic("Compiling LLVM with MSVC and the /arch:AVX flag is known to cause issues with parts of LLVM.\nSee https://github.com/llvm/llvm-project/issues/54645 for details.\nUse clang-cl if you want to enable AVX instructions.")

I have an error when building libunwind, I will exclude it and try the build again.

@devnexen
Copy link
Member Author

Normally

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")

should work, the issues lies on the missing quotes for the string.

@devnexen
Copy link
Member Author

Anyhow, feel free to submit a PR about this later on if you want.

@devnexen devnexen merged commit d705bd2 into llvm:main Sep 29, 2024
7 checks passed
@hnrklssn
Copy link
Member

hnrklssn commented Oct 1, 2024

freadlink.c test cases are failing on Darwin x86_64: https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-cmake-RA-expensive/2122/testReport/

/Users/ec2-user/jenkins/workspace/llvm.org/clang-stage1-cmake-RA-expensive/clang-build/tools/clang/runtime/compiler-rt-bins/test/sanitizer_common/asan-x86_64-Darwin/Darwin/Output/freadlink.c.tmp
Assertion failed: (res2 >= 0), function main, file freadlink.c, line 23.
/Users/ec2-user/jenkins/workspace/llvm.org/clang-stage1-cmake-RA-expensive/clang-build/tools/clang/runtime/compiler-rt-bins/test/sanitizer_common/asan-x86_64-Darwin/Darwin/Output/freadlink.c.script: line 1: 26091 Abort trap: 6           /Users/ec2-user/jenkins/workspace/llvm.org/clang-stage1-cmake-RA-expensive/clang-build/tools/clang/runtime/compiler-rt-bins/test/sanitizer_common/asan-x86_64-Darwin/Darwin/Output/freadlink.c.tmp

Do you have a quick fix? Otherwise, would you please revert your changes?

@devnexen
Copy link
Member Author

devnexen commented Oct 1, 2024

looking into it.

devnexen added a commit to devnexen/llvm-project that referenced this pull request Oct 1, 2024
Sterling-Augustine pushed a commit to Sterling-Augustine/llvm-project that referenced this pull request Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants