Skip to content

Commit

Permalink
dev-lang/julia: version bump to 1.7.0
Browse files Browse the repository at this point in the history
The ebuild for julia 1.7.0 with patches:
 - llvm 13 compatibility
 - libgit1.2 compatibility
 - avoid hardcoded libraries
 - do not build the library a second time
 - do not set rpaths

Some patches come from Arch Linux.

[Matthias Maier]
 - renamed patches
 - misc cleanup

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Janusz Andrzejewski <[email protected]>
Signed-off-by: Matthias Maier <[email protected]>
  • Loading branch information
dzejej authored and tamiko committed Jan 3, 2022
1 parent 1c17e16 commit a7d6cd1
Show file tree
Hide file tree
Showing 9 changed files with 942 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-lang/julia/Manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DIST julia-1.5.3.tar.gz 6949901 BLAKE2B 08f8496980a9bbb9effc0c72cb6b7a5ce1dbd1774735caa366ddc1bb5404117111c624a639f6eb48360061f9fc597a7b37dff24f8555f03ebc4a22524cbeb3b8 SHA512 9e644a64fd6e2caf0390a2bc470084406c078244e65b70a2e3b031d5806c1dff780273ccccfe4bccfd8c03778b7d3a44de7a84bd13f3512afe6864efa5a730fc
DIST julia-1.6.0.tar.gz 7711314 BLAKE2B 135862347a7f3a954acb8d8e17350fbdda84b4813d8498b862e107836a0d29d6e70a26c39c0c29655e6348a5a3afd5b4d7e9824cb88c9e8d31c4515468f46d5b SHA512 41dea60c08882a8f8f9024eb2285c30dbbc68e2256ed6afd5bf956a1828239128b2f39b4ce733a438eafe3b2324ff06dec5c1eb7c9b0f838b2daa972f587d909
DIST julia-1.6.3.tar.gz 7734900 BLAKE2B 679851ee159ac83f49e54f1d71068d4abde919a0da39475dccaecc97e705b87db70c38a55fbc7a0cfacc774291013b189fb516817d6c6e67ca5ccfbb515c3f90 SHA512 a622fddc9e9f3f47037053a1e722153a567c065723f99a97912f8c5a6c2a22c3be0be674325361dd1b04601bbe6c6f204c66004ce887f3f7822e8204fd6855de
DIST julia-1.7.0-full.tar.gz 255670801 BLAKE2B e7c5be50ab9e7014f028cf7d0530b269e78dd798dc3d4a88af2ed9fa1331694e39fbcae26d2cae6f15aaf1087656384c9872f344f99121406abdf2902a200176 SHA512 00e1bfe354010f5d900476e46b471c4425b711fff5a2aa0ac9e5dbe6ff02245011d4297e4703f2d46f7d4e7b6d97ffaf1bc63170edbfec440196c5ec75c984ce
DIST julia-Pkg-49908bffe83790bc7cf3c5d46faf3667f8902ad4.tar.gz 389738 BLAKE2B 1ed9201badf0a1db5142e0566bfe085b364e4681670937ac5fa53c15312ff8eb29d5e783b75fe3f4f379b041ba38c66ce94962fa7d98fcfd0b7b49acd1749d69 SHA512 a85aa80b3080794a8e3ae5ce54856e63457c461659c12fde5dde1b5ec33176ea06af49ee516d01ccd7b78d8358de2fe0ffcd5c6a6d5a5088cdcd76a0133780eb
DIST julia-UnicodeData-13.0.0.txt 1851767 BLAKE2B 72bbcf352f2f6a004abb3f351fe5da160e83644feea8de0ca154b5a1aa78f36cb04b252d0c7b64a5eeca388e600b2875bb76bc2746ee799a1a6eff97c1fe8b06 SHA512 1a4a662e2ab33469976bf5f91aa6933ed9b73f6d4179a2daffb349e1869d7d6cfa885b164e82d15dcdad7458cd451c81add58d875eb0c70de854589dc97b2055
DIST julia-dsfmt-2.2.3.tar.gz 291773 BLAKE2B 6ffae90494d72527920c80fc0fb005da1c7b84f8a03a7ecb0789434c0fff97359e5098e85431896dffccc7d5148c414e847aaba5feef648b8788421a466ff65e SHA512 6d8ddcd01aab3f9039f4f0288a8af53e290cc2f293ed8c4a8c9f3b3f12398e7eedfce8016117b425766ba89c61c86c13b3e420035b5f9bf91315b8b814c03662
Expand Down
29 changes: 29 additions & 0 deletions dev-lang/julia/files/julia-1.7.0-do_not_set_rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- a/Makefile 2021-12-21 09:38:26.782829864 +0100
+++ b/Makefile 2021-12-21 10:52:40.760565902 +0100
@@ -336,7 +336,7 @@
install_name_tool -add_rpath @executable_path/$(build_libdir_rel) @executable_path/$(libdir_rel) $(DESTDIR)$(bindir)/$$j; \
done
endif
-else ifneq (,$(findstring $(OS),Linux FreeBSD))
+else ifneq (,$(findstring $(OS),FreeBSD))
for j in $(JL_TARGETS) ; do \
$(PATCHELF) --set-rpath '$$ORIGIN/$(private_libdir_rel):$$ORIGIN/$(libdir_rel)' $(DESTDIR)$(bindir)/$$j; \
done
@@ -357,7 +357,7 @@
endif

# Set rpath for libjulia-internal, which is moving from `../lib` to `../lib/julia`. We only need to do this for Linux/FreeBSD
-ifneq (,$(findstring $(OS),Linux FreeBSD))
+ifneq (,$(findstring $(OS),FreeBSD))
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal.$(SHLIB_EXT)
ifeq ($(BUNDLE_DEBUG_LIBS),1)
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal-debug.$(SHLIB_EXT)
@@ -365,7 +365,7 @@
endif

# Set rpath for LLVM.so which is `$ORIGIN/../lib` moving from `../lib` to `../lib/julia`. We only need to do this for Linux/FreeBSD
-ifneq (,$(findstring $(OS),Linux FreeBSD))
+ifneq (,$(findstring $(OS),FreeBSD))
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libLLVM.$(SHLIB_EXT)
endif

72 changes: 72 additions & 0 deletions dev-lang/julia/files/julia-1.7.0-hardcoded-libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
This pacth comes from:
https://raw.githubusercontent.com/archlinux/svntogit-community/packages/julia/trunk/julia-hardcoded-libs.patch

diff --git a/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl b/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
index a7ca666b23..b84a42f4e7 100644
--- a/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
+++ b/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
@@ -31,9 +31,9 @@ elseif Sys.isapple()
const libmbedtls = "@rpath/libmbedtls.13.dylib"
const libmbedx509 = "@rpath/libmbedx509.1.dylib"
else
- const libmbedcrypto = "libmbedcrypto.so.5"
- const libmbedtls = "libmbedtls.so.13"
- const libmbedx509 = "libmbedx509.so.1"
+ const libmbedcrypto = "libmbedcrypto.so"
+ const libmbedtls = "libmbedtls.so"
+ const libmbedx509 = "libmbedx509.so"
end

function __init__()
diff --git a/stdlib/libLLVM_jll/src/libLLVM_jll.jl b/stdlib/libLLVM_jll/src/libLLVM_jll.jl
index fa45e754e5..b51812e3a8 100644
--- a/stdlib/libLLVM_jll/src/libLLVM_jll.jl
+++ b/stdlib/libLLVM_jll/src/libLLVM_jll.jl
@@ -23,7 +23,7 @@ if Sys.iswindows()
elseif Sys.isapple()
const libLLVM = "@rpath/libLLVM.dylib"
else
- const libLLVM = "libLLVM-12jl.so"
+ const libLLVM = "libLLVM.so"
end

function __init__()
diff --git a/stdlib/nghttp2_jll/src/nghttp2_jll.jl b/stdlib/nghttp2_jll/src/nghttp2_jll.jl
index 8b98c76ac5..77ad9e3800 100644
--- a/stdlib/nghttp2_jll/src/nghttp2_jll.jl
+++ b/stdlib/nghttp2_jll/src/nghttp2_jll.jl
@@ -22,7 +22,7 @@ if Sys.iswindows()
elseif Sys.isapple()
const libnghttp2 = "@rpath/libnghttp2.14.dylib"
else
- const libnghttp2 = "libnghttp2.so.14"
+ const libnghttp2 = "libnghttp2.so"
end

function __init__()
diff --git a/stdlib/LibGit2_jll/src/LibGit2_jll.jl b/stdlib/LibGit2_jll/src/LibGit2_jll.jl
index f0d4b5dda6..2ed3017b51 100644
--- a/stdlib/LibGit2_jll/src/LibGit2_jll.jl
+++ b/stdlib/LibGit2_jll/src/LibGit2_jll.jl
@@ -23,7 +23,7 @@ if Sys.iswindows()
elseif Sys.isapple()
const libgit2 = "@rpath/libgit2.1.1.dylib"
else
- const libgit2 = "libgit2.so.1.1"
+ const libgit2 = "libgit2.so"
end

function __init__()
diff --git a/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl b/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
index 215de8aed6..918d1ffdc2 100644
--- a/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
+++ b/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl
@@ -22,7 +22,7 @@ if Sys.iswindows()
elseif Sys.isapple()
const libopenlibm = "@rpath/libopenlibm.3.dylib"
else
- const libopenlibm = "libopenlibm.so.3"
+ const libopenlibm = "libopenlibm.so"
end

function __init__()
17 changes: 17 additions & 0 deletions dev-lang/julia/files/julia-1.7.0-libgit-1.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This patch comes from
https://raw.githubusercontent.com/archlinux/svntogit-community/packages/julia/trunk/julia-libgit-1.2.patch

diff --git a/stdlib/LibGit2/src/types.jl b/stdlib/LibGit2/src/types.jl
index 9ffcaa3646..5f571e7b26 100644
--- a/stdlib/LibGit2/src/types.jl
+++ b/stdlib/LibGit2/src/types.jl
@@ -230,6 +230,9 @@ Matches the [`git_remote_callbacks`](https://libgit2.org/libgit2/#HEAD/type/git_
push_update_reference::Ptr{Cvoid} = C_NULL
push_negotiation::Ptr{Cvoid} = C_NULL
transport::Ptr{Cvoid} = C_NULL
+ @static if LibGit2.VERSION >= v"1.2.0"
+ remote_ready::Ptr{Cvoid} = C_NULL
+ end
payload::Any = nothing
@static if LibGit2.VERSION >= v"0.99.0"
resolve_url::Ptr{Cvoid} = C_NULL
172 changes: 172 additions & 0 deletions dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
This patch is from the julialang repository:
https://github.com/JuliaLang/julia/commit/677ce6d3.patch
but reference comes form ARCH Linux juia package
https://github.com/archlinux/svntogit-community/tree/packages/julia/trunk

From 677ce6d3adc2f70886f72795b0e5c739e75730ee Mon Sep 17 00:00:00 2001
From: Valentin Churavy <[email protected]>
Date: Sat, 28 Aug 2021 16:48:32 +0200
Subject: [PATCH] [LLVM] Adapt to LLVM 13 changes

---
src/cgutils.cpp | 8 +++++++-
src/codegen.cpp | 2 +-
src/disasm.cpp | 8 ++++++++
src/jitlayers.cpp | 7 +++++++
src/llvm-late-gc-lowering.cpp | 5 +++--
src/llvm-multiversioning.cpp | 5 +++++
src/llvm-remove-addrspaces.cpp | 8 ++++++++
7 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/src/cgutils.cpp b/src/cgutils.cpp
index 4e9917b6b078..928e1a07b2f1 100644
--- a/src/cgutils.cpp
+++ b/src/cgutils.cpp
@@ -2757,8 +2757,14 @@ static jl_value_t *static_constant_instance(Constant *constant, jl_value_t *jt)
size_t nargs;
if (const auto *CC = dyn_cast<ConstantAggregate>(constant))
nargs = CC->getNumOperands();
- else if (const auto *CAZ = dyn_cast<ConstantAggregateZero>(constant))
+ else if (const auto *CAZ = dyn_cast<ConstantAggregateZero>(constant)) {
+#if JL_LLVM_VERSION >= 130000
+ // SVE: Elsewhere we use `getMinKownValue`
+ nargs = CAZ->getElementCount().getFixedValue();
+#else
nargs = CAZ->getNumElements();
+#endif
+ }
else if (const auto *CDS = dyn_cast<ConstantDataSequential>(constant))
nargs = CDS->getNumElements();
else
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 5cc9f66ffaef..9000513151fe 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -7394,7 +7394,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
#endif
continue;
}
- assert(find(pred_begin(PhiBB), pred_end(PhiBB), FromBB) != pred_end(PhiBB)); // consistency check
+ assert(std::find(pred_begin(PhiBB), pred_end(PhiBB), FromBB) != pred_end(PhiBB)); // consistency check
TerminatorInst *terminator = FromBB->getTerminator();
if (!terminator->getParent()->getUniqueSuccessor()) {
// Can't use `llvm::SplitCriticalEdge` here because
diff --git a/src/disasm.cpp b/src/disasm.cpp
index 6157873ad71c..589f618396ea 100644
--- a/src/disasm.cpp
+++ b/src/disasm.cpp
@@ -857,8 +857,16 @@ static void jl_dump_asm_internal(
assert(MRI && "Unable to create target register info!");

std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
+#if JL_LLVM_VERSION >= 130000
+ MCSubtargetInfo *MSTI = TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features);
+ assert(MSTI && "Unable to create subtarget info!");
+
+ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), MSTI, &SrcMgr);
+ MOFI->initMCObjectFileInfo(Ctx, /* PIC */ false, /* LargeCodeModel */ false);
+#else
MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr);
MOFI->InitMCObjectFileInfo(TheTriple, /* PIC */ false, Ctx);
+#endif

