Commit 50e2fb8fd0

kcbanner <kcbanner@gmail.com>
2023-11-06 05:36:11
cbe: fixup __asm style exports, re-enable 12680 on macos now that alias isn't used
1 parent 8c0e0cd
Changed files (2)
lib
test
behavior
lib/zig.h
@@ -194,9 +194,11 @@ typedef char bool;
 #endif /*_M_X64 */
 #else /* _MSC_VER */
 #if __APPLE__
-#define zig_export(sig, symbol, name) __asm("_" name " = _" #symbol)
+#define zig_export(sig, symbol, name) zig_extern sig;\
+    __asm("_" name " = _" #symbol)
 #else /* __APPLE__ */
-#define zig_export(sig, symbol, name) __asm(name " = " #symbol)
+#define zig_export(sig, symbol, name) zig_extern sig;\
+    __asm(name " = " #symbol)
 #endif /* __APPLE__ */
 #endif /* _MSC_VER */
 
test/behavior/bugs/12680.zig
@@ -12,11 +12,6 @@ test "export a function twice" {
     if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
     if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
 
-    if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) {
-        // TODO: test.c: error: aliases are not supported on darwin
-        return error.SkipZigTest;
-    }
-
     // If it exports the function correctly, `test_func` and `testFunc` will points to the same address.
     try expectEqual(test_func(), other_file.testFunc());
 }