mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-13 11:30:35 +08:00
llvmPackages_15.compiler-rt: fixes for Darwin
this introduces a codesigning related patch that we can drop once #195107 goes through see: https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272116014
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001
|
||||
From: Will Dietz <w@wdtz.org>
|
||||
Date: Tue, 19 Sep 2017 13:13:06 -0500
|
||||
Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that
|
||||
needs it
|
||||
|
||||
---
|
||||
cmake/Modules/AddCompilerRT.cmake | 8 ------
|
||||
test/asan/CMakeLists.txt | 52 ---------------------------------------
|
||||
test/tsan/CMakeLists.txt | 47 -----------------------------------
|
||||
3 files changed, 107 deletions(-)
|
||||
|
||||
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
|
||||
index bc69ec95c419..9f100fdcec2f 100644
|
||||
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -366,14 +366,6 @@ function(add_compiler_rt_runtime name type)
|
||||
set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
|
||||
set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")
|
||||
endif()
|
||||
- if(APPLE)
|
||||
- # Ad-hoc sign the dylibs
|
||||
- add_custom_command(TARGET ${libname}
|
||||
- POST_BUILD
|
||||
- COMMAND codesign --sign - $<TARGET_FILE:${libname}>
|
||||
- WORKING_DIRECTORY ${COMPILER_RT_OUTPUT_LIBRARY_DIR}
|
||||
- )
|
||||
- endif()
|
||||
endif()
|
||||
|
||||
set(parent_target_arg)
|
||||
2.14.1
|
||||
|
||||
@@ -66,6 +66,10 @@ stdenv.mkDerivation {
|
||||
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
|
||||
"-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
"-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
|
||||
# `COMPILER_RT_DEFAULT_TARGET_ONLY` does not apply to Darwin:
|
||||
# https://github.com/llvm/llvm-project/blob/27ef42bec80b6c010b7b3729ed0528619521a690/compiler-rt/cmake/base-config-ix.cmake#L153
|
||||
"-DCOMPILER_RT_ENABLE_IOS=OFF"
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
@@ -78,7 +82,26 @@ stdenv.mkDerivation {
|
||||
./normalize-var.patch
|
||||
] # Prevent a compilation error on darwin
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin ./darwin-targetconditionals.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch
|
||||
|
||||
# The `compiler-rt` build inspects `ld` to figure out whether it needs to
|
||||
# explicitly call `codesign`:
|
||||
# https://github.com/llvm/llvm-project/blob/27ef42bec80b6c010b7b3729ed0528619521a690/compiler-rt/cmake/Modules/AddCompilerRT.cmake#L409-L422
|
||||
#
|
||||
# In our case, despite (currently) having an `ld` version than 609, we don't
|
||||
# need an explicit codesigning step because `postLinkSignHook` handles this
|
||||
# for us.
|
||||
#
|
||||
# Unfortunately there isn't an easy way to override
|
||||
# `NEED_EXPLICIT_ADHOC_CODESIGN`.
|
||||
#
|
||||
# Adding `codesign` as a build input also doesn't currently work because, as
|
||||
# of this writing, `codesign` in nixpkgs doesn't support the `--sign` alias
|
||||
# which the `compiler-rt` build uses. See here for context:
|
||||
# https://github.com/NixOS/nixpkgs/pull/194634#issuecomment-1272116014
|
||||
#
|
||||
# So, for now, we patch `compiler-rt` to skip the explicit codesigning step.
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin ./skip-explicit-codesign.patch;
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
|
||||
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -406,7 +406,7 @@ function(add_compiler_rt_runtime name type)
|
||||
if (HAD_ERROR)
|
||||
message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}")
|
||||
endif()
|
||||
- set(NEED_EXPLICIT_ADHOC_CODESIGN 1)
|
||||
+ set(NEED_EXPLICIT_ADHOC_CODESIGN 0) # `postLinkSignHook` handles this for us
|
||||
if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
|
||||
string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
|
||||
if (HOST_LINK_VERSION VERSION_GREATER_EQUAL 609)
|
||||
Reference in New Issue
Block a user