Skip to content

Commit

Permalink
libjulia: update to 1.8.2 and latest 1.9-DEV (#5506)
Browse files Browse the repository at this point in the history
* libjulia: update to 1.8.2 and latest 1.9-DEV

* Fix aarch64 unwind stuff and more

Co-authored-by: Benjamin Lorenz <[email protected]>
  • Loading branch information
fingolfin and benlorenz authored Oct 30, 2022
1 parent da95d28 commit 61cefde
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 43 deletions.
2 changes: 1 addition & 1 deletion L/libjulia/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ include("common.jl")
jllversion=v"1.8.0"
build_julia(ARGS, v"1.6.3"; jllversion)
build_julia(ARGS, v"1.7.0"; jllversion)
build_julia(ARGS, v"1.8.0-DEV"; jllversion)
build_julia(ARGS, v"1.8.2"; jllversion)
build_julia(ARGS, v"1.9.0-DEV"; jllversion)

26 changes: 0 additions & 26 deletions L/libjulia/bundled/patches/1.8.0-DEV/debuginfo-32-bit-arm.patch

This file was deleted.

54 changes: 54 additions & 0 deletions L/libjulia/bundled/patches/1.9.0-DEV/cycleclock.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From cc7f4029d82343f1c109d925fa4beb1c87a62387 Mon Sep 17 00:00:00 2001
From: Max Horn <[email protected]>
Date: Thu, 27 Oct 2022 17:06:17 +0200
Subject: [PATCH] Provider cycleclock() for 32bit ARM targets

Taken from https://github.com/google/benchmark/blob/main/src/cycleclock.h
---
src/julia_internal.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/src/julia_internal.h b/src/julia_internal.h
index 7eb34239e7..9eec7f5b69 100644
--- a/src/julia_internal.h
+++ b/src/julia_internal.h
@@ -20,6 +20,9 @@
#else
#define sleep(x) Sleep(1000*x)
#endif
+#if defined(_CPU_ARM_)
+#include <sys/time.h>
+#endif

#ifdef __cplusplus
extern "C" {
@@ -216,6 +219,26 @@ static inline uint64_t cycleclock(void) JL_NOTSAFEPOINT
int64_t virtual_timer_value;
__asm__ volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));
return virtual_timer_value;
+#elif defined(_CPU_ARM_)
+ // V6 is the earliest arch that has a standard cyclecount
+#if (__ARM_ARCH >= 6)
+ uint32_t pmccntr;
+ uint32_t pmuseren;
+ uint32_t pmcntenset;
+ // Read the user mode perf monitor counter access permissions.
+ asm volatile("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren));
+ if (pmuseren & 1) { // Allows reading perfmon counters for user mode code.
+ asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset));
+ if (pmcntenset & 0x80000000ul) { // Is it counting?
+ asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr));
+ // The counter is set up to count every 64th cycle
+ return (int64_t)(pmccntr) * 64; // Should optimize to << 6
+ }
+ }
+#endif
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (int64_t)(tv.tv_sec) * 1000000 + tv.tv_usec;
#elif defined(_CPU_PPC64_)
// This returns a time-base, which is not always precisely a cycle-count.
// https://reviews.llvm.org/D78084
--
2.38.1

13 changes: 13 additions & 0 deletions L/libjulia/bundled/patches/1.9.0-DEV/msys_build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Make.inc b/Make.inc
index dfc2594c40..72fb4b4b01 100644
--- a/Make.inc
+++ b/Make.inc
@@ -774,7 +774,7 @@ else ifeq (cygwin, $(shell $(CC) -dumpmachine | cut -d\- -f3))
$(error "cannot build julia with cygwin-target compilers. set XC_HOST to i686-w64-mingw32 or x86_64-w64-mingw32 for mingw cross-compile")
else ifeq (msys, $(shell $(CC) -dumpmachine | cut -d\- -f3))
$(error "cannot build julia with msys-target compilers. please see the README.windows document for instructions on setting up mingw-w64 compilers")
-else ifneq (,$(findstring MSYS,$(shell uname)))
+else ifneq (,$(findstring MSYS,$(BUILD_OS)))
$(error "cannot build julia from a msys shell. please launch a mingw shell instead by setting MSYSTEM=MINGW64")
endif

41 changes: 25 additions & 16 deletions L/libjulia/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ function libjulia_platforms(julia_version)
filter!(p -> arch(p) != "armv6l", platforms)
end

if julia_version == v"1.9.0"
# 32bit ARM seems broken, see https://github.com/JuliaLang/julia/issues/47345
filter!(p -> arch(p) != "armv6l", platforms)
filter!(p -> arch(p) != "armv7l", platforms)
end

for p in platforms
p["julia_version"] = string(julia_version)
end
Expand All @@ -40,16 +46,12 @@ function build_julia(ARGS, version::VersionNumber; jllversion=version)
checksums = Dict(
v"1.6.3" => "2593def8cc9ef81663d1c6bfb8addc3f10502dd9a1d5a559728316a11dea2594",
v"1.7.0" => "8e870dbef71bc72469933317a1a18214fd1b4b12f1080784af7b2c56177efcb4",
v"1.8.2" => "3e2cea35bf5df963ed7b75a83e8febfc000acf1e664ecd657a0772508eb1fb5d",
)

