From 084eab03d75187df41fbda5e4bd78e89d96297ff Mon Sep 17 00:00:00 2001 From: Sertonix Date: Wed, 22 Apr 2026 12:15:35 +0200 Subject: [PATCH] compiler_rt: Fix extern mem{set,cpy,move} type on arm Otherwise gcc will refuse to compile the bootstrap compiler_rt.c. Excerpt of the errors: /builds/sertonix/aports/community/zig/src/zig-0.16.0/build/compiler_rt.c:1459:21: error: conflicting types for 'memcpy'; have 'uint8_t *(uint8_t *, const uint8_t *, uintptr_t)' {aka 'unsigned char *(unsigned char *, const unsigned char *, unsigned int)'} 1459 | zig_extern uint8_t *memcpy(uint8_t *a0 zig_nonstring, uint8_t const *a1 zig_nonstring, uintptr_t a2); | ^~~~~~ /builds/sertonix/aports/community/zig/src/zig-0.16.0/stage1/zig.h:510:18: note: previous declaration of 'memcpy' with type 'void *(void *, const void *, unsigned int)' 510 | zig_extern void *memcpy (void *zig_restrict, void const *zig_restrict, size_t); | ^~~~~~ /builds/sertonix/aports/community/zig/src/zig-0.16.0/build/compiler_rt.c: In function 'zig_e___negxf2': /builds/sertonix/aports/community/zig/src/zig-0.16.0/build/compiler_rt.c:1758:9: error: passing argument 1 of 'memcpy' from incompatible pointer type [-Wincompatible-pointer-types] 1758 | memcpy(&t0, &a0, 16); | ^~~ | | | zig_u128 * --- lib/compiler_rt/arm.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/compiler_rt/arm.zig b/lib/compiler_rt/arm.zig index eecb0e5d037bf5cbbb385caad94864a155a502d4..d3a9e4f69695026fd6435d0f4b21ee8e7d1f5455 100644 --- a/lib/compiler_rt/arm.zig +++ b/lib/compiler_rt/arm.zig @@ -57,9 +57,9 @@ const __udivmodsi4 = @import("int.zig").__udivmodsi4; const __divmoddi4 = @import("int.zig").__divmoddi4; const __udivmoddi4 = @import("int.zig").__udivmoddi4; -extern fn memset(dest: ?[*]u8, c: i32, n: usize) ?[*]u8; -extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) ?[*]u8; -extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) ?[*]u8; +extern fn memset(dest: ?*anyopaque, c: i32, n: usize) ?*anyopaque; +extern fn memcpy(noalias dest: ?*anyopaque, noalias src: ?*const anyopaque, n: usize) ?*anyopaque; +extern fn memmove(dest: ?*anyopaque, src: ?*const anyopaque, n: usize) ?*anyopaque; pub fn __aeabi_memcpy(dest: [*]u8, src: [*]u8, n: usize) callconv(.{ .arm_aapcs = .{} }) void { @setRuntimeSafety(false); -- 2.54.0