forked from OSchip/llvm-project
[darwin] build and link with a separate compiler-rt builtins library
for device simulators This change separates out the iOS/tvOS/watchOS simulator slices from the "libclang_rt.<os>.a" fat archive, by moving them out to their own "libclang_rt.<os>sim.a" static archive. This allows us to build and to link with an arm64 device simulator slice for the simulators running on Apple Silicons, and to distribute it in one archive alongside the Intel simulator slices. Differential Revision: https://reviews.llvm.org/D84564
This commit is contained in:
parent
ae7589e1f1
commit
dc22182d1f
|
@ -1062,10 +1062,9 @@ void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
|
|||
DarwinLibName += Component;
|
||||
if (!(Opts & RLO_IsEmbedded))
|
||||
DarwinLibName += "_";
|
||||
DarwinLibName += getOSLibraryNameSuffix();
|
||||
} else
|
||||
DarwinLibName += getOSLibraryNameSuffix(true);
|
||||
}
|
||||
|
||||
DarwinLibName += getOSLibraryNameSuffix();
|
||||
DarwinLibName += IsShared ? "_dynamic.dylib" : ".a";
|
||||
SmallString<128> Dir(getDriver().ResourceDir);
|
||||
llvm::sys::path::append(
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
// RUN: FileCheck -check-prefix=LINK_IOSSIM_PROFILE %s < %t.log
|
||||
// LINK_IOSSIM_PROFILE: {{ld(.exe)?"}}
|
||||
// LINK_IOSSIM_PROFILE: libclang_rt.profile_iossim.a
|
||||
// LINK_IOSSIM_PROFILE: libclang_rt.ios.a
|
||||
// LINK_IOSSIM_PROFILE: libclang_rt.iossim.a
|
||||
|
||||
// RUN: %clang -target arm64-apple-tvos8.3 -mlinker-version=400 -mtvos-version-min=8.3 -resource-dir=%S/Inputs/resource_dir -### %t.o 2> %t.log
|
||||
// RUN: FileCheck -check-prefix=LINK_TVOS_ARM64 %s < %t.log
|
||||
|
|
|
@ -289,6 +289,15 @@ macro(darwin_add_builtin_library name suffix)
|
|||
endforeach(cflag)
|
||||
endif()
|
||||
|
||||
if ("${LIB_OS}" MATCHES ".*sim$")
|
||||
# Pass an explicit -simulator environment to the -target option to ensure
|
||||
# that we don't rely on the architecture to infer whether we're building
|
||||
# for the simulator.
|
||||
string(REGEX REPLACE "sim" "" base_os "${LIB_OS}")
|
||||
list(APPEND builtin_cflags
|
||||
-target "${LIB_ARCH}-apple-${base_os}${DARWIN_${LIBOS}_BUILTIN_MIN_VER}-simulator")
|
||||
endif()
|
||||
|
||||
set_target_compile_flags(${libname}
|
||||
${sysroot_flag}
|
||||
${DARWIN_${LIB_OS}_BUILTIN_MIN_VER_FLAG}
|
||||
|
@ -449,16 +458,13 @@ macro(darwin_add_builtin_libraries)
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
# We put the x86 sim slices into the archives for their base OS
|
||||
foreach (os ${ARGN})
|
||||
if(NOT ${os} MATCHES ".*sim$")
|
||||
darwin_lipo_libs(clang_rt.${os}
|
||||
PARENT_TARGET builtins
|
||||
LIPO_FLAGS ${${os}_builtins_lipo_flags} ${${os}sim_builtins_lipo_flags}
|
||||
DEPENDS ${${os}_builtins_libs} ${${os}sim_builtins_libs}
|
||||
OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
|
||||
INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR})
|
||||
endif()
|
||||
darwin_lipo_libs(clang_rt.${os}
|
||||
PARENT_TARGET builtins
|
||||
LIPO_FLAGS ${${os}_builtins_lipo_flags}
|
||||
DEPENDS ${${os}_builtins_libs}
|
||||
OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
|
||||
INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR})
|
||||
endforeach()
|
||||
darwin_add_embedded_builtin_libraries()
|
||||
endmacro()
|
||||
|
|
Loading…
Reference in New Issue