authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2022-10-07 21:24:44+03:30
committergravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2022-11-04 00:09:27+03:30
logf5f1f8c66625237e4eceb3cd40597a687e9a58ac
tree913632d097ffcdeea739da3a2f9b5b023e0ba81c
parent678f3f6e65e8808520973912fb6c4d7dbca189fe

all: rename i386 to x86


67 files changed, 587 insertions(+), 587 deletions(-)

doc/langref.html.in+6-6
......@@ -5126,7 +5126,7 @@ const builtin = @import("builtin");
51265126const native_arch = builtin.cpu.arch;
51275127const expect = std.testing.expect;
51285128
5129const WINAPI: std.builtin.CallingConvention = if (native_arch == .i386) .Stdcall else .C;
5129const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .Stdcall else .C;
51305130extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn;
51315131
51325132test "foo" {
......@@ -5165,7 +5165,7 @@ export fn sub(a: i8, b: i8) i8 { return a - b; }
51655165// at link time, when linking statically, or at runtime, when linking
51665166// dynamically.
51675167// The callconv specifier changes the calling convention of the function.
5168const WINAPI: std.builtin.CallingConvention = if (native_arch == .i386) .Stdcall else .C;
5168const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .Stdcall else .C;
51695169extern "kernel32" fn ExitProcess(exit_code: u32) callconv(WINAPI) noreturn;
51705170extern "c" fn atan2(a: f64, b: f64) f64;
51715171
......@@ -7487,7 +7487,7 @@ volatile (
74877487 : "rcx", "r11"
74887488);{#end_syntax_block#}
74897489 <p>
7490 For i386 and x86_64 targets, the syntax is AT&amp;T syntax, rather than the more
7490 For x86 and x86_64 targets, the syntax is AT&amp;T syntax, rather than the more
74917491 popular Intel syntax. This is due to technical constraints; assembly parsing is
74927492 provided by LLVM and its support for Intel syntax is buggy and not well tested.
74937493 </p>
......@@ -11608,7 +11608,7 @@ Architectures:
1160811608 v5
1160911609 v5te
1161011610 v4t
11611 i386
11611 x86
1161211612 x86_64 (native)
1161311613 xcore
1161411614 nvptx
......@@ -11687,8 +11687,8 @@ Available libcs:
1168711687 arm-linux-gnueabihf
1168811688 arm-linux-musleabi
1168911689 arm-linux-musleabihf
11690 i386-linux-gnu
11691 i386-linux-musl
11690 x86-linux-gnu
11691 x86-linux-musl
1169211692 mips64el-linux-gnuabi64
1169311693 mips64el-linux-gnuabin32
1169411694 mips64el-linux-musl
lib/c.zig+1-1
......@@ -190,7 +190,7 @@ test "strncmp" {
190190// across .o file boundaries. fix comptime @ptrCast of nakedcc functions.
191191fn clone() callconv(.Naked) void {
192192 switch (native_arch) {
193 .i386 => {
193 .x86 => {
194194 // __clone(func, stack, flags, arg, ptid, tls, ctid)
195195 // +8, +12, +16, +20, +24, +28, +32
196196 // syscall(SYS_clone, flags, stack, ptid, tls, ctid)
lib/compiler_rt/aulldiv.zig+1-1
......@@ -7,7 +7,7 @@ const common = @import("common.zig");
77pub const panic = common.panic;
88
99comptime {
10 if (arch == .i386 and abi == .msvc) {
10 if (arch == .x86 and abi == .msvc) {
1111 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
1212 @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage });
1313 @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage });
lib/compiler_rt/aullrem.zig+1-1
......@@ -7,7 +7,7 @@ const common = @import("common.zig");
77pub const panic = common.panic;
88
99comptime {
10 if (arch == .i386 and abi == .msvc) {
10 if (arch == .x86 and abi == .msvc) {
1111 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
1212 @export(_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage });
1313 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage });
lib/compiler_rt/clear_cache.zig+1-1
......@@ -17,7 +17,7 @@ comptime {
1717
1818fn clear_cache(start: usize, end: usize) callconv(.C) void {
1919 const x86 = switch (arch) {
20 .i386, .x86_64 => true,
20 .x86, .x86_64 => true,
2121 else => false,
2222 };
2323 const arm32 = switch (arch) {
lib/compiler_rt/common.zig+2-2
......@@ -48,7 +48,7 @@ pub const gnu_f16_abi = switch (builtin.cpu.arch) {
4848 .x86_64,
4949 => false,
5050
51 .i386 => true,
51 .x86 => true,
5252
5353 .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) {
5454 .eabi, .eabihf => false,
......@@ -79,7 +79,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?
7979pub const F16T = switch (builtin.cpu.arch) {
8080 .aarch64, .aarch64_be, .aarch64_32 => f16,
8181 .riscv64 => if (builtin.zig_backend == .stage1) u16 else f16,
82 .i386, .x86_64 => f16,
82 .x86, .x86_64 => f16,
8383 else => u16,
8484};
8585
lib/compiler_rt/divti3.zig+1-1
......@@ -9,7 +9,7 @@ pub const panic = common.panic;
99comptime {
1010 if (builtin.os.tag == .windows) {
1111 switch (arch) {
12 .i386 => {
12 .x86 => {
1313 @export(__divti3, .{ .name = "__divti3", .linkage = common.linkage });
1414 },
1515 .x86_64 => {
lib/compiler_rt/extendf_test.zig+1-1
......@@ -140,7 +140,7 @@ test "extendhfsf2" {
140140 try test__extendhfsf2(0x7f00, 0x7fe00000); // sNaN
141141 // On x86 the NaN becomes quiet because the return is pushed on the x87
142142 // stack due to ABI requirements
143 if (builtin.target.cpu.arch != .i386 and builtin.target.os.tag == .windows)
143 if (builtin.target.cpu.arch != .x86 and builtin.target.os.tag == .windows)
144144 try test__extendhfsf2(0x7c01, 0x7f802000); // sNaN
145145
146146 try test__extendhfsf2(0, 0); // 0
lib/compiler_rt/stack_probe.zig+5-5
......@@ -30,7 +30,7 @@ comptime {
3030 }
3131
3232 switch (arch) {
33 .i386,
33 .x86,
3434 .x86_64,
3535 => {
3636 @export(zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage });
......@@ -69,7 +69,7 @@ pub fn zig_probe_stack() callconv(.Naked) void {
6969 \\ ret
7070 );
7171 },
72 .i386 => {
72 .x86 => {
7373 // %eax = probe length, %esp = stack pointer
7474 asm volatile (
7575 \\ push %%ecx
......@@ -121,7 +121,7 @@ fn win_probe_stack_only() void {
121121 \\ ret
122122 );
123123 },
124 .i386 => {
124 .x86 => {
125125 asm volatile (
126126 \\ push %%ecx
127127 \\ push %%eax
......@@ -191,7 +191,7 @@ fn win_probe_stack_adjust_sp() void {
191191 \\ ret
192192 );
193193 },
194 .i386 => {
194 .x86 => {
195195 asm volatile (
196196 \\ push %%ecx
197197 \\ cmp $0x1000,%%eax
......@@ -243,7 +243,7 @@ pub fn __chkstk() callconv(.Naked) void {
243243 if (comptime arch.isAARCH64()) {
244244 @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{});
245245 } else switch (arch) {
246 .i386 => @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}),
246 .x86 => @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}),
247247 .x86_64 => @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}),
248248 else => unreachable,
249249 }
lib/libc/glibc/abilists
Binary files a/lib/libc/glibc/abilists and b/lib/libc/glibc/abilists differ
lib/ssp.zig+1-1
......@@ -35,7 +35,7 @@ export fn __chk_fail() callconv(.C) noreturn {
3535 @panic("buffer overflow detected");
3636}
3737
38// Emitted when targeting some architectures (eg. i386)
38// Emitted when targeting some architectures (eg. x86)
3939// XXX: This symbol should be hidden
4040export fn __stack_chk_fail_local() callconv(.C) noreturn {
4141 __stack_chk_fail();
lib/std/Thread.zig+4-4
......@@ -753,7 +753,7 @@ const LinuxThreadImpl = struct {
753753 /// https://github.com/ifduyue/musl/search?q=__unmapself
754754 fn freeAndExit(self: *ThreadCompletion) noreturn {
755755 switch (target.cpu.arch) {
756 .i386 => asm volatile (
756 .x86 => asm volatile (
757757 \\ movl $91, %%eax
758758 \\ movl %[ptr], %%ebx
759759 \\ movl %[len], %%ecx
......@@ -959,10 +959,10 @@ const LinuxThreadImpl = struct {
959959 else => |e| return e,
960960 };
961961
962 // Prepare the TLS segment and prepare a user_desc struct when needed on i386
962 // Prepare the TLS segment and prepare a user_desc struct when needed on x86
963963 var tls_ptr = os.linux.tls.prepareTLS(mapped[tls_offset..]);
964 var user_desc: if (target.cpu.arch == .i386) os.linux.user_desc else void = undefined;
965 if (target.cpu.arch == .i386) {
964 var user_desc: if (target.cpu.arch == .x86) os.linux.user_desc else void = undefined;
965 if (target.cpu.arch == .x86) {
966966 defer tls_ptr = @ptrToInt(&user_desc);
967967 user_desc = .{
968968 .entry_number = os.linux.tls.tls_image.gdt_entry_number,
lib/std/atomic.zig+1-1
......@@ -44,7 +44,7 @@ pub inline fn spinLoopHint() void {
4444 // No-op instruction that can hint to save (or share with a hardware-thread)
4545 // pipelining/power resources
4646 // https://software.intel.com/content/www/us/en/develop/articles/benefitting-power-and-performance-sleep-loops.html
47 .i386, .x86_64 => asm volatile ("pause" ::: "memory"),
47 .x86, .x86_64 => asm volatile ("pause" ::: "memory"),
4848
4949 // No-op instruction that serves as a hardware-thread resource yield hint.
5050 // https://stackoverflow.com/a/7588941
lib/std/build.zig+2-2
......@@ -2978,12 +2978,12 @@ pub const LibExeObjStep = struct {
29782978 if (glibc_dir_arg) |dir| {
29792979 // TODO look into making this a call to `linuxTriple`. This
29802980 // needs the directory to be called "i686" rather than
2981 // "i386" which is why we do it manually here.
2981 // "x86" which is why we do it manually here.
29822982 const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";
29832983 const cpu_arch = self.target.getCpuArch();
29842984 const os_tag = self.target.getOsTag();
29852985 const abi = self.target.getAbi();
2986 const cpu_arch_name: []const u8 = if (cpu_arch == .i386)
2986 const cpu_arch_name: []const u8 = if (cpu_arch == .x86)
29872987 "i686"
29882988 else
29892989 @tagName(cpu_arch);
lib/std/build/EmulatableRunStep.zig+2-2
......@@ -95,12 +95,12 @@ fn make(step: *Step) !void {
9595 if (glibc_dir_arg) |dir| {
9696 // TODO look into making this a call to `linuxTriple`. This
9797 // needs the directory to be called "i686" rather than
98 // "i386" which is why we do it manually here.
98 // "x86" which is why we do it manually here.
9999 const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";
100100 const cpu_arch = self.exe.target.getCpuArch();
101101 const os_tag = self.exe.target.getOsTag();
102102 const abi = self.exe.target.getAbi();
103 const cpu_arch_name: []const u8 = if (cpu_arch == .i386)
103 const cpu_arch_name: []const u8 = if (cpu_arch == .x86)
104104 "i686"
105105 else
106106 @tagName(cpu_arch);
lib/std/c/freebsd.zig+1-1
......@@ -1444,7 +1444,7 @@ pub const E = enum(u16) {
14441444};
14451445
14461446pub const MINSIGSTKSZ = switch (builtin.cpu.arch) {
1447 .i386, .x86_64 => 2048,
1447 .x86, .x86_64 => 2048,
14481448 .arm, .aarch64 => 4096,
14491449 else => @compileError("MINSIGSTKSZ not defined for this architecture"),
14501450};
lib/std/c/netbsd.zig+4-4
......@@ -80,7 +80,7 @@ pub const pthread_cond_t = extern struct {
8080pub const pthread_rwlock_t = extern struct {
8181 magic: c_uint = 0x99990009,
8282 interlock: switch (builtin.cpu.arch) {
83 .aarch64, .sparc, .x86_64, .i386 => u8,
83 .aarch64, .sparc, .x86_64, .x86 => u8,
8484 .arm, .powerpc => c_int,
8585 else => unreachable,
8686 } = 0,
......@@ -97,7 +97,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) {
9797 .aarch64, .aarch64_be, .aarch64_32 => u8,
9898 .mips, .mipsel, .mips64, .mips64el => u32,
9999 .powerpc, .powerpc64, .powerpc64le => i32,
100 .i386, .x86_64 => u8,
100 .x86, .x86_64 => u8,
101101 .arm, .armeb, .thumb, .thumbeb => i32,
102102 .sparc, .sparcel, .sparc64 => u8,
103103 .riscv32, .riscv64 => u32,
......@@ -105,7 +105,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) {
105105};
106106
107107const padded_pthread_spin_t = switch (builtin.cpu.arch) {
108 .i386, .x86_64 => u32,
108 .x86, .x86_64 => u32,
109109 .sparc, .sparcel, .sparc64 => u32,
110110 else => pthread_spin_t,
111111};
......@@ -1067,7 +1067,7 @@ pub const ucontext_t = extern struct {
10671067 mcontext: mcontext_t,
10681068 __pad: [
10691069 switch (builtin.cpu.arch) {
1070 .i386 => 4,
1070 .x86 => 4,
10711071 .mips, .mipsel, .mips64, .mips64el => 14,
10721072 .arm, .armeb, .thumb, .thumbeb => 1,
10731073 .sparc, .sparcel, .sparc64 => if (@sizeOf(usize) == 4) 43 else 8,
lib/std/c/openbsd.zig+1-1
......@@ -1247,7 +1247,7 @@ pub const E = enum(u16) {
12471247};
12481248
12491249const _MAX_PAGE_SHIFT = switch (builtin.cpu.arch) {
1250 .i386 => 12,
1250 .x86 => 12,
12511251 .sparc64 => 13,
12521252};
12531253pub const MINSIGSTKSZ = 1 << _MAX_PAGE_SHIFT;
lib/std/coff.zig+2-2
......@@ -1025,7 +1025,7 @@ pub const MachineType = enum(u16) {
10251025 .powerpc => .POWERPC,
10261026 .riscv32 => .RISCV32,
10271027 .thumb => .Thumb,
1028 .i386 => .I386,
1028 .x86 => .I386,
10291029 .aarch64 => .ARM64,
10301030 .riscv64 => .RISCV64,
10311031 .x86_64 => .X64,
......@@ -1040,7 +1040,7 @@ pub const MachineType = enum(u16) {
10401040 .POWERPC => .powerpc,
10411041 .RISCV32 => .riscv32,
10421042 .Thumb => .thumb,
1043 .I386 => .i386,
1043 .I386 => .x86,
10441044 .ARM64 => .aarch64,
10451045 .RISCV64 => .riscv64,
10461046 .X64 => .x86_64,
lib/std/debug.zig+3-3
......@@ -182,7 +182,7 @@ pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void {
182182 // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid
183183 // an overflow. We do not need to signal `StackIterator` as it will correctly detect this
184184 // condition on the subsequent iteration and return `null` thus terminating the loop.
185 // same behaviour for i386-windows-msvc
185 // same behaviour for x86-windows-msvc
186186 const address = if (return_address == 0) return_address else return_address - 1;
187187 printSourceAtAddress(debug_info, stderr, address, tty_config) catch return;
188188 }
......@@ -568,7 +568,7 @@ pub fn writeCurrentStackTrace(
568568 // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid
569569 // an overflow. We do not need to signal `StackIterator` as it will correctly detect this
570570 // condition on the subsequent iteration and return `null` thus terminating the loop.
571 // same behaviour for i386-windows-msvc
571 // same behaviour for x86-windows-msvc
572572 const address = if (return_address == 0) return_address else return_address - 1;
573573 try printSourceAtAddress(debug_info, out_stream, address, tty_config);
574574 }
......@@ -1922,7 +1922,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
19221922 }
19231923
19241924 switch (native_arch) {
1925 .i386 => {
1925 .x86 => {
19261926 const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
19271927 const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]);
19281928 const bp = @intCast(usize, ctx.mcontext.gregs[os.REG.EBP]);
lib/std/elf.zig+1-1
......@@ -1502,7 +1502,7 @@ pub const EM = enum(u16) {
15021502 .MIPS_RS3_LE => .mipsel,
15031503 .PPC => .powerpc,
15041504 .SPARC => .sparc,
1505 .@"386" => .i386,
1505 .@"386" => .x86,
15061506 .XCORE => .xcore,
15071507 .CSR_KALIMBA => .kalimba,
15081508 .LANAI => .lanai,
lib/std/macho.zig+2-2
......@@ -1201,7 +1201,7 @@ pub const MH_DEAD_STRIPPABLE_DYLIB = 0x400000;
12011201/// Contains a section of type S_THREAD_LOCAL_VARIABLES
12021202pub const MH_HAS_TLV_DESCRIPTORS = 0x800000;
12031203
1204/// When this bit is set, the OS will run the main executable with a non-executable heap even on platforms (e.g. i386) that don't require it. Only used in MH_EXECUTE filetypes.
1204/// When this bit is set, the OS will run the main executable with a non-executable heap even on platforms (e.g. x86) that don't require it. Only used in MH_EXECUTE filetypes.
12051205pub const MH_NO_HEAP_EXECUTION = 0x1000000;
12061206
12071207/// The code was linked for use in an application extension.
......@@ -1444,7 +1444,7 @@ pub const S_ATTR_NO_DEAD_STRIP = 0x10000000;
14441444/// blocks are live if they reference live blocks
14451445pub const S_ATTR_LIVE_SUPPORT = 0x8000000;
14461446
1447/// used with i386 code stubs written on by dyld
1447/// used with x86 code stubs written on by dyld
14481448pub const S_ATTR_SELF_MODIFYING_CODE = 0x4000000;
14491449
14501450/// section contains some machine instructions
lib/std/os/linux.zig+22-22
......@@ -33,7 +33,7 @@ const syscall_bits = switch (native_arch) {
3333};
3434
3535const arch_bits = switch (native_arch) {
36 .i386 => @import("linux/i386.zig"),
36 .x86 => @import("linux/x86.zig"),
3737 .x86_64 => @import("linux/x86_64.zig"),
3838 .aarch64 => @import("linux/arm64.zig"),
3939 .arm, .thumb => @import("linux/arm-eabi.zig"),
......@@ -94,7 +94,7 @@ pub const SECCOMP = @import("linux/seccomp.zig");
9494
9595pub const syscalls = @import("linux/syscalls.zig");
9696pub const SYS = switch (@import("builtin").cpu.arch) {
97 .i386 => syscalls.X86,
97 .x86 => syscalls.X86,
9898 .x86_64 => syscalls.X64,
9999 .aarch64 => syscalls.Arm64,
100100 .arm, .thumb => syscalls.Arm,
......@@ -1198,42 +1198,42 @@ pub fn sigismember(set: *const sigset_t, sig: u6) bool {
11981198}
11991199
12001200pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize {
1201 if (native_arch == .i386) {
1201 if (native_arch == .x86) {
12021202 return socketcall(SC.getsockname, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) });
12031203 }
12041204 return syscall3(.getsockname, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len));
12051205}
12061206
12071207pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize {
1208 if (native_arch == .i386) {
1208 if (native_arch == .x86) {
12091209 return socketcall(SC.getpeername, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) });
12101210 }
12111211 return syscall3(.getpeername, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len));
12121212}
12131213
12141214pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize {
1215 if (native_arch == .i386) {
1215 if (native_arch == .x86) {
12161216 return socketcall(SC.socket, &[3]usize{ domain, socket_type, protocol });
12171217 }
12181218 return syscall3(.socket, domain, socket_type, protocol);
12191219}
12201220
12211221pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize {
1222 if (native_arch == .i386) {
1222 if (native_arch == .x86) {
12231223 return socketcall(SC.setsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen) });
12241224 }
12251225 return syscall5(.setsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen));
12261226}
12271227
12281228pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize {
1229 if (native_arch == .i386) {
1229 if (native_arch == .x86) {
12301230 return socketcall(SC.getsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen) });
12311231 }
12321232 return syscall5(.getsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen));
12331233}
12341234
12351235pub fn sendmsg(fd: i32, msg: *const std.x.os.Socket.Message, flags: c_int) usize {
1236 if (native_arch == .i386) {
1236 if (native_arch == .x86) {
12371237 return socketcall(SC.sendmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) });
12381238 }
12391239 return syscall3(.sendmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)));
......@@ -1280,49 +1280,49 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize
12801280}
12811281
12821282pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize {
1283 if (native_arch == .i386) {
1283 if (native_arch == .x86) {
12841284 return socketcall(SC.connect, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len });
12851285 }
12861286 return syscall3(.connect, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len);
12871287}
12881288
12891289pub fn recvmsg(fd: i32, msg: *std.x.os.Socket.Message, flags: c_int) usize {
1290 if (native_arch == .i386) {
1290 if (native_arch == .x86) {
12911291 return socketcall(SC.recvmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) });
12921292 }
12931293 return syscall3(.recvmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)));
12941294}
12951295
12961296pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize {
1297 if (native_arch == .i386) {
1297 if (native_arch == .x86) {
12981298 return socketcall(SC.recvfrom, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen) });
12991299 }
13001300 return syscall6(.recvfrom, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen));
13011301}
13021302
13031303pub fn shutdown(fd: i32, how: i32) usize {
1304 if (native_arch == .i386) {
1304 if (native_arch == .x86) {
13051305 return socketcall(SC.shutdown, &[2]usize{ @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)) });
13061306 }
13071307 return syscall2(.shutdown, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)));
13081308}
13091309
13101310pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize {
1311 if (native_arch == .i386) {
1311 if (native_arch == .x86) {
13121312 return socketcall(SC.bind, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len) });
13131313 }
13141314 return syscall3(.bind, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len));
13151315}
13161316
13171317pub fn listen(fd: i32, backlog: u32) usize {
1318 if (native_arch == .i386) {
1318 if (native_arch == .x86) {
13191319 return socketcall(SC.listen, &[2]usize{ @bitCast(usize, @as(isize, fd)), backlog });
13201320 }
13211321 return syscall2(.listen, @bitCast(usize, @as(isize, fd)), backlog);
13221322}
13231323
13241324pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize {
1325 if (native_arch == .i386) {
1325 if (native_arch == .x86) {
13261326 return socketcall(SC.sendto, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen) });
13271327 }
13281328 return syscall6(.sendto, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen));
......@@ -1349,21 +1349,21 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize {
13491349}
13501350
13511351pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: *[2]i32) usize {
1352 if (native_arch == .i386) {
1352 if (native_arch == .x86) {
13531353 return socketcall(SC.socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd) });
13541354 }
13551355 return syscall4(.socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd));
13561356}
13571357
13581358pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize {
1359 if (native_arch == .i386) {
1359 if (native_arch == .x86) {
13601360 return socketcall(SC.accept, &[4]usize{ fd, addr, len, 0 });
13611361 }
13621362 return accept4(fd, addr, len, 0);
13631363}
13641364
13651365pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize {
1366 if (native_arch == .i386) {
1366 if (native_arch == .x86) {
13671367 return socketcall(SC.accept4, &[4]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags });
13681368 }
13691369 return syscall4(.accept4, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags);
......@@ -3459,12 +3459,12 @@ pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {
34593459}
34603460
34613461pub const MINSIGSTKSZ = switch (native_arch) {
3462 .i386, .x86_64, .arm, .mipsel => 2048,
3462 .x86, .x86_64, .arm, .mipsel => 2048,
34633463 .aarch64 => 5120,
34643464 else => @compileError("MINSIGSTKSZ not defined for this architecture"),
34653465};
34663466pub const SIGSTKSZ = switch (native_arch) {
3467 .i386, .x86_64, .arm, .mipsel => 8192,
3467 .x86, .x86_64, .arm, .mipsel => 8192,
34683468 .aarch64 => 16384,
34693469 else => @compileError("SIGSTKSZ not defined for this architecture"),
34703470};
......@@ -5631,7 +5631,7 @@ pub const AUDIT = struct {
56315631 const LE = 0x40000000;
56325632
56335633 pub const current: AUDIT.ARCH = switch (native_arch) {
5634 .i386 => .I386,
5634 .x86 => .X86,
56355635 .x86_64 => .X86_64,
56365636 .aarch64 => .AARCH64,
56375637 .arm, .thumb => .ARM,
......@@ -5650,7 +5650,7 @@ pub const AUDIT = struct {
56505650 ARMEB = toAudit(.armeb),
56515651 CSKY = toAudit(.csky),
56525652 HEXAGON = @enumToInt(std.elf.EM.HEXAGON),
5653 I386 = toAudit(.i386),
5653 X86 = toAudit(.x86),
56545654 M68K = toAudit(.m68k),
56555655 MIPS = toAudit(.mips),
56565656 MIPSEL = toAudit(.mips) | LE,
lib/std/os/linux/i386.zig deleted-383
......@@ -1,383 +0,0 @@
1const std = @import("../../std.zig");
2const maxInt = std.math.maxInt;
3const linux = std.os.linux;
4const SYS = linux.SYS;
5const socklen_t = linux.socklen_t;
6const iovec = std.os.iovec;
7const iovec_const = std.os.iovec_const;
8const uid_t = linux.uid_t;
9const gid_t = linux.gid_t;
10const pid_t = linux.pid_t;
11const stack_t = linux.stack_t;
12const sigset_t = linux.sigset_t;
13const sockaddr = linux.sockaddr;
14const timespec = linux.timespec;
15
16pub fn syscall0(number: SYS) usize {
17 return asm volatile ("int $0x80"
18 : [ret] "={eax}" (-> usize),
19 : [number] "{eax}" (@enumToInt(number)),
20 : "memory"
21 );
22}
23
24pub fn syscall1(number: SYS, arg1: usize) usize {
25 return asm volatile ("int $0x80"
26 : [ret] "={eax}" (-> usize),
27 : [number] "{eax}" (@enumToInt(number)),
28 [arg1] "{ebx}" (arg1),
29 : "memory"
30 );
31}
32
33pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
34 return asm volatile ("int $0x80"
35 : [ret] "={eax}" (-> usize),
36 : [number] "{eax}" (@enumToInt(number)),
37 [arg1] "{ebx}" (arg1),
38 [arg2] "{ecx}" (arg2),
39 : "memory"
40 );
41}
42
43pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
44 return asm volatile ("int $0x80"
45 : [ret] "={eax}" (-> usize),
46 : [number] "{eax}" (@enumToInt(number)),
47 [arg1] "{ebx}" (arg1),
48 [arg2] "{ecx}" (arg2),
49 [arg3] "{edx}" (arg3),
50 : "memory"
51 );
52}
53
54pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
55 return asm volatile ("int $0x80"
56 : [ret] "={eax}" (-> usize),
57 : [number] "{eax}" (@enumToInt(number)),
58 [arg1] "{ebx}" (arg1),
59 [arg2] "{ecx}" (arg2),
60 [arg3] "{edx}" (arg3),
61 [arg4] "{esi}" (arg4),
62 : "memory"
63 );
64}
65
66pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
67 return asm volatile ("int $0x80"
68 : [ret] "={eax}" (-> usize),
69 : [number] "{eax}" (@enumToInt(number)),
70 [arg1] "{ebx}" (arg1),
71 [arg2] "{ecx}" (arg2),
72 [arg3] "{edx}" (arg3),
73 [arg4] "{esi}" (arg4),
74 [arg5] "{edi}" (arg5),
75 : "memory"
76 );
77}
78
79pub fn syscall6(
80 number: SYS,
81 arg1: usize,
82 arg2: usize,
83 arg3: usize,
84 arg4: usize,
85 arg5: usize,
86 arg6: usize,
87) usize {
88 // The 6th argument is passed via memory as we're out of registers if ebp is
89 // used as frame pointer. We push arg6 value on the stack before changing
90 // ebp or esp as the compiler may reference it as an offset relative to one
91 // of those two registers.
92 return asm volatile (
93 \\ push %[arg6]
94 \\ push %%ebp
95 \\ mov 4(%%esp), %%ebp
96 \\ int $0x80
97 \\ pop %%ebp
98 \\ add $4, %%esp
99 : [ret] "={eax}" (-> usize),
100 : [number] "{eax}" (@enumToInt(number)),
101 [arg1] "{ebx}" (arg1),
102 [arg2] "{ecx}" (arg2),
103 [arg3] "{edx}" (arg3),
104 [arg4] "{esi}" (arg4),
105 [arg5] "{edi}" (arg5),
106 [arg6] "rm" (arg6),
107 : "memory"
108 );
109}
110
111pub fn socketcall(call: usize, args: [*]usize) usize {
112 return asm volatile ("int $0x80"
113 : [ret] "={eax}" (-> usize),
114 : [number] "{eax}" (@enumToInt(SYS.socketcall)),
115 [arg1] "{ebx}" (call),
116 [arg2] "{ecx}" (@ptrToInt(args)),
117 : "memory"
118 );
119}
120
121const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
122
123/// This matches the libc clone function.
124pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
125
126pub fn restore() callconv(.Naked) void {
127 switch (@import("builtin").zig_backend) {
128 .stage2_c => return asm volatile (
129 \\ movl %[number], %%eax
130 \\ int $0x80
131 :
132 : [number] "i" (@enumToInt(SYS.sigreturn)),
133 : "memory"
134 ),
135 else => return asm volatile ("int $0x80"
136 :
137 : [number] "{eax}" (@enumToInt(SYS.sigreturn)),
138 : "memory"
139 ),
140 }
141}
142
143pub fn restore_rt() callconv(.Naked) void {
144 switch (@import("builtin").zig_backend) {
145 .stage2_c => return asm volatile (
146 \\ movl %[number], %%eax
147 \\ int $0x80
148 :
149 : [number] "i" (@enumToInt(SYS.rt_sigreturn)),
150 : "memory"
151 ),
152 else => return asm volatile ("int $0x80"
153 :
154 : [number] "{eax}" (@enumToInt(SYS.rt_sigreturn)),
155 : "memory"
156 ),
157 }
158}
159
160pub const O = struct {
161 pub const CREAT = 0o100;
162 pub const EXCL = 0o200;
163 pub const NOCTTY = 0o400;
164 pub const TRUNC = 0o1000;
165 pub const APPEND = 0o2000;
166 pub const NONBLOCK = 0o4000;
167 pub const DSYNC = 0o10000;
168 pub const SYNC = 0o4010000;
169 pub const RSYNC = 0o4010000;
170 pub const DIRECTORY = 0o200000;
171 pub const NOFOLLOW = 0o400000;
172 pub const CLOEXEC = 0o2000000;
173
174 pub const ASYNC = 0o20000;
175 pub const DIRECT = 0o40000;
176 pub const LARGEFILE = 0o100000;
177 pub const NOATIME = 0o1000000;
178 pub const PATH = 0o10000000;
179 pub const TMPFILE = 0o20200000;
180 pub const NDELAY = NONBLOCK;
181};
182
183pub const F = struct {
184 pub const DUPFD = 0;
185 pub const GETFD = 1;
186 pub const SETFD = 2;
187 pub const GETFL = 3;
188 pub const SETFL = 4;
189 pub const SETOWN = 8;
190 pub const GETOWN = 9;
191 pub const SETSIG = 10;
192 pub const GETSIG = 11;
193 pub const GETLK = 12;
194 pub const SETLK = 13;
195 pub const SETLKW = 14;
196 pub const SETOWN_EX = 15;
197 pub const GETOWN_EX = 16;
198 pub const GETOWNER_UIDS = 17;
199
200 pub const RDLCK = 0;
201 pub const WRLCK = 1;
202 pub const UNLCK = 2;
203};
204
205pub const LOCK = struct {
206 pub const SH = 1;
207 pub const EX = 2;
208 pub const NB = 4;
209 pub const UN = 8;
210};
211
212pub const MAP = struct {
213 pub const NORESERVE = 0x4000;
214 pub const GROWSDOWN = 0x0100;
215 pub const DENYWRITE = 0x0800;
216 pub const EXECUTABLE = 0x1000;
217 pub const LOCKED = 0x2000;
218 pub const @"32BIT" = 0x40;
219};
220
221pub const MMAP2_UNIT = 4096;
222
223pub const VDSO = struct {
224 pub const CGT_SYM = "__vdso_clock_gettime";
225 pub const CGT_VER = "LINUX_2.6";
226};
227
228pub const ARCH = struct {};
229
230pub const Flock = extern struct {
231 type: i16,
232 whence: i16,
233 start: off_t,
234 len: off_t,
235 pid: pid_t,
236};
237
238pub const msghdr = extern struct {
239 name: ?*sockaddr,
240 namelen: socklen_t,
241 iov: [*]iovec,
242 iovlen: i32,
243 control: ?*anyopaque,
244 controllen: socklen_t,
245 flags: i32,
246};
247
248pub const msghdr_const = extern struct {
249 name: ?*const sockaddr,
250 namelen: socklen_t,
251 iov: [*]const iovec_const,
252 iovlen: i32,
253 control: ?*const anyopaque,
254 controllen: socklen_t,
255 flags: i32,
256};
257
258pub const blksize_t = i32;
259pub const nlink_t = u32;
260pub const time_t = isize;
261pub const mode_t = u32;
262pub const off_t = i64;
263pub const ino_t = u64;
264pub const dev_t = u64;
265pub const blkcnt_t = i64;
266
267// The `stat` definition used by the Linux kernel.
268pub const Stat = extern struct {
269 dev: dev_t,
270 __dev_padding: u32,
271 __ino_truncated: u32,
272 mode: mode_t,
273 nlink: nlink_t,
274 uid: uid_t,
275 gid: gid_t,
276 rdev: dev_t,
277 __rdev_padding: u32,
278 size: off_t,
279 blksize: blksize_t,
280 blocks: blkcnt_t,
281 atim: timespec,
282 mtim: timespec,
283 ctim: timespec,
284 ino: ino_t,
285
286 pub fn atime(self: @This()) timespec {
287 return self.atim;
288 }
289
290 pub fn mtime(self: @This()) timespec {
291 return self.mtim;
292 }
293
294 pub fn ctime(self: @This()) timespec {
295 return self.ctim;
296 }
297};
298
299pub const timeval = extern struct {
300 tv_sec: i32,
301 tv_usec: i32,
302};
303
304pub const timezone = extern struct {
305 tz_minuteswest: i32,
306 tz_dsttime: i32,
307};
308
309pub const mcontext_t = extern struct {
310 gregs: [19]usize,
311 fpregs: [*]u8,
312 oldmask: usize,
313 cr2: usize,
314};
315
316pub const REG = struct {
317 pub const GS = 0;
318 pub const FS = 1;
319 pub const ES = 2;
320 pub const DS = 3;
321 pub const EDI = 4;
322 pub const ESI = 5;
323 pub const EBP = 6;
324 pub const ESP = 7;
325 pub const EBX = 8;
326 pub const EDX = 9;
327 pub const ECX = 10;
328 pub const EAX = 11;
329 pub const TRAPNO = 12;
330 pub const ERR = 13;
331 pub const EIP = 14;
332 pub const CS = 15;
333 pub const EFL = 16;
334 pub const UESP = 17;
335 pub const SS = 18;
336};
337
338pub const ucontext_t = extern struct {
339 flags: usize,
340 link: ?*ucontext_t,
341 stack: stack_t,
342 mcontext: mcontext_t,
343 sigmask: sigset_t,
344 regspace: [64]u64,
345};
346
347pub const Elf_Symndx = u32;
348
349pub const user_desc = packed struct {
350 entry_number: u32,
351 base_addr: u32,
352 limit: u32,
353 seg_32bit: u1,
354 contents: u2,
355 read_exec_only: u1,
356 limit_in_pages: u1,
357 seg_not_present: u1,
358 useable: u1,
359};
360
361/// socketcall() call numbers
362pub const SC = struct {
363 pub const socket = 1;
364 pub const bind = 2;
365 pub const connect = 3;
366 pub const listen = 4;
367 pub const accept = 5;
368 pub const getsockname = 6;
369 pub const getpeername = 7;
370 pub const socketpair = 8;
371 pub const send = 9;
372 pub const recv = 10;
373 pub const sendto = 11;
374 pub const recvfrom = 12;
375 pub const shutdown = 13;
376 pub const setsockopt = 14;
377 pub const getsockopt = 15;
378 pub const sendmsg = 16;
379 pub const recvmsg = 17;
380 pub const accept4 = 18;
381 pub const recvmmsg = 19;
382 pub const sendmmsg = 20;
383};
lib/std/os/linux/start_pie.zig+2-2
......@@ -11,7 +11,7 @@ const R_RISCV_RELATIVE = 3;
1111const R_SPARC_RELATIVE = 22;
1212
1313const R_RELATIVE = switch (builtin.cpu.arch) {
14 .i386 => R_386_RELATIVE,
14 .x86 => R_386_RELATIVE,
1515 .x86_64 => R_AMD64_RELATIVE,
1616 .arm => R_ARM_RELATIVE,
1717 .aarch64 => R_AARCH64_RELATIVE,
......@@ -24,7 +24,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
2424// relocation that, at this point, is not yet applied.
2525fn getDynamicSymbol() [*]elf.Dyn {
2626 return switch (builtin.cpu.arch) {
27 .i386 => asm volatile (
27 .x86 => asm volatile (
2828 \\ .weak _DYNAMIC
2929 \\ .hidden _DYNAMIC
3030 \\ call 1f
lib/std/os/linux/tls.zig+4-4
......@@ -30,7 +30,7 @@ const native_arch = @import("builtin").cpu.arch;
3030// `-- The thread pointer register points here
3131//
3232// The structure of the TCB is not defined by the ABI so we reserve enough space
33// for a single pointer as some architectures such as i386 and x86_64 need a
33// for a single pointer as some architectures such as x86 and x86_64 need a
3434// pointer to the TCB block itself at the address pointed by the tp.
3535//
3636// In this case the control structure and DTV are placed one after another right
......@@ -49,7 +49,7 @@ const TLSVariant = enum {
4949
5050const tls_variant = switch (native_arch) {
5151 .arm, .armeb, .thumb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => TLSVariant.VariantI,
52 .x86_64, .i386, .sparc64 => TLSVariant.VariantII,
52 .x86_64, .x86, .sparc64 => TLSVariant.VariantII,
5353 else => @compileError("undefined tls_variant for this architecture"),
5454};
5555
......@@ -102,7 +102,7 @@ const TLSImage = struct {
102102 dtv_offset: usize,
103103 data_offset: usize,
104104 data_size: usize,
105 // Only used on the i386 architecture
105 // Only used on the x86 architecture
106106 gdt_entry_number: usize,
107107};
108108
......@@ -110,7 +110,7 @@ pub var tls_image: TLSImage = undefined;
110110
111111pub fn setThreadPointer(addr: usize) void {
112112 switch (native_arch) {
113 .i386 => {
113 .x86 => {
114114 var user_desc = std.os.linux.user_desc{
115115 .entry_number = tls_image.gdt_entry_number,
116116 .base_addr = addr,
lib/std/os/linux/x86.zig created+383
......@@ -0,0 +1,383 @@
1const std = @import("../../std.zig");
2const maxInt = std.math.maxInt;
3const linux = std.os.linux;
4const SYS = linux.SYS;
5const socklen_t = linux.socklen_t;
6const iovec = std.os.iovec;
7const iovec_const = std.os.iovec_const;
8const uid_t = linux.uid_t;
9const gid_t = linux.gid_t;
10const pid_t = linux.pid_t;
11const stack_t = linux.stack_t;
12const sigset_t = linux.sigset_t;
13const sockaddr = linux.sockaddr;
14const timespec = linux.timespec;
15
16pub fn syscall0(number: SYS) usize {
17 return asm volatile ("int $0x80"
18 : [ret] "={eax}" (-> usize),
19 : [number] "{eax}" (@enumToInt(number)),
20 : "memory"
21 );
22}
23
24pub fn syscall1(number: SYS, arg1: usize) usize {
25 return asm volatile ("int $0x80"
26 : [ret] "={eax}" (-> usize),
27 : [number] "{eax}" (@enumToInt(number)),
28 [arg1] "{ebx}" (arg1),
29 : "memory"
30 );
31}
32
33pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
34 return asm volatile ("int $0x80"
35 : [ret] "={eax}" (-> usize),
36 : [number] "{eax}" (@enumToInt(number)),
37 [arg1] "{ebx}" (arg1),
38 [arg2] "{ecx}" (arg2),
39 : "memory"
40 );
41}
42
43pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
44 return asm volatile ("int $0x80"
45 : [ret] "={eax}" (-> usize),
46 : [number] "{eax}" (@enumToInt(number)),
47 [arg1] "{ebx}" (arg1),
48 [arg2] "{ecx}" (arg2),
49 [arg3] "{edx}" (arg3),
50 : "memory"
51 );
52}
53
54pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
55 return asm volatile ("int $0x80"
56 : [ret] "={eax}" (-> usize),
57 : [number] "{eax}" (@enumToInt(number)),
58 [arg1] "{ebx}" (arg1),
59 [arg2] "{ecx}" (arg2),
60 [arg3] "{edx}" (arg3),
61 [arg4] "{esi}" (arg4),
62 : "memory"
63 );
64}
65
66pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
67 return asm volatile ("int $0x80"
68 : [ret] "={eax}" (-> usize),
69 : [number] "{eax}" (@enumToInt(number)),
70 [arg1] "{ebx}" (arg1),
71 [arg2] "{ecx}" (arg2),
72 [arg3] "{edx}" (arg3),
73 [arg4] "{esi}" (arg4),
74 [arg5] "{edi}" (arg5),
75 : "memory"
76 );
77}
78
79pub fn syscall6(
80 number: SYS,
81 arg1: usize,
82 arg2: usize,
83 arg3: usize,
84 arg4: usize,
85 arg5: usize,
86 arg6: usize,
87) usize {
88 // The 6th argument is passed via memory as we're out of registers if ebp is
89 // used as frame pointer. We push arg6 value on the stack before changing
90 // ebp or esp as the compiler may reference it as an offset relative to one
91 // of those two registers.
92 return asm volatile (
93 \\ push %[arg6]
94 \\ push %%ebp
95 \\ mov 4(%%esp), %%ebp
96 \\ int $0x80
97 \\ pop %%ebp
98 \\ add $4, %%esp
99 : [ret] "={eax}" (-> usize),
100 : [number] "{eax}" (@enumToInt(number)),
101 [arg1] "{ebx}" (arg1),
102 [arg2] "{ecx}" (arg2),
103 [arg3] "{edx}" (arg3),
104 [arg4] "{esi}" (arg4),
105 [arg5] "{edi}" (arg5),
106 [arg6] "rm" (arg6),
107 : "memory"
108 );
109}
110
111pub fn socketcall(call: usize, args: [*]usize) usize {
112 return asm volatile ("int $0x80"
113 : [ret] "={eax}" (-> usize),
114 : [number] "{eax}" (@enumToInt(SYS.socketcall)),
115 [arg1] "{ebx}" (call),
116 [arg2] "{ecx}" (@ptrToInt(args)),
117 : "memory"
118 );
119}
120
121const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
122
123/// This matches the libc clone function.
124pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
125
126pub fn restore() callconv(.Naked) void {
127 switch (@import("builtin").zig_backend) {
128 .stage2_c => return asm volatile (
129 \\ movl %[number], %%eax
130 \\ int $0x80
131 :
132 : [number] "i" (@enumToInt(SYS.sigreturn)),
133 : "memory"
134 ),
135 else => return asm volatile ("int $0x80"
136 :
137 : [number] "{eax}" (@enumToInt(SYS.sigreturn)),
138 : "memory"
139 ),
140 }
141}
142
143pub fn restore_rt() callconv(.Naked) void {
144 switch (@import("builtin").zig_backend) {
145 .stage2_c => return asm volatile (
146 \\ movl %[number], %%eax
147 \\ int $0x80
148 :
149 : [number] "i" (@enumToInt(SYS.rt_sigreturn)),
150 : "memory"
151 ),
152 else => return asm volatile ("int $0x80"
153 :
154 : [number] "{eax}" (@enumToInt(SYS.rt_sigreturn)),
155 : "memory"
156 ),
157 }
158}
159
160pub const O = struct {
161 pub const CREAT = 0o100;
162 pub const EXCL = 0o200;
163 pub const NOCTTY = 0o400;
164 pub const TRUNC = 0o1000;
165 pub const APPEND = 0o2000;
166 pub const NONBLOCK = 0o4000;
167 pub const DSYNC = 0o10000;
168 pub const SYNC = 0o4010000;
169 pub const RSYNC = 0o4010000;
170 pub const DIRECTORY = 0o200000;
171 pub const NOFOLLOW = 0o400000;
172 pub const CLOEXEC = 0o2000000;
173
174 pub const ASYNC = 0o20000;
175 pub const DIRECT = 0o40000;
176 pub const LARGEFILE = 0o100000;
177 pub const NOATIME = 0o1000000;
178 pub const PATH = 0o10000000;
179 pub const TMPFILE = 0o20200000;
180 pub const NDELAY = NONBLOCK;
181};
182
183pub const F = struct {
184 pub const DUPFD = 0;
185 pub const GETFD = 1;
186 pub const SETFD = 2;
187 pub const GETFL = 3;
188 pub const SETFL = 4;
189 pub const SETOWN = 8;
190 pub const GETOWN = 9;
191 pub const SETSIG = 10;
192 pub const GETSIG = 11;
193 pub const GETLK = 12;
194 pub const SETLK = 13;
195 pub const SETLKW = 14;
196 pub const SETOWN_EX = 15;
197 pub const GETOWN_EX = 16;
198 pub const GETOWNER_UIDS = 17;
199
200 pub const RDLCK = 0;
201 pub const WRLCK = 1;
202 pub const UNLCK = 2;
203};
204
205pub const LOCK = struct {
206 pub const SH = 1;
207 pub const EX = 2;
208 pub const NB = 4;
209 pub const UN = 8;
210};
211
212pub const MAP = struct {
213 pub const NORESERVE = 0x4000;
214 pub const GROWSDOWN = 0x0100;
215 pub const DENYWRITE = 0x0800;
216 pub const EXECUTABLE = 0x1000;
217 pub const LOCKED = 0x2000;
218 pub const @"32BIT" = 0x40;
219};
220
221pub const MMAP2_UNIT = 4096;
222
223pub const VDSO = struct {
224 pub const CGT_SYM = "__vdso_clock_gettime";
225 pub const CGT_VER = "LINUX_2.6";
226};
227
228pub const ARCH = struct {};
229
230pub const Flock = extern struct {
231 type: i16,
232 whence: i16,
233 start: off_t,
234 len: off_t,
235 pid: pid_t,
236};
237
238pub const msghdr = extern struct {
239 name: ?*sockaddr,
240 namelen: socklen_t,
241 iov: [*]iovec,
242 iovlen: i32,
243 control: ?*anyopaque,
244 controllen: socklen_t,
245 flags: i32,
246};
247
248pub const msghdr_const = extern struct {
249 name: ?*const sockaddr,
250 namelen: socklen_t,
251 iov: [*]const iovec_const,
252 iovlen: i32,
253 control: ?*const anyopaque,
254 controllen: socklen_t,
255 flags: i32,
256};
257
258pub const blksize_t = i32;
259pub const nlink_t = u32;
260pub const time_t = isize;
261pub const mode_t = u32;
262pub const off_t = i64;
263pub const ino_t = u64;
264pub const dev_t = u64;
265pub const blkcnt_t = i64;
266
267// The `stat` definition used by the Linux kernel.
268pub const Stat = extern struct {
269 dev: dev_t,
270 __dev_padding: u32,
271 __ino_truncated: u32,
272 mode: mode_t,
273 nlink: nlink_t,
274 uid: uid_t,
275 gid: gid_t,
276 rdev: dev_t,
277 __rdev_padding: u32,
278 size: off_t,
279 blksize: blksize_t,
280 blocks: blkcnt_t,
281 atim: timespec,
282 mtim: timespec,
283 ctim: timespec,
284 ino: ino_t,
285
286 pub fn atime(self: @This()) timespec {
287 return self.atim;
288 }
289
290 pub fn mtime(self: @This()) timespec {
291 return self.mtim;
292 }
293
294 pub fn ctime(self: @This()) timespec {
295 return self.ctim;
296 }
297};
298
299pub const timeval = extern struct {
300 tv_sec: i32,
301 tv_usec: i32,
302};
303
304pub const timezone = extern struct {
305 tz_minuteswest: i32,
306 tz_dsttime: i32,
307};
308
309pub const mcontext_t = extern struct {
310 gregs: [19]usize,
311 fpregs: [*]u8,
312 oldmask: usize,
313 cr2: usize,
314};
315
316pub const REG = struct {
317 pub const GS = 0;
318 pub const FS = 1;
319 pub const ES = 2;
320 pub const DS = 3;
321 pub const EDI = 4;
322 pub const ESI = 5;
323 pub const EBP = 6;
324 pub const ESP = 7;
325 pub const EBX = 8;
326 pub const EDX = 9;
327 pub const ECX = 10;
328 pub const EAX = 11;
329 pub const TRAPNO = 12;
330 pub const ERR = 13;
331 pub const EIP = 14;
332 pub const CS = 15;
333 pub const EFL = 16;
334 pub const UESP = 17;
335 pub const SS = 18;
336};
337
338pub const ucontext_t = extern struct {
339 flags: usize,
340 link: ?*ucontext_t,
341 stack: stack_t,
342 mcontext: mcontext_t,
343 sigmask: sigset_t,
344 regspace: [64]u64,
345};
346
347pub const Elf_Symndx = u32;
348
349pub const user_desc = packed struct {
350 entry_number: u32,
351 base_addr: u32,
352 limit: u32,
353 seg_32bit: u1,
354 contents: u2,
355 read_exec_only: u1,
356 limit_in_pages: u1,
357 seg_not_present: u1,
358 useable: u1,
359};
360
361/// socketcall() call numbers
362pub const SC = struct {
363 pub const socket = 1;
364 pub const bind = 2;
365 pub const connect = 3;
366 pub const listen = 4;
367 pub const accept = 5;
368 pub const getsockname = 6;
369 pub const getpeername = 7;
370 pub const socketpair = 8;
371 pub const send = 9;
372 pub const recv = 10;
373 pub const sendto = 11;
374 pub const recvfrom = 12;
375 pub const shutdown = 13;
376 pub const setsockopt = 14;
377 pub const getsockopt = 15;
378 pub const sendmsg = 16;
379 pub const recvmsg = 17;
380 pub const accept4 = 18;
381 pub const recvmmsg = 19;
382 pub const sendmmsg = 20;
383};
lib/std/os/test.zig+1-1
......@@ -746,7 +746,7 @@ test "sigaction" {
746746 return error.SkipZigTest;
747747
748748 // https://github.com/ziglang/zig/issues/7427
749 if (native_os == .linux and builtin.target.cpu.arch == .i386)
749 if (native_os == .linux and builtin.target.cpu.arch == .x86)
750750 return error.SkipZigTest;
751751
752752 const S = struct {
lib/std/os/windows.zig+3-3
......@@ -1750,7 +1750,7 @@ pub fn UnlockFile(
17501750
17511751pub fn teb() *TEB {
17521752 return switch (native_arch) {
1753 .i386 => asm volatile (
1753 .x86 => asm volatile (
17541754 \\ movl %%fs:0x18, %[ptr]
17551755 : [ptr] "=r" (-> *TEB),
17561756 ),
......@@ -2053,7 +2053,7 @@ pub const STD_OUTPUT_HANDLE = maxInt(DWORD) - 11 + 1;
20532053/// The standard error device. Initially, this is the active console screen buffer, CONOUT$.
20542054pub const STD_ERROR_HANDLE = maxInt(DWORD) - 12 + 1;
20552055
2056pub const WINAPI: std.builtin.CallingConvention = if (native_arch == .i386)
2056pub const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86)
20572057 .Stdcall
20582058else
20592059 .C;
......@@ -3019,7 +3019,7 @@ pub const EXCEPTION_RECORD = extern struct {
30193019};
30203020
30213021pub usingnamespace switch (native_arch) {
3022 .i386 => struct {
3022 .x86 => struct {
30233023 pub const FLOATING_SAVE_AREA = extern struct {
30243024 ControlWord: DWORD,
30253025 StatusWord: DWORD,
lib/std/start.zig+2-2
......@@ -275,7 +275,7 @@ fn _start() callconv(.Naked) noreturn {
275275 \\ andq $-16, %%rsp
276276 \\ call _posixCallMainAndExit
277277 ),
278 .i386 => asm volatile (
278 .x86 => asm volatile (
279279 \\ xorl %%ebp, %%ebp
280280 \\ movl %%esp, argc_argv_ptr
281281 \\ andl $-16, %%esp
......@@ -307,7 +307,7 @@ fn _start() callconv(.Naked) noreturn {
307307 : [argc] "={rsp}" (-> [*]usize),
308308 );
309309 },
310 .i386 => {
310 .x86 => {
311311 argc_argv_ptr = asm volatile (
312312 \\ xor %%ebp, %%ebp
313313 : [argc] "={esp}" (-> [*]usize),
lib/std/start_windows_tls.zig+1-1
......@@ -8,7 +8,7 @@ export var __xl_a: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLA") =
88export var __xl_z: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLZ") = null;
99
1010comptime {
11 if (builtin.target.cpu.arch == .i386) {
11 if (builtin.target.cpu.arch == .x86) {
1212 // The __tls_array is the offset of the ThreadLocalStoragePointer field
1313 // in the TEB block whose base address held in the %fs segment.
1414 asm (
lib/std/target.zig+16-16
......@@ -850,7 +850,7 @@ pub const Target = struct {
850850 tcele,
851851 thumb,
852852 thumbeb,
853 i386,
853 x86,
854854 x86_64,
855855 xcore,
856856 nvptx,
......@@ -879,7 +879,7 @@ pub const Target = struct {
879879
880880 pub fn isX86(arch: Arch) bool {
881881 return switch (arch) {
882 .i386, .x86_64 => true,
882 .x86, .x86_64 => true,
883883 else => false,
884884 };
885885 }
......@@ -999,7 +999,7 @@ pub const Target = struct {
999999 .tcele => .NONE,
10001000 .thumb => .ARM,
10011001 .thumbeb => .ARM,
1002 .i386 => .@"386",
1002 .x86 => .@"386",
10031003 .xcore => .XCORE,
10041004 .nvptx => .NONE,
10051005 .amdil => .NONE,
......@@ -1063,7 +1063,7 @@ pub const Target = struct {
10631063 .tcele => .Unknown,
10641064 .thumb => .Thumb,
10651065 .thumbeb => .Thumb,
1066 .i386 => .I386,
1066 .x86 => .I386,
10671067 .xcore => .Unknown,
10681068 .nvptx => .Unknown,
10691069 .amdil => .Unknown,
......@@ -1134,7 +1134,7 @@ pub const Target = struct {
11341134 .r600,
11351135 .riscv32,
11361136 .riscv64,
1137 .i386,
1137 .x86,
11381138 .x86_64,
11391139 .wasm32,
11401140 .wasm64,
......@@ -1179,7 +1179,7 @@ pub const Target = struct {
11791179 const is_nvptx = arch == .nvptx or arch == .nvptx64;
11801180 return switch (address_space) {
11811181 .generic => true,
1182 .fs, .gs, .ss => arch == .x86_64 or arch == .i386,
1182 .fs, .gs, .ss => arch == .x86_64 or arch == .x86,
11831183 .global, .constant, .local, .shared => arch == .amdgcn or is_nvptx,
11841184 .param => is_nvptx,
11851185 };
......@@ -1211,7 +1211,7 @@ pub const Target = struct {
12111211 .tcele,
12121212 .thumb,
12131213 .thumbeb,
1214 .i386,
1214 .x86,
12151215 .xcore,
12161216 .nvptx,
12171217 .amdil,
......@@ -1267,7 +1267,7 @@ pub const Target = struct {
12671267 .riscv32, .riscv64 => "riscv",
12681268 .sparc, .sparc64, .sparcel => "sparc",
12691269 .s390x => "s390x",
1270 .i386, .x86_64 => "x86",
1270 .x86, .x86_64 => "x86",
12711271 .nvptx, .nvptx64 => "nvptx",
12721272 .wasm32, .wasm64 => "wasm",
12731273 .spirv32, .spirv64 => "spir-v",
......@@ -1291,7 +1291,7 @@ pub const Target = struct {
12911291 .sparc, .sparc64, .sparcel => &sparc.all_features,
12921292 .spirv32, .spirv64 => &spirv.all_features,
12931293 .s390x => &s390x.all_features,
1294 .i386, .x86_64 => &x86.all_features,
1294 .x86, .x86_64 => &x86.all_features,
12951295 .nvptx, .nvptx64 => &nvptx.all_features,
12961296 .ve => &ve.all_features,
12971297 .wasm32, .wasm64 => &wasm.all_features,
......@@ -1315,7 +1315,7 @@ pub const Target = struct {
13151315 .riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu),
13161316 .sparc, .sparc64, .sparcel => comptime allCpusFromDecls(sparc.cpu),
13171317 .s390x => comptime allCpusFromDecls(s390x.cpu),
1318 .i386, .x86_64 => comptime allCpusFromDecls(x86.cpu),
1318 .x86, .x86_64 => comptime allCpusFromDecls(x86.cpu),
13191319 .nvptx, .nvptx64 => comptime allCpusFromDecls(nvptx.cpu),
13201320 .ve => comptime allCpusFromDecls(ve.cpu),
13211321 .wasm32, .wasm64 => comptime allCpusFromDecls(wasm.cpu),
......@@ -1377,7 +1377,7 @@ pub const Target = struct {
13771377 .sparc, .sparcel => &sparc.cpu.generic,
13781378 .sparc64 => &sparc.cpu.v9, // 64-bit SPARC needs v9 as the baseline
13791379 .s390x => &s390x.cpu.generic,
1380 .i386 => &x86.cpu.i386,
1380 .x86 => &x86.cpu.x86,
13811381 .x86_64 => &x86.cpu.x86_64,
13821382 .nvptx, .nvptx64 => &nvptx.cpu.sm_20,
13831383 .ve => &ve.cpu.generic,
......@@ -1392,7 +1392,7 @@ pub const Target = struct {
13921392 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,
13931393 .riscv32 => &riscv.cpu.baseline_rv32,
13941394 .riscv64 => &riscv.cpu.baseline_rv64,
1395 .i386 => &x86.cpu.pentium4,
1395 .x86 => &x86.cpu.pentium4,
13961396 .nvptx, .nvptx64 => &nvptx.cpu.sm_20,
13971397 .sparc, .sparcel => &sparc.cpu.v8,
13981398
......@@ -1622,7 +1622,7 @@ pub const Target = struct {
16221622 .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"),
16231623 .solaris => return copy(&result, "/lib/64/ld.so.1"),
16241624 .linux => switch (self.cpu.arch) {
1625 .i386,
1625 .x86,
16261626 .sparc,
16271627 .sparcel,
16281628 => return copy(&result, "/lib/ld-linux.so.2"),
......@@ -1771,7 +1771,7 @@ pub const Target = struct {
17711771 /// 5c arm little-endian ARM
17721772 /// 6c amd64 AMD64 and compatibles (e.g., Intel EM64T)
17731773 /// 7c arm64 ARM64 (ARMv8)
1774 /// 8c 386 Intel i386, i486, Pentium, etc.
1774 /// 8c 386 Intel x86, i486, Pentium, etc.
17751775 /// kc sparc Sun SPARC
17761776 /// qc power Power PC
17771777 /// vc mips big-endian MIPS 3000 family
......@@ -1780,7 +1780,7 @@ pub const Target = struct {
17801780 .arm => ".5",
17811781 .x86_64 => ".6",
17821782 .aarch64 => ".7",
1783 .i386 => ".8",
1783 .x86 => ".8",
17841784 .sparc => ".k",
17851785 .powerpc, .powerpcle => ".q",
17861786 .mips, .mipsel => ".v",
......@@ -1815,7 +1815,7 @@ pub const Target = struct {
18151815 .wasm64,
18161816 => 8,
18171817
1818 .i386 => return switch (target.os.tag) {
1818 .x86 => return switch (target.os.tag) {
18191819 .windows, .uefi => 8,
18201820 else => 4,
18211821 },
lib/std/target/x86.zig+2-2
......@@ -2040,8 +2040,8 @@ pub const cpu = struct {
20402040 .xsaveopt,
20412041 }),
20422042 };
2043 pub const @"i386" = CpuModel{
2044 .name = "i386",
2043 pub const x86 = CpuModel{
2044 .name = "x86",
20452045 .llvm_name = "i386",
20462046 .features = featureSet(&[_]Feature{
20472047 .slow_unaligned_mem_16,
lib/std/valgrind.zig+1-1
......@@ -8,7 +8,7 @@ pub fn doClientRequest(default: usize, request: usize, a1: usize, a2: usize, a3:
88 }
99
1010 switch (builtin.target.cpu.arch) {
11 .i386 => {
11 .x86 => {
1212 return asm volatile (
1313 \\ roll $3, %%edi ; roll $13, %%edi
1414 \\ roll $29, %%edi ; roll $19, %%edi
lib/std/zig/CrossTarget.zig+1-1
......@@ -592,7 +592,7 @@ pub const VcpkgLinkage = std.builtin.LinkMode;
592592/// Returned slice must be freed by the caller.
593593pub fn vcpkgTriplet(self: CrossTarget, allocator: mem.Allocator, linkage: VcpkgLinkage) ![]u8 {
594594 const arch = switch (self.getCpuArch()) {
595 .i386 => "x86",
595 .x86 => "x86",
596596 .x86_64 => "x64",
597597
598598 .arm,
lib/std/zig/system/NativeTargetInfo.zig+5-5
......@@ -199,11 +199,11 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo {
199199 // For x86, we need to populate some CPU feature flags depending on architecture
200200 // and mode:
201201 // * 16bit_mode => if the abi is code16
202 // * 32bit_mode => if the arch is i386
202 // * 32bit_mode => if the arch is x86
203203 // However, the "mode" flags can be used as overrides, so if the user explicitly
204204 // sets one of them, that takes precedence.
205205 switch (cpu_arch) {
206 .i386 => {
206 .x86 => {
207207 if (!std.Target.x86.featureSetHasAny(cross_target.cpu_features_add, .{
208208 .@"16bit_mode", .@"32bit_mode",
209209 })) {
......@@ -969,7 +969,7 @@ fn detectNativeCpuAndFeatures(cpu_arch: Target.Cpu.Arch, os: Target.Os, cross_ta
969969 // although it is a runtime value, is guaranteed to be one of the architectures in the set
970970 // of the respective switch prong.
971971 switch (builtin.cpu.arch) {
972 .x86_64, .i386 => {
972 .x86_64, .x86 => {
973973 return @import("x86.zig").detectNativeCpuAndFeatures(cpu_arch, os, cross_target);
974974 },
975975 else => {},
......@@ -1019,7 +1019,7 @@ pub fn getExternalExecutor(
10191019 if (host.target.cpu.arch == candidate.target.cpu.arch)
10201020 break :cpu_ok true;
10211021
1022 if (host.target.cpu.arch == .x86_64 and candidate.target.cpu.arch == .i386)
1022 if (host.target.cpu.arch == .x86_64 and candidate.target.cpu.arch == .x86)
10231023 break :cpu_ok true;
10241024
10251025 if (host.target.cpu.arch == .aarch64 and candidate.target.cpu.arch == .arm)
......@@ -1068,7 +1068,7 @@ pub fn getExternalExecutor(
10681068 .arm => Executor{ .qemu = "qemu-arm" },
10691069 .armeb => Executor{ .qemu = "qemu-armeb" },
10701070 .hexagon => Executor{ .qemu = "qemu-hexagon" },
1071 .i386 => Executor{ .qemu = "qemu-i386" },
1071 .x86 => Executor{ .qemu = "qemu-i386" },
10721072 .m68k => Executor{ .qemu = "qemu-m68k" },
10731073 .mips => Executor{ .qemu = "qemu-mips" },
10741074 .mipsel => Executor{ .qemu = "qemu-mipsel" },
lib/std/zig/system/x86.zig+1-1
......@@ -80,7 +80,7 @@ fn detectIntelProcessor(cpu: *Target.Cpu, family: u32, model: u32, brand_id: u32
8080 }
8181 switch (family) {
8282 3 => {
83 cpu.model = &Target.x86.cpu.i386;
83 cpu.model = &Target.x86.cpu.x86;
8484 return;
8585 },
8686 4 => {
src/Compilation.zig+2-2
......@@ -4281,7 +4281,7 @@ pub fn addCCArgs(
42814281 },
42824282 .ios, .tvos, .watchos => switch (target.cpu.arch) {
42834283 // Pass the proper -m<os>-version-min argument for darwin.
4284 .i386, .x86_64 => {
4284 .x86, .x86_64 => {
42854285 const ver = target.os.version_range.semver.min;
42864286 try argv.append(try std.fmt.allocPrint(
42874287 arena,
......@@ -4969,7 +4969,7 @@ pub fn getZigBackend(comp: Compilation) std.builtin.CompilerBackend {
49694969 .wasm32, .wasm64 => std.builtin.CompilerBackend.stage2_wasm,
49704970 .arm, .armeb, .thumb, .thumbeb => .stage2_arm,
49714971 .x86_64 => .stage2_x86_64,
4972 .i386 => .stage2_x86,
4972 .x86 => .stage2_x86,
49734973 .aarch64, .aarch64_be, .aarch64_32 => .stage2_aarch64,
49744974 .riscv64 => .stage2_riscv64,
49754975 .sparc64 => .stage2_sparc64,
src/Sema.zig+7-7
......@@ -8415,20 +8415,20 @@ fn funcCommon(
84158415 if (switch (cc_workaround) {
84168416 .Unspecified, .C, .Naked, .Async, .Inline => null,
84178417 .Interrupt => switch (arch) {
8418 .i386, .x86_64, .avr, .msp430 => null,
8419 else => @as([]const u8, "i386, x86_64, AVR, and MSP430"),
8418 .x86, .x86_64, .avr, .msp430 => null,
8419 else => @as([]const u8, "x86, x86_64, AVR, and MSP430"),
84208420 },
84218421 .Signal => switch (arch) {
84228422 .avr => null,
84238423 else => @as([]const u8, "AVR"),
84248424 },
84258425 .Stdcall, .Fastcall, .Thiscall => switch (arch) {
8426 .i386 => null,
8427 else => @as([]const u8, "i386"),
8426 .x86 => null,
8427 else => @as([]const u8, "x86"),
84288428 },
84298429 .Vectorcall => switch (arch) {
8430 .i386, .aarch64, .aarch64_be, .aarch64_32 => null,
8431 else => @as([]const u8, "i386 and AArch64"),
8430 .x86, .aarch64, .aarch64_be, .aarch64_32 => null,
8431 else => @as([]const u8, "x86 and AArch64"),
84328432 },
84338433 .APCS, .AAPCS, .AAPCSVFP => switch (arch) {
84348434 .arm, .armeb, .aarch64, .aarch64_be, .aarch64_32, .thumb, .thumbeb => null,
......@@ -30766,7 +30766,7 @@ pub fn analyzeAddressSpace(
3076630766
3076730767 const supported = switch (address_space) {
3076830768 .generic => true,
30769 .gs, .fs, .ss => (arch == .i386 or arch == .x86_64) and ctx == .pointer,
30769 .gs, .fs, .ss => (arch == .x86 or arch == .x86_64) and ctx == .pointer,
3077030770 // TODO: check that .shared and .local are left uninitialized
3077130771 .param => is_nv,
3077230772 .global, .shared, .local => is_gpu,
src/codegen.zig+1-1
......@@ -110,7 +110,7 @@ pub fn generateFunction(
110110 //.tcele => return Function(.tcele).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
111111 //.thumb => return Function(.thumb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
112112 //.thumbeb => return Function(.thumbeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
113 //.i386 => return Function(.i386).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
113 //.x86 => return Function(.x86).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
114114 .x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
115115 //.xcore => return Function(.xcore).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
116116 //.nvptx => return Function(.nvptx).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
src/codegen/llvm.zig+9-9
......@@ -70,7 +70,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 {
7070 .tcele => "tcele",
7171 .thumb => "thumb",
7272 .thumbeb => "thumbeb",
73 .i386 => "i386",
73 .x86 => "i386",
7474 .x86_64 => "x86_64",
7575 .xcore => "xcore",
7676 .nvptx => "nvptx",
......@@ -282,7 +282,7 @@ pub fn targetArch(arch_tag: std.Target.Cpu.Arch) llvm.ArchType {
282282 .tcele => .tcele,
283283 .thumb => .thumb,
284284 .thumbeb => .thumbeb,
285 .i386 => .x86,
285 .x86 => .x86,
286286 .x86_64 => .x86_64,
287287 .xcore => .xcore,
288288 .nvptx => .nvptx,
......@@ -6195,7 +6195,7 @@ pub const FuncGen = struct {
61956195 // here then we may risk tripping LLVM bugs since anything not used by Clang tends
61966196 // to be buggy and regress often.
61976197 switch (target.cpu.arch) {
6198 .x86_64, .i386 => {
6198 .x86_64, .x86 => {
61996199 if (total_i != 0) try llvm_constraints.append(self.gpa, ',');
62006200 try llvm_constraints.appendSlice(self.gpa, "~{dirflag},~{fpsr},~{flags}");
62016201 total_i += 3;
......@@ -9275,7 +9275,7 @@ pub const FuncGen = struct {
92759275 switch (prefetch.cache) {
92769276 .instruction => switch (target.cpu.arch) {
92779277 .x86_64,
9278 .i386,
9278 .x86,
92799279 .powerpc,
92809280 .powerpcle,
92819281 .powerpc64,
......@@ -9856,7 +9856,7 @@ fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {
98569856 llvm.LLVMInitializeWebAssemblyAsmPrinter();
98579857 llvm.LLVMInitializeWebAssemblyAsmParser();
98589858 },
9859 .i386, .x86_64 => {
9859 .x86, .x86_64 => {
98609860 llvm.LLVMInitializeX86Target();
98619861 llvm.LLVMInitializeX86TargetInfo();
98629862 llvm.LLVMInitializeX86TargetMC();
......@@ -9968,7 +9968,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca
99689968 .Stdcall => .X86_StdCall,
99699969 .Fastcall => .X86_FastCall,
99709970 .Vectorcall => return switch (target.cpu.arch) {
9971 .i386, .x86_64 => .X86_VectorCall,
9971 .x86, .x86_64 => .X86_VectorCall,
99729972 .aarch64, .aarch64_be, .aarch64_32 => .AArch64_VectorCall,
99739973 else => unreachable,
99749974 },
......@@ -9977,7 +9977,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca
99779977 .AAPCS => .ARM_AAPCS,
99789978 .AAPCSVFP => .ARM_AAPCS_VFP,
99799979 .Interrupt => return switch (target.cpu.arch) {
9980 .i386, .x86_64 => .X86_INTR,
9980 .x86, .x86_64 => .X86_INTR,
99819981 .avr => .AVR_INTR,
99829982 .msp430 => .MSP430_INTR,
99839983 else => unreachable,
......@@ -9999,7 +9999,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca
99999999/// Convert a zig-address space to an llvm address space.
1000010000fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: std.Target) c_uint {
1000110001 return switch (target.cpu.arch) {
10002 .i386, .x86_64 => switch (address_space) {
10002 .x86, .x86_64 => switch (address_space) {
1000310003 .generic => llvm.address_space.default,
1000410004 .gs => llvm.address_space.x86.gs,
1000510005 .fs => llvm.address_space.x86.fs,
......@@ -10714,7 +10714,7 @@ fn isScalar(ty: Type) bool {
1071410714/// and false if we expect LLVM to crash if it counters an x86_fp80 type.
1071510715fn backendSupportsF80(target: std.Target) bool {
1071610716 return switch (target.cpu.arch) {
10717 .x86_64, .i386 => !std.Target.x86.featureSetHas(target.cpu.features, .soft_float),
10717 .x86_64, .x86 => !std.Target.x86.featureSetHas(target.cpu.features, .soft_float),
1071810718 else => false,
1071910719 };
1072010720}
src/crash_report.zig+1-1
......@@ -205,7 +205,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
205205 };
206206
207207 const stack_ctx: StackContext = switch (builtin.cpu.arch) {
208 .i386 => ctx: {
208 .x86 => ctx: {
209209 const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
210210 const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]);
211211 const bp = @intCast(usize, ctx.mcontext.gregs[os.REG.EBP]);
src/glibc.zig+4-4
......@@ -327,7 +327,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
327327 });
328328 try add_include_dirs(comp, arena, &args);
329329
330 if (target.cpu.arch == .i386) {
330 if (target.cpu.arch == .x86) {
331331 // This prevents i386/sysdep.h from trying to do some
332332 // silly and unnecessary inline asm hack that uses weird
333333 // syntax that clang does not support.
......@@ -406,7 +406,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![
406406 }
407407 } else if (arch == .x86_64) {
408408 try result.appendSlice("x86_64");
409 } else if (arch == .i386) {
409 } else if (arch == .x86) {
410410 try result.appendSlice("i386");
411411 } else if (is_aarch64) {
412412 try result.appendSlice("aarch64");
......@@ -504,7 +504,7 @@ fn add_include_dirs_arch(
504504 opt_nptl: ?[]const u8,
505505 dir: []const u8,
506506) error{OutOfMemory}!void {
507 const is_x86 = arch == .i386 or arch == .x86_64;
507 const is_x86 = arch == .x86 or arch == .x86_64;
508508 const is_aarch64 = arch == .aarch64 or arch == .aarch64_be;
509509 const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le;
510510 const is_sparc = arch == .sparc or arch == .sparcel or arch == .sparc64;
......@@ -521,7 +521,7 @@ fn add_include_dirs_arch(
521521 try args.append("-I");
522522 try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64" }));
523523 }
524 } else if (arch == .i386) {
524 } else if (arch == .x86) {
525525 if (opt_nptl) |nptl| {
526526 try args.append("-I");
527527 try args.append(try path.join(arena, &[_][]const u8{ dir, "i386", nptl }));
src/libc_installation.zig+2-2
......@@ -408,7 +408,7 @@ pub const LibCInstallation = struct {
408408 defer result_buf.deinit();
409409
410410 const arch_sub_dir = switch (builtin.target.cpu.arch) {
411 .i386 => "x86",
411 .x86 => "x86",
412412 .x86_64 => "x64",
413413 .arm, .armeb => "arm",
414414 else => return error.UnsupportedArchitecture,
......@@ -471,7 +471,7 @@ pub const LibCInstallation = struct {
471471 defer result_buf.deinit();
472472
473473 const arch_sub_dir = switch (builtin.target.cpu.arch) {
474 .i386 => "x86",
474 .x86 => "x86",
475475 .x86_64 => "x64",
476476 .arm, .armeb => "arm",
477477 else => return error.UnsupportedArchitecture,
src/link/Coff.zig+1-1
......@@ -1294,7 +1294,7 @@ pub fn updateDeclExports(
12941294 const exported_decl = module.declPtr(exp.exported_decl);
12951295 if (exported_decl.getFunction() == null) continue;
12961296 const winapi_cc = switch (self.base.options.target.cpu.arch) {
1297 .i386 => std.builtin.CallingConvention.Stdcall,
1297 .x86 => std.builtin.CallingConvention.Stdcall,
12981298 else => std.builtin.CallingConvention.C,
12991299 };
13001300 const decl_cc = exported_decl.ty.fnCallingConvention();
src/link/Coff/lld.zig+3-3
......@@ -197,7 +197,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
197197 try argv.append(try std.fmt.allocPrint(arena, "-BASE:{d}", .{image_base}));
198198 }
199199
200 if (target.cpu.arch == .i386) {
200 if (target.cpu.arch == .x86) {
201201 try argv.append("-MACHINE:X86");
202202 } else if (target.cpu.arch == .x86_64) {
203203 try argv.append("-MACHINE:X64");
......@@ -380,7 +380,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
380380 if (target.abi.isGnu()) {
381381 try argv.append("-lldmingw");
382382
383 if (target.cpu.arch == .i386) {
383 if (target.cpu.arch == .x86) {
384384 try argv.append("-ALTERNATENAME:__image_base__=___ImageBase");
385385 } else {
386386 try argv.append("-ALTERNATENAME:__image_base__=__ImageBase");
......@@ -388,7 +388,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
388388
389389 if (is_dyn_lib) {
390390 try argv.append(try comp.get_libc_crt_file(arena, "dllcrt2.obj"));
391 if (target.cpu.arch == .i386) {
391 if (target.cpu.arch == .x86) {
392392 try argv.append("-ALTERNATENAME:__DllMainCRTStartup@12=_DllMainCRTStartup@12");
393393 } else {
394394 try argv.append("-ALTERNATENAME:_DllMainCRTStartup=DllMainCRTStartup");
src/link/Elf.zig+1-1
......@@ -3004,7 +3004,7 @@ fn sectHeaderTo32(shdr: elf.Elf64_Shdr) elf.Elf32_Shdr {
30043004
30053005fn getLDMOption(target: std.Target) ?[]const u8 {
30063006 switch (target.cpu.arch) {
3007 .i386 => return "elf_i386",
3007 .x86 => return "elf_i386",
30083008 .aarch64 => return "aarch64linux",
30093009 .aarch64_be => return "aarch64_be_linux",
30103010 .arm, .thumb => return "armelf_linux_eabi",
src/link/Plan9.zig+1-1
......@@ -150,7 +150,7 @@ pub fn defaultBaseAddrs(arch: std.Target.Cpu.Arch) Bases {
150150 .text = 0x200028,
151151 .data = 0x400000,
152152 },
153 .i386 => .{
153 .x86 => .{
154154 // header size => 32 => 0x20
155155 .text = 0x200020,
156156 .data = 0x400000,
src/link/Plan9/aout.zig+2-2
......@@ -109,7 +109,7 @@ pub const R_MAGIC = _MAGIC(HDR_MAGIC, 28); // arm64
109109
110110pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 {
111111 return switch (arch) {
112 .i386 => I_MAGIC,
112 .x86 => I_MAGIC,
113113 .sparc => K_MAGIC, // TODO should sparc64 and sparcel go here?
114114 .mips => V_MAGIC,
115115 .arm => E_MAGIC,
......@@ -124,7 +124,7 @@ pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 {
124124/// gets the quantization of pc for the arch
125125pub fn getPCQuant(arch: std.Target.Cpu.Arch) !u8 {
126126 return switch (arch) {
127 .i386, .x86_64 => 1,
127 .x86, .x86_64 => 1,
128128 .powerpc, .powerpc64, .mips, .sparc, .arm, .aarch64 => 4,
129129 else => error.ArchNotSupportedByPlan9,
130130 };
src/mingw.zig+4-4
......@@ -128,7 +128,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
128128 .extra_flags = extra_flags,
129129 };
130130 }
131 if (comp.getTarget().cpu.arch == .i386) {
131 if (comp.getTarget().cpu.arch == .x86) {
132132 for (msvcrt_i386_src) |dep| {
133133 (try c_source_files.addOne()).* = .{
134134 .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{
......@@ -180,7 +180,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
180180 };
181181 }
182182 const target = comp.getTarget();
183 if (target.cpu.arch == .i386 or target.cpu.arch == .x86_64) {
183 if (target.cpu.arch == .x86 or target.cpu.arch == .x86_64) {
184184 for (mingwex_x86_src) |dep| {
185185 (try c_source_files.addOne()).* = .{
186186 .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{
......@@ -338,7 +338,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {
338338 });
339339
340340 const target_def_arg = switch (target.cpu.arch) {
341 .i386 => "-DDEF_I386",
341 .x86 => "-DDEF_I386",
342342 .x86_64 => "-DDEF_X64",
343343 .arm, .armeb, .thumb, .thumbeb, .aarch64_32 => "-DDEF_ARM32",
344344 .aarch64, .aarch64_be => "-DDEF_ARM64",
......@@ -434,7 +434,7 @@ fn findDef(comp: *Compilation, allocator: Allocator, lib_name: []const u8) ![]u8
434434 const target = comp.getTarget();
435435
436436 const lib_path = switch (target.cpu.arch) {
437 .i386 => "lib32",
437 .x86 => "lib32",
438438 .x86_64 => "lib64",
439439 .arm, .armeb, .thumb, .thumbeb, .aarch64_32 => "libarm32",
440440 .aarch64, .aarch64_be => "libarm64",
src/musl.zig+1-1
......@@ -262,7 +262,7 @@ pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
262262 switch (arch) {
263263 .aarch64, .aarch64_be => return "aarch64",
264264 .arm, .armeb, .thumb, .thumbeb => return "arm",
265 .i386 => return "i386",
265 .x86 => return "i386",
266266 .mips, .mipsel => return "mips",
267267 .mips64el, .mips64 => return "mips64",
268268 .powerpc => return "powerpc",
src/target.zig+9-9
......@@ -35,9 +35,9 @@ pub const available_libcs = [_]ArchOsAbi{
3535 .{ .arch = .arm, .os = .windows, .abi = .gnu },
3636 .{ .arch = .csky, .os = .linux, .abi = .gnueabi },
3737 .{ .arch = .csky, .os = .linux, .abi = .gnueabihf },
38 .{ .arch = .i386, .os = .linux, .abi = .gnu },
39 .{ .arch = .i386, .os = .linux, .abi = .musl },
40 .{ .arch = .i386, .os = .windows, .abi = .gnu },
38 .{ .arch = .x86, .os = .linux, .abi = .gnu },
39 .{ .arch = .x86, .os = .linux, .abi = .musl },
40 .{ .arch = .x86, .os = .windows, .abi = .gnu },
4141 .{ .arch = .m68k, .os = .linux, .abi = .gnu },
4242 .{ .arch = .m68k, .os = .linux, .abi = .musl },
4343 .{ .arch = .mips64el, .os = .linux, .abi = .gnuabi64 },
......@@ -137,7 +137,7 @@ pub fn osArchName(target: std.Target) [:0]const u8 {
137137 .powerpc, .powerpcle, .powerpc64, .powerpc64le => "powerpc",
138138 .riscv32, .riscv64 => "riscv",
139139 .sparc, .sparcel, .sparc64 => "sparc",
140 .i386, .x86_64 => "x86",
140 .x86, .x86_64 => "x86",
141141 else => @tagName(target.cpu.arch),
142142 },
143143 else => @tagName(target.cpu.arch),
......@@ -278,7 +278,7 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
278278 .tcele,
279279 .thumb,
280280 .thumbeb,
281 .i386,
281 .x86,
282282 .x86_64,
283283 .xcore,
284284 .nvptx,
......@@ -319,7 +319,7 @@ pub fn selfHostedBackendIsAsRobustAsLlvm(target: std.Target) bool {
319319
320320pub fn supportsStackProbing(target: std.Target) bool {
321321 return target.os.tag != .windows and target.os.tag != .uefi and
322 (target.cpu.arch == .i386 or target.cpu.arch == .x86_64);
322 (target.cpu.arch == .x86 or target.cpu.arch == .x86_64);
323323}
324324
325325pub fn supportsStackProtector(target: std.Target) bool {
......@@ -431,7 +431,7 @@ pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.Mode {
431431pub fn hasRedZone(target: std.Target) bool {
432432 return switch (target.cpu.arch) {
433433 .x86_64,
434 .i386,
434 .x86,
435435 .powerpc,
436436 .powerpc64,
437437 .powerpc64le,
......@@ -550,7 +550,7 @@ pub fn atomicPtrAlignment(
550550 .tcele,
551551 .thumb,
552552 .thumbeb,
553 .i386,
553 .x86,
554554 .xcore,
555555 .amdil,
556556 .hsail,
......@@ -655,7 +655,7 @@ pub fn addrSpaceCastIsValid(
655655) bool {
656656 const arch = target.cpu.arch;
657657 switch (arch) {
658 .x86_64, .i386 => return arch.supportsAddressSpace(from) and arch.supportsAddressSpace(to),
658 .x86_64, .x86 => return arch.supportsAddressSpace(from) and arch.supportsAddressSpace(to),
659659 .nvptx64, .nvptx, .amdgcn => {
660660 const to_generic = arch.supportsAddressSpace(from) and to == .generic;
661661 const from_generic = arch.supportsAddressSpace(to) and from == .generic;
src/type.zig+9-9
......@@ -6653,7 +6653,7 @@ pub const CType = enum {
66536653 .long, .ulong => return target.cpu.arch.ptrBitWidth(),
66546654 .longlong, .ulonglong, .double => return 64,
66556655 .longdouble => switch (target.cpu.arch) {
6656 .i386 => switch (target.abi) {
6656 .x86 => switch (target.abi) {
66576657 .android => return 64,
66586658 else => return 80,
66596659 },
......@@ -6741,7 +6741,7 @@ pub const CType = enum {
67416741 .long, .ulong => return target.cpu.arch.ptrBitWidth(),
67426742 .longlong, .ulonglong, .double => return 64,
67436743 .longdouble => switch (target.cpu.arch) {
6744 .i386 => switch (target.abi) {
6744 .x86 => switch (target.abi) {
67456745 .android => return 64,
67466746 else => return 80,
67476747 },
......@@ -6795,7 +6795,7 @@ pub const CType = enum {
67956795 },
67966796
67976797 .windows, .uefi => switch (target.cpu.arch) {
6798 .i386 => switch (self) {
6798 .x86 => switch (self) {
67996799 .short, .ushort => return 16,
68006800 .int, .uint, .float => return 32,
68016801 .long, .ulong => return 32,
......@@ -6831,7 +6831,7 @@ pub const CType = enum {
68316831 .short, .ushort => return 16,
68326832 .int, .uint, .float => return 32,
68336833 .long, .ulong => switch (target.cpu.arch) {
6834 .i386, .arm, .aarch64_32 => return 32,
6834 .x86, .arm, .aarch64_32 => return 32,
68356835 .x86_64 => switch (target.abi) {
68366836 .gnux32, .muslx32 => return 32,
68376837 else => return 64,
......@@ -6840,7 +6840,7 @@ pub const CType = enum {
68406840 },
68416841 .longlong, .ulonglong, .double => return 64,
68426842 .longdouble => switch (target.cpu.arch) {
6843 .i386 => switch (target.abi) {
6843 .x86 => switch (target.abi) {
68446844 .android => return 64,
68456845 else => return 80,
68466846 },
......@@ -6899,7 +6899,7 @@ pub const CType = enum {
68996899 .short, .ushort => return 2,
69006900 else => return 1,
69016901 },
6902 .i386 => switch (target.os.tag) {
6902 .x86 => switch (target.os.tag) {
69036903 .windows, .uefi => switch (self) {
69046904 .longlong, .ulonglong, .double => return 8,
69056905 .longdouble => switch (target.abi) {
......@@ -6940,7 +6940,7 @@ pub const CType = enum {
69406940
69416941 .arc,
69426942 .csky,
6943 .i386,
6943 .x86,
69446944 .xcore,
69456945 .dxil,
69466946 .loongarch32,
......@@ -7037,7 +7037,7 @@ pub const CType = enum {
70377037 .double => return 4,
70387038 .longlong, .ulonglong => return 8,
70397039 },
7040 .i386 => switch (target.os.tag) {
7040 .x86 => switch (target.os.tag) {
70417041 .windows, .uefi => switch (self) {
70427042 .longdouble => switch (target.abi) {
70437043 .gnu, .gnuilp32, .cygnus => return 4,
......@@ -7090,7 +7090,7 @@ pub const CType = enum {
70907090 .bpfeb,
70917091 .hexagon,
70927092 .hsail64,
7093 .i386,
7093 .x86,
70947094 .loongarch64,
70957095 .m68k,
70967096 .mips,
src/windows_sdk.cpp+5-5
......@@ -21,7 +21,7 @@ struct ZigWindowsSDKPrivate {
2121
2222enum NativeArch {
2323 NativeArchArm,
24 NativeArchi386,
24 NativeArchx86,
2525 NativeArchx86_64,
2626 NativeArchAarch64,
2727};
......@@ -29,7 +29,7 @@ enum NativeArch {
2929#if defined(_M_ARM) || defined(__arm_)
3030static const NativeArch native_arch = NativeArchArm;
3131#elif defined(_M_IX86) || defined(__i386__)
32static const NativeArch native_arch = NativeArchi386;
32static const NativeArch native_arch = NativeArchx86;
3333#elif defined(_M_X64) || defined(__x86_64__)
3434static const NativeArch native_arch = NativeArchx86_64;
3535#elif defined(_M_ARM64) || defined(__aarch64__)
......@@ -110,7 +110,7 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) {
110110 fclose(tools_file);
111111 out_append_ptr += sprintf(out_append_ptr, "VC\\Tools\\MSVC\\%s\\lib\\", tmp_path);
112112 switch (native_arch) {
113 case NativeArchi386:
113 case NativeArchx86:
114114 out_append_ptr += sprintf(out_append_ptr, "x86\\");
115115 break;
116116 case NativeArchx86_64:
......@@ -158,7 +158,7 @@ com_done:;
158158 char *tmp_buf_append_ptr = tmp_buf + (cb_data - 1);
159159 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "VC\\Lib\\");
160160 switch (native_arch) {
161 case NativeArchi386:
161 case NativeArchx86:
162162 //x86 is in the root of the Lib folder
163163 break;
164164 case NativeArchx86_64:
......@@ -219,7 +219,7 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) {
219219 case NativeArchx86_64:
220220 option_name = "OptionId.DesktopCPPx64";
221221 break;
222 case NativeArchi386:
222 case NativeArchx86:
223223 option_name = "OptionId.DesktopCPPx86";
224224 break;
225225 default:
test/behavior/align.zig+1-1
......@@ -107,7 +107,7 @@ test "alignment and size of structs with 128-bit fields" {
107107 .u129_size = 24,
108108 },
109109
110 .i386 => switch (builtin.os.tag) {
110 .x86 => switch (builtin.os.tag) {
111111 .windows => .{
112112 .a_align = 8,
113113 .a_size = 16,
test/behavior/floatop.zig+1-1
......@@ -5,7 +5,7 @@ const math = std.math;
55const pi = std.math.pi;
66const e = std.math.e;
77const has_f80_rt = switch (builtin.cpu.arch) {
8 .x86_64, .i386 => true,
8 .x86_64, .x86 => true,
99 else => false,
1010};
1111
test/behavior/fn.zig+2-2
......@@ -150,9 +150,9 @@ test "extern struct with stdcallcc fn pointer" {
150150 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
151151
152152 const S = extern struct {
153 ptr: *const fn () callconv(if (builtin.target.cpu.arch == .i386) .Stdcall else .C) i32,
153 ptr: *const fn () callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .C) i32,
154154
155 fn foo() callconv(if (builtin.target.cpu.arch == .i386) .Stdcall else .C) i32 {
155 fn foo() callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .C) i32 {
156156 return 1234;
157157 }
158158 };
test/behavior/struct.zig+1-1
......@@ -1109,7 +1109,7 @@ test "packed struct with undefined initializers" {
11091109 var p: P = undefined;
11101110 p = P{ .a = 2, .b = 4, .c = 6 };
11111111 // Make sure the compiler doesn't touch the unprefixed fields.
1112 // Use expect since i386-linux doesn't like expectEqual
1112 // Use expect since x86-linux doesn't like expectEqual
11131113 try expect(p.a == 2);
11141114 try expect(p.b == 4);
11151115 try expect(p.c == 6);
test/behavior/vector.zig+1-1
......@@ -639,7 +639,7 @@ test "vector shift operators" {
639639 };
640640
641641 switch (builtin.target.cpu.arch) {
642 .i386,
642 .x86,
643643 .aarch64,
644644 .aarch64_be,
645645 .aarch64_32,
test/c_abi/main.zig+10-10
......@@ -2,7 +2,7 @@ const std = @import("std");
22const builtin = @import("builtin");
33const print = std.debug.print;
44const expect = std.testing.expect;
5const has_i128 = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isARM() and
5const has_i128 = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isARM() and
66 !builtin.cpu.arch.isMIPS() and !builtin.cpu.arch.isPPC();
77
88extern fn run_c_tests() void;
......@@ -153,7 +153,7 @@ export fn zig_bool(x: bool) void {
153153// https://github.com/ziglang/zig/issues/8465
154154//
155155// For now, we have no way of referring to the _Complex C types from Zig,
156// so our ABI is unavoidably broken on some platforms (such as i386)
156// so our ABI is unavoidably broken on some platforms (such as x86)
157157const ComplexFloat = extern struct {
158158 real: f32,
159159 imag: f32,
......@@ -170,7 +170,7 @@ extern fn c_cmultd_comp(a_r: f64, a_i: f64, b_r: f64, b_i: f64) ComplexDouble;
170170extern fn c_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat;
171171extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble;
172172
173const complex_abi_compatible = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isMIPS() and
173const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isMIPS() and
174174 !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV();
175175
176176test "C ABI complex float" {
......@@ -323,7 +323,7 @@ extern fn c_med_struct_mixed(MedStructMixed) void;
323323extern fn c_ret_med_struct_mixed() MedStructMixed;
324324
325325test "C ABI medium struct of ints and floats" {
326 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
326 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
327327 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
328328 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
329329 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
......@@ -356,7 +356,7 @@ extern fn c_small_struct_ints(SmallStructInts) void;
356356extern fn c_ret_small_struct_ints() SmallStructInts;
357357
358358test "C ABI small struct of ints" {
359 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
359 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
360360 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
361361 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
362362 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
......@@ -438,7 +438,7 @@ const SplitStructInt = extern struct {
438438extern fn c_split_struct_ints(SplitStructInt) void;
439439
440440test "C ABI split struct of ints" {
441 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
441 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
442442 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
443443 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
444444 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
......@@ -466,7 +466,7 @@ extern fn c_split_struct_mixed(SplitStructMixed) void;
466466extern fn c_ret_split_struct_mixed() SplitStructMixed;
467467
468468test "C ABI split struct of ints and floats" {
469 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
469 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
470470 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
471471 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
472472 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
......@@ -729,7 +729,7 @@ extern fn c_struct_with_array(StructWithArray) void;
729729extern fn c_ret_struct_with_array() StructWithArray;
730730
731731test "Struct with array as padding." {
732 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
732 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
733733 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
734734 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
735735 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
......@@ -783,7 +783,7 @@ extern fn c_small_vec(SmallVec) void;
783783extern fn c_ret_small_vec() SmallVec;
784784
785785test "small simd vector" {
786 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
786 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
787787 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
788788
789789 c_small_vec(.{ 1, 2 });
......@@ -820,7 +820,7 @@ extern fn c_ptr_size_float_struct(Vector2) void;
820820extern fn c_ret_ptr_size_float_struct() Vector2;
821821
822822test "C ABI pointer sized float struct" {
823 if (builtin.cpu.arch == .i386) return error.SkipZigTest;
823 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
824824 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
825825 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
826826 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
test/cases/compile_errors/callconv_interrupt_on_unsupported_platform.zig+1-1
......@@ -4,4 +4,4 @@ export fn entry() callconv(.Interrupt) void {}
44// backend=stage2
55// target=aarch64-linux-none
66//
7// :1:29: error: callconv 'Interrupt' is only available on i386, x86_64, AVR, and MSP430, not aarch64
7// :1:29: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64
test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig+3-3
......@@ -18,6 +18,6 @@ export fn entry3() void {
1818// backend=stage2
1919// target=x86_64-linux-none
2020//
21// :1:28: error: callconv 'Stdcall' is only available on i386, not x86_64
22// :2:28: error: callconv 'Fastcall' is only available on i386, not x86_64
23// :3:28: error: callconv 'Thiscall' is only available on i386, not x86_64
21// :1:28: error: callconv 'Stdcall' is only available on x86, not x86_64
22// :2:28: error: callconv 'Fastcall' is only available on x86, not x86_64
23// :3:28: error: callconv 'Thiscall' is only available on x86, not x86_64
test/cases/compile_errors/callconv_vectorcall_on_unsupported_platform.zig+1-1
......@@ -4,4 +4,4 @@ export fn entry() callconv(.Vectorcall) void {}
44// backend=stage2
55// target=x86_64-linux-none
66//
7// :1:29: error: callconv 'Vectorcall' is only available on i386 and AArch64, not x86_64
7// :1:29: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64
test/tests.zig+6-6
......@@ -163,14 +163,14 @@ const test_targets = blk: {
163163
164164 .{
165165 .target = .{
166 .cpu_arch = .i386,
166 .cpu_arch = .x86,
167167 .os_tag = .linux,
168168 .abi = .none,
169169 },
170170 },
171171 .{
172172 .target = .{
173 .cpu_arch = .i386,
173 .cpu_arch = .x86,
174174 .os_tag = .linux,
175175 .abi = .musl,
176176 },
......@@ -178,7 +178,7 @@ const test_targets = blk: {
178178 },
179179 .{
180180 .target = .{
181 .cpu_arch = .i386,
181 .cpu_arch = .x86,
182182 .os_tag = .linux,
183183 .abi = .gnu,
184184 },
......@@ -387,7 +387,7 @@ const test_targets = blk: {
387387
388388 .{
389389 .target = .{
390 .cpu_arch = .i386,
390 .cpu_arch = .x86,
391391 .os_tag = .windows,
392392 .abi = .msvc,
393393 },
......@@ -403,7 +403,7 @@ const test_targets = blk: {
403403
404404 .{
405405 .target = .{
406 .cpu_arch = .i386,
406 .cpu_arch = .x86,
407407 .os_tag = .windows,
408408 .abi = .gnu,
409409 },
......@@ -1279,7 +1279,7 @@ const c_abi_targets = [_]CrossTarget{
12791279 .abi = .musl,
12801280 },
12811281 .{
1282 .cpu_arch = .i386,
1282 .cpu_arch = .x86,
12831283 .os_tag = .linux,
12841284 .abi = .musl,
12851285 },
test/translate_c.zig+1-1
......@@ -1775,7 +1775,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
17751775 }
17761776
17771777 cases.addWithTarget("Calling convention", .{
1778 .cpu_arch = .i386,
1778 .cpu_arch = .x86,
17791779 .os_tag = .linux,
17801780 .abi = .none,
17811781 },
tools/gen_stubs.zig+7-7
......@@ -2,7 +2,7 @@
22//! ./gen_stubs /path/to/musl/build-all >libc.S
33//!
44//! The directory 'build-all' is expected to contain these subdirectories:
5//! arm i386 mips mips64 powerpc powerpc64 riscv64 x86_64
5//! arm x86 mips mips64 powerpc powerpc64 riscv64 x86_64
66//!
77//! ...each with 'lib/libc.so' inside of them.
88//!
......@@ -30,7 +30,7 @@ const native_endian = @import("builtin").target.cpu.arch.endian();
3030
3131const arches: [7]std.Target.Cpu.Arch = blk: {
3232 var result: [7]std.Target.Cpu.Arch = undefined;
33 for (.{ .riscv64, .mips, .i386, .x86_64, .powerpc, .powerpc64, .aarch64 }) |arch| {
33 for (.{ .riscv64, .mips, .x86, .x86_64, .powerpc, .powerpc64, .aarch64 }) |arch| {
3434 result[archIndex(arch)] = arch;
3535 }
3636 break :blk result;
......@@ -56,7 +56,7 @@ const MultiSym = struct {
5656 fn is32Only(ms: MultiSym) bool {
5757 return ms.present[archIndex(.riscv64)] == false and
5858 ms.present[archIndex(.mips)] == true and
59 ms.present[archIndex(.i386)] == true and
59 ms.present[archIndex(.x86)] == true and
6060 ms.present[archIndex(.x86_64)] == false and
6161 ms.present[archIndex(.powerpc)] == true and
6262 ms.present[archIndex(.powerpc64)] == false and
......@@ -97,7 +97,7 @@ const MultiSym = struct {
9797 const map = .{
9898 .{ .riscv64, 8 },
9999 .{ .mips, 4 },
100 .{ .i386, 4 },
100 .{ .x86, 4 },
101101 .{ .x86_64, 8 },
102102 .{ .powerpc, 4 },
103103 .{ .powerpc64, 8 },
......@@ -118,7 +118,7 @@ const MultiSym = struct {
118118 const map = .{
119119 .{ .riscv64, 16 },
120120 .{ .mips, 8 },
121 .{ .i386, 8 },
121 .{ .x86, 8 },
122122 .{ .x86_64, 16 },
123123 .{ .powerpc, 8 },
124124 .{ .powerpc64, 16 },
......@@ -139,7 +139,7 @@ const MultiSym = struct {
139139 const map = .{
140140 .{ .riscv64, 2 },
141141 .{ .mips, 1 },
142 .{ .i386, 1 },
142 .{ .x86, 1 },
143143 .{ .x86_64, 2 },
144144 .{ .powerpc, 1 },
145145 .{ .powerpc64, 2 },
......@@ -555,7 +555,7 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {
555555 // zig fmt: off
556556 .riscv64 => 0,
557557 .mips => 1,
558 .i386 => 2,
558 .x86 => 2,
559559 .x86_64 => 3,
560560 .powerpc => 4,
561561 .powerpc64 => 5,
tools/process_headers.zig+3-3
......@@ -96,7 +96,7 @@ const glibc_targets = [_]LibCTarget{
9696 },
9797 LibCTarget{
9898 .name = "i686-linux-gnu",
99 .arch = MultiArch{ .specific = Arch.i386 },
99 .arch = MultiArch{ .specific = Arch.x86 },
100100 .abi = MultiAbi{ .specific = Abi.gnu },
101101 },
102102 LibCTarget{
......@@ -208,8 +208,8 @@ const musl_targets = [_]LibCTarget{
208208 .abi = MultiAbi.musl,
209209 },
210210 LibCTarget{
211 .name = "i386",
212 .arch = MultiArch{ .specific = .i386 },
211 .name = "x86",
212 .arch = MultiArch{ .specific = .x86 },
213213 .abi = MultiAbi.musl,
214214 },
215215 LibCTarget{