SHA256
1
0
forked from pool/julia

Accepting request 1132207 from home:uncomfyhalomacro:branches:science

- Remove debug package. It's not created. Still we won't strip
  debug symbols from julia as it will cause issues.
- Declare that it conflicts with juliaup.
- Update tagged release banner message that says it is an unofficial experimental build
- Add mbedtls-hardcoded-libs.patch
- Update description
- Add llvm-link-shared.patch
- Add openlibm.patch
- Add libblastrampoline-hardcoded-libs.patch 
- Add use-system-libuv-correctly.patch
- Use sed to replace julia-hardcoded-libs.patch
- Add patch julia-suitesparse-7.patch
- Update julia-env-script-interpreter.patch
- Add new patches
  * 21d4c2f1.patch
  * 959902f1.patch
  * e08e1444.patch
  * f11bfc6c.patch
  * julia-hardcoded-libs.patch
  * julia-libgit2-1.7.patch
  * julia-libunwind-1.9.patch
- Update to julia version 1.9.4
  ** CHANGELOG TOO HUGE SINCE 1.6.3 **
  See https://github.com/JuliaLang/julia/compare/v1.6.3...v1.9.4
- Remove a lot of old patches
  * julia-fix_doc_build.patch
  * julia-fix-mbedtls-build-failure-gcc-11.patch
  * julia-fix-task-build-failure-gcc-11.patch

OBS-URL: https://build.opensuse.org/request/show/1132207
OBS-URL: https://build.opensuse.org/package/show/science/julia?expand=0&rev=114
This commit is contained in:
Soc Virnyl Estela 2023-12-09 08:02:57 +00:00 committed by Git OBS Bridge
parent bd3f4624e7
commit e15cadffe0
23 changed files with 1522 additions and 528 deletions

411
21d4c2f1.patch Normal file
View File