if version == v"1.8.0-DEV"
sources = [
GitSource("https://github.com/JuliaLang/julia.git", "3e092a25212c819b05b2e1d131a5ab28bce5722a"),
DirectorySource("./bundled"),
]
elseif version == v"1.9.0-DEV"
if version == v"1.9.0-DEV"
sources = [
GitSource("https://github.com/JuliaLang/julia.git", "487d0e68aad44b9bf15415bc7263966be73cd814"),
GitSource("https://github.com/JuliaLang/julia.git", "37e0579af04919e1e6264bbfc33ed8f4c537005a"),
DirectorySource("./bundled"),
]
else
Expand Down Expand Up @@ -138,7 +140,7 @@ function build_julia(ARGS, version::VersionNumber; jllversion=version)
if [[ "${version}" == 1.8.* ]]; then
LLVMLINK="-L${prefix}/bin -lLLVM-13jl"
elif [[ "${version}" == 1.9.* ]]; then
LLVMLINK="-L${prefix}/bin -lLLVM-13jl"
LLVMLINK="-L${prefix}/bin -lLLVM-14jl"
else
LLVMLINK="-L${prefix}/bin -lLLVM"
fi
Expand All @@ -154,7 +156,7 @@ function build_julia(ARGS, version::VersionNumber; jllversion=version)
elif [[ "${version}" == 1.8.* ]]; then
LLVMLINK="-L${prefix}/lib -lLLVM-13jl"
elif [[ "${version}" == 1.9.* ]]; then
LLVMLINK="-L${prefix}/lib -lLLVM-13jl"
LLVMLINK="-L${prefix}/lib -lLLVM-14jl"
else
echo "Error, LLVM version not specified"
exit 1
Expand All @@ -169,6 +171,7 @@ function build_julia(ARGS, version::VersionNumber; jllversion=version)
cat << EOM >Make.user
USE_SYSTEM_LLVM=1
USE_SYSTEM_LLD=1
USE_SYSTEM_LIBUNWIND=1
USE_SYSTEM_PCRE=1
Expand Down Expand Up @@ -307,8 +310,6 @@ function build_julia(ARGS, version::VersionNumber; jllversion=version)
# Dependencies that must be installed before this package can be built/used

dependencies = BinaryBuilder.AbstractDependency[
Dependency("LibUnwind_jll"),
Dependency("LibUV_jll"),
BuildDependency("OpenLibm_jll"),
BuildDependency("dSFMT_jll"),
BuildDependency("utf8proc_jll"),
Expand All @@ -329,18 +330,26 @@ function build_julia(ARGS, version::VersionNumber; jllversion=version)
# This means the resulting package has fewer dependencies declared, but at least it
# will work and allow people to build JLL binaries ready for Julia 1.7
if version.major == 1 && version.minor == 6
push!(dependencies, Dependency("LibUV_jll"))
push!(dependencies, Dependency("LibUnwind_jll"))
push!(dependencies, BuildDependency(get_addable_spec("LLVM_full_jll", v"11.0.1+3")))
push!(dependencies, BuildDependency(get_addable_spec("OpenBLAS_jll", v"0.3.10+10")))
push!(dependencies, BuildDependency(get_addable_spec("LibGit2_jll", v"1.2.3+0")))
elseif version.major == 1 && version.minor == 7
push!(dependencies, Dependency("LibUV_jll"))
push!(dependencies, Dependency("LibUnwind_jll"; platforms=filter(!Sys.isapple, platforms)))
push!(dependencies, Dependency(get_addable_spec("LLVMLibUnwind_jll", v"11.0.1+1"); platforms=filter(Sys.isapple, platforms)))
push!(dependencies, BuildDependency(get_addable_spec("LLVM_full_jll", v"12.0.1+3")))
push!(dependencies, BuildDependency(get_addable_spec("LLVMLibUnwind_jll", v"11.0.1+1")))
elseif version.major == 1 && version.minor == 8
push!(dependencies, BuildDependency(get_addable_spec("LLVM_full_jll", v"13.0.0+3")))
push!(dependencies, BuildDependency(get_addable_spec("LLVMLibUnwind_jll", v"12.0.1+0")))
push!(dependencies, Dependency(get_addable_spec("LibUV_jll", v"2.0.1+11")))
push!(dependencies, Dependency("LibUnwind_jll"; platforms=filter(!Sys.isapple, platforms)))
push!(dependencies, Dependency(get_addable_spec("LLVMLibUnwind_jll", v"12.0.1+0"); platforms=filter(Sys.isapple, platforms)))
push!(dependencies, BuildDependency(get_addable_spec("LLVM_full_jll", v"13.0.1+3")))
elseif version.major == 1 && version.minor == 9
push!(dependencies, BuildDependency(get_addable_spec("LLVM_full_jll", v"13.0.1+0")))
push!(dependencies, BuildDependency(get_addable_spec("LLVMLibUnwind_jll", v"12.0.1+0")))
push!(dependencies, Dependency(get_addable_spec("LibUV_jll", v"2.0.1+11")))
push!(dependencies, Dependency(get_addable_spec("LibUnwind_jll", v"1.5.0+4"); platforms=filter(!Sys.isapple, platforms)))
push!(dependencies, Dependency(get_addable_spec("LLVMLibUnwind_jll", v"12.0.1+0"); platforms=filter(Sys.isapple, platforms)))
push!(dependencies, BuildDependency(get_addable_spec("LLVM_full_jll", v"14.0.6+0")))
else
error("Unsupported Julia version")
end
Expand Down

0 comments on commit 61cefde

Please sign in to comment.