// Set up Subtarget and Disassembler
std::unique_ptr<MCSubtargetInfo>
diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp
index 60b1903aaa80..12497cadf491 100644
--- a/src/jitlayers.cpp
+++ b/src/jitlayers.cpp
@@ -10,6 +10,9 @@
#include <llvm/Analysis/TargetTransformInfo.h>
#include <llvm/ExecutionEngine/Orc/CompileUtils.h>
#include <llvm/ExecutionEngine/Orc/ExecutionUtils.h>
+#if JL_LLVM_VERSION >= 130000
+#include <llvm/ExecutionEngine/Orc/ExecutorProcessControl.h>
+#endif
#include <llvm/Support/DynamicLibrary.h>
#include <llvm/Support/FormattedStream.h>
#include <llvm/Support/SmallVectorMemoryBuffer.h>
@@ -654,7 +657,11 @@ JuliaOJIT::JuliaOJIT(TargetMachine &TM, LLVMContext *LLVMCtx)
MemMgr(createRTDyldMemoryManager()),
JuliaListener(CreateJuliaJITEventListener()),
TSCtx(std::unique_ptr<LLVMContext>(LLVMCtx)),
+#if JL_LLVM_VERSION >= 130000
+ ES(cantFail(orc::SelfExecutorProcessControl::Create())),
+#else
ES(),
+#endif
GlobalJD(ES.createBareJITDylib("JuliaGlobals")),
JD(ES.createBareJITDylib("JuliaOJIT")),
ObjectLayer(
diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
index 0aac7638be0d..db8b19bacea5 100644
--- a/src/llvm-late-gc-lowering.cpp
+++ b/src/llvm-late-gc-lowering.cpp
@@ -709,7 +709,7 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
else
Numbers[i] = Number;
}
- if (auto VTy = dyn_cast<VectorType>(SI->getType())) {
+ if (auto VTy = dyn_cast<FixedVectorType>(SI->getType())) {
if (NumRoots != Numbers.size()) {
// broadcast the scalar root number to fill the vector
assert(NumRoots == 1);
@@ -736,11 +736,12 @@ void LateLowerGCFrame::LiftPhi(State &S, PHINode *Phi) {
SmallVector<PHINode *, 2> lifted;
std::vector<int> Numbers;
unsigned NumRoots = 1;
- if (auto VTy = dyn_cast<VectorType>(Phi->getType())) {
+ if (auto VTy = dyn_cast<FixedVectorType>(Phi->getType())) {
NumRoots = VTy->getNumElements();
Numbers.resize(NumRoots);
}
else {
+ // TODO: SVE
assert(isa<PointerType>(Phi->getType()) && "unimplemented");
}
for (unsigned i = 0; i < NumRoots; ++i) {
diff --git a/src/llvm-multiversioning.cpp b/src/llvm-multiversioning.cpp
index 68081eb53d3a..a82600162fa9 100644
--- a/src/llvm-multiversioning.cpp
+++ b/src/llvm-multiversioning.cpp
@@ -403,7 +403,12 @@ void CloneCtx::clone_function(Function *F, Function *new_f, ValueToValueMapTy &v
vmap[&*J] = &*DestI++;
}
SmallVector<ReturnInst*,8> Returns;
+#if JL_LLVM_VERSION >= 130000
+ // We are cloning into the same module
+ CloneFunctionInto(new_f, F, vmap, CloneFunctionChangeType::GlobalChanges, Returns);
+#else
CloneFunctionInto(new_f, F, vmap, true, Returns);
+#endif
}

// Clone all clone_all targets. Makes sure that the base targets are all available.
diff --git a/src/llvm-remove-addrspaces.cpp b/src/llvm-remove-addrspaces.cpp
index ada10c8d5f1f..7c6ef093fbce 100644
--- a/src/llvm-remove-addrspaces.cpp
+++ b/src/llvm-remove-addrspaces.cpp
@@ -345,7 +345,11 @@ bool RemoveAddrspacesPass::runOnModule(Module &M)
for (auto MD : MDs)
NGV->addMetadata(
MD.first,
+#if JL_LLVM_VERSION >= 130000
+ *MapMetadata(MD.second, VMap));
+#else
*MapMetadata(MD.second, VMap, RF_MoveDistinctMDs));
+#endif

copyComdat(NGV, GV);

@@ -372,7 +376,11 @@ bool RemoveAddrspacesPass::runOnModule(Module &M)
NF,
F,
VMap,
+#if JL_LLVM_VERSION >= 130000
+ CloneFunctionChangeType::GlobalChanges,
+#else
/*ModuleLevelChanges=*/true,
+#endif
Returns,
"",
nullptr,
80 changes: 80 additions & 0 deletions dev-lang/julia/files/julia-1.7.0-llvm_13_compat_part_2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
This patch is from julialang repository:
https://github.com/JuliaLang/julia/commit/47f9139e.patch
but reference comes form ARCH Linux juia package
https://github.com/archlinux/svntogit-community/tree/packages/julia/trunk

From 47f9139e88917813cb7beee5e690c48c2ac65de4 Mon Sep 17 00:00:00 2001
From: Xuanda Yang <[email protected]>
Date: Wed, 9 Jun 2021 22:35:14 +0800
Subject: [PATCH] codegen: replace deprecated llvm::VectorType::getNumElements
with new APIs (#41144)

---
src/llvm-late-gc-lowering.cpp | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
index 50015045151b..4df303462d96 100644
--- a/src/llvm-late-gc-lowering.cpp
+++ b/src/llvm-late-gc-lowering.cpp
@@ -396,8 +396,14 @@ CountTrackedPointers::CountTrackedPointers(Type *T) {
}
if (isa<ArrayType>(T))
count *= cast<ArrayType>(T)->getNumElements();
- else if (isa<VectorType>(T))
+ else if (isa<VectorType>(T)) {
+#if JL_LLVM_VERSION >= 120000
+ ElementCount EC = cast<VectorType>(T)->getElementCount();
+ count *= EC.getKnownMinValue();
+#else
count *= cast<VectorType>(T)->getNumElements();
+#endif
+ }
}
if (count == 0)
all = false;
@@ -408,8 +414,14 @@ unsigned getCompositeNumElements(Type *T) {
return ST->getNumElements();
else if (auto *AT = dyn_cast<ArrayType>(T))
return AT->getNumElements();
- else
+ else {
+#if JL_LLVM_VERSION >= 120000
+ ElementCount EC = cast<VectorType>(T)->getElementCount();
+ return EC.getKnownMinValue();
+#else
return cast<VectorType>(T)->getNumElements();
+#endif
+ }
}

// Walk through a Type, and record the element path to every tracked value inside
@@ -625,8 +637,14 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
}
std::vector<int> Numbers;
unsigned NumRoots = 1;
- if (auto VTy = dyn_cast<VectorType>(SI->getType()))
+ if (auto VTy = dyn_cast<VectorType>(SI->getType())) {
+#if JL_LLVM_VERSION >= 120000
+ ElementCount EC = VTy->getElementCount();
+ Numbers.resize(EC.getKnownMinValue(), -1);
+#else
Numbers.resize(VTy->getNumElements(), -1);
+#endif
+ }
else
assert(isa<PointerType>(SI->getType()) && "unimplemented");
assert(!isTrackedValue(SI));
@@ -686,7 +704,12 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
assert(NumRoots == 1);
int Number = Numbers[0];
Numbers.resize(0);
+#if JL_LLVM_VERSION >= 120000
+ ElementCount EC = VTy->getElementCount();
+ Numbers.resize(EC.getKnownMinValue(), Number);
+#else
Numbers.resize(VTy->getNumElements(), Number);
+#endif
}
}
if (!isa<PointerType>(SI->getType()))
Loading

0 comments on commit a7d6cd1

Please sign in to comment.