Commit 98037a0238

Veikka Tuominen <git@vexu.eu>
2022-11-30 16:20:34
compiler-rt: disable some exports for ofmt=c
1 parent f8b779c
Changed files (3)
lib/compiler_rt/atomics.zig
@@ -453,7 +453,7 @@ fn __atomic_fetch_nand_8(ptr: *u64, val: u64, model: i32) callconv(.C) u64 {
 }
 
 comptime {
-    if (supports_atomic_ops) {
+    if (supports_atomic_ops and builtin.object_format != .c) {
         @export(__atomic_load, .{ .name = "__atomic_load", .linkage = linkage });
         @export(__atomic_store, .{ .name = "__atomic_store", .linkage = linkage });
         @export(__atomic_exchange, .{ .name = "__atomic_exchange", .linkage = linkage });
lib/compiler_rt/memcpy.zig
@@ -1,8 +1,11 @@
 const std = @import("std");
 const common = @import("./common.zig");
+const builtin = @import("builtin");
 
 comptime {
-    @export(memcpy, .{ .name = "memcpy", .linkage = common.linkage });
+    if (builtin.object_format != .c) {
+        @export(memcpy, .{ .name = "memcpy", .linkage = common.linkage });
+    }
 }
 
 pub fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, len: usize) callconv(.C) ?[*]u8 {
lib/compiler_rt/memset.zig
@@ -1,9 +1,12 @@
 const std = @import("std");
 const common = @import("./common.zig");
+const builtin = @import("builtin");
 
 comptime {
-    @export(memset, .{ .name = "memset", .linkage = common.linkage });
-    @export(__memset, .{ .name = "__memset", .linkage = common.linkage });
+    if (builtin.object_format != .c) {
+        @export(memset, .{ .name = "memset", .linkage = common.linkage });
+        @export(__memset, .{ .name = "__memset", .linkage = common.linkage });
+    }
 }
 
 pub fn memset(dest: ?[*]u8, c: u8, len: usize) callconv(.C) ?[*]u8 {