forked from void-linux/void-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for all ppc64 targets. * Use bundled LLVM instead of system wide LLVM. Rust statically links against LLVM anyway and we can avoid some bugs this way (such as Rust failing to compile Firefox, see rust-lang/rust#57762 Co-authored-by: q66 <daniel@octaforge.org> [ci skip]
- Loading branch information
Rasmus Thomsen
committed
Jan 24, 2019
1 parent
4f7fe5b
commit bff3374
Showing
7 changed files
with
228 additions
and
29 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
srcpkgs/rust/files/patches/internal-llvm/llvm-001-musl.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001 | ||
From: Andrea Brancaleoni <miwaxe@gmail.com> | ||
Date: Tue, 8 Sep 2015 22:03:02 +0200 | ||
Subject: [PATCH 3/3] musl | ||
|
||
--- | ||
include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++ | ||
lib/Support/DynamicLibrary.cpp | 2 +- | ||
lib/Support/Unix/Signals.inc | 6 +++--- | ||
utils/unittest/googletest/src/gtest.cc | 1 + | ||
5 files changed, 17 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h | ||
index e0a1ee3..465b65a 100644 | ||
--- a/include/llvm/Analysis/TargetLibraryInfo.h | ||
+++ b/include/llvm/Analysis/TargetLibraryInfo.h | ||
@@ -18,6 +18,15 @@ | ||
#include "llvm/IR/Module.h" | ||
#include "llvm/Pass.h" | ||
|
||
+#undef fopen64 | ||
+#undef fseeko64 | ||
+#undef fstat64 | ||
+#undef fstatvfs64 | ||
+#undef ftello64 | ||
+#undef lstat64 | ||
+#undef stat64 | ||
+#undef tmpfile64 | ||
+ | ||
namespace llvm { | ||
/// VecDesc - Describes a possible vectorization of a function. | ||
/// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized | ||
diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc | ||
index 5780764..1d548c1 100644 | ||
--- a/utils/unittest/googletest/src/gtest.cc | ||
+++ b/utils/unittest/googletest/src/gtest.cc | ||
@@ -120,6 +120,7 @@ | ||
|
||
#if GTEST_CAN_STREAM_RESULTS_ | ||
# include <arpa/inet.h> // NOLINT | ||
+# include <sys/socket.h> // NOLINT | ||
# include <netdb.h> // NOLINT | ||
#endif | ||
|
||
-- | ||
2.5.1 | ||
|
||
--- llvm-5.0.0.src/lib/Support/Unix/DynamicLibrary.inc.orig | ||
+++ llvm-5.0.0.src/lib/Support/Unix/DynamicLibrary.inc | ||
@@ -103,7 +103,7 @@ | ||
|
||
// This macro returns the address of a well-known, explicit symbol | ||
#define EXPLICIT_SYMBOL(SYM) \ | ||
- if (!strcmp(SymbolName, #SYM)) return &SYM | ||
+ if (!strcmp(SymbolName, #SYM)) return (void *)&SYM | ||
|
||
// Under glibc we have a weird situation. The stderr/out/in symbols are both | ||
// macros and global variables because of standards requirements. So, we |
28 changes: 28 additions & 0 deletions
28
srcpkgs/rust/files/patches/internal-llvm/llvm-002-musl-ppc64-elfv2.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From 750d323a6060ad92c3d247f85d6555041f55b4a5 Mon Sep 17 00:00:00 2001 | ||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> | ||
Date: Thu, 4 Oct 2018 15:26:59 -0500 | ||
Subject: [PATCH] Add support for powerpc64-*-linux-musl targets | ||
|
||
This patch ensures that 64-bit PowerPC musl targets use ELFv2 ABI on both | ||
endians. It additionally adds a test that big endian PPC64 uses ELFv2 on | ||
musl. | ||
--- | ||
lib/Target/PowerPC/PPCTargetMachine.cpp | 4 ++++ | ||
test/CodeGen/PowerPC/ppc64-elf-abi.ll | 1 + | ||
2 files changed, 5 insertions(+) | ||
|
||
diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp | ||
index 34410393ef6..c583fba8cab 100644 | ||
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp | ||
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp | ||
@@ -199,6 +199,10 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, | ||
case Triple::ppc64le: | ||
return PPCTargetMachine::PPC_ABI_ELFv2; | ||
case Triple::ppc64: | ||
+ // musl uses ELFv2 ABI on both endians. | ||
+ if (TT.getEnvironment() == Triple::Musl) | ||
+ return PPCTargetMachine::PPC_ABI_ELFv2; | ||
+ | ||
return PPCTargetMachine::PPC_ABI_ELFv1; | ||
default: | ||
return PPCTargetMachine::PPC_ABI_UNKNOWN; |
33 changes: 33 additions & 0 deletions
33
srcpkgs/rust/files/patches/sys-llvm/1c95f5a34c14f08d65cdd198827e3a2fcb63cf39.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
From 1c95f5a34c14f08d65cdd198827e3a2fcb63cf39 Mon Sep 17 00:00:00 2001 | ||
From: Tom Tromey <tom@tromey.com> | ||
Date: Tue, 22 Jan 2019 11:13:53 -0700 | ||
Subject: [PATCH] Fix issue 57762 | ||
|
||
Issue 57762 points out a compiler crash when the compiler was built | ||
using a stock LLVM 7. LLVM 7 was released without a necessary fix for | ||
a bug in the DWARF discriminant code. | ||
|
||
This patch changes rustc to use the fallback mode on (non-Rust) LLVM 7. | ||
|
||
Closes #57762 | ||
--- | ||
src/librustc_codegen_llvm/debuginfo/metadata.rs | 6 +++++- | ||
1 file changed, 5 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs | ||
index 6deedd0b5ea3..a354eef6887a 100644 | ||
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs | ||
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs | ||
@@ -1164,7 +1164,11 @@ fn use_enum_fallback(cx: &CodegenCx) -> bool { | ||
// On MSVC we have to use the fallback mode, because LLVM doesn't | ||
// lower variant parts to PDB. | ||
return cx.sess().target.target.options.is_like_msvc | ||
- || llvm_util::get_major_version() < 7; | ||
+ || llvm_util::get_major_version() < 7 | ||
+ // LLVM version 7 did not release with an important bug fix; | ||
+ // but the required patch is in the equivalent Rust LLVM. | ||
+ // See /~https://github.com/rust-lang/rust/issues/57762. | ||
+ || (llvm_util::get_major_version() == 7 && unsafe { !llvm::LLVMRustIsRustLLVM() }); | ||
} | ||
|
||
// Describes the members of an enum value: An enum is described as a union of |
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
srcpkgs/rust/patches/1c95f5a34c14f08d65cdd198827e3a2fcb63cf39.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
From 1c95f5a34c14f08d65cdd198827e3a2fcb63cf39 Mon Sep 17 00:00:00 2001 | ||
From: Tom Tromey <tom@tromey.com> | ||
Date: Tue, 22 Jan 2019 11:13:53 -0700 | ||
Subject: [PATCH] Fix issue 57762 | ||
|
||
Issue 57762 points out a compiler crash when the compiler was built | ||
using a stock LLVM 7. LLVM 7 was released without a necessary fix for | ||
a bug in the DWARF discriminant code. | ||
|
||
This patch changes rustc to use the fallback mode on (non-Rust) LLVM 7. | ||
|
||
Closes #57762 | ||
--- | ||
src/librustc_codegen_llvm/debuginfo/metadata.rs | 6 +++++- | ||
1 file changed, 5 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs | ||
index 6deedd0b5ea3..a354eef6887a 100644 | ||
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs | ||
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs | ||
@@ -1164,7 +1164,11 @@ fn use_enum_fallback(cx: &CodegenCx) -> bool { | ||
// On MSVC we have to use the fallback mode, because LLVM doesn't | ||
// lower variant parts to PDB. | ||
return cx.sess().target.target.options.is_like_msvc | ||
- || llvm_util::get_major_version() < 7; | ||
+ || llvm_util::get_major_version() < 7 | ||
+ // LLVM version 7 did not release with an important bug fix; | ||
+ // but the required patch is in the equivalent Rust LLVM. | ||
+ // See /~https://github.com/rust-lang/rust/issues/57762. | ||
+ || (llvm_util::get_major_version() == 7 && unsafe { !llvm::LLVMRustIsRustLLVM() }); | ||
} | ||
|
||
// Describes the members of an enum value: An enum is described as a union of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters