diff options
author | Anuj Mittal <anuj.mittal@intel.com> | 2022-08-15 13:08:55 +0800 |
---|---|---|
committer | Anuj Mittal <anuj.mittal@intel.com> | 2022-08-15 13:40:22 +0800 |
commit | 0a7687b2c1e174b055213db7e535eec03828d3d1 (patch) | |
tree | 5562886285c6a0ff4643bd4672415ffd276707c0 /dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm12-0002-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch | |
parent | 94d6ec3730ac57fa2c27d1b04124d55cd5f88952 (diff) | |
download | meta-intel-0a7687b2c1e174b055213db7e535eec03828d3d1.tar.gz |
Remove support for LLVM 12
We can now build with LLVM 14 and no longer need to keep LLVM 12 patches
and compatibility code.
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm12-0002-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch')
-rw-r--r-- | dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm12-0002-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm12-0002-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm12-0002-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch deleted file mode 100644 index 497db4f5..00000000 --- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm12-0002-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | From 60854c328d8729b2ef10b9bb4dcbcc282f43c5e7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Raphael Isemann <teemperor@gmail.com> | ||
3 | Date: Thu, 1 Apr 2021 18:41:44 +0200 | ||
4 | Subject: [PATCH] Avoid calling ParseCommandLineOptions in BackendUtil if | ||
5 | possible | ||
6 | |||
7 | Calling `ParseCommandLineOptions` should only be called from `main` as the | ||
8 | CommandLine setup code isn't thread-safe. As BackendUtil is part of the | ||
9 | generic Clang FrontendAction logic, a process which has several threads executing | ||
10 | Clang FrontendActions will randomly crash in the unsafe setup code. | ||
11 | |||
12 | This patch avoids calling the function unless either the debug-pass option or | ||
13 | limit-float-precision option is set. Without these two options set the | ||
14 | `ParseCommandLineOptions` call doesn't do anything beside parsing | ||
15 | the command line `clang` which doesn't set any options. | ||
16 | |||
17 | See also D99652 where LLDB received a workaround for this crash. | ||
18 | |||
19 | Reviewed By: JDevlieghere | ||
20 | |||
21 | Differential Revision: https://reviews.llvm.org/D99740 | ||
22 | |||
23 | Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/60854c328d8729b2ef10b9bb4dcbcc282f43c5e7] | ||
24 | Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> | ||
25 | |||
26 | --- | ||
27 | clang/lib/CodeGen/BackendUtil.cpp | 8 ++++++++ | ||
28 | 1 file changed, 8 insertions(+) | ||
29 | |||
30 | diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp | ||
31 | index 41eafd13d97c..00d92e7beadd 100644 | ||
32 | --- a/clang/lib/CodeGen/BackendUtil.cpp | ||
33 | +++ b/clang/lib/CodeGen/BackendUtil.cpp | ||
34 | @@ -871,7 +871,15 @@ static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) { | ||
35 | BackendArgs.push_back("-limit-float-precision"); | ||
36 | BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str()); | ||
37 | } | ||
38 | + // Check for the default "clang" invocation that won't set any cl::opt values. | ||
39 | + // Skip trying to parse the command line invocation to avoid the issues | ||
40 | + // described below. | ||
41 | + if (BackendArgs.size() == 1) | ||
42 | + return; | ||
43 | BackendArgs.push_back(nullptr); | ||
44 | + // FIXME: The command line parser below is not thread-safe and shares a global | ||
45 | + // state, so this call might crash or overwrite the options of another Clang | ||
46 | + // instance in the same process. | ||
47 | llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1, | ||
48 | BackendArgs.data()); | ||
49 | } | ||
50 | -- | ||
51 | 2.29.2 | ||
52 | |||