stage2: add all functions to freestanding libc

Looks like all these functions are at least compiling successfully. I
haven't tried to run their test suites yet.

The one exception is `clone` which is crashing the compiler due to the
inline assembly. Still, this is progress!
This commit is contained in:
Andrew Kelley 2022-03-03 00:37:58 -07:00
parent b33f3b23c9
commit 67ba4c5679
3 changed files with 1106 additions and 1106 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -23,9 +23,7 @@ const long_double_is_f128 = builtin.target.longDoubleIsF128();
comptime { comptime {
// These files do their own comptime exporting logic. // These files do their own comptime exporting logic.
if (builtin.zig_backend == .stage1) { _ = @import("compiler_rt/atomics.zig");
_ = @import("compiler_rt/atomics.zig");
}
if (builtin.zig_backend != .stage2_llvm) { // TODO if (builtin.zig_backend != .stage2_llvm) { // TODO
_ = @import("compiler_rt/clear_cache.zig").clear_cache; _ = @import("compiler_rt/clear_cache.zig").clear_cache;
} }
@ -201,7 +199,7 @@ comptime {
const __trunctfxf2 = @import("compiler_rt/trunc_f80.zig").__trunctfxf2; const __trunctfxf2 = @import("compiler_rt/trunc_f80.zig").__trunctfxf2;
@export(__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = linkage }); @export(__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = linkage });
if (builtin.zig_backend == .stage1) { if (builtin.zig_backend == .stage1) { // TODO
switch (arch) { switch (arch) {
.i386, .i386,
.x86_64, .x86_64,
@ -304,7 +302,7 @@ comptime {
const __floatunsisf = @import("compiler_rt/floatunsisf.zig").__floatunsisf; const __floatunsisf = @import("compiler_rt/floatunsisf.zig").__floatunsisf;
@export(__floatunsisf, .{ .name = "__floatunsisf", .linkage = linkage }); @export(__floatunsisf, .{ .name = "__floatunsisf", .linkage = linkage });
if (builtin.zig_backend == .stage1) { if (builtin.zig_backend == .stage1) { // TODO it's crashing on a switch expression
const __floatundisf = @import("compiler_rt/floatundisf.zig").__floatundisf; const __floatundisf = @import("compiler_rt/floatundisf.zig").__floatundisf;
@export(__floatundisf, .{ .name = "__floatundisf", .linkage = linkage }); @export(__floatundisf, .{ .name = "__floatundisf", .linkage = linkage });
} }
@ -789,11 +787,6 @@ fn floorl(x: c_longdouble) callconv(.C) c_longdouble {
pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn {
_ = error_return_trace; _ = error_return_trace;
@setCold(true); @setCold(true);
if (builtin.zig_backend != .stage1) {
while (true) {
@breakpoint();
}
}
if (is_test) { if (is_test) {
std.debug.panic("{s}", .{msg}); std.debug.panic("{s}", .{msg});
} else { } else {