llvmPackages_10.compiler-rt: Add i486, i586, i686

to X86 family. Link crtbeginS.o and crtendS.o Expose ix86 family builtins.
This commit is contained in:
Giulio De Pasquale 2022-04-15 18:44:32 +01:00
parent 5e66f427c6
commit ab7241de71

View File

@ -44,9 +44,7 @@ stdenv.mkDerivation {
] ++ lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
# The compiler-rt build infrastructure sniffs supported platforms on Darwin
# and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails
# when it tries to use libc++ and libc++api for i386.
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
"-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
"-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
];
@ -68,6 +66,8 @@ stdenv.mkDerivation {
postPatch = lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
substituteInPlace cmake/config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace cmake/config-ix.cmake \
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
@ -86,8 +86,16 @@ stdenv.mkDerivation {
'' + lib.optionalString (useLLVM) ''
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtendS.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
''
# See https://reviews.llvm.org/D37278 for why android exception
+ lib.optionalString (stdenv.hostPlatform.isx86_32 && !stdenv.hostPlatform.isAndroid) ''
for f in $out/lib/*/*builtins-i?86*; do
ln -s "$f" $(echo "$f" | sed -e 's/builtins-i.86/builtins-i386/')
done
'';
meta = llvm_meta // {