Skip to content

Commit

Permalink
Fix detection of riscv64-linux-android target features
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnatsel committed Sep 7, 2024
1 parent 1304b57 commit 52ce497
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cargo-auditable/src/object_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ fn riscv_features(target_triple: &str) -> String {
if extensions.contains('g') {
extensions.push_str("imadf");
}
// Most but not all riscv targets declare target features.
// A notable exception is `riscv64-linux-android`.
// We assume that all Linux-capable targets are -gc.
if target_triple.contains("linux") {
extensions.push_str("imadfc");
}
extensions
}

Expand Down Expand Up @@ -234,6 +240,11 @@ mod tests {
assert!(!features.contains('c'));
assert!(!features.contains('d'));
assert!(features.contains('f'));
// real-world Android riscv target
let features = riscv_features("riscv64-linux-android");
assert!(features.contains('c'));
assert!(features.contains('d'));
assert!(features.contains('f'));
}

#[test]
Expand Down

0 comments on commit 52ce497

Please sign in to comment.