@ -0,0 +1,411 @@
From 921f1b9d5e9389756826898d6907c0a2829efa51 Mon Sep 17 00:00:00 2001
From: Prem Chintalapudi <prem.chintalapudi@gmail.com>
Date: Wed, 10 May 2023 09:58:04 -0400
Subject: [PATCH 1/7] Fix remarks emissions from simdloop pass
Co-authored-by: Valentin Churavy <v.churavy@gmail.com>
---
src/llvm-simdloop.cpp | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/llvm-simdloop.cpp b/src/llvm-simdloop.cpp
index 3c94b226ad7b8..233f61c9fea6b 100644
--- a/src/llvm-simdloop.cpp
+++ b/src/llvm-simdloop.cpp
@@ -165,11 +165,13 @@ static bool markLoopInfo(Module &M, Function *marker, function_ref<LoopInfo &(Fu
Instruction *I = cast<Instruction>(U);
ToDelete.push_back(I);
- LoopInfo &LI = GetLI(*I->getParent()->getParent());
- Loop *L = LI.getLoopFor(I->getParent());
- I->removeFromParent();
- if (!L)
+ BasicBlock *B = I->getParent();
+ LoopInfo &LI = GetLI(*B->getParent());
+ Loop *L = LI.getLoopFor(B);
+ if (!L) {
+ I->removeFromParent();
continue;
+ }
LLVM_DEBUG(dbgs() << "LSL: loopinfo marker found\n");
bool simd = false;
@@ -258,6 +260,8 @@ static bool markLoopInfo(Module &M, Function *marker, function_ref<LoopInfo &(Fu
}
}
+ I->removeFromParent();
+
Changed = true;
}
From b2273d39542fe803f7d9da03ef57af7e815db68c Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy@gmail.com>
Date: Sun, 30 Apr 2023 20:19:08 -0400
Subject: [PATCH 3/7] Do not yet mandate opaque pointers for LLVM 15
---
src/codegen.cpp | 11 +++++++++++
src/jitlayers.cpp | 3 ---
src/llvm-version.h | 2 +-
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/codegen.cpp b/src/codegen.cpp
index a9d2cb0c60333..2e3f7eb2bf7bb 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -9083,6 +9083,17 @@ extern "C" void jl_init_llvm(void)
if (clopt && clopt->getNumOccurrences() == 0)
cl::ProvidePositionalOption(clopt, "4", 1);
+#if JL_LLVM_VERSION >= 150000
+ clopt = llvmopts.lookup("opaque-pointers");
+ if (clopt && clopt->getNumOccurrences() == 0) {
+#ifdef JL_LLVM_OPAQUE_POINTERS
+ cl::ProvidePositionalOption(clopt, "true", 1);
+#else
+ cl::ProvidePositionalOption(clopt, "false", 1);
+#endif
+ }
+#endif
+
jl_ExecutionEngine = new JuliaOJIT();
bool jl_using_gdb_jitevents = false;
diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp
index 643f0468457ae..ef7e98bb7852a 100644
--- a/src/jitlayers.cpp
+++ b/src/jitlayers.cpp
@@ -1306,9 +1306,6 @@ JuliaOJIT::JuliaOJIT()
JD(ES.createBareJITDylib("JuliaOJIT")),
ContextPool([](){
auto ctx = std::make_unique<LLVMContext>();
-#ifdef JL_LLVM_OPAQUE_POINTERS
- ctx->setOpaquePointers(true);
-#endif
return orc::ThreadSafeContext(std::move(ctx));
}),
#ifdef JL_USE_JITLINK
diff --git a/src/llvm-version.h b/src/llvm-version.h
index a3f3774b6dc15..819ec1c88976b 100644
--- a/src/llvm-version.h
+++ b/src/llvm-version.h
@@ -14,7 +14,7 @@
#error Only LLVM versions >= 12.0.0 are supported by Julia
#endif
-#if JL_LLVM_VERSION >= 150000
+#if JL_LLVM_VERSION >= 160000
#define JL_LLVM_OPAQUE_POINTERS 1
#endif
From 190f84180883eb498cb7b7ed27e10af9a6c62863 Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy@gmail.com>
Date: Wed, 26 Apr 2023 20:48:45 -0400
Subject: [PATCH 4/7] Upgrade Julia to LLVM 15.0.7+5
Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com>
---
Make.inc | 2 +-
deps/checksums/clang | 224 ++++++++--------
deps/checksums/lld | 224 ++++++++--------
deps/checksums/llvm | 452 +++++++++++++++-----------------
deps/clang.version | 2 +-
deps/lld.version | 2 +-
deps/llvm-tools.version | 4 +-
deps/llvm.version | 9 +-
stdlib/LLD_jll/Project.toml | 4 +-
stdlib/libLLVM_jll/Project.toml | 2 +-
10 files changed, 446 insertions(+), 479 deletions(-)
diff --git a/Make.inc b/Make.inc
index 4d564f057a3da..35b0657de5aa2 100644
--- a/Make.inc
+++ b/Make.inc
@@ -480,7 +480,7 @@ FC := $(CROSS_COMPILE)gfortran
ifeq ($(OS), Darwin)
APPLE_ARCH := $(shell uname -m)
ifneq ($(APPLE_ARCH),arm64)
-MACOSX_VERSION_MIN := 10.10
+MACOSX_VERSION_MIN := 10.14
else
MACOSX_VERSION_MIN := 11.0
endif
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 2e3f7eb2bf7bb..07e7b15afc165 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -9169,7 +9169,9 @@ extern "C" JL_DLLEXPORT void jl_init_codegen_impl(void)
extern "C" JL_DLLEXPORT void jl_teardown_codegen_impl() JL_NOTSAFEPOINT
{
// output LLVM timings and statistics
- jl_ExecutionEngine->printTimers();
+ // Guard against exits before we have initialized the ExecutionEngine
+ if (jl_ExecutionEngine)
+ jl_ExecutionEngine->printTimers();
PrintStatistics();
}
diff --git a/src/jitlayers.h b/src/jitlayers.h
index bbbcbe73f1e54..4c6921cd42dab 100644
--- a/src/jitlayers.h
+++ b/src/jitlayers.h
@@ -97,10 +97,8 @@ struct OptimizationOptions {
};
// LLVM's new pass manager is scheduled to replace the legacy pass manager
-// for middle-end IR optimizations. However, we have not qualified the new
-// pass manager on our optimization pipeline yet, so this remains an optional
-// define
-#if defined(HAS_SANITIZER) && JL_LLVM_VERSION >= 150000
+// for middle-end IR optimizations.
+#if JL_LLVM_VERSION >= 150000
#define JL_USE_NEW_PM
#endif
diff --git a/src/pipeline.cpp b/src/pipeline.cpp
index 4403653a9d8e4..7e61171d288e6 100644
--- a/src/pipeline.cpp
+++ b/src/pipeline.cpp
@@ -361,7 +361,8 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
{
FunctionPassManager FPM;
FPM.addPass(SROAPass());
- FPM.addPass(InstSimplifyPass());
+ // SROA can duplicate PHI nodes which can block LowerSIMD
+ FPM.addPass(InstCombinePass());
FPM.addPass(JumpThreadingPass());
FPM.addPass(CorrelatedValuePropagationPass());
FPM.addPass(ReassociatePass());
@@ -384,7 +385,7 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
#endif
LPM2.addPass(LICMPass(LICMOptions()));
JULIA_PASS(LPM2.addPass(JuliaLICMPass()));
- LPM2.addPass(SimpleLoopUnswitchPass(true, true));
+ LPM2.addPass(SimpleLoopUnswitchPass(false, true));
LPM2.addPass(LICMPass(LICMOptions()));
JULIA_PASS(LPM2.addPass(JuliaLICMPass()));
//LICM needs MemorySSA now, so we must use it
@@ -397,11 +398,11 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
LPM.addPass(LoopIdiomRecognizePass());
LPM.addPass(IndVarSimplifyPass());
LPM.addPass(LoopDeletionPass());
+ LPM.addPass(LoopFullUnrollPass());
invokeLoopOptimizerEndCallbacks(LPM, PB, O);
//We don't know if the loop end callbacks support MSSA
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM), /*UseMemorySSA = */false));
}
- FPM.addPass(LoopUnrollPass(LoopUnrollOptions().setRuntime(false)));
JULIA_PASS(FPM.addPass(AllocOptPass()));
FPM.addPass(SROAPass());
FPM.addPass(InstSimplifyPass());
From 2ddbb5abb93045eeb4513e223c86e9c25fa774a4 Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy@gmail.com>
Date: Wed, 26 Apr 2023 20:49:16 -0400
Subject: [PATCH 6/7] Fix tests and static analyzer for LLVM 15
Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com>
Co-authored-by: Prem Chintalapudi <prem.chintalapudi@gmail.com>
---
src/llvm-alloc-opt.cpp | 3 ++
src/llvm-late-gc-lowering.cpp | 1 +
src/llvm-lower-handlers.cpp | 1 +
src/llvm-multiversioning.cpp | 3 ++
src/llvm-ptls.cpp | 2 +
test/clangsa/MissingRoots.c | 3 ++
test/cmdlineargs.jl | 10 ++--
test/llvmpasses/pipeline-o2-broadcast.jl | 68 ++++++++++++++----------
test/llvmpasses/pipeline-o2.jl | 6 +--
9 files changed, 62 insertions(+), 35 deletions(-)
diff --git a/src/llvm-alloc-opt.cpp b/src/llvm-alloc-opt.cpp
index 1a524cbe8d419..bb6de67f347ff 100644
--- a/src/llvm-alloc-opt.cpp
+++ b/src/llvm-alloc-opt.cpp
@@ -1138,9 +1138,12 @@ void Optimizer::splitOnStack(CallInst *orig_inst)
ref->setOrdering(AtomicOrdering::NotAtomic);
operands.push_back(ref);
}
+#ifndef __clang_analyzer__
+ // FIXME: SA finds "Called C++ object pointer is null" inside the LLVM code.
auto new_call = builder.CreateCall(pass.gc_preserve_begin_func, operands);
new_call->takeName(call);
call->replaceAllUsesWith(new_call);
+#endif
call->eraseFromParent();
return;
}
diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp
index a836ff1361768..ac70685e7431b 100644
--- a/src/llvm-late-gc-lowering.cpp
+++ b/src/llvm-late-gc-lowering.cpp
@@ -1262,6 +1262,7 @@ static bool isLoadFromConstGV(LoadInst *LI, bool &task_local, PhiSet *seen)
// We only emit single slot GV in codegen
// but LLVM global merging can change the pointer operands to GEPs/bitcasts
auto load_base = LI->getPointerOperand()->stripInBoundsOffsets();
+ assert(load_base); // Static analyzer
auto gv = dyn_cast<GlobalVariable>(load_base);
if (isTBAA(LI->getMetadata(LLVMContext::MD_tbaa),
{"jtbaa_immut", "jtbaa_const", "jtbaa_datatype"})) {
diff --git a/src/llvm-lower-handlers.cpp b/src/llvm-lower-handlers.cpp
index 919128769019b..39a36bfc3ba76 100644
--- a/src/llvm-lower-handlers.cpp
+++ b/src/llvm-lower-handlers.cpp
@@ -8,6 +8,7 @@
#include <llvm/ADT/DepthFirstIterator.h>
#include <llvm/ADT/Statistic.h>
+#include <llvm/ADT/Triple.h>
#include <llvm/Analysis/CFG.h>
#include <llvm/IR/BasicBlock.h>
#include <llvm/IR/Constants.h>
diff --git a/src/llvm-multiversioning.cpp b/src/llvm-multiversioning.cpp
index 21a090724802a..cdba03047a4b7 100644
--- a/src/llvm-multiversioning.cpp
+++ b/src/llvm-multiversioning.cpp
@@ -14,11 +14,13 @@
#include <llvm/Pass.h>
#include <llvm/ADT/BitVector.h>
#include <llvm/ADT/Statistic.h>
+#include <llvm/ADT/Triple.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/Constants.h>
+#include <llvm/IR/Dominators.h>
#include <llvm/IR/LLVMContext.h>
#include <llvm/Analysis/LoopInfo.h>
#include <llvm/Analysis/CallGraph.h>
@@ -779,6 +781,7 @@ static Value *rewrite_inst_use(const Stack& stack, Type *T_size, Value *replace,
replace = inst;
continue;
}
+ assert(val);
unsigned nargs = val->getNumOperands();
args.resize(nargs);
for (unsigned j = 0; j < nargs; j++) {
diff --git a/src/llvm-ptls.cpp b/src/llvm-ptls.cpp
index 8174832b3cebf..a628710916327 100644
--- a/src/llvm-ptls.cpp
+++ b/src/llvm-ptls.cpp
@@ -9,6 +9,7 @@
#include <llvm-c/Types.h>
#include <llvm/Pass.h>
+#include <llvm/ADT/Triple.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/IR/Function.h>
@@ -161,6 +162,7 @@ void LowerPTLS::fix_pgcstack_use(CallInst *pgcstack, Function *pgcstack_getter,
SmallVector<uint32_t, 2> Weights{9, 1};
TerminatorInst *fastTerm;
TerminatorInst *slowTerm;
+ assert(pgcstack->getType()); // Static analyzer
auto cmp = new ICmpInst(phi, CmpInst::ICMP_NE, pgcstack, Constant::getNullValue(pgcstack->getType()));
SplitBlockAndInsertIfThenElse(cmp, phi, &fastTerm, &slowTerm,
MDB.createBranchWeights(Weights));
diff --git a/test/clangsa/MissingRoots.c b/test/clangsa/MissingRoots.c
index f0b32c54bc7b8..0ff5e633622ce 100644
--- a/test/clangsa/MissingRoots.c
+++ b/test/clangsa/MissingRoots.c
@@ -352,6 +352,9 @@ void assoc_exact_broken(jl_value_t **args, size_t n, int8_t offs, size_t world)
}
*/
+// declare
+jl_typemap_level_t *jl_new_typemap_level(void);
+
void assoc_exact_ok(jl_value_t *args1, jl_value_t **args, size_t n, int8_t offs, size_t world) {
jl_typemap_level_t *cache = jl_new_typemap_level();
JL_GC_PUSH1(&cache);
diff --git a/test/cmdlineargs.jl b/test/cmdlineargs.jl
index 389b195d97935..1d04926ef23af 100644
--- a/test/cmdlineargs.jl
+++ b/test/cmdlineargs.jl
@@ -188,10 +188,12 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
@test contains(v[2], r"enable-tail-merge + = 1")
@test isempty(v[3])
end
- @testset let v = readchomperrors(setenv(`$exename -e 0`, "JULIA_LLVM_ARGS" => "-print-options -enable-tail-merge=1 -enable-tail-merge=1", "HOME" => homedir()))
- @test !v[1]
- @test isempty(v[2])
- @test v[3] == "julia: for the --enable-tail-merge option: may only occur zero or one times!"
+ if Base.libllvm_version < v"15" #LLVM over 15 doesn't care for multiple options
+ @testset let v = readchomperrors(setenv(`$exename -e 0`, "JULIA_LLVM_ARGS" => "-print-options -enable-tail-merge=1 -enable-tail-merge=1", "HOME" => homedir()))
+ @test !v[1]
+ @test isempty(v[2])
+ @test v[3] == "julia: for the --enable-tail-merge option: may only occur zero or one times!"
+ end
end
end
diff --git a/test/llvmpasses/pipeline-o2.jl b/test/llvmpasses/pipeline-o2.jl
index 2996a44de62b3..fcb2161de7614 100644
--- a/test/llvmpasses/pipeline-o2.jl
+++ b/test/llvmpasses/pipeline-o2.jl
@@ -78,21 +78,21 @@ end
# COM: memset checks
# COM: INT64
-# ALL-LABEL: define nonnull {} addrspace(10)* @julia_zeros
+# ALL: define {{.*}} @julia_zeros
# ALL-NOT: bounds_error
# COM: memset is not used with bounds checks on (too late in the pipeline)
# BC_OFF: llvm.memset
# BC_AUTO: llvm.memset
# COM: INT32
-# ALL-LABEL: define nonnull {} addrspace(10)* @julia_zeros
+# ALL: define {{.*}} @julia_zeros
# ALL-NOT: bounds_error
# COM: memset is not used with bounds checks on (too late in the pipeline)
# BC_OFF: llvm.memset
# BC_AUTO: llvm.memset
# COM: INT16
-# ALL-LABEL: define nonnull {} addrspace(10)* @julia_zeros
+# ALL: define {{.*}} @julia_zeros
# ALL-NOT: bounds_error
# COM: memset is not used with bounds checks on (too late in the pipeline)
# BC_OFF: llvm.memset
From 77c13ad59364189386114b546a7482dbe2edf233 Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy@gmail.com>
Date: Wed, 10 May 2023 10:51:16 -0400
Subject: [PATCH 7/7] Reenable NonTrivial Loop Unswitch
---
src/codegen.cpp | 3 ---
src/pipeline.cpp | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 07e7b15afc165..ae306d3d1cdb5 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -9073,9 +9073,6 @@ extern "C" void jl_init_llvm(void)
clopt = llvmopts.lookup("unswitch-threshold");
if (clopt->getNumOccurrences() == 0)
cl::ProvidePositionalOption(clopt, "100", 1);
- clopt = llvmopts.lookup("enable-unswitch-cost-multiplier");
- if (clopt->getNumOccurrences() == 0)
- cl::ProvidePositionalOption(clopt, "false", 1);
#endif
// if the patch adding this option has been applied, lower its limit to provide
// better DAGCombiner performance.
diff --git a/src/pipeline.cpp b/src/pipeline.cpp
index 7e61171d288e6..6e6a9a3c37d02 100644
--- a/src/pipeline.cpp
+++ b/src/pipeline.cpp
@@ -385,7 +385,7 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
#endif
LPM2.addPass(LICMPass(LICMOptions()));
JULIA_PASS(LPM2.addPass(JuliaLICMPass()));
- LPM2.addPass(SimpleLoopUnswitchPass(false, true));
+ LPM2.addPass(SimpleLoopUnswitchPass(/*NonTrivial*/true, true));
LPM2.addPass(LICMPass(LICMOptions()));
JULIA_PASS(LPM2.addPass(JuliaLICMPass()));
//LICM needs MemorySSA now, so we must use it

188
959902f1.patch Normal file
View File

@ -0,0 +1,188 @@
From 959902f1c6099c1b513e29103b998545c16731fc Mon Sep 17 00:00:00 2001
From: Valentin Churavy <vchuravy@users.noreply.github.com>
Date: Thu, 27 Apr 2023 16:27:09 -0400
Subject: [PATCH] Support both Float16 ABIs depending on LLVM and platform
(#49527)
There are two Float16 ABIs in the wild, one for platforms that have a
defing register and the original one where we used i16.
LLVM 15 follows GCC and uses the new ABI on x86/ARM but not PPC.
Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com>
---
src/aotcompile.cpp | 11 +++++++--
src/codegen.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++
src/jitlayers.cpp | 2 ++
src/llvm-version.h | 10 +++++++++
4 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
index 391c5d3df46fb..2a14e2a4fa0ab 100644
--- a/src/aotcompile.cpp
+++ b/src/aotcompile.cpp
@@ -494,6 +494,7 @@ static void reportWriterError(const ErrorInfoBase &E)
jl_safe_printf("ERROR: failed to emit output file %s\n", err.c_str());
}
+#if JULIA_FLOAT16_ABI == 1
static void injectCRTAlias(Module &M, StringRef name, StringRef alias, FunctionType *FT)
{
Function *target = M.getFunction(alias);
@@ -510,7 +511,8 @@ static void injectCRTAlias(Module &M, StringRef name, StringRef alias, FunctionT
auto val = builder.CreateCall(target, CallArgs);
builder.CreateRet(val);
}
-
+#endif
+void emitFloat16Wrappers(Module &M, bool external);
// takes the running content that has collected in the shadow module and dump it to disk
// this builds the object file portion of the sysimage files for fast startup
@@ -1003,6 +1006,7 @@ static void add_output_impl(Module &M, TargetMachine &SourceTM, std::string *out
}
if (inject_crt) {
+#if JULIA_FLOAT16_ABI == 1
// We would like to emit an alias or an weakref alias to redirect these symbols
// but LLVM doesn't let us emit a GlobalAlias to a declaration...
// So for now we inject a definition of these functions that calls our runtime
@@ -1018,6 +1023,9 @@ static void add_output_impl(Module &M, TargetMachine &SourceTM, std::string *out
FunctionType::get(Type::getHalfTy(Context), { Type::getFloatTy(Context) }, false));
injectCRTAlias(M, "__truncdfhf2", "julia__truncdfhf2",
FunctionType::get(Type::getHalfTy(Context), { Type::getDoubleTy(Context) }, false));
+#else
+ emitFloat16Wrappers(M, false);
+#endif
#if defined(_OS_WINDOWS_)
// Windows expect that the function `_DllMainStartup` is present in an dll.
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 329c4b452a9dc..f4b0fd518cd39 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -5818,6 +5818,7 @@ static void emit_cfunc_invalidate(
prepare_call_in(gf_thunk->getParent(), jlapplygeneric_func));
}
+#include <iostream>
static Function* gen_cfun_wrapper(
Module *into, jl_codegen_params_t &params,
const function_sig_t &sig, jl_value_t *ff, const char *aliasname,
@@ -8704,6 +8705,58 @@ static JuliaVariable *julia_const_gv(jl_value_t *val)
return nullptr;
}
+// Handle FLOAT16 ABI v2
+#if JULIA_FLOAT16_ABI == 2
+static void makeCastCall(Module &M, StringRef wrapperName, StringRef calledName, FunctionType *FTwrapper, FunctionType *FTcalled, bool external)
+{
+ Function *calledFun = M.getFunction(calledName);
+ if (!calledFun) {
+ calledFun = Function::Create(FTcalled, Function::ExternalLinkage, calledName, M);
+ }
+ auto linkage = external ? Function::ExternalLinkage : Function::InternalLinkage;
+ auto wrapperFun = Function::Create(FTwrapper, linkage, wrapperName, M);
+ wrapperFun->addFnAttr(Attribute::AlwaysInline);
+ llvm::IRBuilder<> builder(BasicBlock::Create(M.getContext(), "top", wrapperFun));
+ SmallVector<Value *, 4> CallArgs;
+ if (wrapperFun->arg_size() != calledFun->arg_size()){
+ llvm::errs() << "FATAL ERROR: Can't match wrapper to called function";
+ abort();
+ }
+ for (auto wrapperArg = wrapperFun->arg_begin(), calledArg = calledFun->arg_begin();
+ wrapperArg != wrapperFun->arg_end() && calledArg != calledFun->arg_end(); ++wrapperArg, ++calledArg)
+ {
+ CallArgs.push_back(builder.CreateBitCast(wrapperArg, calledArg->getType()));
+ }
+ auto val = builder.CreateCall(calledFun, CallArgs);
+ auto retval = builder.CreateBitCast(val,wrapperFun->getReturnType());
+ builder.CreateRet(retval);
+}
+
+void emitFloat16Wrappers(Module &M, bool external)
+{
+ auto &ctx = M.getContext();
+ makeCastCall(M, "__gnu_h2f_ieee", "julia__gnu_h2f_ieee", FunctionType::get(Type::getFloatTy(ctx), { Type::getHalfTy(ctx) }, false),
+ FunctionType::get(Type::getFloatTy(ctx), { Type::getInt16Ty(ctx) }, false), external);
+ makeCastCall(M, "__extendhfsf2", "julia__gnu_h2f_ieee", FunctionType::get(Type::getFloatTy(ctx), { Type::getHalfTy(ctx) }, false),
+ FunctionType::get(Type::getFloatTy(ctx), { Type::getInt16Ty(ctx) }, false), external);
+ makeCastCall(M, "__gnu_f2h_ieee", "julia__gnu_f2h_ieee", FunctionType::get(Type::getHalfTy(ctx), { Type::getFloatTy(ctx) }, false),
+ FunctionType::get(Type::getInt16Ty(ctx), { Type::getFloatTy(ctx) }, false), external);
+ makeCastCall(M, "__truncsfhf2", "julia__gnu_f2h_ieee", FunctionType::get(Type::getHalfTy(ctx), { Type::getFloatTy(ctx) }, false),
+ FunctionType::get(Type::getInt16Ty(ctx), { Type::getFloatTy(ctx) }, false), external);
+ makeCastCall(M, "__truncdfhf2", "julia__truncdfhf2", FunctionType::get(Type::getHalfTy(ctx), { Type::getDoubleTy(ctx) }, false),
+ FunctionType::get(Type::getInt16Ty(ctx), { Type::getDoubleTy(ctx) }, false), external);
+}
+
+static void init_f16_funcs(void)
+{
+ auto ctx = jl_ExecutionEngine->acquireContext();
+ auto TSM = jl_create_ts_module("F16Wrappers", ctx, imaging_default());
+ auto aliasM = TSM.getModuleUnlocked();
+ emitFloat16Wrappers(*aliasM, true);
+ jl_ExecutionEngine->addModule(std::move(TSM));
+}
+#endif
+
static void init_jit_functions(void)
{
add_named_global(jlstack_chk_guard_var, &__stack_chk_guard);
@@ -8942,6 +8995,9 @@ extern "C" JL_DLLEXPORT void jl_init_codegen_impl(void)
jl_init_llvm();
// Now that the execution engine exists, initialize all modules
init_jit_functions();
+#if JULIA_FLOAT16_ABI == 2
+ init_f16_funcs();
+#endif
}
extern "C" JL_DLLEXPORT void jl_teardown_codegen_impl() JL_NOTSAFEPOINT
diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp
index 37302e8ca2ace..b3ec102821858 100644
--- a/src/jitlayers.cpp
+++ b/src/jitlayers.cpp
@@ -1383,6 +1383,7 @@ JuliaOJIT::JuliaOJIT()
JD.addToLinkOrder(GlobalJD, orc::JITDylibLookupFlags::MatchExportedSymbolsOnly);
+#if JULIA_FLOAT16_ABI == 1
orc::SymbolAliasMap jl_crt = {
{ mangle("__gnu_h2f_ieee"), { mangle("julia__gnu_h2f_ieee"), JITSymbolFlags::Exported } },
{ mangle("__extendhfsf2"), { mangle("julia__gnu_h2f_ieee"), JITSymbolFlags::Exported } },
@@ -1391,6 +1392,7 @@ JuliaOJIT::JuliaOJIT()
{ mangle("__truncdfhf2"), { mangle("julia__truncdfhf2"), JITSymbolFlags::Exported } }
};
cantFail(GlobalJD.define(orc::symbolAliases(jl_crt)));
+#endif
#ifdef MSAN_EMUTLS_WORKAROUND
orc::SymbolMap msan_crt;
diff --git a/src/llvm-version.h b/src/llvm-version.h
index 4e15e787b7de8..a3f3774b6dc15 100644
--- a/src/llvm-version.h
+++ b/src/llvm-version.h
@@ -2,6 +2,7 @@
#include <llvm/Config/llvm-config.h>
#include "julia_assert.h"
+#include "platform.h"
// The LLVM version used, JL_LLVM_VERSION, is represented as a 5-digit integer
// of the form ABBCC, where A is the major version, B is minor, and C is patch.
@@ -17,6 +18,15 @@
#define JL_LLVM_OPAQUE_POINTERS 1
#endif
+// Pre GCC 12 libgcc defined the ABI for Float16->Float32
+// to take an i16. GCC 12 silently changed the ABI to now pass
+// Float16 in Float32 registers.
+#if JL_LLVM_VERSION < 150000 || defined(_CPU_PPC64_) || defined(_CPU_PPC_)
+#define JULIA_FLOAT16_ABI 1
+#else
+#define JULIA_FLOAT16_ABI 2
+#endif
+
#ifdef __cplusplus
#if defined(__GNUC__) && (__GNUC__ >= 9)
// Added in GCC 9, this warning is annoying

304
e08e1444.patch Normal file
View File

@ -0,0 +1,304 @@
From e08e14449fdec30d83ae2b9f0d6d1f4a9acf0b75 Mon Sep 17 00:00:00 2001
From: pchintalapudi <34727397+pchintalapudi@users.noreply.github.com>
Date: Mon, 17 Apr 2023 19:37:59 +0000
Subject: [PATCH] Bring in newpm (new pass manager) updates to master (#47038)
* Workaround missing ASAN global
* Add alias analysis at O2 instead of O3
* Disable runtime unrolling
* Make SimpleLoopUnswitch act like LoopUnswitch
* Add --time-passes support
* Only add verification passes in debug mode
* Hide assertion function
---
src/codegen.cpp | 11 ++++++++++-
src/jitlayers.cpp | 49 ++++++++++++++++++++++++++++++++++++-----------
src/jitlayers.h | 17 ++++++++++++----
src/pipeline.cpp | 27 ++++++++++++++------------
4 files changed, 76 insertions(+), 28 deletions(-)
diff --git a/src/codegen.cpp b/src/codegen.cpp
index b6b86ba4442e1..fb8cefe5eb44f 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -8838,6 +8838,15 @@ extern "C" void jl_init_llvm(void)
clopt = llvmopts.lookup("enable-tail-merge"); // NOO TOUCHIE; NO TOUCH! See #922
if (clopt->getNumOccurrences() == 0)
cl::ProvidePositionalOption(clopt, "0", 1);
+#ifdef JL_USE_NEW_PM
+ // For parity with LoopUnswitch
+ clopt = llvmopts.lookup("unswitch-threshold");
+ if (clopt->getNumOccurrences() == 0)
+ cl::ProvidePositionalOption(clopt, "100", 1);
+ clopt = llvmopts.lookup("enable-unswitch-cost-multiplier");
+ if (clopt->getNumOccurrences() == 0)
+ cl::ProvidePositionalOption(clopt, "false", 1);
+#endif
// if the patch adding this option has been applied, lower its limit to provide
// better DAGCombiner performance.
clopt = llvmopts.lookup("combiner-store-merge-dependence-limit");
@@ -8916,7 +8925,7 @@ extern "C" JL_DLLEXPORT void jl_init_codegen_impl(void)
extern "C" JL_DLLEXPORT void jl_teardown_codegen_impl() JL_NOTSAFEPOINT
{
// output LLVM timings and statistics
- reportAndResetTimings();
+ jl_ExecutionEngine->printTimers();
PrintStatistics();
}
diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp
index c7e202b98efab..29665d4e420b9 100644
--- a/src/jitlayers.cpp
+++ b/src/jitlayers.cpp
@@ -1103,6 +1103,8 @@ namespace {
std::unique_ptr<TargetMachine> TM;
int optlevel;
PMCreator(TargetMachine &TM, int optlevel) : TM(cantFail(createJTMBFromTM(TM, optlevel).createTargetMachine())), optlevel(optlevel) {}
+ // overload for newpm compatibility
+ PMCreator(TargetMachine &TM, int optlevel, std::vector<std::function<void()>> &) : PMCreator(TM, optlevel) {}
PMCreator(const PMCreator &other) : PMCreator(*other.TM, other.optlevel) {}
PMCreator(PMCreator &&other) : TM(std::move(other.TM)), optlevel(other.optlevel) {}
friend void swap(PMCreator &self, PMCreator &other) {
@@ -1128,16 +1131,21 @@ namespace {
struct PMCreator {
orc::JITTargetMachineBuilder JTMB;
OptimizationLevel O;
- PMCreator(TargetMachine &TM, int optlevel) : JTMB(createJTMBFromTM(TM, optlevel)), O(getOptLevel(optlevel)) {}
+ std::vector<std::function<void()>> &printers;
+ PMCreator(TargetMachine &TM, int optlevel, std::vector<std::function<void()>> &printers) JL_NOTSAFEPOINT : JTMB(createJTMBFromTM(TM, optlevel)), O(getOptLevel(optlevel)), printers(printers) {}
auto operator()() {
- return std::make_unique<NewPM>(cantFail(JTMB.createTargetMachine()), O);
+ auto NPM = std::make_unique<NewPM>(cantFail(JTMB.createTargetMachine()), O);
+ printers.push_back([NPM = NPM.get()]() JL_NOTSAFEPOINT {
+ NPM->printTimers();
+ });
+ return NPM;
}
};
#endif
struct OptimizerT {
- OptimizerT(TargetMachine &TM, int optlevel) : optlevel(optlevel), PMs(PMCreator(TM, optlevel)) {}
+ OptimizerT(TargetMachine &TM, int optlevel, std::vector<std::function<void()>> &printers) : optlevel(optlevel), PMs(PMCreator(TM, optlevel, printers)) {}
OptimizerResultT operator()(orc::ThreadSafeModule TSM, orc::MaterializationResponsibility &R) {
TSM.withModuleDo([&](Module &M) {
@@ -1247,10 +1255,14 @@ llvm::DataLayout jl_create_datalayout(TargetMachine &TM) {
return jl_data_layout;
}
-JuliaOJIT::PipelineT::PipelineT(orc::ObjectLayer &BaseLayer, TargetMachine &TM, int optlevel)
+JuliaOJIT::PipelineT::PipelineT(orc::ObjectLayer &BaseLayer, TargetMachine &TM, int optlevel, std::vector<std::function<void()>> &PrintLLVMTimers)
: CompileLayer(BaseLayer.getExecutionSession(), BaseLayer,
std::make_unique<CompilerT>(orc::irManglingOptionsFromTargetOptions(TM.Options), TM, optlevel)),
- OptimizeLayer(CompileLayer.getExecutionSession(), CompileLayer, OptimizerT(TM, optlevel)) {}
+ OptimizeLayer(CompileLayer.getExecutionSession(), CompileLayer, OptimizerT(TM, optlevel, PrintLLVMTimers)) {}
+
+#ifdef _COMPILER_ASAN_ENABLED_
+int64_t ___asan_globals_registered;
+#endif
JuliaOJIT::JuliaOJIT()
: TM(createTargetMachine()),
@@ -1285,10 +1297,10 @@ JuliaOJIT::JuliaOJIT()
),
#endif
Pipelines{
- std::make_unique<PipelineT>(ObjectLayer, *TM, 0),
- std::make_unique<PipelineT>(ObjectLayer, *TM, 1),
- std::make_unique<PipelineT>(ObjectLayer, *TM, 2),
- std::make_unique<PipelineT>(ObjectLayer, *TM, 3),
+ std::make_unique<PipelineT>(ObjectLayer, *TM, 0, PrintLLVMTimers),
+ std::make_unique<PipelineT>(ObjectLayer, *TM, 1, PrintLLVMTimers),
+ std::make_unique<PipelineT>(ObjectLayer, *TM, 2, PrintLLVMTimers),
+ std::make_unique<PipelineT>(ObjectLayer, *TM, 3, PrintLLVMTimers),
},
OptSelLayer(Pipelines)
{
@@ -1393,6 +1405,11 @@ JuliaOJIT::JuliaOJIT()
reinterpret_cast<void *>(static_cast<uintptr_t>(msan_workaround::MSanTLS::origin)), JITSymbolFlags::Exported);
cantFail(GlobalJD.define(orc::absoluteSymbols(msan_crt)));
#endif
+#ifdef _COMPILER_ASAN_ENABLED_
+ orc::SymbolMap asan_crt;
+ asan_crt[mangle("___asan_globals_registered")] = JITEvaluatedSymbol::fromPointer(&___asan_globals_registered, JITSymbolFlags::Exported);
+ cantFail(JD.define(orc::absoluteSymbols(asan_crt)));
+#endif
}
JuliaOJIT::~JuliaOJIT() = default;
@@ -1583,6 +1600,16 @@ size_t JuliaOJIT::getTotalBytes() const
}
#endif
+void JuliaOJIT::printTimers()
+{
+#ifdef JL_USE_NEW_PM
+ for (auto &printer : PrintLLVMTimers) {
+ printer();
+ }
+#endif
+ reportAndResetTimings();
+}
+
JuliaOJIT *jl_ExecutionEngine;
// destructively move the contents of src into dest
diff --git a/src/jitlayers.h b/src/jitlayers.h
index d8c06df44176f..7f07034586c80 100644
--- a/src/jitlayers.h
+++ b/src/jitlayers.h
@@ -42,9 +42,7 @@
// and feature support (e.g. Windows, JITEventListeners for various profilers,
// etc.). Thus, we currently only use JITLink where absolutely required, that is,
// for Mac/aarch64.
-// #define JL_FORCE_JITLINK
-
-#if defined(_OS_DARWIN_) && defined(_CPU_AARCH64_) || defined(JL_FORCE_JITLINK)
+#if defined(_OS_DARWIN_) && defined(_CPU_AARCH64_) || defined(_COMPILER_ASAN_ENABLED_) || defined(JL_FORCE_JITLINK)
# if JL_LLVM_VERSION < 130000
# pragma message("On aarch64-darwin, LLVM version >= 13 is required for JITLink; fallback suffers from occasional segfaults")
# endif
@@ -91,6 +89,12 @@ struct OptimizationOptions {
}
};
+// LLVM's new pass manager is scheduled to replace the legacy pass manager
+// for middle-end IR optimizations. However, we have not qualified the new
+// pass manager on our optimization pipeline yet, so this remains an optional
+// define
+// #define JL_USE_NEW_PM
+
struct NewPM {
std::unique_ptr<TargetMachine> TM;
StandardInstrumentations SI;
@@ -103,6 +107,8 @@ struct NewPM {
NewPM(std::unique_ptr<TargetMachine> TM, OptimizationLevel O, OptimizationOptions options = OptimizationOptions::defaults());
void run(Module &M);
+
+ void printTimers();
};
struct AnalysisManagers {
@@ -420,7 +426,7 @@ class JuliaOJIT {
std::unique_ptr<WNMutex> mutex;
};
struct PipelineT {
- PipelineT(orc::ObjectLayer &BaseLayer, TargetMachine &TM, int optlevel);
+ PipelineT(orc::ObjectLayer &BaseLayer, TargetMachine &TM, int optlevel, std::vector<std::function<void()>> &PrintLLVMTimers);
CompileLayerT CompileLayer;
OptimizeLayerT OptimizeLayer;
};
@@ -490,6 +496,7 @@ class JuliaOJIT {
TargetIRAnalysis getTargetIRAnalysis() const;
size_t getTotalBytes() const;
+ void printTimers();
JITDebugInfoRegistry &getDebugInfoRegistry() JL_NOTSAFEPOINT {
return DebugRegistry;
@@ -522,6 +529,8 @@ class JuliaOJIT {
jl_locked_stream dump_compiles_stream;
jl_locked_stream dump_llvm_opt_stream;
+ std::vector<std::function<void()>> PrintLLVMTimers;
+
ResourcePool<orc::ThreadSafeContext, 0, std::queue<orc::ThreadSafeContext>> ContextPool;
#ifndef JL_USE_JITLINK
diff --git a/src/pipeline.cpp b/src/pipeline.cpp
index ae2b1c3202f04..4403653a9d8e4 100644
--- a/src/pipeline.cpp
+++ b/src/pipeline.cpp
@@ -146,7 +146,7 @@ namespace {
// Opts.Recover = CodeGenOpts.SanitizeRecover.has(Mask);
// Opts.UseAfterScope = CodeGenOpts.SanitizeAddressUseAfterScope;
// Opts.UseAfterReturn = CodeGenOpts.getSanitizeAddressUseAfterReturn();
- MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
+ // MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
// MPM.addPass(ModuleAddressSanitizerPass(
// Opts, UseGlobalGC, UseOdrIndicator, DestructorKind));
//Let's assume the defaults are actually fine for our purposes
@@ -173,11 +173,13 @@ namespace {
// }
}
- void addVerificationPasses(ModulePassManager &MPM, bool llvm_only) {
+#ifdef JL_DEBUG_BUILD
+ static inline void addVerificationPasses(ModulePassManager &MPM, bool llvm_only) {
if (!llvm_only)
MPM.addPass(llvm::createModuleToFunctionPassAdaptor(GCInvariantVerifierPass()));
MPM.addPass(VerifierPass());
}
+#endif
auto basicSimplifyCFGOptions() {
return SimplifyCFGOptions()
@@ -244,9 +246,9 @@ namespace {
//Use for O1 and below
void buildBasicPipeline(ModulePassManager &MPM, PassBuilder *PB, OptimizationLevel O, OptimizationOptions options) {
-// #ifdef JL_DEBUG_BUILD
+#ifdef JL_DEBUG_BUILD
addVerificationPasses(MPM, options.llvm_only);
-// #endif
+#endif
invokePipelineStartCallbacks(MPM, PB, O);
MPM.addPass(ConstantMergePass());
if (!options.dump_native) {
@@ -320,9 +322,9 @@ static void buildBasicPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimiza
//Use for O2 and above
void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, OptimizationLevel O, OptimizationOptions options) {
-// #ifdef JL_DEBUG_BUILD
+#ifdef JL_DEBUG_BUILD
addVerificationPasses(MPM, options.llvm_only);
-// #endif
+#endif
invokePipelineStartCallbacks(MPM, PB, O);
MPM.addPass(ConstantMergePass());
{
@@ -382,7 +384,7 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
#endif
LPM2.addPass(LICMPass(LICMOptions()));
JULIA_PASS(LPM2.addPass(JuliaLICMPass()));
- LPM2.addPass(SimpleLoopUnswitchPass());
+ LPM2.addPass(SimpleLoopUnswitchPass(true, true));
LPM2.addPass(LICMPass(LICMOptions()));
JULIA_PASS(LPM2.addPass(JuliaLICMPass()));
//LICM needs MemorySSA now, so we must use it
@@ -399,7 +401,7 @@ static void buildFullPipeline(ModulePassManager &MPM, PassBuilder *PB, Optimizat
//We don't know if the loop end callbacks support MSSA
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM), /*UseMemorySSA = */false));
}
- FPM.addPass(LoopUnrollPass());
+ FPM.addPass(LoopUnrollPass(LoopUnrollOptions().setRuntime(false)));
JULIA_PASS(FPM.addPass(AllocOptPass()));
FPM.addPass(SROAPass());
FPM.addPass(InstSimplifyPass());
@@ -541,11 +543,8 @@ PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
// Register the AA manager first so that our version is the one used.
FAM.registerPass([&] JL_NOTSAFEPOINT {
AAManager AA;
- // TODO: Why are we only doing this for -O3?
- if (O.getSpeedupLevel() >= 3) {
- AA.registerFunctionAnalysis<BasicAA>();
- }
if (O.getSpeedupLevel() >= 2) {
+ AA.registerFunctionAnalysis<BasicAA>();
AA.registerFunctionAnalysis<ScopedNoAliasAA>();
AA.registerFunctionAnalysis<TypeBasedAA>();
}
@@ -603,6 +602,10 @@ void NewPM::run(Module &M) {
#endif
}
+void NewPM::printTimers() {
+ SI.getTimePasses().print();
+}
+
OptimizationLevel getOptLevel(int optlevel) {
switch (std::min(std::max(optlevel, 0), 3)) {
case 0:

95
f11bfc6c.patch Normal file
View File

@ -0,0 +1,95 @@
From f11bfc6ccad3e07fde4e40493635bd832d108477 Mon Sep 17 00:00:00 2001
From: Valentin Churavy <vchuravy@users.noreply.github.com>
Date: Thu, 27 Apr 2023 16:29:25 -0400
Subject: [PATCH] Use NewPM for ASAN/MSAN (#49530)
Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com>
Co-authored-by: Prem Chintalapudi <prem.chintalapudi@gmail.com>
---
src/aotcompile.cpp | 4 ++++
src/cgmemmgr.cpp | 4 ++--
src/jitlayers.h | 13 +++++++++++--
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
index 2a14e2a4fa0ab..b89cdf550171f 100644
--- a/src/aotcompile.cpp
+++ b/src/aotcompile.cpp
@@ -1775,6 +1775,7 @@ void addOptimizationPasses(legacy::PassManagerBase *PM, int opt_level,
PM->add(createCFGSimplificationPass(basicSimplifyCFGOptions));
}
}
+#if JL_LLVM_VERSION < 150000
#if defined(_COMPILER_ASAN_ENABLED_)
PM->add(createAddressSanitizerFunctionPass());
#endif
@@ -1783,6 +1784,7 @@ void addOptimizationPasses(legacy::PassManagerBase *PM, int opt_level,
#endif
#if defined(_COMPILER_TSAN_ENABLED_)
PM->add(createThreadSanitizerLegacyPassPass());
+#endif
#endif
return;
}
@@ -1934,6 +1936,7 @@ void addOptimizationPasses(legacy::PassManagerBase *PM, int opt_level,
}
PM->add(createCombineMulAddPass());
PM->add(createDivRemPairsPass());
+#if JL_LLVM_VERSION < 150000
#if defined(_COMPILER_ASAN_ENABLED_)
PM->add(createAddressSanitizerFunctionPass());
#endif
@@ -1943,6 +1946,7 @@ void addOptimizationPasses(legacy::PassManagerBase *PM, int opt_level,
#if defined(_COMPILER_TSAN_ENABLED_)
PM->add(createThreadSanitizerLegacyPassPass());
#endif
+#endif
}
// An LLVM module pass that just runs all julia passes in order. Useful for
diff --git a/src/cgmemmgr.cpp b/src/cgmemmgr.cpp
index 9f4d69137c0fd..15d28ff270c55 100644
--- a/src/cgmemmgr.cpp
+++ b/src/cgmemmgr.cpp
@@ -860,8 +860,8 @@ uint8_t *RTDyldMemoryManagerJL::allocateCodeSection(uintptr_t Size,
StringRef SectionName)
{
// allocating more than one code section can confuse libunwind.
-#if !defined(_COMPILER_MSAN_ENABLED_)
- // TODO: Figure out why msan needs this.
+#if !defined(_COMPILER_MSAN_ENABLED_) && !defined(_COMPILER_ASAN_ENABLED_)
+ // TODO: Figure out why msan and now asan too need this.
assert(!code_allocated);
code_allocated = true;
#endif
diff --git a/src/jitlayers.h b/src/jitlayers.h
index 7f07034586c80..f63f3a42842f1 100644
--- a/src/jitlayers.h
+++ b/src/jitlayers.h
@@ -42,7 +42,14 @@
// and feature support (e.g. Windows, JITEventListeners for various profilers,
// etc.). Thus, we currently only use JITLink where absolutely required, that is,
// for Mac/aarch64.
-#if defined(_OS_DARWIN_) && defined(_CPU_AARCH64_) || defined(_COMPILER_ASAN_ENABLED_) || defined(JL_FORCE_JITLINK)
+// #define JL_FORCE_JITLINK
+
+#if defined(_COMPILER_ASAN_ENABLED_) || defined(_COMPILER_MSAN_ENABLED_) || defined(_COMPILER_TSAN_ENABLED_)
+# define HAS_SANITIZER
+#endif
+// The sanitizers don't play well with our memory manager
+
+#if defined(_OS_DARWIN_) && defined(_CPU_AARCH64_) || defined(JL_FORCE_JITLINK) || JL_LLVM_VERSION >= 150000 && defined(HAS_SANITIZER)
# if JL_LLVM_VERSION < 130000
# pragma message("On aarch64-darwin, LLVM version >= 13 is required for JITLink; fallback suffers from occasional segfaults")
# endif
@@ -93,7 +100,9 @@ struct OptimizationOptions {
// for middle-end IR optimizations. However, we have not qualified the new
// pass manager on our optimization pipeline yet, so this remains an optional
// define
-// #define JL_USE_NEW_PM
+#if defined(HAS_SANITIZER) && JL_LLVM_VERSION >= 150000
+#define JL_USE_NEW_PM
+#endif
struct NewPM {
std::unique_ptr<TargetMachine> TM;

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:29aad934582fb4c6dd9f9dd558ad649921f43bc7320eab54407fdf6dd3270a33
size 153730803

3
julia-1.9.4-full.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:61843b9647fd06d3b2994f3277a64de1cb5a5a5297d930b8c8e3bc0e93740024
size 294983229

View File

@ -1,7 +1,6 @@
Index: julia/contrib/julia-config.jl
===================================================================
--- julia.orig/contrib/julia-config.jl
+++ julia/contrib/julia-config.jl
diff -ruN a/contrib/julia-config.jl b/contrib/julia-config.jl
--- julia-1.9.4.orig/contrib/julia-config.jl 2023-12-08 06:25:53.680851149 +0800
+++ julia-1.9.4/contrib/julia-config.jl 2023-12-08 06:26:33.647145750 +0800
@@ -1,4 +1,4 @@
-#!/usr/bin/env julia
+#!/usr/bin/julia

View File

@ -1,351 +0,0 @@
Index: julia-1.6.2/deps/mbedtls.mk
===================================================================
--- julia-1.6.2.orig/deps/mbedtls.mk
+++ julia-1.6.2/deps/mbedtls.mk
@@ -5,7 +5,9 @@ MBEDTLS_SRC = mbedtls-$(MBEDTLS_VER)
MBEDTLS_URL = https://github.com/ARMmbed/mbedtls/archive/v$(MBEDTLS_VER).tar.gz
MBEDTLS_OPTS := $(CMAKE_COMMON) -DUSE_SHARED_MBEDTLS_LIBRARY=ON \
- -DUSE_STATIC_MBEDTLS_LIBRARY=OFF -DENABLE_PROGRAMS=OFF -DCMAKE_BUILD_TYPE=Release
+ -DUSE_STATIC_MBEDTLS_LIBRARY=OFF -DENABLE_PROGRAMS=OFF -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -Wno-stringop-overflow -Wno-maybe-uninitialized" \
+ -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -Wno-stringop-overflow -Wno-maybe-uninitialized"
MBEDTLS_OPTS += -DENABLE_ZLIB_SUPPORT=OFF
ifeq ($(BUILD_OS),WINNT)
@@ -36,7 +38,8 @@ $(SRCCACHE)/$(MBEDTLS_SRC)/mbedtls-cmake
# This patch merged upstream shortly after MBedTLS's 2.25.0 minor release, so chances
# are it will be included at least in their next minor release (2.26.0?).
cd $(SRCCACHE)/$(MBEDTLS_SRC) && \
- patch -p1 -f < $(SRCDIR)/patches/mbedtls-cmake-findpy.patch
+ patch -p1 -f < $(SRCDIR)/patches/mbedtls-cmake-findpy.patch && \
+ patch -p1 -f < $(SRCDIR)/patches/mbedtls-fix-build-failure-on-gcc-11.patch
echo 1 > $@
$(BUILDDIR)/$(MBEDTLS_SRC)/build-configured: \
Index: julia-1.6.2/deps/patches/mbedtls-fix-build-failure-on-gcc-11.patch
===================================================================
--- /dev/null
+++ julia-1.6.2/deps/patches/mbedtls-fix-build-failure-on-gcc-11.patch
@@ -0,0 +1,321 @@
+From 2630f6720df59a2084220b1c06f4730a0a330ea0 Mon Sep 17 00:00:00 2001
+From: Rodrigo Dias Correa <rodrigo@correas.us>
+Date: Wed, 4 Nov 2020 01:55:38 -0300
+Subject: [PATCH 1/7] Fix build failure on gcc-11
+
+Function prototypes changed to use array parameters instead of
+pointers.
+
+Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
+---
+ library/ssl_tls.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/library/ssl_tls.c b/library/ssl_tls.c
+index 041578e68f7..ec890d7dcdc 100644
+--- a/library/ssl_tls.c
++++ b/library/ssl_tls.c
+@@ -680,20 +680,20 @@ static void ssl_calc_finished_ssl( mbedtls_ssl_context *, unsigned char *, int )
+ #endif
+
+ #if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1)
+-static void ssl_calc_verify_tls( const mbedtls_ssl_context *, unsigned char *, size_t * );
++static void ssl_calc_verify_tls( const mbedtls_ssl_context *, unsigned char [36], size_t * );
+ static void ssl_calc_finished_tls( mbedtls_ssl_context *, unsigned char *, int );
+ #endif
+
+ #if defined(MBEDTLS_SSL_PROTO_TLS1_2)
+ #if defined(MBEDTLS_SHA256_C)
+ static void ssl_update_checksum_sha256( mbedtls_ssl_context *, const unsigned char *, size_t );
+-static void ssl_calc_verify_tls_sha256( const mbedtls_ssl_context *,unsigned char *, size_t * );
++static void ssl_calc_verify_tls_sha256( const mbedtls_ssl_context *,unsigned char [32], size_t * );
+ static void ssl_calc_finished_tls_sha256( mbedtls_ssl_context *,unsigned char *, int );
+ #endif
+
+ #if defined(MBEDTLS_SHA512_C)
+ static void ssl_update_checksum_sha384( mbedtls_ssl_context *, const unsigned char *, size_t );
+-static void ssl_calc_verify_tls_sha384( const mbedtls_ssl_context *, unsigned char *, size_t * );
++static void ssl_calc_verify_tls_sha384( const mbedtls_ssl_context *, unsigned char [48], size_t * );
+ static void ssl_calc_finished_tls_sha384( mbedtls_ssl_context *, unsigned char *, int );
+ #endif
+ #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
+
+From 2c424570e2a85e21273313808e8c5efcf1cfc9d7 Mon Sep 17 00:00:00 2001
+From: Rodrigo Dias Correa <rodrigo@correas.us>
+Date: Tue, 10 Nov 2020 01:38:00 -0300
+Subject: [PATCH 2/7] Fix mismatched function parameters (prototype/definition)
+
+In GCC 11, parameters declared as arrays in function prototypes
+cannot be declared as pointers in the function definition. The
+same is true for the other way around.
+
+The definition of `mbedtls_aes_cmac_prf_128` was changed to match
+its public prototype in `cmac.h`. The type `output` was
+`unsigned char *`, now is `unsigned char [16]`.
+
+In `ssl_tls.c`, all the `ssl_calc_verify_*` variants now use pointers
+for the output `hash` parameter. The array parameters were removed
+because those functions must be compatible with the function pointer
+`calc_verify` (defined in `ssl_internal.h`).
+
+Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
+---
+ library/cmac.c | 2 +-
+ library/ssl_tls.c | 14 +++++++-------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/library/cmac.c b/library/cmac.c
+index 816bf13da38..59ece155eeb 100644
+--- a/library/cmac.c
++++ b/library/cmac.c
+@@ -420,7 +420,7 @@ int mbedtls_cipher_cmac( const mbedtls_cipher_info_t *cipher_info,
+ */
+ int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_length,
+ const unsigned char *input, size_t in_len,
+- unsigned char *output )
++ unsigned char output[16] )
+ {
+ int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
+ const mbedtls_cipher_info_t *cipher_info;
+diff --git a/library/ssl_tls.c b/library/ssl_tls.c
+index ec890d7dcdc..9d4c4622894 100644
+--- a/library/ssl_tls.c
++++ b/library/ssl_tls.c
+@@ -680,20 +680,20 @@ static void ssl_calc_finished_ssl( mbedtls_ssl_context *, unsigned char *, int )
+ #endif
+
+ #if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1)
+-static void ssl_calc_verify_tls( const mbedtls_ssl_context *, unsigned char [36], size_t * );
++static void ssl_calc_verify_tls( const mbedtls_ssl_context *, unsigned char*, size_t * );
+ static void ssl_calc_finished_tls( mbedtls_ssl_context *, unsigned char *, int );
+ #endif
+
+ #if defined(MBEDTLS_SSL_PROTO_TLS1_2)
+ #if defined(MBEDTLS_SHA256_C)
+ static void ssl_update_checksum_sha256( mbedtls_ssl_context *, const unsigned char *, size_t );
+-static void ssl_calc_verify_tls_sha256( const mbedtls_ssl_context *,unsigned char [32], size_t * );
++static void ssl_calc_verify_tls_sha256( const mbedtls_ssl_context *,unsigned char*, size_t * );
+ static void ssl_calc_finished_tls_sha256( mbedtls_ssl_context *,unsigned char *, int );
+ #endif
+
+ #if defined(MBEDTLS_SHA512_C)
+ static void ssl_update_checksum_sha384( mbedtls_ssl_context *, const unsigned char *, size_t );
+-static void ssl_calc_verify_tls_sha384( const mbedtls_ssl_context *, unsigned char [48], size_t * );
++static void ssl_calc_verify_tls_sha384( const mbedtls_ssl_context *, unsigned char*, size_t * );
+ static void ssl_calc_finished_tls_sha384( mbedtls_ssl_context *, unsigned char *, int );
+ #endif
+ #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
+@@ -1667,7 +1667,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
+
+ #if defined(MBEDTLS_SSL_PROTO_SSL3)
+ void ssl_calc_verify_ssl( const mbedtls_ssl_context *ssl,
+- unsigned char hash[36],
++ unsigned char *hash,
+ size_t *hlen )
+ {
+ mbedtls_md5_context md5;
+@@ -1720,7 +1720,7 @@ void ssl_calc_verify_ssl( const mbedtls_ssl_context *ssl,
+
+ #if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1)
+ void ssl_calc_verify_tls( const mbedtls_ssl_context *ssl,
+- unsigned char hash[36],
++ unsigned char *hash,
+ size_t *hlen )
+ {
+ mbedtls_md5_context md5;
+@@ -1752,7 +1752,7 @@ void ssl_calc_verify_tls( const mbedtls_ssl_context *ssl,
+ #if defined(MBEDTLS_SSL_PROTO_TLS1_2)
+ #if defined(MBEDTLS_SHA256_C)
+ void ssl_calc_verify_tls_sha256( const mbedtls_ssl_context *ssl,
+- unsigned char hash[32],
++ unsigned char *hash,
+ size_t *hlen )
+ {
+ #if defined(MBEDTLS_USE_PSA_CRYPTO)
+@@ -1801,7 +1801,7 @@ void ssl_calc_verify_tls_sha256( const mbedtls_ssl_context *ssl,
+
+ #if defined(MBEDTLS_SHA512_C)
+ void ssl_calc_verify_tls_sha384( const mbedtls_ssl_context *ssl,
+- unsigned char hash[48],
++ unsigned char *hash,
+ size_t *hlen )
+ {
+ #if defined(MBEDTLS_USE_PSA_CRYPTO)
+
+From 80448aae2c93b7bfe73a05410196e237ef2dd8e1 Mon Sep 17 00:00:00 2001
+From: Rodrigo Dias Correa <rodrigo@correas.us>
+Date: Tue, 10 Nov 2020 02:28:50 -0300
+Subject: [PATCH 3/7] Fix GCC warning about `test_snprintf`
+
+GCC 11 generated the warnings because the parameter `ret_buf`
+was declared as `const char[10]`, but some of the arguments
+provided in `run_test_snprintf` are shorter literals, like "".
+
+Now the type of `ret_buf` is `const char *`.
+Both implementations of `test_snprintf` were fixed.
+
+Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
+---
+ programs/test/selftest.c | 2 +-
+ tests/suites/host_test.function | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/programs/test/selftest.c b/programs/test/selftest.c
+index 2aa379b1cf3..41d704073bc 100644
+--- a/programs/test/selftest.c
++++ b/programs/test/selftest.c
+@@ -158,7 +158,7 @@ static int calloc_self_test( int verbose )
+ }
+ #endif /* MBEDTLS_SELF_TEST */
+
+-static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret )
++static int test_snprintf( size_t n, const char *ref_buf, int ref_ret )
+ {
+ int ret;
+ char buf[10] = "xxxxxxxxx";
+diff --git a/tests/suites/host_test.function b/tests/suites/host_test.function
+index db53e9784a7..872a3a43ac4 100644
+--- a/tests/suites/host_test.function
++++ b/tests/suites/host_test.function
+@@ -335,7 +335,7 @@ static int convert_params( size_t cnt , char ** params , int * int_params_store
+ #if defined(__GNUC__)
+ __attribute__((__noinline__))
+ #endif
+-static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret )
++static int test_snprintf( size_t n, const char *ref_buf, int ref_ret )
+ {
+ int ret;
+ char buf[10] = "xxxxxxxxx";
+
+From eb5d014d8ec82cfebfdd008d890d0e1a114c2abc Mon Sep 17 00:00:00 2001
+From: Rodrigo Dias Correa <rodrigo@correas.us>
+Date: Tue, 10 Nov 2020 02:51:51 -0300
+Subject: [PATCH 4/7] Fix GCC warning in `ssl_calc_finished_tls_sha384`
+
+GCC 11 generated a warning because `padbuf` was too small to be
+used as an argument for `mbedtls_sha512_finish_ret`. The `output`
+parameter of `mbedtls_sha512_finish_ret` has the type
+`unsigned char[64]`, but `padbuf` was only 48 bytes long.
+
+Even though `ssl_calc_finished_tls_sha384` uses only 48 bytes for
+the hash output, the size of `padbuf` was increased to 64 bytes.
+
+Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
+---
+ library/ssl_tls.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/library/ssl_tls.c b/library/ssl_tls.c
+index 9d4c4622894..c69de3f1dcb 100644
+--- a/library/ssl_tls.c
++++ b/library/ssl_tls.c
+@@ -3202,7 +3202,7 @@ static void ssl_calc_finished_tls_sha384(
+ {
+ int len = 12;
+ const char *sender;
+- unsigned char padbuf[48];
++ unsigned char padbuf[64];
+ #if defined(MBEDTLS_USE_PSA_CRYPTO)
+ size_t hash_size;
+ psa_hash_operation_t sha384_psa = PSA_HASH_OPERATION_INIT;
+
+From 683028a2f721980fa541e49a42cfdce3cc3f1c1d Mon Sep 17 00:00:00 2001
+From: Rodrigo Dias Correa <rodrigo@correas.us>
+Date: Tue, 10 Nov 2020 03:17:36 -0300
+Subject: [PATCH 5/7] Add changelog entry file to `ChangeLog.d`
+
+Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
+---
+ ChangeLog.d/bugfix_3782.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+ create mode 100644 ChangeLog.d/bugfix_3782.txt
+
+diff --git a/ChangeLog.d/bugfix_3782.txt b/ChangeLog.d/bugfix_3782.txt
+new file mode 100644
+index 00000000000..25e18cb1821
+--- /dev/null
++++ b/ChangeLog.d/bugfix_3782.txt
+@@ -0,0 +1,2 @@
++Bugfix
++ * Fix build failures on GCC 11. Fixes #3782.
+
+From d596ca8a1e34b6ef2fda293250829d014e5d33af Mon Sep 17 00:00:00 2001
+From: Rodrigo Dias Correa <rodrigo@correas.us>
+Date: Wed, 25 Nov 2020 00:42:28 -0300
+Subject: [PATCH 6/7] Fix GCC warning in `ssl_calc_finished_tls_sha384`
+
+This commit fixes the same warning fixed by baeedbf9, but without
+wasting RAM. By casting `mbedtls_sha512_finish_ret()`, `padbuf`
+could be kept 48 bytes long without triggering any warnings.
+
+Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
+---
+ library/ssl_tls.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/library/ssl_tls.c b/library/ssl_tls.c
+index c69de3f1dcb..79348bd8dd0 100644
+--- a/library/ssl_tls.c
++++ b/library/ssl_tls.c
+@@ -3197,12 +3197,15 @@ static void ssl_calc_finished_tls_sha256(
+ #endif /* MBEDTLS_SHA256_C */
+
+ #if defined(MBEDTLS_SHA512_C)
++
++typedef int (*finish_sha384_t)(mbedtls_sha512_context*, unsigned char[48]);
++
+ static void ssl_calc_finished_tls_sha384(
+ mbedtls_ssl_context *ssl, unsigned char *buf, int from )
+ {
+ int len = 12;
+ const char *sender;
+- unsigned char padbuf[64];
++ unsigned char padbuf[48];
+ #if defined(MBEDTLS_USE_PSA_CRYPTO)
+ size_t hash_size;
+ psa_hash_operation_t sha384_psa = PSA_HASH_OPERATION_INIT;
+@@ -3255,8 +3258,14 @@ static void ssl_calc_finished_tls_sha384(
+ MBEDTLS_SSL_DEBUG_BUF( 4, "finished sha512 state", (unsigned char *)
+ sha512.state, sizeof( sha512.state ) );
+ #endif
++ /*
++ * For SHA-384, we can save 16 bytes by keeping padbuf 48 bytes long.
++ * However, to avoid stringop-overflow warning in gcc, we have to cast
++ * mbedtls_sha512_finish_ret().
++ */
++ finish_sha384_t finish = (finish_sha384_t)mbedtls_sha512_finish_ret;
++ finish( &sha512, padbuf );
+
+- mbedtls_sha512_finish_ret( &sha512, padbuf );
+ mbedtls_sha512_free( &sha512 );
+ #endif
+
+
+From f06a6144e23a1a8dcc3dd749b993ad88a96063fb Mon Sep 17 00:00:00 2001
+From: Rodrigo Dias Correa <rodrigo@correas.us>
+Date: Wed, 25 Nov 2020 07:30:26 -0300
+Subject: [PATCH 7/7] Change function casting in `ssl_calc_finished_tls_sha384`
+
+`finish_sha384_t` was made more generic by using `unsigned char*`
+instead of `unsigned char[48]` as the second parameter.
+This change tries to make the function casting more robust against
+future improvements of gcc analysis.
+
+Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
+---
+ library/ssl_tls.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/library/ssl_tls.c b/library/ssl_tls.c
+index 79348bd8dd0..a1a5859f056 100644
+--- a/library/ssl_tls.c
++++ b/library/ssl_tls.c
+@@ -3198,7 +3198,7 @@ static void ssl_calc_finished_tls_sha256(
+
+ #if defined(MBEDTLS_SHA512_C)
+
+-typedef int (*finish_sha384_t)(mbedtls_sha512_context*, unsigned char[48]);
++typedef int (*finish_sha384_t)(mbedtls_sha512_context*, unsigned char*);
+
+ static void ssl_calc_finished_tls_sha384(
+ mbedtls_ssl_context *ssl, unsigned char *buf, int from )

View File

@ -1,13 +0,0 @@
--- julia-1.6.3/src/task.c 2021-09-23 19:34:58.000000000 +0200
+++ julia-1.6.3/src/task.c 2021-10-22 09:54:20.765870391 +0200
@@ -75,8 +75,8 @@
// empirically, jl_finish_task needs about 64k stack space to infer/run
// and additionally, gc-stack reserves 64k for the guard pages
-#if defined(MINSIGSTKSZ) && MINSIGSTKSZ > 131072
-#define MINSTKSZ MINSIGSTKSZ
+#if defined(MINSIGSTKSZ)
+#define MINSTKSZ (MINSIGSTKSZ > 131072 ? MINSIGSTKSZ : 131072)
#else
#define MINSTKSZ 131072
#endif

View File

@ -1,15 +0,0 @@
Index: julia-1.6.0/Makefile
===================================================================
--- julia-1.6.0.orig/Makefile
+++ julia-1.6.0/Makefile
@@ -42,10 +42,6 @@ $(foreach link,base $(JULIAHOME)/test,$(
julia_flisp.boot.inc.phony: julia-deps
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src julia_flisp.boot.inc.phony
-# Build the HTML docs (skipped if already exists, notably in tarballs)
-$(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUILDROOT)/doc \( -path $(BUILDROOT)/doc/_build -o -path $(BUILDROOT)/doc/deps -o -name *_constants.jl -o -name *_h.jl -o -name version_git.jl \) -prune -o -type f -print)
- @$(MAKE) docs
-
julia-symlink: julia-cli-$(JULIA_BUILD_MODE)
ifeq ($(OS),WINNT)
@echo '@"%~dp0\'"$$(echo $(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE)) | tr / '\\')"\" '%*' > $(BUILDROOT)/julia.bat

View File

@ -0,0 +1,87 @@
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-14jl.so"
+ const libLLVM = "libLLVM-15.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.5.dylib"
else
- const libgit2 = "libgit2.so.1.5"
+ 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.4.dylib"
else
- const libopenlibm = "libopenlibm.so.4"
+ const libopenlibm = "libopenlibm.so"
end
function __init__()
diff --git a/stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl b/stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl
index 2940970cef..359dbd9065 100644
--- a/stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl
+++ b/stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl
@@ -67,18 +67,18 @@ elseif Sys.isapple()
const libsuitesparseconfig = "@rpath/libsuitesparseconfig.5.dylib"
const libumfpack = "@rpath/libumfpack.5.dylib"
else
- const libamd = "libamd.so.2"
- const libbtf = "libbtf.so.1"
- const libcamd = "libcamd.so.2"
- const libccolamd = "libccolamd.so.2"
- const libcholmod = "libcholmod.so.3"
- const libcolamd = "libcolamd.so.2"
- const libklu = "libklu.so.1"
- const libldl = "libldl.so.2"
- const librbio = "librbio.so.2"
- const libspqr = "libspqr.so.2"
- const libsuitesparseconfig = "libsuitesparseconfig.so.5"
- const libumfpack = "libumfpack.so.5"
+ const libamd = "libamd.so"
+ const libbtf = "libbtf.so"
+ const libcamd = "libcamd.so"
+ const libccolamd = "libccolamd.so"
+ const libcholmod = "libcholmod.so"
+ const libcolamd = "libcolamd.so"
+ const libklu = "libklu.so"
+ const libldl = "libldl.so"
+ const librbio = "librbio.so"
+ const libspqr = "libspqr.so"
+ const libsuitesparseconfig = "libsuitesparseconfig.so"
+ const libumfpack = "libumfpack.so"
end
function __init__()

77
julia-libgit2-1.7.patch Normal file
View File

@ -0,0 +1,77 @@
From 764484f58b5daead9fd58de08ce35382758d3985 Mon Sep 17 00:00:00 2001
From: Yichao Yu <yyc1992@gmail.com>
Date: Sun, 10 Sep 2023 14:07:57 -0400
Subject: [PATCH] libgit2 1.7.0 support
---
stdlib/LibGit2/src/consts.jl | 5 +++++
stdlib/LibGit2/src/types.jl | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/stdlib/LibGit2/src/consts.jl b/stdlib/LibGit2/src/consts.jl
index f3a460108db6b..8f0e6eeb2ec87 100644
--- a/stdlib/LibGit2/src/consts.jl
+++ b/stdlib/LibGit2/src/consts.jl
@@ -468,4 +468,9 @@ Option flags for `GitProxy`.
TRACE_TRACE
end
+# The type of object id
+@enum(GIT_OID_TYPE,
+ _OID_DEFAULT = 0,
+ OID_SHA1 = 1)
+
end
diff --git a/stdlib/LibGit2/src/types.jl b/stdlib/LibGit2/src/types.jl
index 0b653f9b6ad21..c796ff0f98b20 100644
--- a/stdlib/LibGit2/src/types.jl
+++ b/stdlib/LibGit2/src/types.jl
@@ -2,7 +2,7 @@
using Base: something
import Base.@kwdef
-import .Consts: GIT_SUBMODULE_IGNORE, GIT_MERGE_FILE_FAVOR, GIT_MERGE_FILE, GIT_CONFIG
+import .Consts: GIT_SUBMODULE_IGNORE, GIT_MERGE_FILE_FAVOR, GIT_MERGE_FILE, GIT_CONFIG, GIT_OID_TYPE
const OID_RAWSZ = 20
const OID_HEXSZ = OID_RAWSZ * 2
@@ -439,6 +439,9 @@ The fields represent:
# options controlling how the diff text is generated
context_lines::UInt32 = UInt32(3)
interhunk_lines::UInt32 = UInt32(0)
+ @static if LibGit2.VERSION >= v"1.7.0"
+ oid_type::GIT_OID_TYPE = Consts._OID_DEFAULT
+ end
id_abbrev::UInt16 = UInt16(7)
max_size::Int64 = Int64(512*1024*1024) #512Mb
old_prefix::Cstring = Cstring(C_NULL)
diff --git a/stdlib/LibGit2/test/libgit2-tests.jl b/stdlib/LibGit2/test/libgit2-tests.jl
index 4ace98a0b1..f230ff4e14 100644
--- a/stdlib/LibGit2/test/libgit2-tests.jl
+++ b/stdlib/LibGit2/test/libgit2-tests.jl
@@ -1181,19 +1177,19 @@ mktempdir() do dir
@testset "diff" begin
LibGit2.with(LibGit2.GitRepo(cache_repo)) do repo
@test !LibGit2.isdirty(repo)
- @test !LibGit2.isdirty(repo, test_file)
- @test !LibGit2.isdirty(repo, "nonexistent")
+# @test !LibGit2.isdirty(repo, test_file)
+# @test !LibGit2.isdirty(repo, "nonexistent")
@test !LibGit2.isdiff(repo, "HEAD")
@test !LibGit2.isdirty(repo, cached=true)
- @test !LibGit2.isdirty(repo, test_file, cached=true)
- @test !LibGit2.isdirty(repo, "nonexistent", cached=true)
+# @test !LibGit2.isdirty(repo, test_file, cached=true)
+# @test !LibGit2.isdirty(repo, "nonexistent", cached=true)
@test !LibGit2.isdiff(repo, "HEAD", cached=true)
open(joinpath(cache_repo,test_file), "a") do f
println(f, "zzzz")
end
@test LibGit2.isdirty(repo)
- @test LibGit2.isdirty(repo, test_file)
- @test !LibGit2.isdirty(repo, "nonexistent")
+# @test LibGit2.isdirty(repo, test_file)
+# @test !LibGit2.isdirty(repo, "nonexistent")
@test LibGit2.isdiff(repo, "HEAD")
@test !LibGit2.isdirty(repo, cached=true)
@test !LibGit2.isdiff(repo, "HEAD", cached=true)

20
julia-libunwind-1.9.patch Normal file
View File

@ -0,0 +1,20 @@
diff --git a/src/debuginfo.cpp b/src/debuginfo.cpp
index 95b562311b..69fceb0cfe 100644
--- a/src/debuginfo.cpp
+++ b/src/debuginfo.cpp
@@ -265,6 +265,7 @@ public:
di->format = UNW_INFO_FORMAT_ARM_EXIDX;
di->start_ip = (uintptr_t)arm_text_addr;
di->end_ip = (uintptr_t)(arm_text_addr + arm_text_len);
+ di->load_offset = 0;
di->u.rti.name_ptr = 0;
di->u.rti.table_data = arm_exidx_addr;
di->u.rti.table_len = arm_exidx_len;
@@ -1577,6 +1578,7 @@ void register_eh_frames(uint8_t *Addr, size_t Size)
di->u.rti.table_data = (unw_word_t)table;
di->start_ip = start_ip;
di->end_ip = end_ip;
+ di->load_offset = 0;
jl_profile_atomic([&]() {
_U_dyn_register(di);

View File

@ -1,2 +1,4 @@
# https://github.com/JuliaLang/julia/issues/28564
addFilter("E: devel-file-in-non-devel-package.*/usr/lib.*/julia/.*")
# Julia has sofiles that are not actually an issue
addFilter("E: arch-dependent-file-in-usr-share*")

40
julia-suitesparse-7.patch Normal file
View File

@ -0,0 +1,40 @@
--- a/src/solvers/cholmod.jl.orig 2022-11-11 07:24:15.860939080 +0000
+++ b/src/solvers/cholmod.jl 2022-11-11 07:24:39.462357069 +0000
@@ -194,21 +194,6 @@
from www.julialang.org, which ship with the correct
versions of all dependencies.
"""
- elseif BUILD_VERSION.major != current_version.major
- @warn """
- CHOLMOD version incompatibility
-
- Julia was compiled with CHOLMOD version $BUILD_VERSION. It is
- currently linked with version $current_version.
- This might cause Julia to terminate when working with
- sparse matrix factorizations, e.g. solving systems of
- equations with \\.
-
- It is recommended that you use Julia with the same major
- version of CHOLMOD as the one used during the build, or
- download the generic binaries from www.julialang.org,
- which ship with the correct versions of all dependencies.
- """
end
intsize = sizeof(SuiteSparse_long)
@@ -232,15 +232,6 @@ function __init__()
"""
end
- # Register gc tracked allocator if CHOLMOD is new enough
- if current_version >= v"3.0.0"
- cnfg = cglobal((:SuiteSparse_config, :libsuitesparseconfig), Ptr{Cvoid})
- unsafe_store!(cnfg, cglobal(:jl_malloc, Ptr{Cvoid}), 1)
- unsafe_store!(cnfg, cglobal(:jl_calloc, Ptr{Cvoid}), 2)
- unsafe_store!(cnfg, cglobal(:jl_realloc, Ptr{Cvoid}), 3)
- unsafe_store!(cnfg, cglobal(:jl_free, Ptr{Cvoid}), 4)
- end
-
catch ex
@error "Error during initialization of module CHOLMOD" exception=ex,catch_backtrace()
end

View File

@ -1,3 +1,35 @@
-------------------------------------------------------------------
Sat Dec 9 06:23:13 UTC 2023 - Soc Virnyl Estela <uncomfy+openbuildservice@uncomfyhalomacro.pl>
- Remove debug package. It's not created. Still we won't strip
debug symbols from julia as it will cause issues.
- Declare that it conflicts with juliaup.
- Update tagged release banner message that says it is an unofficial experimental build
- Add mbedtls-hardcoded-libs.patch
- Update description
- Add llvm-link-shared.patch
- Add openlibm.patch
- Add libblastrampoline-hardcoded-libs.patch
- Add use-system-libuv-correctly.patch
- Use sed to replace julia-hardcoded-libs.patch
- Add patch julia-suitesparse-7.patch
- Update julia-env-script-interpreter.patch
- Add new patches
* 21d4c2f1.patch
* 959902f1.patch
* e08e1444.patch
* f11bfc6c.patch
* julia-hardcoded-libs.patch
* julia-libgit2-1.7.patch
* julia-libunwind-1.9.patch
- Update to julia version 1.9.4
** CHANGELOG TOO HUGE SINCE 1.6.3 **
See https://github.com/JuliaLang/julia/compare/v1.6.3...v1.9.4
- Remove a lot of old patches
* julia-fix_doc_build.patch
* julia-fix-mbedtls-build-failure-gcc-11.patch
* julia-fix-task-build-failure-gcc-11.patch
-------------------------------------------------------------------
Wed Nov 24 08:19:54 UTC 2021 - Guillaume GARDET <guillaume.gardet@opensuse.org>

View File

@ -1,4 +1,4 @@
#
# spec file for package julia
#
# Copyright (c) 2021 SUSE LLC
@ -23,47 +23,64 @@
%undefine _build_create_debug
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true
%global __provides_exclude_from ^%{_libdir}/%{name}/.*\\.so$
# List all bundled libraries.
%global _privatelibs lib(LLVM-.*|ccalltest|dSFMT|git2|llvmcalltest|openlibm|suitesparse_wrapper|mbedcrypto|mbedtls|mbedx509|uv)\\.so.*
%global __provides_exclude ^(%{_privatelibs})$
%global __requires_exclude ^(%{_privatelibs})$
%define libjulia_sover_major 1
%define libjulia_sover_minor 6
%define libjulia_sover_minor 9
%if "@BUILD_FLAVOR@%{nil}" == "compat"
%define compat_mode 1
%else
%define compat_mode 0
%endif
Version: 1.6.3
# LTO currently makes building blastrampoline and Julia itself fail
# It is not enabled upstream anyway
%global _lto_cflags %nil
Version: 1.9.4
Release: 0
URL: http://julialang.org/
Source0: https://github.com/JuliaLang/julia/releases/download/v%{version}/julia-%{version}-full.tar.gz
Source1: julia-rpmlintrc
Source99: juliabuildopts
# PATCH-FIX-OPENSUSE julia-env-script-interpreter.patch ronisbr@gmail.com -- Change script interpreted to avoid errors in rpmlint.
Patch0: julia-env-script-interpreter.patch
# PATCH-FIX-OPENSUSE julia-fix_doc_build.patch ronisbr@gmail.com -- Makefile is building the docs with `USE_SYSTEM_CSL=1` even if they are already available in the tarball.
Patch1: julia-fix_doc_build.patch
# PATCH-FIX-UPSTREAM julia-fix-mbedtls-build-failure-gcc-11.patch ronisbr@gmail.com - Fix MBEDTLS building using GCC 11.
Patch2: julia-fix-mbedtls-build-failure-gcc-11.patch
# PATCH-FIX-UPSTREAM julia-fix-task-build-failure-gcc-11.patch pandom79@gmail.com - Fix task.c building using GCC 11.
Patch3: julia-fix-task-build-failure-gcc-11.patch
Patch1: julia-env-script-interpreter.patch
Patch2: https://gitlab.archlinux.org/archlinux/packaging/packages/julia/-/raw/main/e08e1444.patch?ref_type=heads#/e08e1444.patch
Patch3: https://gitlab.archlinux.org/archlinux/packaging/packages/julia/-/raw/main/959902f1.patch?ref_type=heads#/959902f1.patch
Patch4: https://gitlab.archlinux.org/archlinux/packaging/packages/julia/-/raw/main/f11bfc6c.patch?ref_type=heads#/f11bfc6c.patch
Patch5: https://gitlab.archlinux.org/archlinux/packaging/packages/julia/-/raw/main/21d4c2f1.patch?ref_type=heads#/21d4c2f1.patch
Patch6: https://gitlab.archlinux.org/archlinux/packaging/packages/julia/-/raw/main/julia-libunwind-1.6.patch?ref_type=heads#/julia-libunwind-1.9.patch
Patch8: https://gitlab.archlinux.org/archlinux/packaging/packages/julia/-/raw/main/julia-libgit2-1.7.patch?ref_type=heads#/julia-libgit2-1.7.patch
Patch9: https://gitlab.archlinux.org/archlinux/packaging/packages/julia/-/raw/main/julia-suitesparse-7.patch?ref_type=heads#/julia-suitesparse-7.patch
Patch10: use-system-libuv-correctly.patch
Patch11: openlibm.patch
Patch12: llvm-link-shared.patch
Patch13: https://gitlab.archlinux.org/archlinux/packaging/packages/julia/-/raw/main/julia-hardcoded-libs.patch?ref_type=heads#/julia-hardcoded-libs.patch
Patch14: mbedtls-hardcoded-libs.patch
Patch15: libblastrampoline-hardcoded-libs.patch
BuildRequires: arpack-ng-devel >= 3.3.0
BuildRequires: llvm15-devel
BuildRequires: libblastrampoline-devel
BuildRequires: lld15
BuildRequires: libwhich
BuildRequires: libgit2-devel
BuildRequires: zlib-devel
BuildRequires: p7zip >= 16
BuildRequires: dSFMT-devel
BuildRequires: libuv-devel
BuildRequires: mbedtls-devel
BuildRequires: openlibm-devel
BuildRequires: utf8proc-devel
BuildRequires: blas-devel
BuildRequires: cmake
BuildRequires: double-conversion-devel
BuildRequires: fdupes
BuildRequires: fftw3-threads-devel >= 3.3.4
BuildRequires: gcc-c++
BuildRequires: gcc
BuildRequires: gcc-fortran
BuildRequires: gmp-devel >= 6.1.2
BuildRequires: hicolor-icon-theme
BuildRequires: lapack-devel >= 3.5.0
BuildRequires: libcurl-devel
BuildRequires: libnghttp2-devel
BuildRequires: openblas-common-devel
BuildRequires: libopenblas_openmp-devel >= 0.3.5
BuildRequires: libssh2-devel >= 1.9.0
BuildRequires: libunwind-devel >= 1.3.1
@ -79,24 +96,12 @@ BuildRequires: python >= 2.5
BuildRequires: readline-devel
BuildRequires: suitesparse-devel >= 5.4.0
BuildRequires: update-desktop-files
BuildRequires: zlib-devel >= 1.2.11
Requires: libamd2
Requires: libarpack2
Requires: libcamd2
Requires: libccolamd2
Requires: libcholmod3
Requires: libcolamd2
Requires: libfftw3_threads3
Requires: libgmp10
Requires: libmpfr6
Requires: libopenblas_openmp0 >= 0.3.5
Requires: libpcre2-8-0
Requires: libspqr2
Requires: libsuitesparseconfig5
Requires: libumfpack5
Requires: ncurses
BuildRequires: ca-certificates
Conflicts: juliaup
Requires: p7zip >= 16
Requires: readline
Requires: ca-certificates
Requires: julia-devel = %{version}
Recommends: arpack-ng-devel
Recommends: git
Recommends: gmp-devel
@ -140,6 +145,9 @@ library. The library, largely written in Julia itself, also integrates mature,
best-of-breed C and Fortran libraries for linear algebra, random number
generation, signal processing, and string processing.
This package is experimental and by no means supported by upstream. If you want
to use julia, please install juliaup instead
%package devel
Summary: Julia development, debugging and testing files
Group: Development/Languages/Other
@ -155,45 +163,50 @@ debugging version of Julia. This package is normally not needed when programming
in the Julia language, but rather for embedding Julia into external programs or
debugging Julia itself.
%package debug
Summary: Julia debugging
Group: Development/Languages/Other
Requires: %{name} = %{version}
%if 0%{?compat_mode}
Conflicts: julia-debug
%endif
%description debug
Contains a debugging version of Julia system image and Julia library.
%if 0%{?compat_mode} == 0
%package doc
Summary: Julia documentation and code examples
Group: Documentation/Other
BuildArch: noarch
%description doc
Contains the Julia manual, the reference documentation of the standard library.
%endif
%{expand:%global juliabuildopts %(cat %{SOURCE99})}
%prep
%setup -q -n julia-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
patch -p1 -i %{PATCH1}
patch -p1 -i %{PATCH2}
patch -p1 -i %{PATCH3}
patch -p1 -i %{PATCH4}
patch -p1 -i %{PATCH5}
# libunwind 1.6 compatibility
patch -p1 -i %{PATCH6}
# Fix tests with libgit2 1.7
patch -p1 -i %{PATCH8}
# Make.inc puts it in the wrong libpath
# patch -p1 -i %{PATCH10}
patch -p1 -i %{PATCH11}
patch -p1 -i %{PATCH12}
patch -p1 -i %{PATCH13}
patch -p1 -i %{PATCH14}
patch -p1 -i %{PATCH15}
%ifarch aarch64 %{arm}
# https://github.com/JuliaLang/julia/issues/41613#issuecomment-976535193
sed -i 's#$(eval $(call symlink_system_library,CSL,libquadmath,0))##' base/Makefile
%endif
# remove .gitignore
find . -name ".git*" -exec rm {} \;
pushd stdlib/srccache
tar -xzf SparseArrays-37e6e58706a54c5a1b96a17cda7d3e8be8bcb190.tar.gz
patch -d JuliaSparse-SparseArrays.jl-37e6e58 -p1 -i %{PATCH9}
rm SparseArrays-37e6e58706a54c5a1b96a17cda7d3e8be8bcb190.tar.gz
tar -czf SparseArrays-37e6e58706a54c5a1b96a17cda7d3e8be8bcb190.tar.gz JuliaSparse-SparseArrays.jl-37e6e58
md5sum SparseArrays-37e6e58706a54c5a1b96a17cda7d3e8be8bcb190.tar.gz | cut -d ' ' -f 1 > ../../deps/checksums/SparseArrays-37e6e58706a54c5a1b96a17cda7d3e8be8bcb190.tar.gz/md5
sha512sum SparseArrays-37e6e58706a54c5a1b96a17cda7d3e8be8bcb190.tar.gz | cut -d ' ' -f 1 > ../../deps/checksums/SparseArrays-37e6e58706a54c5a1b96a17cda7d3e8be8bcb190.tar.gz/sha512
popd
# Work around bug that prompts zlib to be downloaded even when not used
# https://github.com/JuliaLang/julia/pull/42524/files#r734972945
sed "s/ \$(build_prefix)\\/manifest\\/zlib//" -i deps/llvm.mk
%build
# Workaround for https://github.com/JuliaLang/julia/issues/27118
%global build_cxxflags %(echo %{build_cxxflags} | sed 's/-Wp,-D_GLIBCXX_ASSERTIONS //')
# Workaround for https://github.com/JuliaLang/julia/issues/39822
# and https://bugzilla.redhat.com/show_bug.cgi?id=1928696
%global build_cflags %(echo %{build_cflags} | sed 's/-Wp,-D_GNU_SOURCE //')
%if 0%{?compat_mode} == 0
%ifarch x86_64
@ -225,7 +238,7 @@ find . -name ".git*" -exec rm {} \;
%define julia_march x86-64
%endif
%ifarch armv6l armv6hl
%ifarch armv6l armv6hl aarch64
export LDFLAGS="$LDFLAGS -latomic"
%endif
@ -233,14 +246,18 @@ export LDFLAGS="$LDFLAGS -latomic"
# GCC-11.
# Ref.: https://build.opensuse.org/package/show/security:tls/mbedtls
export CFLAGS="%{optflags} -Wno-stringop-overflow -Wno-maybe-uninitialized"
export CXXLAGS="%{optflags} -Wno-stringop-overflow -Wno-maybe-uninitialized"
export CXXFLAGS="%{optflags} -Wno-stringop-overflow -Wno-maybe-uninitialized"
%define julia_builddir %{_builddir}/%{name}/
make %{?_smp_mflags} \
MARCH=%{julia_march} \
%ifarch aarch64
JULIA_CPU_TARGET="generic" \
JULIA_CPU_TARGET="generic;cortex-a57;thunderx2t99;armv8.2-a,crypto,fullfp16,lse,rdm" \
%endif
%ifarch x86_64
JULIA_CPU_TARGET="generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)" \
%endif
build_prefix=%{_builddir}/%{buildsubdir}/build%{_prefix} \
build_libdir=%{_builddir}/%{buildsubdir}/build%{_libdir} \
prefix=%{_prefix} \
bindir=%{_bindir} \
libdir=%{_libdir} \
@ -248,7 +265,42 @@ make %{?_smp_mflags} \
datarootdir=%{_datarootdir} \
includedir=%{_includedir} \
sysconfdir=%{_sysconfdir} \
%{juliabuildopts} \
USE_BINARYBUILDER=0 \
USE_SYSTEM_CSL=1 \
USE_SYSTEM_LLVM=1 \
USE_SYSTEM_LLD=1 \
USE_SYSTEM_LIBUNWIND=1 \
USE_SYSTEM_PCRE=1 \
USE_SYSTEM_BLAS=1 \
OPENBLAS_LIBNAMESUFFIX= \
USE_SYSTEM_LAPACK=1 \
USE_SYSTEM_LIBBLASTRAMPOLINE=1 \
USE_SYSTEM_GMP=1 \
USE_SYSTEM_MPFR=1 \
USE_SYSTEM_LIBSUITESPARSE=1 \
USE_SYSTEM_SUITESPARSE=1 \
USE_INTEL_JITEVENTS=0 \
USE_SYSTEM_LIBWHICH=1 \
USE_SYSTEM_DSFMT=1 \
USE_SYSTEM_LIBUV=0 \
USE_SYSTEM_UTF8PROC=1 \
USE_SYSTEM_LIBGIT2=1 \
USE_SYSTEM_LIBSSH2=1 \
USE_SYSTEM_MBEDTLS=1 \
USE_SYSTEM_CURL=1 \
USE_SYSTEM_PATCHELF=1 \
USE_SYSTEM_ZLIB=1 \
USE_SYSTEM_P7ZIP=1 \
USE_SYSTEM_OPENLIBM=1 \
USE_BLAS64=0 \
LIBBLAS=-lblas \
LIBBLASNAME=libblas \
LIBLAPACK=-llapack \
LIBLAPACKNAME=liblapack \
JLDFLAGS="$LDFLAGS" \
VERBOSE=1 \
LLVM_CONFIG=llvm-config \
TAGGED_RELEASE_BANNER="openSUSE %{suse_version} experimental build (unofficial)" \
release debug
%check
@ -256,11 +308,22 @@ make %{?_smp_mflags} \
# make %{?_smp_mflags} test
%install
# We need these compilation flags to avoid error when building MBEDTLS with
# GCC-11.
# Ref.: https://build.opensuse.org/package/show/security:tls/mbedtls
export CFLAGS="%{optflags} -Wno-stringop-overflow -Wno-maybe-uninitialized"
export CXXFLAGS="%{optflags} -Wno-stringop-overflow -Wno-maybe-uninitialized"
make install DESTDIR=%{buildroot} \
MARCH=%{julia_march} \
%ifarch aarch64
JULIA_CPU_TARGET="generic" \
JULIA_CPU_TARGET="generic;cortex-a57;thunderx2t99;armv8.2-a,crypto,fullfp16,lse,rdm" \
%endif
%ifarch x86_64
JULIA_CPU_TARGET="generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)" \
%endif
build_prefix=%{_builddir}/%{buildsubdir}/build%{_prefix} \
build_libdir=%{_builddir}/%{buildsubdir}/build%{_libdir} \
prefix=%{_prefix} \
bindir=%{_bindir} \
libdir=%{_libdir} \
@ -268,14 +331,48 @@ make install DESTDIR=%{buildroot} \
datarootdir=%{_datarootdir} \
includedir=%{_includedir} \
sysconfdir=%{_sysconfdir} \
%{juliabuildopts}
USE_BINARYBUILDER=0 \
USE_SYSTEM_CSL=1 \
USE_SYSTEM_LLVM=1 \
USE_SYSTEM_LLD=1 \
USE_SYSTEM_LIBUNWIND=1 \
USE_SYSTEM_PCRE=1 \
USE_SYSTEM_BLAS=1 \
OPENBLAS_LIBNAMESUFFIX= \
USE_SYSTEM_LAPACK=1 \
USE_SYSTEM_LIBBLASTRAMPOLINE=1 \
USE_SYSTEM_GMP=1 \
USE_SYSTEM_MPFR=1 \
USE_SYSTEM_LIBSUITESPARSE=1 \
USE_SYSTEM_SUITESPARSE=1 \
USE_INTEL_JITEVENTS=0 \
USE_SYSTEM_LIBWHICH=1 \
USE_SYSTEM_DSFMT=1 \
USE_SYSTEM_LIBUV=0 \
USE_SYSTEM_UTF8PROC=1 \
USE_SYSTEM_LIBGIT2=1 \
USE_SYSTEM_LIBSSH2=1 \
USE_SYSTEM_MBEDTLS=1 \
USE_SYSTEM_CURL=1 \
USE_SYSTEM_PATCHELF=1 \
USE_SYSTEM_ZLIB=1 \
USE_SYSTEM_P7ZIP=1 \
USE_SYSTEM_OPENLIBM=1 \
USE_BLAS64=0 \
LIBBLAS=-lblas \
LIBBLASNAME=libblas \
LIBLAPACK=-llapack \
LIBLAPACKNAME=liblapack \
JLDFLAGS="$LDFLAGS" \
VERBOSE=1 \
LLVM_CONFIG=llvm-config \
TAGGED_RELEASE_BANNER="openSUSE %{suse_version} experimental build (unofficial)"
# GZip man page.
gzip %{buildroot}/%{_mandir}/man1/julia.1
# Copy the man page for every executable.
cd %{buildroot}/%{_mandir}/man1/
ln -sf julia.1.gz julia-debug.1.gz
rm -f %{buildroot}%{_libdir}/julia/libuv.a
rm -f %{buildroot}%{_datadir}/julia/base/build.h
@ -286,14 +383,21 @@ mkdir -p %{buildroot}%{_docdir}/julia
mv -f %{buildroot}%{_datadir}/doc/julia/* %{buildroot}%{_docdir}/julia/
rm -r %{buildroot}%{_datadir}/doc/julia
ln -sfv /var/lib/ca-certificates/ca-bundle.pem %{buildroot}%{_datadir}/julia/cert.pem # Needed by some julia packages
# Remove execution permission on documentation files.
chmod -x+X -R %{buildroot}%{_docdir}/julia/*
# Remove hidden files from stdlib.
pushd %{buildroot}%{_datadir}/julia/stdlib/
find . -name ".codecov.yml" -exec rm -rf {} \;
find . -name ".gitignore" -exec rm -rf {} \;
find . -name ".travis.yml" -exec rm -rf {} \;
# Remove hidden files and zero-length files and directories from stdlib.
pushd %{buildroot}
find . -name ".codecov.yml" -prune -execdir rm -rf {} \;
find . -name ".git*" -prune -execdir rm -rf {} \;
find . -name ".ci" -prune -execdir rm -rf {} \;
find . -name ".devcontainer" -prune -execdir rm -rf {} \;
find . -name ".travis.yml" -prune -execdir rm -rf {} \;
find . -empty -type d -prune -execdir rm -rf {} \;
find . -empty -type f -prune -execdir rm -rf {} \;
find . -name "*.orig" -prune -execdir rm -rf {} \;
popd
%if 0%{?compat_mode}
@ -315,8 +419,6 @@ rm %{buildroot}%{_datadir}/appdata/julia.appdata.xml
%postun -p /sbin/ldconfig
%post devel -p /sbin/ldconfig
%postun devel -p /sbin/ldconfig
%post debug -p /sbin/ldconfig
%postun debug -p /sbin/ldconfig
%files
%doc CONTRIBUTING.md NEWS.md README.md
@ -326,10 +428,16 @@ rm %{buildroot}%{_datadir}/appdata/julia.appdata.xml
%{_datadir}/julia/base
%{_datadir}/julia/base.cache
%{_datadir}/julia/stdlib
%{_datadir}/julia/compiled*
%{_datadir}/julia/cert.pem
%dir %{_libexecdir}/julia
%{_libexecdir}/julia/*
%if !%{?compat_mode}
%dir %{_datadir}/appdata/
%{_datadir}/appdata/julia.appdata.xml
%dir %{_docdir}/julia
%{_docdir}/julia/*
%endif
%{_datadir}/applications/julia.desktop
%{_libdir}/julia/
@ -337,11 +445,6 @@ rm %{buildroot}%{_datadir}/appdata/julia.appdata.xml
%{_mandir}/man1/julia.1%{?ext_man}
%dir %{_sysconfdir}/julia/
%config(noreplace) %{_sysconfdir}/julia/startup.jl
# Exclude debugging files.
%exclude %{_libdir}/julia/libccalltest.so.debug
%exclude %{_libdir}/julia/sys-debug.so
# Exclude documentation.
%exclude %{_docdir}/julia/html
%files devel
%{_datadir}/julia/test/
@ -350,21 +453,4 @@ rm %{buildroot}%{_datadir}/appdata/julia.appdata.xml
%{_libdir}/libjulia.so.%{libjulia_sover_major}
%{_libdir}/libjulia.so
%files debug
%{_bindir}/julia-debug
%{_libdir}/libjulia-debug.so.%{libjulia_sover_major}.%{libjulia_sover_minor}
%{_libdir}/libjulia-debug.so.%{libjulia_sover_major}
%{_libdir}/libjulia-debug.so
%{_libdir}/julia/libccalltest.so.debug
%{_libdir}/julia/sys-debug.so
%{_mandir}/man1/julia-debug.1%{?ext_man}
%if 0%{?compat_mode} == 0
%files doc
%{_docdir}/julia
%exclude %{_docdir}/julia/CONTRIBUTING.md
%exclude %{_docdir}/julia/NEWS.md
%exclude %{_docdir}/julia/README.md
%endif
%changelog

View File

@ -1,41 +0,0 @@
BUNDLE_DEBUG_LIBS=1 \
NO_GIT=1 \
USE_SYSTEM_LLVM=0 \
USE_SYSTEM_LIBUNWIND=1 \
USE_SYSTEM_READLINE=1 \
USE_SYSTEM_PCRE=1 \
USE_SYSTEM_LIBM=0 \
USE_SYSTEM_OPENLIBM=0 \
USE_SYSTEM_OPENSPECFUN=1 \
USE_SYSTEM_DSFMT=0 \
USE_SYSTEM_BLAS=1 \
LIBBLAS=-lopenblas \
LIBBLASNAME=libopenblas \
USE_SYSTEM_LAPACK=1 \
LIBLAPACK=-libopenblas \
LIBLAPACKNAME=libopenblas \
USE_SYSTEM_FFTW=1 \
LIBFFTWNAME=libfftw3_threads.so.3 \
LIBFFTWFNAME=libfftw3f_threads.so.3 \
USE_SYSTEM_GMP=1 \
USE_SYSTEM_MPFR=1 \
USE_SYSTEM_ARPACK=1 \
USE_SYSTEM_SUITESPARSE=1 \
USE_SYSTEM_ZLIB=1 \
USE_SYSTEM_GRISU=1 \
USE_SYSTEM_LIBUV=0 \
USE_SYSTEM_UTF8PROC=0 \
USE_SYSTEM_PATCHELF=1 \
USE_SYSTEM_P7ZIP=1 \
USE_SYSTEM_MBEDTLS=0 \
USE_SYSTEM_LIBSSH2=1 \
USE_SYSTEM_LIBGIT2=0 \
USE_SYSTEM_CURL=1 \
USE_SYSTEM_NGHTTP2=1 \
USE_SYSTEM_CSL=1 \
USE_MKL=0 \
USE_BLAS64=0 \
USE_LLVM_SHLIB=1 \
VERBOSE=1 \
USECLANG=0 \
USE_BINARYBUILDER=0

View File

@ -0,0 +1,12 @@
diff -ruN julia-1.9.4.orig/stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl julia-1.9.4/stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl
--- julia-1.9.4.orig/stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl 2023-12-09 14:21:37.910096392 +0800
+++ julia-1.9.4/stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl 2023-12-09 14:21:58.006998468 +0800
@@ -24,7 +24,7 @@
elseif Sys.isapple()
"@rpath/libblastrampoline.5.dylib"
else
- "libblastrampoline.so.5"
+ "libblastrampoline.so"
end
function __init__()

21
llvm-link-shared.patch Normal file
View File

@ -0,0 +1,21 @@
diff -ruN julia-1.9.4.orig/src/Makefile julia/src/Makefile
--- julia-1.9.4.orig/src/Makefile 2023-12-08 06:25:53.604185583 +0800
+++ julia/src/Makefile 2023-12-08 13:19:45.202318921 +0800
@@ -125,7 +125,7 @@
# USE_SYSTEM_LLVM == 0
ifneq ($(USE_LLVM_SHLIB),1)
# USE_LLVM_SHLIB != 1
-CG_LLVMLINK += $(LLVM_LDFLAGS) $(shell $(LLVM_CONFIG_HOST) --libs $(CG_LLVM_LIBS) --link-static) $($(LLVM_LDFLAGS) $(shell $(LLVM_CONFIG_HOST) --system-libs 2> /dev/null)
+CG_LLVMLINK += $(LLVM_LDFLAGS) $(shell $(LLVM_CONFIG_HOST) --libs $(CG_LLVM_LIBS) --link-shared) $($(LLVM_LDFLAGS) $(shell $(LLVM_CONFIG_HOST) --system-libs 2> /dev/null)
else
# USE_LLVM_SHLIB == 1
ifeq ($(OS), Darwin)
@@ -141,7 +141,7 @@
endif # USE_LLVM_SHLIB == 1
endif # JULIACODEGEN == LLVM
-RT_LLVM_LINK_ARGS := $(shell $(LLVM_CONFIG_HOST) --libs $(RT_LLVM_LIBS) --system-libs --link-static)
+RT_LLVM_LINK_ARGS := $(shell $(LLVM_CONFIG_HOST) --libs $(RT_LLVM_LIBS) --system-libs --link-shared)
RT_LLVMLINK += $(LLVM_LDFLAGS) $(RT_LLVM_LINK_ARGS)
ifeq ($(OS), WINNT)
RT_LLVMLINK += -luuid -lole32

View File

@ -0,0 +1,16 @@
diff -ruN julia-1.9.4.orig/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl julia/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl
--- julia-1.9.4.orig/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl 2023-12-08 17:54:46.804532060 +0800
+++ julia/stdlib/MbedTLS_jll/src/MbedTLS_jll.jl 2023-12-09 07:41:38.758431369 +0800
@@ -31,9 +31,9 @@
const libmbedtls = "@rpath/libmbedtls.14.dylib"
const libmbedx509 = "@rpath/libmbedx509.1.dylib"
else
- const libmbedcrypto = "libmbedcrypto.so.7"
- const libmbedtls = "libmbedtls.so.14"
- const libmbedx509 = "libmbedx509.so.1"
+ const libmbedcrypto = "libmbedcrypto.so"
+ const libmbedtls = "libmbedtls.so"
+ const libmbedx509 = "libmbedx509.so"
end
function __init__()

12
openlibm.patch Normal file
View File

@ -0,0 +1,12 @@
diff -ruN julia-1.9.4.orig/Make.inc julia/Make.inc
--- julia-1.9.4.orig/Make.inc 2023-12-08 06:25:53.640851723 +0800
+++ julia/Make.inc 2023-12-08 12:47:48.403970277 +0800
@@ -1111,7 +1111,7 @@
LIBM := -lm
LIBMNAME := libm
else
-LIBM := -lopenlibm
+LIBM := -L/usr/lib -lopenlibm
LIBMNAME := libopenlibm
endif

View File

@ -0,0 +1,12 @@
diff -ruN julia-1.9.4.orig/Make.inc julia-1.9.4/Make.inc
--- julia-1.9.4.orig/Make.inc 2023-12-08 06:25:53.640851723 +0800
+++ julia-1.9.4/Make.inc 2023-12-08 10:44:21.177558348 +0800
@@ -1116,7 +1116,7 @@
endif
ifeq ($(USE_SYSTEM_LIBUV), 1)
- LIBUV := $(LOCALBASE)/lib/libuv-julia.a
+ LIBUV := -luv
LIBUV_INC := $(LOCALBASE)/include
else
LIBUV := $(build_libdir)/libuv.a