Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support riscv64 #1355

Merged
merged 5 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "BinaryBuilder"
uuid = "12aac903-9f7c-5d81-afc2-d9565ea332ae"
authors = ["Elliot Saba <[email protected]>"]
version = "0.6.0"
version = "0.6.1"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand Down Expand Up @@ -33,15 +33,15 @@ ghr_jll = "07c12ed4-43bc-5495-8a2a-d5838ef8d533"

[compat]
ArgParse = "1.1"
BinaryBuilderBase = "1.31"
BinaryBuilderBase = "1.33"
Downloads = "1"
GitHub = "5.1"
HTTP = "0.8, 0.9, 1"
JLD2 = "0.1.6, 0.2, 0.3, 0.4, 0.5"
JLLWrappers = "1.2.0"
JSON = "0.21"
LoggingExtras = "0.4, 1"
ObjectFile = "0.4"
ObjectFile = "0.4.3"
OutputCollectors = "0.1"
PkgLicenses = "0.2"
Registrator = "1.1"
Expand Down
5 changes: 5 additions & 0 deletions src/auditor/dynamic_linkage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function platform_for_object(oh::ObjectHandle)
ELF.EM_X86_64 => "x86_64",
ELF.EM_AARCH64 => "aarch64",
ELF.EM_PPC64 => "powerpc64le",
ELF.EM_RISCV => "riscv64", # Could also be riscv32; should check ELF_CLASS
ELF.EM_ARM => "arm",
)
mach = oh.header.e_machine
Expand Down Expand Up @@ -120,6 +121,9 @@ function is_for_platform(h::ObjectHandle, platform::AbstractPlatform)
return m == ELF.EM_AARCH64
elseif arch(platform) == "powerpc64le"
return m == ELF.EM_PPC64
elseif arch(platform) == "riscv64"
# Could also be riscv32; should check ELF_CLASS
return m == ELF.EM_RISCV
elseif arch(platform) ∈ ("armv7l", "armv6l")
return m == ELF.EM_ARM
else
Expand Down Expand Up @@ -326,6 +330,7 @@ function patchelf_flags(p::AbstractPlatform)
flags = []

# ppc64le and aarch64 have 64KB page sizes, don't muck up the ELF section load alignment
# TODO: What is the riscv64 page size?
eschnett marked this conversation as resolved.
Show resolved Hide resolved
if arch(p) in ("powerpc64le", "aarch64")
append!(flags, ["--page-size", "65536"])
end
Expand Down
2 changes: 2 additions & 0 deletions src/auditor/instruction_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ function minimum_march(counts::Dict, p::AbstractPlatform)
# TODO: Detect NEON and vfpv4 instructions
elseif arch(p) == "powerpc64le"
# TODO Detect POWER9/10 instructions
elseif arch(p) == "riscv64"
# TODO
end
return generic_march(p)
end
Expand Down
4 changes: 2 additions & 2 deletions src/wizard/interactive_build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ Pick the first platform for use to run on. We prefer Linux x86_64 because
that's generally the host platform, so it's usually easiest. After that we
go by the following preferences:
* OS (in order): Linux, Windows, OSX
* Architecture: x86_64, i686, aarch64, powerpc64le, armv7l
* Architecture: x86_64, i686, aarch64, powerpc64le, armv7l, riscv64
* The first remaining after this selection
"""
function pick_preferred_platform(platforms)
Expand All @@ -480,7 +480,7 @@ function pick_preferred_platform(platforms)
platforms = plats
end
end
for a in ("x86_64", "i686", "aarch64", "powerpc64le", "armv7l")
for a in ("x86_64", "i686", "aarch64", "powerpc64le", "armv7l", "riscv64")
plats = filter(p->arch(p) == a, platforms)
if !isempty(plats)
platforms = plats
Expand Down
Loading