Accepting request 800119 from home:namtrac:branches:devel:languages:rust
- Add rust-pr70163-prepare-for-llvm-10-upgrade.patch to fix compilation with llvm10 OBS-URL: https://build.opensuse.org/request/show/800119 OBS-URL: https://build.opensuse.org/package/show/devel:languages:rust/rust?expand=0&rev=250
This commit is contained in:
parent
1b10ff8fe7
commit
fe469f919c
175
rust-pr70163-prepare-for-llvm-10-upgrade.patch
Normal file
175
rust-pr70163-prepare-for-llvm-10-upgrade.patch
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
commit 374ab25585f0a817fe7bd6986737f12347b12d0b (from 1add455ec6f81045e7651c6225902823f5d4fbfa)
|
||||||
|
Merge: 1add455ec6f8 497f879b1e24
|
||||||
|
Author: bors <bors@rust-lang.org>
|
||||||
|
Date: Tue Mar 24 12:42:54 2020 +0000
|
||||||
|
|
||||||
|
Auto merge of #70163 - nikic:llvm-10-preparation, r=cuviper
|
||||||
|
|
||||||
|
Prepare for LLVM 10 upgrade
|
||||||
|
|
||||||
|
This is #67759 minus the submodule update.
|
||||||
|
|
||||||
|
* Fix two compatibility issues in the rustllvm wrapper.
|
||||||
|
* Update data layout strings in tests.
|
||||||
|
* Fix LLVM version comparison (this become a problem because the major version has two digits now).
|
||||||
|
|
||||||
|
r? @cuviper
|
||||||
|
|
||||||
|
Index: rustc-1.43.0-src/src/bootstrap/test.rs
|
||||||
|
===================================================================
|
||||||
|
--- rustc-1.43.0-src.orig/src/bootstrap/test.rs
|
||||||
|
+++ rustc-1.43.0-src/src/bootstrap/test.rs
|
||||||
|
@@ -1142,6 +1142,8 @@ impl Step for Compiletest {
|
||||||
|
let llvm_config = builder.ensure(native::Llvm { target: builder.config.build });
|
||||||
|
if !builder.config.dry_run {
|
||||||
|
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
|
||||||
|
+ // Remove trailing newline from llvm-config output.
|
||||||
|
+ let llvm_version = llvm_version.trim_end();
|
||||||
|
cmd.arg("--llvm-version").arg(llvm_version);
|
||||||
|
}
|
||||||
|
if !builder.is_rust_llvm(target) {
|
||||||
|
Index: rustc-1.43.0-src/src/rustllvm/PassWrapper.cpp
|
||||||
|
===================================================================
|
||||||
|
--- rustc-1.43.0-src.orig/src/rustllvm/PassWrapper.cpp
|
||||||
|
+++ rustc-1.43.0-src/src/rustllvm/PassWrapper.cpp
|
||||||
|
@@ -67,7 +67,11 @@ extern "C" void LLVMInitializePasses() {
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void LLVMTimeTraceProfilerInitialize() {
|
||||||
|
-#if LLVM_VERSION_GE(9, 0)
|
||||||
|
+#if LLVM_VERSION_GE(10, 0)
|
||||||
|
+ timeTraceProfilerInitialize(
|
||||||
|
+ /* TimeTraceGranularity */ 0,
|
||||||
|
+ /* ProcName */ "rustc");
|
||||||
|
+#elif LLVM_VERSION_GE(9, 0)
|
||||||
|
timeTraceProfilerInitialize();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Index: rustc-1.43.0-src/src/rustllvm/RustWrapper.cpp
|
||||||
|
===================================================================
|
||||||
|
--- rustc-1.43.0-src.orig/src/rustllvm/RustWrapper.cpp
|
||||||
|
+++ rustc-1.43.0-src/src/rustllvm/RustWrapper.cpp
|
||||||
|
@@ -1328,8 +1328,13 @@ extern "C" LLVMValueRef LLVMRustBuildMem
|
||||||
|
LLVMValueRef Dst, unsigned DstAlign,
|
||||||
|
LLVMValueRef Val,
|
||||||
|
LLVMValueRef Size, bool IsVolatile) {
|
||||||
|
+#if LLVM_VERSION_GE(10, 0)
|
||||||
|
+ return wrap(unwrap(B)->CreateMemSet(
|
||||||
|
+ unwrap(Dst), unwrap(Val), unwrap(Size), MaybeAlign(DstAlign), IsVolatile));
|
||||||
|
+#else
|
||||||
|
return wrap(unwrap(B)->CreateMemSet(
|
||||||
|
unwrap(Dst), unwrap(Val), unwrap(Size), DstAlign, IsVolatile));
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" LLVMValueRef
|
||||||
|
Index: rustc-1.43.0-src/src/test/run-make-fulldeps/target-specs/my-awesome-platform.json
|
||||||
|
===================================================================
|
||||||
|
--- rustc-1.43.0-src.orig/src/test/run-make-fulldeps/target-specs/my-awesome-platform.json
|
||||||
|
+++ rustc-1.43.0-src/src/test/run-make-fulldeps/target-specs/my-awesome-platform.json
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
{
|
||||||
|
- "data-layout": "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128",
|
||||||
|
+ "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128",
|
||||||
|
"linker-flavor": "gcc",
|
||||||
|
"llvm-target": "i686-unknown-linux-gnu",
|
||||||
|
"target-endian": "little",
|
||||||
|
Index: rustc-1.43.0-src/src/test/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json
|
||||||
|
===================================================================
|
||||||
|
--- rustc-1.43.0-src.orig/src/test/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json
|
||||||
|
+++ rustc-1.43.0-src/src/test/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
{
|
||||||
|
"pre-link-args": {"gcc": ["-m64"]},
|
||||||
|
- "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
|
||||||
|
+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
|
||||||
|
"linker-flavor": "gcc",
|
||||||
|
"llvm-target": "x86_64-unknown-linux-gnu",
|
||||||
|
"target-endian": "little",
|
||||||
|
Index: rustc-1.43.0-src/src/tools/compiletest/src/header.rs
|
||||||
|
===================================================================
|
||||||
|
--- rustc-1.43.0-src.orig/src/tools/compiletest/src/header.rs
|
||||||
|
+++ rustc-1.43.0-src/src/tools/compiletest/src/header.rs
|
||||||
|
@@ -191,6 +191,7 @@ impl EarlyProps {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if let Some(ref actual_version) = config.llvm_version {
|
||||||
|
+ let actual_version = version_to_int(actual_version);
|
||||||
|
if line.starts_with("min-llvm-version") {
|
||||||
|
let min_version = line
|
||||||
|
.trim_end()
|
||||||
|
@@ -199,7 +200,7 @@ impl EarlyProps {
|
||||||
|
.expect("Malformed llvm version directive");
|
||||||
|
// Ignore if actual version is smaller the minimum required
|
||||||
|
// version
|
||||||
|
- &actual_version[..] < min_version
|
||||||
|
+ actual_version < version_to_int(min_version)
|
||||||
|
} else if line.starts_with("min-system-llvm-version") {
|
||||||
|
let min_version = line
|
||||||
|
.trim_end()
|
||||||
|
@@ -208,7 +209,7 @@ impl EarlyProps {
|
||||||
|
.expect("Malformed llvm version directive");
|
||||||
|
// Ignore if using system LLVM and actual version
|
||||||
|
// is smaller the minimum required version
|
||||||
|
- config.system_llvm && &actual_version[..] < min_version
|
||||||
|
+ config.system_llvm && actual_version < version_to_int(min_version)
|
||||||
|
} else if line.starts_with("ignore-llvm-version") {
|
||||||
|
// Syntax is: "ignore-llvm-version <version1> [- <version2>]"
|
||||||
|
let range_components = line
|
||||||
|
@@ -219,15 +220,15 @@ impl EarlyProps {
|
||||||
|
.take(3) // 3 or more = invalid, so take at most 3.
|
||||||
|
.collect::<Vec<&str>>();
|
||||||
|
match range_components.len() {
|
||||||
|
- 1 => &actual_version[..] == range_components[0],
|
||||||
|
+ 1 => actual_version == version_to_int(range_components[0]),
|
||||||
|
2 => {
|
||||||
|
- let v_min = range_components[0];
|
||||||
|
- let v_max = range_components[1];
|
||||||
|
+ let v_min = version_to_int(range_components[0]);
|
||||||
|
+ let v_max = version_to_int(range_components[1]);
|
||||||
|
if v_max < v_min {
|
||||||
|
panic!("Malformed LLVM version range: max < min")
|
||||||
|
}
|
||||||
|
// Ignore if version lies inside of range.
|
||||||
|
- &actual_version[..] >= v_min && &actual_version[..] <= v_max
|
||||||
|
+ actual_version >= v_min && actual_version <= v_max
|
||||||
|
}
|
||||||
|
_ => panic!("Malformed LLVM version directive"),
|
||||||
|
}
|
||||||
|
@@ -238,6 +239,20 @@ impl EarlyProps {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ fn version_to_int(version: &str) -> u32 {
|
||||||
|
+ let version_without_suffix = version.split('-').next().unwrap();
|
||||||
|
+ let components: Vec<u32> = version_without_suffix
|
||||||
|
+ .split('.')
|
||||||
|
+ .map(|s| s.parse().expect("Malformed version component"))
|
||||||
|
+ .collect();
|
||||||
|
+ match components.len() {
|
||||||
|
+ 1 => components[0] * 10000,
|
||||||
|
+ 2 => components[0] * 10000 + components[1] * 100,
|
||||||
|
+ 3 => components[0] * 10000 + components[1] * 100 + components[2],
|
||||||
|
+ _ => panic!("Malformed version"),
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Index: rustc-1.43.0-src/src/tools/compiletest/src/header/tests.rs
|
||||||
|
===================================================================
|
||||||
|
--- rustc-1.43.0-src.orig/src/tools/compiletest/src/header/tests.rs
|
||||||
|
+++ rustc-1.43.0-src/src/tools/compiletest/src/header/tests.rs
|
||||||
|
@@ -122,9 +122,8 @@ fn llvm_version() {
|
||||||
|
config.llvm_version = Some("9.3.1-rust-1.43.0-dev".to_owned());
|
||||||
|
assert!(!parse_rs(&config, "// min-llvm-version 9.2").ignore);
|
||||||
|
|
||||||
|
- // FIXME.
|
||||||
|
- // config.llvm_version = Some("10.0.0-rust".to_owned());
|
||||||
|
- // assert!(!parse_rs(&config, "// min-llvm-version 9.0").ignore);
|
||||||
|
+ config.llvm_version = Some("10.0.0-rust".to_owned());
|
||||||
|
+ assert!(!parse_rs(&config, "// min-llvm-version 9.0").ignore);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 4 16:21:54 UTC 2020 - Ismail Dönmez <idonmez@suse.com>
|
||||||
|
|
||||||
|
- Add rust-pr70163-prepare-for-llvm-10-upgrade.patch to fix compilation
|
||||||
|
with llvm10
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon May 4 10:45:18 UTC 2020 - Andreas Schwab <schwab@suse.de>
|
Mon May 4 10:45:18 UTC 2020 - Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
|
@ -135,7 +135,8 @@ Source108: %{dl_url}/rust-%{version_bootstrap}-powerpc-unknown-linux-gnu.ta
|
|||||||
Source1000: README.suse-maint
|
Source1000: README.suse-maint
|
||||||
# PATCH-FIX-OPENSUSE: edit src/librustc_llvm/build.rs to ignore GCC incompatible flag
|
# PATCH-FIX-OPENSUSE: edit src/librustc_llvm/build.rs to ignore GCC incompatible flag
|
||||||
Patch0: ignore-Wstring-conversion.patch
|
Patch0: ignore-Wstring-conversion.patch
|
||||||
# PATCH-FIX-UPSTREAM: fix rustdoc compilation: https://github.com/rust-lang/rust/issues/66224
|
# PATCH-FIX-UPSTREAM: fix compilation with llvm10 https://github.com/rust-lang/rust/issues/71573
|
||||||
|
Patch1: rust-pr70163-prepare-for-llvm-10-upgrade.patch
|
||||||
BuildRequires: ccache
|
BuildRequires: ccache
|
||||||
BuildRequires: curl
|
BuildRequires: curl
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
@ -386,6 +387,7 @@ This package includes HTML documentation for Cargo.
|
|||||||
%setup -q -n rustc-%{version}-src
|
%setup -q -n rustc-%{version}-src
|
||||||
|
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
# use python3
|
# use python3
|
||||||
sed -i -e "1s|#!.*|#!%{_bindir}/python3|" x.py
|
sed -i -e "1s|#!.*|#!%{_bindir}/python3|" x.py
|
||||||
|
Loading…
x
Reference in New Issue
Block a user