mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-29 19:30:11 +00:00
cc-wrapper: Default-disable AltiVec with powerpc64-linux LLVM
GCC is very conservative about enabling AltiVec. The default target has it disabled, and it requires either: - picking a CPU target that is generic POWER7 or higher, or is a specific CPU model that had AltiVec, or - using -maltivec to opt into it LLVM default-enables AltiVec, and has it marked as supported on CPUs that historically lacked it. Inconsistency aside, this leads to issues when building things with Clang that do not expect just AltiVec to be enabled, like webkitgtk. To make things more consistent, if no gcc.cpu is configured, pass -mno-altivec to Clang.
This commit is contained in:
@@ -370,7 +370,15 @@ let
|
||||
# Aarch64 uses TLSDESC by default and the option is completely ignored (at least on LLVM).
|
||||
# TODO: Enable by default in GCC via --with-tls since https://gcc.gnu.org/cgit/gcc/commit/?id=96a291c4bb0b8a00b0a125e6a60f60072ffe53a7 (GCC 16).
|
||||
# No equivalent build-time option for LLVM yet.
|
||||
++ optional (tlsDialect != null) "-mtls-dialect=${tlsDialect}";
|
||||
++ optional (tlsDialect != null) "-mtls-dialect=${tlsDialect}"
|
||||
# LLVM default-enables AltiVec for powerpc64, and for many CPU targets that didn't actually have it.
|
||||
# https://github.com/llvm/llvm-project/blob/40977001fcb190a509897aee592819cdd7e83740/llvm/lib/Target/PowerPC/PPC.td#L791-L796
|
||||
# GCC is more conservative: Requires selecting POWER7 or higher for auto-enable, or opting into it on older ones.
|
||||
# If no CPU is specified, disable AltiVec like GCC does.
|
||||
# TODO: Specify CPU + AltiVec preference?
|
||||
++ optional (
|
||||
(targetPlatform.isPower64 && targetPlatform.isBigEndian) && isClang && !(targetPlatform ? gcc.cpu)
|
||||
) "-mno-altivec";
|
||||
|
||||
defaultHardeningFlags = bintools.defaultHardeningFlags or [ ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user