diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 4d69a624f9..7b66998dc1 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -751,9 +751,18 @@ else /// therefore must be kept in sync with the compiler implementation. pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn { @setCold(true); + // Until self-hosted catches up with stage1 language features, we have a simpler // default panic function: - if (builtin.zig_backend != .stage1 and builtin.zig_backend != .stage2_llvm) { + if ((builtin.zig_backend == .stage2_llvm and builtin.link_libc) or + builtin.zig_backend == .stage2_c or + builtin.zig_backend == .stage2_wasm or + builtin.zig_backend == .stage2_arm or + builtin.zig_backend == .stage2_aarch64 or + builtin.zig_backend == .stage2_x86_64 or + builtin.zig_backend == .stage2_x86 or + builtin.zig_backend == .stage2_riscv64) + { while (true) { @breakpoint(); } diff --git a/lib/std/c/linux.zig b/lib/std/c/linux.zig index a0f90f563b..5f96fe3fe0 100644 --- a/lib/std/c/linux.zig +++ b/lib/std/c/linux.zig @@ -263,7 +263,11 @@ pub extern "c" fn inotify_rm_watch(fd: fd_t, wd: c_int) c_int; /// See std.elf for constants for this pub extern "c" fn getauxval(__type: c_ulong) c_ulong; -pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int; +pub const dl_iterate_phdr_callback = switch (builtin.zig_backend) { + .stage1 => fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int, + else => *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int, +}; + pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int; pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; diff --git a/src/Sema.zig b/src/Sema.zig index 28110efc83..8ac994a543 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -6231,6 +6231,10 @@ fn funcCommon( comptime_params[i] = param.is_comptime or try sema.typeRequiresComptime(block, param_src, param.ty); is_generic = is_generic or comptime_params[i] or param.ty.tag() == .generic_poison; + if (is_extern and is_generic) { + // TODO add note: function is generic because of this parameter + return sema.fail(block, param_src, "extern function cannot be generic", .{}); + } } is_generic = is_generic or