[arch-commits] Commit in julia/trunk (PKGBUILD julia-llvm13.patch)
Antonio Rojas
arojas at gemini.archlinux.org
Tue Oct 26 22:12:31 UTC 2021
Date: Tuesday, October 26, 2021 @ 22:12:31
Author: arojas
Revision: 1034580
LLVM 13 rebuild
Added:
julia/trunk/julia-llvm13.patch
Modified:
julia/trunk/PKGBUILD
--------------------+
PKGBUILD | 26 +++
julia-llvm13.patch | 372 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 395 insertions(+), 3 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2021-10-26 22:11:34 UTC (rev 1034579)
+++ PKGBUILD 2021-10-26 22:12:31 UTC (rev 1034580)
@@ -8,7 +8,7 @@
pkgname=julia
epoch=2
pkgver=1.6.3
-pkgrel=2
+pkgrel=3
arch=(x86_64)
pkgdesc='High-level, high-performance, dynamic programming language'
url='https://julialang.org/'
@@ -19,7 +19,13 @@
optdepends=('gnuplot: If using the Gaston Package from julia')
replaces=(julia-docs)
source=(https://github.com/JuliaLang/julia/releases/download/v$pkgver/$pkgname-$pkgver-full.tar.gz{,.asc}
- julia-llvm12.patch::https://github.com/JuliaLang/julia/commit/7df16be0.patch
+ https://github.com/JuliaLang/julia/commit/7df16be0.patch
+ https://github.com/JuliaLang/julia/commit/677ce6d3.patch
+ https://github.com/JuliaLang/julia/commit/a2d85f6d.patch
+ https://github.com/JuliaLang/julia/commit/47f9139e.patch
+ https://github.com/JuliaLang/julia/commit/0f7d183c.patch
+ https://github.com/JuliaLang/julia/commit/d6a655bc.patch
+ julia-llvm13.patch
julia-libgit-1.2.patch
julia-system-cblas.patch
julia-hardcoded-libs.patch
@@ -28,6 +34,12 @@
sha256sums=('29aad934582fb4c6dd9f9dd558ad649921f43bc7320eab54407fdf6dd3270a33'
'SKIP'
'764582f5ac30e694ee99aba6b0ad6cbf45d1ad53e90005678eb3fe7b30781e64'
+ 'a798c58ab518def84e4112538de59a10802e7dc854c20b08990a1619ba2aa95b'
+ '8d0dd9693a2db66ac09b8f08e162bee74a8f4aebbdb3aa422a677d688671d00b'
+ 'c76c6fbb4e04b185d11e3c3e0aec99a2088f3b06621ce61d29cd21227a044a7a'
+ '67053b0da6fe46f82dc676b78adbdf2e6939d851316fefe328c6de6baa58e338'
+ '1d636ab9f93dd0a509d2a365fb6a975d87b5df7667f1d9f6844741818e37fbc9'
+ 'ab8a8ec61963661dca5bb2fa965dccaa36c500d55ef7b6767b8faef5fff461b5'
'c57ea92a11fa8dac72229e6a912d2372ec0d98d63486426fe3bdeeb795de48f7'
'e44c260e4111908337caa82e1c3fef563b9d40e0a30da68d6e91405bf6db24dc'
'a8e664f39f3efaeea63e99c2f5727a28ab7eca01e9164b464c66e991426d7e90'
@@ -38,7 +50,15 @@
cd $pkgname-$pkgver
# fix bad performance with LLVM 12
- patch -p1 -i ../julia-llvm12.patch
+ patch -p1 -i ../7df16be0.patch
+# fix build with LLVM 13
+ patch -p1 -i ../677ce6d3.patch
+ patch -p1 -i ../a2d85f6d.patch
+ patch -p1 -i ../47f9139e.patch
+# Adapt to LLVM 13 type changes
+ patch -p1 -i ../julia-llvm13.patch
+# Fix LazyArtifacts tests
+ patch -p1 -i ../d6a655bc.patch
# libgit2 1.2 compatibility
patch -p1 -i ../julia-libgit-1.2.patch
# Add and use option to build with system cblas
Added: julia-llvm13.patch
===================================================================
--- julia-llvm13.patch (rev 0)
+++ julia-llvm13.patch 2021-10-26 22:12:31 UTC (rev 1034580)
@@ -0,0 +1,372 @@
+From 9daa25a5f331a7e1c0f0b222373a853c2ce1462d Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Tue, 12 Oct 2021 11:56:19 -0400
+Subject: [PATCH 2/6] WIP: add Type to ByVal attribute
+
+---
+ src/abi_aarch64.cpp | 2 +-
+ src/abi_arm.cpp | 2 +-
+ src/abi_llvm.cpp | 2 +-
+ src/abi_ppc64le.cpp | 6 +++++-
+ src/abi_win32.cpp | 6 +++++-
+ src/abi_win64.cpp | 9 +++++++--
+ src/abi_x86.cpp | 8 ++++++--
+ src/abi_x86_64.cpp | 11 ++++++++++-
+ src/ccall.cpp | 4 ++--
+ 9 files changed, 38 insertions(+), 12 deletions(-)
+
+diff --git a/src/abi_aarch64.cpp b/src/abi_aarch64.cpp
+index ce94cc66f0..7ffe107d61 100644
+--- a/src/abi_aarch64.cpp
++++ b/src/abi_aarch64.cpp
+@@ -194,7 +194,7 @@ Type *isHFAorHVA(jl_datatype_t *dt, size_t &nele) const
+ return NULL;
+ }
+
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
+ {
+ // B.2
+ // If the argument type is an HFA or an HVA, then the argument is used
+diff --git a/src/abi_arm.cpp b/src/abi_arm.cpp
+index 1a5d3d0651..ed846dfafb 100644
+--- a/src/abi_arm.cpp
++++ b/src/abi_arm.cpp
+@@ -23,7 +23,7 @@
+
+ struct ABI_ARMLayout : AbiLayout {
+
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
+ {
+ return false;
+ }
+diff --git a/src/abi_llvm.cpp b/src/abi_llvm.cpp
+index 1ab30da1b2..dba8f4aa8a 100644
+--- a/src/abi_llvm.cpp
++++ b/src/abi_llvm.cpp
+@@ -45,7 +45,7 @@ bool use_sret(jl_datatype_t *ty) override
+ return false;
+ }
+
+-bool needPassByRef(jl_datatype_t *ty, AttrBuilder &ab) override
++bool needPassByRef(jl_datatype_t *ty, AttrBuilder &ab, Type *Ty) override
+ {
+ return false;
+ }
+diff --git a/src/abi_ppc64le.cpp b/src/abi_ppc64le.cpp
+index dd6f927d9c..35e444ef77 100644
+--- a/src/abi_ppc64le.cpp
++++ b/src/abi_ppc64le.cpp
+@@ -101,12 +101,16 @@ bool use_sret(jl_datatype_t *dt) override
+ return false;
+ }
+
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
+ {
+ jl_datatype_t *ty0 = NULL;
+ bool hva = false;
+ if (jl_datatype_size(dt) > 64 && isHFA(dt, &ty0, &hva) > 8) {
++#if JL_LLVM_VERSION < 120000
+ ab.addAttribute(Attribute::ByVal);
++#else
++ ab.addByValAttr(Ty);
++#endif
+ return true;
+ }
+ return false;
+diff --git a/src/abi_win32.cpp b/src/abi_win32.cpp
+index af16a0310b..0b34f840e4 100644
+--- a/src/abi_win32.cpp
++++ b/src/abi_win32.cpp
+@@ -49,11 +49,15 @@ bool use_sret(jl_datatype_t *dt) override
+ return true;
+ }
+
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
+ {
+ // Use pass by reference for all structs
+ if (dt->layout->nfields > 0) {
++#if JL_LLVM_VERSION < 120000
+ ab.addAttribute(Attribute::ByVal);
++#else
++ ab.addByValAttr(Ty);
++#endif
+ return true;
+ }
+ return false;
+diff --git a/src/abi_win64.cpp b/src/abi_win64.cpp
+index 16e46a9703..f47802edf1 100644
+--- a/src/abi_win64.cpp
++++ b/src/abi_win64.cpp
+@@ -56,14 +56,19 @@ bool use_sret(jl_datatype_t *dt) override
+ return true;
+ }
+
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
+ {
+ nargs++;
+ size_t size = jl_datatype_size(dt);
+ if (win64_reg_size(size))
+ return false;
+- if (nargs <= 4)
++ if (nargs <= 4) {
++#if JL_LLVM_VERSION < 120000
+ ab.addAttribute(Attribute::ByVal);
++#else
++ ab.addByValAttr(Ty);
++#endif
++ }
+ return true;
+ }
+
+diff --git a/src/abi_x86.cpp b/src/abi_x86.cpp
+index 7a65de028e..c6c0282602 100644
+--- a/src/abi_x86.cpp
++++ b/src/abi_x86.cpp
+@@ -67,12 +67,16 @@ bool use_sret(jl_datatype_t *dt) override
+ return true;
+ }
+
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
+ {
+ size_t size = jl_datatype_size(dt);
+ if (is_complex64(dt) || is_complex128(dt) || (jl_is_primitivetype(dt) && size <= 8))
+ return false;
+- ab.addAttribute(Attribute::ByVal);
++#if JL_LLVM_VERSION < 120000
++ ab.addAttribute(Attribute::ByVal);
++#else
++ ab.addByValAttr(Ty);
++#endif
+ return true;
+ }
+
+diff --git a/src/abi_x86_64.cpp b/src/abi_x86_64.cpp
+index ac28af3011..5f8256dee4 100644
+--- a/src/abi_x86_64.cpp
++++ b/src/abi_x86_64.cpp
+@@ -178,11 +178,15 @@ bool use_sret(jl_datatype_t *dt) override
+ return sret;
+ }
+
+-bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
++bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab, Type *Ty) override
+ {
+ Classification cl = classify(dt);
+ if (cl.isMemory) {
++#if JL_LLVM_VERSION < 120000
+ ab.addAttribute(Attribute::ByVal);
++#else
++ ab.addByValAttr(Ty);
++#endif
+ return true;
+ }
+
+@@ -202,7 +206,12 @@ bool needPassByRef(jl_datatype_t *dt, AttrBuilder &ab) override
+ else if (jl_is_structtype(dt)) {
+ // spill to memory even though we would ordinarily pass
+ // it in registers
++#if JL_LLVM_VERSION < 120000
+ ab.addAttribute(Attribute::ByVal);
++#else
++ Type* Ty = preferred_llvm_type(dt, false);
++ ab.addByValAttr(Ty);
++#endif
+ return true;
+ }
+ return false;
+diff --git a/src/ccall.cpp b/src/ccall.cpp
+index 66ab84c264..e21c717d41 100644
+--- a/src/ccall.cpp
++++ b/src/ccall.cpp
+@@ -291,7 +291,7 @@ class AbiLayout {
+ public:
+ virtual ~AbiLayout() {}
+ virtual bool use_sret(jl_datatype_t *ty) = 0;
+- virtual bool needPassByRef(jl_datatype_t *ty, AttrBuilder&) = 0;
++ virtual bool needPassByRef(jl_datatype_t *ty, AttrBuilder&, Type* llvm_t) = 0;
+ virtual Type *preferred_llvm_type(jl_datatype_t *ty, bool isret) const = 0;
+ };
+
+@@ -1077,7 +1077,7 @@ std::string generate_func_sig(const char *fname)
+ }
+
+ // Whether or not LLVM wants us to emit a pointer to the data
+- bool byRef = abi->needPassByRef((jl_datatype_t*)tti, ab);
++ bool byRef = abi->needPassByRef((jl_datatype_t*)tti, ab, t);
+
+ if (jl_is_cpointer_type(tti)) {
+ pat = t;
+
+From 1fe19a197ebbe33c9e60b2ca7d30c2573772b476 Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Thu, 21 Oct 2021 20:32:39 -0400
+Subject: [PATCH 4/6] [LLVM/Win32] Force stack alignment on module
+
+---
+ src/aotcompile.cpp | 3 +++
+ src/ccall.cpp | 3 +++
+ src/codegen.cpp | 11 ++++++++++-
+ 3 files changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
+index ffd43ee8d48d..d3dfc744fcd0 100644
+--- a/src/aotcompile.cpp
++++ b/src/aotcompile.cpp
+@@ -550,6 +550,9 @@ void jl_dump_native_impl(void *native_code,
+ std::unique_ptr<Module> sysimage(new Module("sysimage", Context));
+ sysimage->setTargetTriple(data->M->getTargetTriple());
+ sysimage->setDataLayout(data->M->getDataLayout());
++#if JL_LLVM_VERSION >= 130000
++ sysimage->setOverrideStackAlignment(data->M->getOverrideStackAlignment());
++#endif
+ data->M.reset(); // free memory for data->M
+
+ if (sysimg_data) {
+diff --git a/src/ccall.cpp b/src/ccall.cpp
+index fb70e53e2814..dd7626c918d0 100644
+--- a/src/ccall.cpp
++++ b/src/ccall.cpp
+@@ -891,6 +891,9 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar
+ // copy module properties that should always match
+ Mod->setTargetTriple(jl_Module->getTargetTriple());
+ Mod->setDataLayout(jl_Module->getDataLayout());
++#if JL_LLVM_VERSION >= 130000
++ Mod->setOverrideStackAlignment(jl_Module->getOverrideStackAlignment());
++#endif
+
+ // verify the definition
+ Function *def = Mod->getFunction(ir_name);
+diff --git a/src/codegen.cpp b/src/codegen.cpp
+index b09eb8db04e0..bc4ea7711a04 100644
+--- a/src/codegen.cpp
++++ b/src/codegen.cpp
+@@ -1707,6 +1707,14 @@ static void jl_setup_module(Module *m, const jl_cgparams_t *params = &jl_default
+ llvm::DEBUG_METADATA_VERSION);
+ m->setDataLayout(jl_data_layout);
+ m->setTargetTriple(jl_TargetMachine->getTargetTriple().str());
++
++#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_) && JL_LLVM_VERSIOn >= 130000
++ // tell Win32 to assume the stack is always 16-byte aligned,
++ // and to ensure that it is 16-byte aligned for out-going calls,
++ // to ensure compatibility with GCC codes
++ m->setOverrideStackAlignment(16;)
++#endif
++
+ }
+
+ Module *jl_create_llvm_module(StringRef name)
+@@ -8235,10 +8243,11 @@ extern "C" void jl_init_llvm(void)
+
+ TargetOptions options = TargetOptions();
+ //options.PrintMachineCode = true; //Print machine code produced during JIT compiling
+-#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_)
++#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_) && JL_LLVM_VERSION <= 120000
+ // tell Win32 to assume the stack is always 16-byte aligned,
+ // and to ensure that it is 16-byte aligned for out-going calls,
+ // to ensure compatibility with GCC codes
++ // In LLVM 13 and onwards this has turned into a module option
+ options.StackAlignmentOverride = 16;
+ #endif
+ #ifdef JL_DEBUG_BUILD
+
+From 7a320647976eb97fdd169b5e85397b9e493e4569 Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Fri, 22 Oct 2021 15:35:38 -0400
+Subject: [PATCH 5/6] StackProtector is now a module flag
+
+---
+ src/aotcompile.cpp | 1 +
+ src/ccall.cpp | 1 +
+ src/codegen.cpp | 6 ++++--
+ 3 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/aotcompile.cpp b/src/aotcompile.cpp
+index d3dfc744fcd0..05fcca50c4ee 100644
+--- a/src/aotcompile.cpp
++++ b/src/aotcompile.cpp
+@@ -551,6 +551,7 @@ void jl_dump_native_impl(void *native_code,
+ sysimage->setTargetTriple(data->M->getTargetTriple());
+ sysimage->setDataLayout(data->M->getDataLayout());
+ #if JL_LLVM_VERSION >= 130000
++ sysimage->setStackProtectorGuard(data->M->getStackProtectorGuard());
+ sysimage->setOverrideStackAlignment(data->M->getOverrideStackAlignment());
+ #endif
+ data->M.reset(); // free memory for data->M
+diff --git a/src/ccall.cpp b/src/ccall.cpp
+index dd7626c918d0..647735edb37d 100644
+--- a/src/ccall.cpp
++++ b/src/ccall.cpp
+@@ -892,6 +892,7 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar
+ Mod->setTargetTriple(jl_Module->getTargetTriple());
+ Mod->setDataLayout(jl_Module->getDataLayout());
+ #if JL_LLVM_VERSION >= 130000
++ Mod->setStackProtectorGuard(jl_Module->getStackProtectorGuard());
+ Mod->setOverrideStackAlignment(jl_Module->getOverrideStackAlignment());
+ #endif
+
+diff --git a/src/codegen.cpp b/src/codegen.cpp
+index bc4ea7711a04..1a7017d3aeb7 100644
+--- a/src/codegen.cpp
++++ b/src/codegen.cpp
+@@ -1714,7 +1714,9 @@ static void jl_setup_module(Module *m, const jl_cgparams_t *params = &jl_default
+ // to ensure compatibility with GCC codes
+ m->setOverrideStackAlignment(16;)
+ #endif
+-
++#if defined(JL_DEBUG_BUILD) && JL_LLVM_VERSION >= 130000
++ m->setStackProtectorGuard("global");
++#endif
+ }
+
+ Module *jl_create_llvm_module(StringRef name)
+
+From e323fc8f7be4ce053dec613076d7dd7517515134 Mon Sep 17 00:00:00 2001
+From: Valentin Churavy <v.churavy at gmail.com>
+Date: Sun, 24 Oct 2021 15:18:23 -0400
+Subject: [PATCH 6/6] Cleanup MachineObjectFileInfo handling in disassembly
+
+---
+ src/disasm.cpp | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/disasm.cpp b/src/disasm.cpp
+index 73b394b77d0b..25e7841bde85 100644
+--- a/src/disasm.cpp
++++ b/src/disasm.cpp
+@@ -860,21 +860,21 @@ static void jl_dump_asm_internal(
+ std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TheTriple.str()));
+ 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!");
++ std::unique_ptr<llvm::MCSubtargetInfo> STI(
++ TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features));
++ assert(STI && "Unable to create subtarget info!");
+
+- MCContext Ctx(TheTriple, MAI.get(), MRI.get(), MSTI, &SrcMgr);
+- MOFI->initMCObjectFileInfo(Ctx, /* PIC */ false, /* LargeCodeModel */ false);
++#if JL_LLVM_VERSION >= 130000
++ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), &SrcMgr);
++ std::unique_ptr<MCObjectFileInfo> MOFI(
++ TheTarget->createMCObjectFileInfo(Ctx, /*PIC=*/false, /*LargeCodeModel=*/ false));
++ Ctx.setObjectFileInfo(MOFI.get());
+ #else
++ std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
+ 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>
+- STI(TheTarget->createMCSubtargetInfo(TheTriple.str(), cpu, features));
+ std::unique_ptr<MCDisassembler> DisAsm(TheTarget->createMCDisassembler(*STI, Ctx));
+ if (!DisAsm) {
+ rstream << "ERROR: no disassembler for target " << TheTriple.str();
More information about the arch-commits
mailing list