Port rldd

This commit is contained in:
Wildan M 2026-08-27 09:19:01 +07:00
parent 81bc5bf19a
commit 4e0432c4bc
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79
5 changed files with 86 additions and 0 deletions

View File

@ -95,6 +95,7 @@ python312 = {}
redoxfs = {}
relibc = {}
ripgrep = {}
rldd = {}
rsync = {}
rust = {}
rustpython = {}

View File

@ -240,6 +240,7 @@ relibc = {}
relibc-tests = {}
relibc-tests-bins = {}
ripgrep = {}
rldd = {}
rodioplay = {}
rs-nes = {}
rsille = {}

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
rldd -l $1

View File

@ -0,0 +1,14 @@
[source]
git = "https://github.com/zatrazz/rldd"
rev = "v0.4.0"
patches = [ "redox.patch" ]
[build]
template = "custom"
script = """
DYNAMIC_INIT
cookbook_cargo
cp ${COOKBOOK_RECIPE}/ldd.sh ${COOKBOOK_STAGE}/usr/bin/ldd
chmod +x ${COOKBOOK_STAGE}/usr/bin/ldd
"""

View File

@ -0,0 +1,67 @@
diff --git a/Cargo.toml b/Cargo.toml
index 0a346a7..14d9171 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,12 +33,3 @@ raw-cpuid = "11.6.0"
[target.'cfg(target_os = "freebsd")'.dev-dependencies]
tempfile = "3.3.0"
-
-[profile.release]
-strip = true
-opt-level = "z"
-lto = true
-# Defaultimproves compile times, but prevents some optimizations.
-codegen-units = 1
-# Remove stack unwinder and backtrace.
-panic = "abort"
diff --git a/src/deptree.rs b/src/deptree.rs
index c0f3f93..fc6a44d 100644
--- a/src/deptree.rs
+++ b/src/deptree.rs
@@ -96,7 +96,7 @@ impl fmt::Display for DepMode {
DepMode::LdCache => write!(f, "[ld-so.hints]"),
#[cfg(target_os = "netbsd")]
DepMode::LdCache => write!(f, "[ld.so.conf]"),
- #[cfg(any(target_os = "illumos", target_os = "solaris"))]
+ #[cfg(any(target_os = "illumos", target_os = "solaris", target_os = "redox"))]
DepMode::LdCache => write!(f, "[unknown]"),
#[cfg(target_os = "macos")]
DepMode::LdCache => write!(f, "[dyld cache]"),
diff --git a/src/elf.rs b/src/elf.rs
index 1b1add2..9b7e621 100644
--- a/src/elf.rs
+++ b/src/elf.rs
@@ -526,6 +526,10 @@ fn check_elf_header(elc: &ElfInfo) -> bool {
fn check_elf_header(elc: &ElfInfo) -> bool {
elc.ei_osabi == ELFOSABI_SYSV || elc.ei_osabi == ELFOSABI_SOLARIS
}
+#[cfg(any(target_os = "redox"))]
+fn check_elf_header(elc: &ElfInfo) -> bool {
+ elc.ei_osabi == ELFOSABI_SYSV
+}
fn match_elf_header(a1: &ElfInfo, a2: &ElfInfo) -> bool {
a1.ei_class == a2.ei_class && a1.ei_data == a2.ei_data && a1.e_machine == a2.e_machine
@@ -893,7 +897,7 @@ fn load_so_cache<P: AsRef<Path>>(ld_cache: &mut Option<LoaderCache>, _binary: &P
*ld_cache = ld_so_conf_netbsd::parse_ld_so_conf(&Path::new("/etc/ld.so.conf")).ok()
}
}
-#[cfg(any(target_os = "illumos", target_os = "solaris"))]
+#[cfg(any(target_os = "illumos", target_os = "solaris", target_os = "redox"))]
fn load_so_cache<P: AsRef<Path>>(_ld_cache: &mut Option<LoaderCache>, _binary: &P, _ecl: &ElfInfo) {
}
diff --git a/src/elf/system_dirs.rs b/src/elf/system_dirs.rs
index 6641544..e19aebe 100644
--- a/src/elf/system_dirs.rs
+++ b/src/elf/system_dirs.rs
@@ -245,7 +245,7 @@ pub fn get_system_dirs(
.collect())
}
-#[cfg(any(target_os = "openbsd", target_os = "netbsd"))]
+#[cfg(any(target_os = "openbsd", target_os = "netbsd", target_os = "redox"))]
pub fn get_system_dirs(
_interp: &Option<String>,
_is_musl: bool,