From 11fe943a11a2752b3fc743416777bb26f24a8a86 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 7 Jun 2022 11:30:00 +1000 Subject: [PATCH] Fix `parse_abi` for `gnu_ilp32` and `gnuspe` Signed-off-by: Jiahao XU --- src/target.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/target.rs b/src/target.rs index d4456244..af3f02d2 100644 --- a/src/target.rs +++ b/src/target.rs @@ -120,16 +120,14 @@ mod linux { } fn parse_abi() -> &'static str { - if TARGET.ends_with("abi64") { - "abi64" - } else if TARGET.ends_with("eabi") { - "eabi" - } else if TARGET.ends_with("eabihf") { - "eabihf" - } else if TARGET.ends_with("gnu") || TARGET.ends_with("musl") { - "" + let last = TARGET.rsplit_once('-').unwrap().1; + + if let Some(libc_version) = last.strip_prefix("musl") { + libc_version + } else if let Some(libc_version) = last.strip_prefix("gnu") { + libc_version } else { - panic!("Unknown abi") + panic!("Unrecognized libc") } }