From ff97a3df3b0fa33d666c49510e582323953d8af6 Mon Sep 17 00:00:00 2001 From: aleksana Date: Thu, 1 May 2025 23:41:20 +0800 Subject: [PATCH] cc-wrapper: add -m{,no-}strict-align and -mcmodel parameter --- pkgs/build-support/cc-wrapper/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 5304203e342c..22109523d312 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -332,7 +332,17 @@ let ++ optional (targetPlatform ? gcc.fpu) "-mfpu=${targetPlatform.gcc.fpu}" ++ optional (targetPlatform ? gcc.mode) "-mmode=${targetPlatform.gcc.mode}" ++ optional (targetPlatform ? gcc.thumb) "-m${thumb}" - ++ optional (tune != null) "-mtune=${tune}"; + ++ optional (tune != null) "-mtune=${tune}" + ++ + optional (targetPlatform ? gcc.strict-align) + "-m${optionalString (!targetPlatform.gcc.strict-align) "no-"}strict-align" + ++ optional ( + targetPlatform ? gcc.cmodel + && + # TODO: clang on powerpcspe also needs a condition: https://github.com/llvm/llvm-project/issues/71356 + # https://releases.llvm.org/18.1.6/tools/clang/docs/ReleaseNotes.html#loongarch-support + ((targetPlatform.isLoongArch64 && isClang) -> versionAtLeast ccVersion "18.1") + ) "-mcmodel=${targetPlatform.gcc.cmodel}"; defaultHardeningFlags = bintools.defaultHardeningFlags or [ ];