Skip to content

Commit

Permalink
compiler-rt: prevent platform sniffing on Darwin
Browse files Browse the repository at this point in the history
Exposed by the tbd stubs which contains fat libraries. The previously
used proxy libraries were x86_64 only.
  • Loading branch information
thefloweringash committed Nov 9, 2020
1 parent fece3eb commit ddd1720
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkgs/development/compilers/llvm/10/compiler-rt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ stdenv.mkDerivation rec {
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ stdenv.lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ stdenv.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_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}"
];

outputs = [ "out" "dev" ];
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/llvm/5/compiler-rt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ stdenv.mkDerivation {
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ stdenv.lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ stdenv.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_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}"
];

outputs = [ "out" "dev" ];
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/llvm/6/compiler-rt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ stdenv.mkDerivation {
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ stdenv.lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ stdenv.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_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}"
];

outputs = [ "out" "dev" ];
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/llvm/7/compiler-rt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ stdenv.mkDerivation {
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ stdenv.lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ stdenv.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_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}"
];

outputs = [ "out" "dev" ];
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/llvm/8/compiler-rt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ stdenv.mkDerivation {
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ stdenv.lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ stdenv.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_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}"
];

outputs = [ "out" "dev" ];
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/llvm/9/compiler-rt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ stdenv.mkDerivation rec {
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ stdenv.lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ stdenv.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_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}"
];

outputs = [ "out" "dev" ];
Expand Down

0 comments on commit ddd1720

Please sign in to comment.