Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvmPackages_{12,13,14,15,16,17,18}.compiler-rt: fix build with clang 18 #309405

Closed
wants to merge 1 commit into from

Conversation

reckenrode
Copy link
Contributor

Description of changes

Clang 18 rejects assembly code that used to be accepted because it can cause runtime crashes. This change prevents older versions of compiler-rt from building on Darwin with a clang 18 stdenv.

The fix is to apply or backport llvm/llvm-project@7939ce3.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Clang 18 rejects assembly code that used to be accepted because it can
cause runtime crashes. This change prevents older versions of
compiler-rt from building on Darwin with a clang 18 stdenv.

The fix is to apply or backport llvm/llvm-project@7939ce3.
@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 4, 2024
@paparodeo
Copy link
Contributor

since the llvm versions were unified this PR needs a little update. The diff below should work (tested with llvm13) and dropped llvm_12 given it is currently broken on darwin but the patch can be added back. I can open a new PR if necessary.

updated compiler-rt diff
diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix
index c3a98c1f063f..26b3a7977893 100644
--- a/pkgs/development/compilers/llvm/common/default.nix
+++ b/pkgs/development/compilers/llvm/common/default.nix
@@ -990,6 +990,14 @@ let
         ++ lib.optional (
           lib.versionAtLeast metadata.release_version "14" && lib.versionOlder metadata.release_version "18"
         ) (metadata.getVersionFile "compiler-rt/gnu-install-dirs.patch")
+        ++ lib.optional (
+          lib.versionAtLeast metadata.release_version "13" && lib.versionOlder metadata.release_version "18"
+          ) (fetchpatch {
+              name = "cfi_startproc-after-label.patch";
+              url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
+              stripLen = 1;
+              hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
+        })
         ++ [
           # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
           # extra `/`.

@emilazy
Copy link
Member

emilazy commented Nov 8, 2024

Fixed on the LLVM 19 branch in #354569. Could be backported if anyone cares.

@emilazy emilazy closed this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild 10.rebuild-linux: 501+ 10.rebuild-linux: 5001+
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants