Skip to content

Commit 0a15ee8

Browse files
androm3daJohnTitor
authored andcommitted
enable musl32_time64 and musl_v1_2_3 for hexagon
Hexagon musl uses 64-bit time_t (__USE_TIME_BITS64), so add it to MUSL_REDIR_TIME64_ARCHES and force musl_v1_2_3 since hexagon only exists with recent musl. Without this, time_t is c_long (4 bytes) causing a 24-byte stack buffer overflow on fstat() calls.
1 parent 12bbae2 commit 0a15ee8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[
5252
];
5353

5454
/// Musl architectures that set `#define _REDIR_TIME64 1`.
55-
const MUSL_REDIR_TIME64_ARCHES: &[&str] = &["arm", "mips", "powerpc", "x86"];
55+
const MUSL_REDIR_TIME64_ARCHES: &[&str] = &["arm", "hexagon", "mips", "powerpc", "x86"];
5656

5757
fn main() {
5858
// Avoid unnecessary re-building.
@@ -110,8 +110,8 @@ fn main() {
110110
// OpenHarmony uses a fork of the musl libc
111111
let musl = target_env == "musl" || target_env == "ohos";
112112

113-
// loongarch64 and ohos only exist with recent musl
114-
if target_arch == "loongarch64" || target_env == "ohos" {
113+
// loongarch64, hexagon, and ohos only exist with recent musl
114+
if target_arch == "loongarch64" || target_arch == "hexagon" || target_env == "ohos" {
115115
musl_v1_2_3 = true;
116116
}
117117

libc-test/build.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,6 +3685,7 @@ fn test_linux(target: &str) {
36853685
let gnueabihf = target.contains("gnueabihf");
36863686
let x86_64_gnux32 = target.contains("gnux32") && x86_64;
36873687
let riscv64 = target.contains("riscv64");
3688+
let hexagon = target.contains("hexagon");
36883689
let loongarch64 = target.contains("loongarch64");
36893690
let wasm32 = target.contains("wasm32");
36903691
let uclibc = target.contains("uclibc");
@@ -3699,9 +3700,9 @@ fn test_linux(target: &str) {
36993700
let old_musl = musl && !musl_v1_2_3;
37003701

37013702
let mut cfg = ctest_cfg();
3702-
if (musl_v1_2_3 || loongarch64) && musl {
3703+
if (musl_v1_2_3 || loongarch64 || hexagon) && musl {
37033704
cfg.cfg("musl_v1_2_3", None);
3704-
if arm || ppc32 || x86_32 || mips32 {
3705+
if arm || hexagon || ppc32 || x86_32 || mips32 {
37053706
cfg.cfg("musl32_time64", None);
37063707
cfg.cfg("linux_time_bits64", None);
37073708
}

0 commit comments

Comments
 (0)