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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Adapted from the following patch.

From 5c2b84b0963aa1af0c55c38afbc4080fd9f6a46f Mon Sep 17 00:00:00 2001
From: Jon Roelofs <[email protected]>
Date: Fri, 17 Nov 2023 14:21:57 -0800
Subject: [PATCH] [builtins] Move cfi start's after the symbol name [NFC]

... in preparation for diagnosing improperly nested .cfi regions.

See https://reviews.llvm.org/D155245
---
compiler-rt/lib/builtins/assembly.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
index f6ce6a9fccff..f859ad8f6706 100644
--- a/lib/builtins/assembly.h
+++ b/lib/builtins/assembly.h
@@ -249,9 +249,10 @@
.globl name SEPARATOR \
SYMBOL_IS_FUNC(name) SEPARATOR \
DECLARE_SYMBOL_VISIBILITY(name) SEPARATOR \
- CFI_START SEPARATOR \
DECLARE_FUNC_ENCODING \
- name: SEPARATOR BTI_C
+ name: \
+ SEPARATOR CFI_START \
+ SEPARATOR BTI_C

#define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \
.globl SYMBOL_NAME(name) SEPARATOR \
--
2.44.0

4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/12/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ let
../common/compiler-rt/armv6-mcr-dmb.patch
../common/compiler-rt/armv6-sync-ops-no-thumb.patch
../common/compiler-rt/armv6-no-ldrexd-strexd.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
../12/compiler-rt/clang18-compat.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand All @@ -327,6 +329,8 @@ let
../common/compiler-rt/armv6-mcr-dmb.patch
../common/compiler-rt/armv6-sync-ops-no-thumb.patch
../common/compiler-rt/armv6-no-ldrexd-strexd.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
../12/compiler-rt/clang18-compat.patch
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand Down
12 changes: 12 additions & 0 deletions pkgs/development/compilers/llvm/13/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ in let
../common/compiler-rt/armv6-no-ldrexd-strexd.patch
../common/compiler-rt/armv6-scudo-no-yield.patch
../common/compiler-rt/armv6-scudo-libatomic.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand All @@ -367,6 +373,12 @@ in let
../common/compiler-rt/armv6-no-ldrexd-strexd.patch
../common/compiler-rt/armv6-scudo-no-yield.patch
../common/compiler-rt/armv6-scudo-libatomic.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand Down
12 changes: 12 additions & 0 deletions pkgs/development/compilers/llvm/14/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ in let
../common/compiler-rt/armv6-no-ldrexd-strexd.patch
../common/compiler-rt/armv6-scudo-no-yield.patch
../common/compiler-rt/armv6-scudo-libatomic.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand All @@ -342,6 +348,12 @@ in let
../common/compiler-rt/armv6-no-ldrexd-strexd.patch
../common/compiler-rt/armv6-scudo-no-yield.patch
../common/compiler-rt/armv6-scudo-libatomic.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand Down
12 changes: 12 additions & 0 deletions pkgs/development/compilers/llvm/15/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ in let
../common/compiler-rt/darwin-plistbuddy-workaround.patch
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
../common/compiler-rt/armv7l-15.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand All @@ -384,6 +390,12 @@ in let
../common/compiler-rt/darwin-plistbuddy-workaround.patch
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
../common/compiler-rt/armv7l-15.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand Down
14 changes: 13 additions & 1 deletion pkgs/development/compilers/llvm/16/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, ninja
, preLibcCrossHeaders
, libxml2, python3, fetchFromGitHub, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
, libxml2, python3, fetchFromGitHub, fetchpatch, substituteAll, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
Expand Down Expand Up @@ -373,6 +373,12 @@ in let
../common/compiler-rt/darwin-plistbuddy-workaround.patch
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic)
Expand All @@ -393,6 +399,12 @@ in let
../common/compiler-rt/darwin-plistbuddy-workaround.patch
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand Down
12 changes: 12 additions & 0 deletions pkgs/development/compilers/llvm/17/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,12 @@ in let
../common/compiler-rt/darwin-plistbuddy-workaround.patch
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic)
Expand All @@ -378,6 +384,12 @@ in let
../common/compiler-rt/darwin-plistbuddy-workaround.patch
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../common/compiler-rt/armv7l-15.patch
# Fix build with clang 18 due to https://github.com/llvm/llvm-project/commit/d506aa4edfa66074db3dc1fa84da9d9c80d71500.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/7939ce39dac0078fef7183d6198598b99c652c88.patch";
stripLen = 1;
hash = "sha256-tGqXsYvUllFrPa/r/dsKVlwx5IrcJGccuR1WAtUg7/o=";
})
];
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
Expand Down