Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 8 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobserver = "0.1.30"
leb128 = "0.2.5"
libc = "0.2.171"
libloading = "0.9.0"
target-lexicon = "0.13.5"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

memchr = "2.6.0"
memmap2 = "0.9.0"
mimalloc = { version = "0.1", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions libwild/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ libloading = { workspace = true, optional = true }
linker-layout = { path = "../linker-layout", version = "0.8.0" }
linker-trace = { path = "../linker-trace", version = "0.8.0" }
linker-utils = { path = "../linker-utils", version = "0.8.0" }
target-lexicon = { workspace = true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it near to other t.. deps.

memchr = { workspace = true }
memmap2 = { workspace = true }
object = { workspace = true }
Expand Down
14 changes: 14 additions & 0 deletions libwild/src/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ pub(crate) enum Architecture {
LoongArch64,
}

impl Architecture {
/// Convert a `target_lexicon::Architecture` to an `Architecture`.
/// Panics if the architecture is not supported.
pub const fn from_target_lexicon(arch: target_lexicon::Architecture) -> Self {
match arch {
target_lexicon::Architecture::X86_64 => Self::X86_64,
target_lexicon::Architecture::Aarch64(_) => Self::AArch64,
target_lexicon::Architecture::Riscv64(_) => Self::RISCV64,
target_lexicon::Architecture::LoongArch64 => Self::LoongArch64,
_ => panic!("Unsupported architecture"),
}
}
}

impl TryFrom<u16> for Architecture {
type Error = crate::error::Error;

Expand Down
Loading