authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-11-05 02:34:24-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-11-05 02:34:24-04:00
log1d680459197e7ba5e163d99e07fdfe54c2ad9225
tree3e95a4d15194369e1640dc508ebe9c064f11fb63
parente9a12491f6fe5e38a05eeef0e920f2dec23634a4
parent986b7ce5b27d5aa5fb2f31d70fd2cd863926bcba
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #13101 from alichraghi/o4


141 files changed, 3222 insertions(+), 3222 deletions(-)

doc/langref.html.in+6-6
...@@ -5126,7 +5126,7 @@ const builtin = @import("builtin");...@@ -5126,7 +5126,7 @@ const builtin = @import("builtin");
5126const native_arch = builtin.cpu.arch;5126const native_arch = builtin.cpu.arch;
5127const expect = std.testing.expect;5127const 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;
5130extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn;5130extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn;
51315131
5132test "foo" {5132test "foo" {
...@@ -5165,7 +5165,7 @@ export fn sub(a: i8, b: i8) i8 { return a - b; }...@@ -5165,7 +5165,7 @@ export fn sub(a: i8, b: i8) i8 { return a - b; }
5165// at link time, when linking statically, or at runtime, when linking5165// at link time, when linking statically, or at runtime, when linking
5166// dynamically.5166// dynamically.
5167// The callconv specifier changes the calling convention of the function.5167// 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;
5169extern "kernel32" fn ExitProcess(exit_code: u32) callconv(WINAPI) noreturn;5169extern "kernel32" fn ExitProcess(exit_code: u32) callconv(WINAPI) noreturn;
5170extern "c" fn atan2(a: f64, b: f64) f64;5170extern "c" fn atan2(a: f64, b: f64) f64;
51715171
...@@ -7487,7 +7487,7 @@ volatile (...@@ -7487,7 +7487,7 @@ volatile (
7487 : "rcx", "r11"7487 : "rcx", "r11"
7488);{#end_syntax_block#}7488);{#end_syntax_block#}
7489 <p>7489 <p>
7490 For i386 and x86_64 targets, the syntax is AT&amp;T syntax, rather than the more7490 For x86 and x86_64 targets, the syntax is AT&amp;T syntax, rather than the more
7491 popular Intel syntax. This is due to technical constraints; assembly parsing is7491 popular Intel syntax. This is due to technical constraints; assembly parsing is
7492 provided by LLVM and its support for Intel syntax is buggy and not well tested.7492 provided by LLVM and its support for Intel syntax is buggy and not well tested.
7493 </p>7493 </p>
...@@ -11608,7 +11608,7 @@ Architectures:...@@ -11608,7 +11608,7 @@ Architectures:
11608 v511608 v5
11609 v5te11609 v5te
11610 v4t11610 v4t
11611 i38611611 x86
11612 x86_64 (native)11612 x86_64 (native)
11613 xcore11613 xcore
11614 nvptx11614 nvptx
...@@ -11687,8 +11687,8 @@ Available libcs:...@@ -11687,8 +11687,8 @@ Available libcs:
11687 arm-linux-gnueabihf11687 arm-linux-gnueabihf
11688 arm-linux-musleabi11688 arm-linux-musleabi
11689 arm-linux-musleabihf11689 arm-linux-musleabihf
11690 i386-linux-gnu11690 x86-linux-gnu
11691 i386-linux-musl11691 x86-linux-musl
11692 mips64el-linux-gnuabi6411692 mips64el-linux-gnuabi64
11693 mips64el-linux-gnuabin3211693 mips64el-linux-gnuabin32
11694 mips64el-linux-musl11694 mips64el-linux-musl
lib/c.zig+1-1
...@@ -190,7 +190,7 @@ test "strncmp" {...@@ -190,7 +190,7 @@ test "strncmp" {
190// across .o file boundaries. fix comptime @ptrCast of nakedcc functions.190// across .o file boundaries. fix comptime @ptrCast of nakedcc functions.
191fn clone() callconv(.Naked) void {191fn clone() callconv(.Naked) void {
192 switch (native_arch) {192 switch (native_arch) {
193 .i386 => {193 .x86 => {
194 // __clone(func, stack, flags, arg, ptid, tls, ctid)194 // __clone(func, stack, flags, arg, ptid, tls, ctid)
195 // +8, +12, +16, +20, +24, +28, +32195 // +8, +12, +16, +20, +24, +28, +32
196 // syscall(SYS_clone, flags, stack, ptid, tls, ctid)196 // syscall(SYS_clone, flags, stack, ptid, tls, ctid)
lib/compiler_rt/aulldiv.zig+1-1
...@@ -7,7 +7,7 @@ const common = @import("common.zig");...@@ -7,7 +7,7 @@ const common = @import("common.zig");
7pub const panic = common.panic;7pub const panic = common.panic;
88
9comptime {9comptime {
10 if (arch == .i386 and abi == .msvc) {10 if (arch == .x86 and abi == .msvc) {
11 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins11 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
12 @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage });12 @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage });
13 @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage });13 @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage });
lib/compiler_rt/aullrem.zig+1-1
...@@ -7,7 +7,7 @@ const common = @import("common.zig");...@@ -7,7 +7,7 @@ const common = @import("common.zig");
7pub const panic = common.panic;7pub const panic = common.panic;
88
9comptime {9comptime {
10 if (arch == .i386 and abi == .msvc) {10 if (arch == .x86 and abi == .msvc) {
11 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins11 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
12 @export(_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage });12 @export(_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage });
13 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage });13 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage });
lib/compiler_rt/clear_cache.zig+1-1
...@@ -17,7 +17,7 @@ comptime {...@@ -17,7 +17,7 @@ comptime {
1717
18fn clear_cache(start: usize, end: usize) callconv(.C) void {18fn clear_cache(start: usize, end: usize) callconv(.C) void {
19 const x86 = switch (arch) {19 const x86 = switch (arch) {
20 .i386, .x86_64 => true,20 .x86, .x86_64 => true,
21 else => false,21 else => false,
22 };22 };
23 const arm32 = switch (arch) {23 const arm32 = switch (arch) {
lib/compiler_rt/common.zig+2-2
...@@ -48,7 +48,7 @@ pub const gnu_f16_abi = switch (builtin.cpu.arch) {...@@ -48,7 +48,7 @@ pub const gnu_f16_abi = switch (builtin.cpu.arch) {
48 .x86_64,48 .x86_64,
49 => false,49 => false,
5050
51 .i386 => true,51 .x86 => true,
5252
53 .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) {53 .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) {
54 .eabi, .eabihf => false,54 .eabi, .eabihf => false,
...@@ -79,7 +79,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?...@@ -79,7 +79,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?
79pub const F16T = switch (builtin.cpu.arch) {79pub const F16T = switch (builtin.cpu.arch) {
80 .aarch64, .aarch64_be, .aarch64_32 => f16,80 .aarch64, .aarch64_be, .aarch64_32 => f16,
81 .riscv64 => if (builtin.zig_backend == .stage1) u16 else f16,81 .riscv64 => if (builtin.zig_backend == .stage1) u16 else f16,
82 .i386, .x86_64 => f16,82 .x86, .x86_64 => f16,
83 else => u16,83 else => u16,
84};84};
8585
lib/compiler_rt/divti3.zig+1-1
...@@ -9,7 +9,7 @@ pub const panic = common.panic;...@@ -9,7 +9,7 @@ pub const panic = common.panic;
9comptime {9comptime {
10 if (builtin.os.tag == .windows) {10 if (builtin.os.tag == .windows) {
11 switch (arch) {11 switch (arch) {
12 .i386 => {12 .x86 => {
13 @export(__divti3, .{ .name = "__divti3", .linkage = common.linkage });13 @export(__divti3, .{ .name = "__divti3", .linkage = common.linkage });
14 },14 },
15 .x86_64 => {15 .x86_64 => {
lib/compiler_rt/extendf_test.zig+1-1
...@@ -140,7 +140,7 @@ test "extendhfsf2" {...@@ -140,7 +140,7 @@ test "extendhfsf2" {
140 try test__extendhfsf2(0x7f00, 0x7fe00000); // sNaN140 try test__extendhfsf2(0x7f00, 0x7fe00000); // sNaN
141 // On x86 the NaN becomes quiet because the return is pushed on the x87141 // On x86 the NaN becomes quiet because the return is pushed on the x87
142 // stack due to ABI requirements142 // 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)
144 try test__extendhfsf2(0x7c01, 0x7f802000); // sNaN144 try test__extendhfsf2(0x7c01, 0x7f802000); // sNaN
145145
146 try test__extendhfsf2(0, 0); // 0146 try test__extendhfsf2(0, 0); // 0
lib/compiler_rt/stack_probe.zig+5-5
...@@ -30,7 +30,7 @@ comptime {...@@ -30,7 +30,7 @@ comptime {
30 }30 }
3131
32 switch (arch) {32 switch (arch) {
33 .i386,33 .x86,
34 .x86_64,34 .x86_64,
35 => {35 => {
36 @export(zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage });36 @export(zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage });
...@@ -69,7 +69,7 @@ pub fn zig_probe_stack() callconv(.Naked) void {...@@ -69,7 +69,7 @@ pub fn zig_probe_stack() callconv(.Naked) void {
69 \\ ret69 \\ ret
70 );70 );
71 },71 },
72 .i386 => {72 .x86 => {
73 // %eax = probe length, %esp = stack pointer73 // %eax = probe length, %esp = stack pointer
74 asm volatile (74 asm volatile (
75 \\ push %%ecx75 \\ push %%ecx
...@@ -121,7 +121,7 @@ fn win_probe_stack_only() void {...@@ -121,7 +121,7 @@ fn win_probe_stack_only() void {
121 \\ ret121 \\ ret
122 );122 );
123 },123 },
124 .i386 => {124 .x86 => {
125 asm volatile (125 asm volatile (
126 \\ push %%ecx126 \\ push %%ecx
127 \\ push %%eax127 \\ push %%eax
...@@ -191,7 +191,7 @@ fn win_probe_stack_adjust_sp() void {...@@ -191,7 +191,7 @@ fn win_probe_stack_adjust_sp() void {
191 \\ ret191 \\ ret
192 );192 );
193 },193 },
194 .i386 => {194 .x86 => {
195 asm volatile (195 asm volatile (
196 \\ push %%ecx196 \\ push %%ecx
197 \\ cmp $0x1000,%%eax197 \\ cmp $0x1000,%%eax
...@@ -243,7 +243,7 @@ pub fn __chkstk() callconv(.Naked) void {...@@ -243,7 +243,7 @@ pub fn __chkstk() callconv(.Naked) void {
243 if (comptime arch.isAARCH64()) {243 if (comptime arch.isAARCH64()) {
244 @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{});244 @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{});
245 } else switch (arch) {245 } 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, .{}),
247 .x86_64 => @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}),247 .x86_64 => @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}),
248 else => unreachable,248 else => unreachable,
249 }249 }
lib/libc/glibc/abilists
Binary files a/lib/libc/glibc/abilists and b/lib/libc/glibc/abilists differ
lib/libc/include/i386-linux-gnu/bits/a.out.h deleted-11
...@@ -1,11 +0,0 @@
1#ifndef __A_OUT_GNU_H__
2# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
3#endif
4
5#ifdef __x86_64__
6
7/* Signal to users of this header that this architecture really doesn't
8 support a.out binary format. */
9#define __NO_A_OUT_SUPPORT 1
10
11#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/endianness.h deleted-11
...@@ -1,11 +0,0 @@
1#ifndef _BITS_ENDIANNESS_H
2#define _BITS_ENDIANNESS_H 1
3
4#ifndef _BITS_ENDIAN_H
5# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
6#endif
7
8/* i386/x86_64 are little-endian. */
9#define __BYTE_ORDER __LITTLE_ENDIAN
10
11#endif /* bits/endianness.h */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/environments.h deleted-105
...@@ -1,105 +0,0 @@
1/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _UNISTD_H
19# error "Never include this file directly. Use <unistd.h> instead"
20#endif
21
22#include <bits/wordsize.h>
23
24/* This header should define the following symbols under the described
25 situations. A value `1' means that the model is always supported,
26 `-1' means it is never supported. Undefined means it cannot be
27 statically decided.
28
29 _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type
30 _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type
31
32 _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type
33 _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type
34
35 The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG,
36 _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32,
37 _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were
38 used in previous versions of the Unix standard and are available
39 only for compatibility.
40*/
41
42#if __WORDSIZE == 64
43
44/* Environments with 32-bit wide pointers are optionally provided.
45 Therefore following macros aren't defined:
46 # undef _POSIX_V7_ILP32_OFF32
47 # undef _POSIX_V7_ILP32_OFFBIG
48 # undef _POSIX_V6_ILP32_OFF32
49 # undef _POSIX_V6_ILP32_OFFBIG
50 # undef _XBS5_ILP32_OFF32
51 # undef _XBS5_ILP32_OFFBIG
52 and users need to check at runtime. */
53
54/* We also have no use (for now) for an environment with bigger pointers
55 and offsets. */
56# define _POSIX_V7_LPBIG_OFFBIG -1
57# define _POSIX_V6_LPBIG_OFFBIG -1
58# define _XBS5_LPBIG_OFFBIG -1
59
60/* By default we have 64-bit wide `long int', pointers and `off_t'. */
61# define _POSIX_V7_LP64_OFF64 1
62# define _POSIX_V6_LP64_OFF64 1
63# define _XBS5_LP64_OFF64 1
64
65#else /* __WORDSIZE == 32 */
66
67/* We have 32-bit wide `int', `long int' and pointers and all platforms
68 support LFS. -mx32 has 64-bit wide `off_t'. */
69# define _POSIX_V7_ILP32_OFFBIG 1
70# define _POSIX_V6_ILP32_OFFBIG 1
71# define _XBS5_ILP32_OFFBIG 1
72
73# ifndef __x86_64__
74/* -m32 has 32-bit wide `off_t'. */
75# define _POSIX_V7_ILP32_OFF32 1
76# define _POSIX_V6_ILP32_OFF32 1
77# define _XBS5_ILP32_OFF32 1
78# endif
79
80/* We optionally provide an environment with the above size but an 64-bit
81 side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */
82
83/* Environments with 64-bit wide pointers can be provided,
84 so these macros aren't defined:
85 # undef _POSIX_V7_LP64_OFF64
86 # undef _POSIX_V7_LPBIG_OFFBIG
87 # undef _POSIX_V6_LP64_OFF64
88 # undef _POSIX_V6_LPBIG_OFFBIG
89 # undef _XBS5_LP64_OFF64
90 # undef _XBS5_LPBIG_OFFBIG
91 and sysconf tests for it at runtime. */
92
93#endif /* __WORDSIZE == 32 */
94
95#define __ILP32_OFF32_CFLAGS "-m32"
96#define __ILP32_OFF32_LDFLAGS "-m32"
97#if defined __x86_64__ && defined __ILP32__
98# define __ILP32_OFFBIG_CFLAGS "-mx32"
99# define __ILP32_OFFBIG_LDFLAGS "-mx32"
100#else
101# define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
102# define __ILP32_OFFBIG_LDFLAGS "-m32"
103#endif
104#define __LP64_OFF64_CFLAGS "-m64"
105#define __LP64_OFF64_LDFLAGS "-m64"
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/epoll.h deleted-29
...@@ -1,29 +0,0 @@
1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_EPOLL_H
19# error "Never use <bits/epoll.h> directly; include <sys/epoll.h> instead."
20#endif
21
22/* Flags to be passed to epoll_create1. */
23enum
24 {
25 EPOLL_CLOEXEC = 02000000
26#define EPOLL_CLOEXEC EPOLL_CLOEXEC
27 };
28
29#define __EPOLL_PACKED __attribute__ ((__packed__))
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/fcntl.h deleted-61
...@@ -1,61 +0,0 @@
1/* O_*, F_*, FD_* bit values for Linux/x86.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _FCNTL_H
20# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
21#endif
22
23#ifdef __x86_64__
24# define __O_LARGEFILE 0
25#endif
26
27#ifdef __x86_64__
28/* Not necessary, we always have 64-bit offsets. */
29# define F_GETLK64 5 /* Get record locking info. */
30# define F_SETLK64 6 /* Set record locking info (non-blocking). */
31# define F_SETLKW64 7 /* Set record locking info (blocking). */
32#endif
33
34
35struct flock
36 {
37 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
38 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
39#ifndef __USE_FILE_OFFSET64
40 __off_t l_start; /* Offset where the lock begins. */
41 __off_t l_len; /* Size of the locked area; zero means until EOF. */
42#else
43 __off64_t l_start; /* Offset where the lock begins. */
44 __off64_t l_len; /* Size of the locked area; zero means until EOF. */
45#endif
46 __pid_t l_pid; /* Process holding the lock. */
47 };
48
49#ifdef __USE_LARGEFILE64
50struct flock64
51 {
52 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
53 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
54 __off64_t l_start; /* Offset where the lock begins. */
55 __off64_t l_len; /* Size of the locked area; zero means until EOF. */
56 __pid_t l_pid; /* Process holding the lock. */
57 };
58#endif
59
60/* Include generic Linux declarations. */
61#include <bits/fcntl-linux.h>
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/fenv.h deleted-116
...@@ -1,116 +0,0 @@
1/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _FENV_H
19# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
20#endif
21
22/* Define bits representing the exception. We use the bit positions
23 of the appropriate bits in the FPU control word. */
24enum
25 {
26 FE_INVALID =
27#define FE_INVALID 0x01
28 FE_INVALID,
29 __FE_DENORM = 0x02,
30 FE_DIVBYZERO =
31#define FE_DIVBYZERO 0x04
32 FE_DIVBYZERO,
33 FE_OVERFLOW =
34#define FE_OVERFLOW 0x08
35 FE_OVERFLOW,
36 FE_UNDERFLOW =
37#define FE_UNDERFLOW 0x10
38 FE_UNDERFLOW,
39 FE_INEXACT =
40#define FE_INEXACT 0x20
41 FE_INEXACT
42 };
43
44#define FE_ALL_EXCEPT \
45 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
46
47/* The ix87 FPU supports all of the four defined rounding modes. We
48 use again the bit positions in the FPU control word as the values
49 for the appropriate macros. */
50enum
51 {
52 FE_TONEAREST =
53#define FE_TONEAREST 0
54 FE_TONEAREST,
55 FE_DOWNWARD =
56#define FE_DOWNWARD 0x400
57 FE_DOWNWARD,
58 FE_UPWARD =
59#define FE_UPWARD 0x800
60 FE_UPWARD,
61 FE_TOWARDZERO =
62#define FE_TOWARDZERO 0xc00
63 FE_TOWARDZERO
64 };
65
66
67/* Type representing exception flags. */
68typedef unsigned short int fexcept_t;
69
70
71/* Type representing floating-point environment. This structure
72 corresponds to the layout of the block written by the `fstenv'
73 instruction and has additional fields for the contents of the MXCSR
74 register as written by the `stmxcsr' instruction. */
75typedef struct
76 {
77 unsigned short int __control_word;
78 unsigned short int __glibc_reserved1;
79 unsigned short int __status_word;
80 unsigned short int __glibc_reserved2;
81 unsigned short int __tags;
82 unsigned short int __glibc_reserved3;
83 unsigned int __eip;
84 unsigned short int __cs_selector;
85 unsigned int __opcode:11;
86 unsigned int __glibc_reserved4:5;
87 unsigned int __data_offset;
88 unsigned short int __data_selector;
89 unsigned short int __glibc_reserved5;
90#ifdef __x86_64__
91 unsigned int __mxcsr;
92#endif
93 }
94fenv_t;
95
96/* If the default argument is used we use this value. */
97#define FE_DFL_ENV ((const fenv_t *) -1)
98
99#ifdef __USE_GNU
100/* Floating-point environment where none of the exception is masked. */
101# define FE_NOMASK_ENV ((const fenv_t *) -2)
102#endif
103
104#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
105/* Type representing floating-point control modes. */
106typedef struct
107 {
108 unsigned short int __control_word;
109 unsigned short int __glibc_reserved;
110 unsigned int __mxcsr;
111 }
112femode_t;
113
114/* Default floating-point control modes. */
115# define FE_DFL_MODE ((const femode_t *) -1L)
116#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/floatn.h deleted-121
...@@ -1,121 +0,0 @@
1/* Macros to control TS 18661-3 glibc features on x86.
2 Copyright (C) 2017-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_FLOATN_H
20#define _BITS_FLOATN_H
21
22#include <features.h>
23
24/* Defined to 1 if the current compiler invocation provides a
25 floating-point type with the IEEE 754 binary128 format, and this
26 glibc includes corresponding *f128 interfaces for it. The required
27 libgcc support was added some time after the basic compiler
28 support, for x86_64 and x86. */
29#if (defined __x86_64__ \
30 ? __GNUC_PREREQ (4, 3) \
31 : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4)))
32# define __HAVE_FLOAT128 1
33#else
34# define __HAVE_FLOAT128 0
35#endif
36
37/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct
38 from the default float, double and long double types in this glibc. */
39#if __HAVE_FLOAT128
40# define __HAVE_DISTINCT_FLOAT128 1
41#else
42# define __HAVE_DISTINCT_FLOAT128 0
43#endif
44
45/* Defined to 1 if the current compiler invocation provides a
46 floating-point type with the right format for _Float64x, and this
47 glibc includes corresponding *f64x interfaces for it. */
48#define __HAVE_FLOAT64X 1
49
50/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format
51 of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has
52 the format of _Float128, which must be different from that of long
53 double. */
54#define __HAVE_FLOAT64X_LONG_DOUBLE 1
55
56#ifndef __ASSEMBLER__
57
58/* Defined to concatenate the literal suffix to be used with _Float128
59 types, if __HAVE_FLOAT128 is 1. */
60# if __HAVE_FLOAT128
61# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
62/* The literal suffix f128 exists only since GCC 7.0. */
63# define __f128(x) x##q
64# else
65# define __f128(x) x##f128
66# endif
67# endif
68
69/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
70# if __HAVE_FLOAT128
71# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
72/* Add a typedef for older GCC compilers which don't natively support
73 _Complex _Float128. */
74typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
75# define __CFLOAT128 __cfloat128
76# else
77# define __CFLOAT128 _Complex _Float128
78# endif
79# endif
80
81/* The remaining of this file provides support for older compilers. */
82# if __HAVE_FLOAT128
83
84/* The type _Float128 exists only since GCC 7.0. */
85# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
86typedef __float128 _Float128;
87# endif
88
89/* __builtin_huge_valf128 doesn't exist before GCC 7.0. */
90# if !__GNUC_PREREQ (7, 0)
91# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ())
92# endif
93
94/* Older GCC has only a subset of built-in functions for _Float128 on
95 x86, and __builtin_infq is not usable in static initializers.
96 Converting a narrower sNaN to _Float128 produces a quiet NaN, so
97 attempts to use _Float128 sNaNs will not work properly with older
98 compilers. */
99# if !__GNUC_PREREQ (7, 0)
100# define __builtin_copysignf128 __builtin_copysignq
101# define __builtin_fabsf128 __builtin_fabsq
102# define __builtin_inff128() ((_Float128) __builtin_inf ())
103# define __builtin_nanf128(x) ((_Float128) __builtin_nan (x))
104# define __builtin_nansf128(x) ((_Float128) __builtin_nans (x))
105# endif
106
107/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*,
108 e.g.: __builtin_signbitf128, before GCC 6. However, there has never
109 been a __builtin_signbitf128 in GCC and the type-generic builtin is
110 only available since GCC 6. */
111# if !__GNUC_PREREQ (6, 0)
112# define __builtin_signbitf128 __signbitf128
113# endif
114
115# endif
116
117#endif /* !__ASSEMBLER__. */
118
119#include <bits/floatn-common.h>
120
121#endif /* _BITS_FLOATN_H */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/flt-eval-method.h deleted-33
...@@ -1,33 +0,0 @@
1/* Define __GLIBC_FLT_EVAL_METHOD. x86 version.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never use <bits/flt-eval-method.h> directly; include <math.h> instead."
21#endif
22
23#ifdef __FLT_EVAL_METHOD__
24# if __FLT_EVAL_METHOD__ == -1
25# define __GLIBC_FLT_EVAL_METHOD 2
26# else
27# define __GLIBC_FLT_EVAL_METHOD __FLT_EVAL_METHOD__
28# endif
29#elif defined __x86_64__
30# define __GLIBC_FLT_EVAL_METHOD 0
31#else
32# define __GLIBC_FLT_EVAL_METHOD 2
33#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/fp-logb.h deleted-24
...@@ -1,24 +0,0 @@
1/* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. x86 version.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never use <bits/fp-logb.h> directly; include <math.h> instead."
21#endif
22
23#define __FP_LOGB0_IS_MIN 1
24#define __FP_LOGBNAN_IS_MIN 1
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/indirect-return.h deleted-37
...@@ -1,37 +0,0 @@
1/* Definition of __INDIRECT_RETURN. x86 version.
2 Copyright (C) 2018-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _UCONTEXT_H
20# error "Never include <bits/indirect-return.h> directly; use <ucontext.h> instead."
21#endif
22
23/* On x86, swapcontext returns via indirect branch when the shadow stack
24 is enabled. Define __INDIRECT_RETURN to indicate whether swapcontext
25 returns via indirect branch. */
26#if defined __CET__ && (__CET__ & 2) != 0
27# if __glibc_has_attribute (__indirect_return__)
28# define __INDIRECT_RETURN __attribute__ ((__indirect_return__))
29# else
30/* Newer compilers provide the indirect_return attribute, but without
31 it we can use returns_twice to affect the optimizer in the same
32 way and avoid unsafe optimizations. */
33# define __INDIRECT_RETURN __attribute__ ((__returns_twice__))
34# endif
35#else
36# define __INDIRECT_RETURN
37#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/ipctypes.h deleted-33
...@@ -1,33 +0,0 @@
1/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM.
2 Copyright (C) 2012-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_IPC_H
20# error "Never use <bits/ipctypes.h> directly; include <sys/ipc.h> instead."
21#endif
22
23#ifndef _BITS_IPCTYPES_H
24#define _BITS_IPCTYPES_H 1
25
26/* Used in `struct shmid_ds'. */
27# ifdef __x86_64__
28typedef int __ipc_pid_t;
29# else
30typedef unsigned short int __ipc_pid_t;
31# endif
32
33#endif /* bits/ipctypes.h */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/iscanonical.h deleted-54
...@@ -1,54 +0,0 @@
1/* Define iscanonical macro. ldbl-96 version.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never use <bits/iscanonical.h> directly; include <math.h> instead."
21#endif
22
23extern int __iscanonicall (long double __x)
24 __THROW __attribute__ ((__const__));
25#define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1)
26#define __iscanonical(x) ((void) (__typeof (x)) (x), 1)
27#if __HAVE_DISTINCT_FLOAT128
28# define __iscanonicalf128(x) ((void) (__typeof (x)) (x), 1)
29#endif
30
31/* Return nonzero value if X is canonical. In IEEE interchange binary
32 formats, all values are canonical, but the argument must still be
33 converted to its semantic type for any exceptions arising from the
34 conversion, before being discarded; in extended precision, there
35 are encodings that are not consistently handled as corresponding to
36 any particular value of the type, and we return 0 for those. */
37#ifndef __cplusplus
38# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x))
39#else
40/* In C++ mode, __MATH_TG cannot be used, because it relies on
41 __builtin_types_compatible_p, which is a C-only builtin. On the
42 other hand, overloading provides the means to distinguish between
43 the floating-point types. The overloading resolution will match
44 the correct parameter (regardless of type qualifiers (i.e.: const
45 and volatile)). */
46extern "C++" {
47inline int iscanonical (float __val) { return __iscanonicalf (__val); }
48inline int iscanonical (double __val) { return __iscanonical (__val); }
49inline int iscanonical (long double __val) { return __iscanonicall (__val); }
50# if __HAVE_DISTINCT_FLOAT128
51inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); }
52# endif
53}
54#endif /* __cplusplus */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/link.h deleted-159
...@@ -1,159 +0,0 @@
1/* Copyright (C) 2004-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINK_H
19# error "Never include <bits/link.h> directly; use <link.h> instead."
20#endif
21
22
23#ifndef __x86_64__
24/* Registers for entry into PLT on IA-32. */
25typedef struct La_i86_regs
26{
27 uint32_t lr_edx;
28 uint32_t lr_ecx;
29 uint32_t lr_eax;
30 uint32_t lr_ebp;
31 uint32_t lr_esp;
32} La_i86_regs;
33
34/* Return values for calls from PLT on IA-32. */
35typedef struct La_i86_retval
36{
37 uint32_t lrv_eax;
38 uint32_t lrv_edx;
39 long double lrv_st0;
40 long double lrv_st1;
41 uint64_t lrv_bnd0;
42 uint64_t lrv_bnd1;
43} La_i86_retval;
44
45
46__BEGIN_DECLS
47
48extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
49 uintptr_t *__refcook,
50 uintptr_t *__defcook,
51 La_i86_regs *__regs,
52 unsigned int *__flags,
53 const char *__symname,
54 long int *__framesizep);
55extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
56 uintptr_t *__refcook,
57 uintptr_t *__defcook,
58 const La_i86_regs *__inregs,
59 La_i86_retval *__outregs,
60 const char *symname);
61
62__END_DECLS
63
64#else
65
66/* Registers for entry into PLT on x86-64. */
67# if __GNUC_PREREQ (4,0)
68typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16)));
69typedef float La_x86_64_ymm
70 __attribute__ ((__vector_size__ (32), __aligned__ (16)));
71typedef double La_x86_64_zmm
72 __attribute__ ((__vector_size__ (64), __aligned__ (16)));
73# else
74typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__)));
75# endif
76
77typedef union
78{
79# if __GNUC_PREREQ (4,0)
80 La_x86_64_ymm ymm[2];
81 La_x86_64_zmm zmm[1];
82# endif
83 La_x86_64_xmm xmm[4];
84} La_x86_64_vector __attribute__ ((__aligned__ (16)));
85
86typedef struct La_x86_64_regs
87{
88 uint64_t lr_rdx;
89 uint64_t lr_r8;
90 uint64_t lr_r9;
91 uint64_t lr_rcx;
92 uint64_t lr_rsi;
93 uint64_t lr_rdi;
94 uint64_t lr_rbp;
95 uint64_t lr_rsp;
96 La_x86_64_xmm lr_xmm[8];
97 La_x86_64_vector lr_vector[8];
98#ifndef __ILP32__
99 __int128_t lr_bnd[4];
100#endif
101} La_x86_64_regs;
102
103/* Return values for calls from PLT on x86-64. */
104typedef struct La_x86_64_retval
105{
106 uint64_t lrv_rax;
107 uint64_t lrv_rdx;
108 La_x86_64_xmm lrv_xmm0;
109 La_x86_64_xmm lrv_xmm1;
110 long double lrv_st0;
111 long double lrv_st1;
112 La_x86_64_vector lrv_vector0;
113 La_x86_64_vector lrv_vector1;
114#ifndef __ILP32__
115 __int128_t lrv_bnd0;
116 __int128_t lrv_bnd1;
117#endif
118} La_x86_64_retval;
119
120#define La_x32_regs La_x86_64_regs
121#define La_x32_retval La_x86_64_retval
122
123__BEGIN_DECLS
124
125extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym,
126 unsigned int __ndx,
127 uintptr_t *__refcook,
128 uintptr_t *__defcook,
129 La_x86_64_regs *__regs,
130 unsigned int *__flags,
131 const char *__symname,
132 long int *__framesizep);
133extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym,
134 unsigned int __ndx,
135 uintptr_t *__refcook,
136 uintptr_t *__defcook,
137 const La_x86_64_regs *__inregs,
138 La_x86_64_retval *__outregs,
139 const char *__symname);
140
141extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym,
142 unsigned int __ndx,
143 uintptr_t *__refcook,
144 uintptr_t *__defcook,
145 La_x32_regs *__regs,
146 unsigned int *__flags,
147 const char *__symname,
148 long int *__framesizep);
149extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym,
150 unsigned int __ndx,
151 uintptr_t *__refcook,
152 uintptr_t *__defcook,
153 const La_x32_regs *__inregs,
154 La_x32_retval *__outregs,
155 const char *__symname);
156
157__END_DECLS
158
159#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/long-double.h deleted-21
...@@ -1,21 +0,0 @@
1/* Properties of long double type. ldbl-96 version.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* long double is distinct from double, so there is nothing to
20 define here. */
21#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/math-vector.h deleted-63
...@@ -1,63 +0,0 @@
1/* Platform-specific SIMD declarations of math functions.
2 Copyright (C) 2014-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never include <bits/math-vector.h> directly;\
21 include <math.h> instead."
22#endif
23
24/* Get default empty definitions for simd declarations. */
25#include <bits/libm-simd-decl-stubs.h>
26
27#if defined __x86_64__ && defined __FAST_MATH__
28# if defined _OPENMP && _OPENMP >= 201307
29/* OpenMP case. */
30# define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch")
31# elif __GNUC_PREREQ (6,0)
32/* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)). */
33# define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch")))
34# endif
35
36# ifdef __DECL_SIMD_x86_64
37# undef __DECL_SIMD_cos
38# define __DECL_SIMD_cos __DECL_SIMD_x86_64
39# undef __DECL_SIMD_cosf
40# define __DECL_SIMD_cosf __DECL_SIMD_x86_64
41# undef __DECL_SIMD_sin
42# define __DECL_SIMD_sin __DECL_SIMD_x86_64
43# undef __DECL_SIMD_sinf
44# define __DECL_SIMD_sinf __DECL_SIMD_x86_64
45# undef __DECL_SIMD_sincos
46# define __DECL_SIMD_sincos __DECL_SIMD_x86_64
47# undef __DECL_SIMD_sincosf
48# define __DECL_SIMD_sincosf __DECL_SIMD_x86_64
49# undef __DECL_SIMD_log
50# define __DECL_SIMD_log __DECL_SIMD_x86_64
51# undef __DECL_SIMD_logf
52# define __DECL_SIMD_logf __DECL_SIMD_x86_64
53# undef __DECL_SIMD_exp
54# define __DECL_SIMD_exp __DECL_SIMD_x86_64
55# undef __DECL_SIMD_expf
56# define __DECL_SIMD_expf __DECL_SIMD_x86_64
57# undef __DECL_SIMD_pow
58# define __DECL_SIMD_pow __DECL_SIMD_x86_64
59# undef __DECL_SIMD_powf
60# define __DECL_SIMD_powf __DECL_SIMD_x86_64
61
62# endif
63#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/mman.h deleted-34
...@@ -1,34 +0,0 @@
1/* Definitions for POSIX memory map interface. Linux/x86_64 version.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_MMAN_H
20# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
21#endif
22
23/* The following definitions basically come from the kernel headers.
24 But the kernel header is not namespace clean. */
25
26/* Other flags. */
27#ifdef __USE_MISC
28# define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */
29#endif
30
31#include <bits/mman-map-flags-generic.h>
32
33/* Include generic Linux declarations. */
34#include <bits/mman-linux.h>
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/procfs-id.h deleted-30
...@@ -1,30 +0,0 @@
1/* Types of pr_uid and pr_gid in struct elf_prpsinfo. x86 version.
2 Copyright (C) 2018-2021 Free Software Foundation, Inc.
3
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _SYS_PROCFS_H
21# error "Never include <bits/procfs-id.h> directly; use <sys/procfs.h> instead."
22#endif
23
24#if __WORDSIZE == 32
25typedef unsigned short int __pr_uid_t;
26typedef unsigned short int __pr_gid_t;
27#else
28typedef unsigned int __pr_uid_t;
29typedef unsigned int __pr_gid_t;
30#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/procfs.h deleted-50
...@@ -1,50 +0,0 @@
1/* Types for registers for sys/procfs.h. x86 version.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_PROCFS_H
20# error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead."
21#endif
22
23/* Type for a general-purpose register. */
24#ifdef __x86_64__
25__extension__ typedef unsigned long long elf_greg_t;
26#else
27typedef unsigned long elf_greg_t;
28#endif
29
30/* And the whole bunch of them. We could have used `struct
31 user_regs_struct' directly in the typedef, but tradition says that
32 the register set is an array, which does have some peculiar
33 semantics, so leave it that way. */
34#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t))
35typedef elf_greg_t elf_gregset_t[ELF_NGREG];
36
37#ifndef __x86_64__
38/* Register set for the floating-point registers. */
39typedef struct user_fpregs_struct elf_fpregset_t;
40
41/* Register set for the extended floating-point registers. Includes
42 the Pentium III SSE registers in addition to the classic
43 floating-point stuff. */
44typedef struct user_fpxregs_struct elf_fpxregset_t;
45#else
46/* Register set for the extended floating-point registers. Includes
47 the Pentium III SSE registers in addition to the classic
48 floating-point stuff. */
49typedef struct user_fpregs_struct elf_fpregset_t;
50#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/pthreadtypes-arch.h deleted-55
...@@ -1,55 +0,0 @@
1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _BITS_PTHREADTYPES_ARCH_H
19#define _BITS_PTHREADTYPES_ARCH_H 1
20
21#include <bits/wordsize.h>
22
23#ifdef __x86_64__
24# if __WORDSIZE == 64
25# define __SIZEOF_PTHREAD_MUTEX_T 40
26# define __SIZEOF_PTHREAD_ATTR_T 56
27# define __SIZEOF_PTHREAD_RWLOCK_T 56
28# define __SIZEOF_PTHREAD_BARRIER_T 32
29# else
30# define __SIZEOF_PTHREAD_MUTEX_T 32
31# define __SIZEOF_PTHREAD_ATTR_T 32
32# define __SIZEOF_PTHREAD_RWLOCK_T 44
33# define __SIZEOF_PTHREAD_BARRIER_T 20
34# endif
35#else
36# define __SIZEOF_PTHREAD_MUTEX_T 24
37# define __SIZEOF_PTHREAD_ATTR_T 36
38# define __SIZEOF_PTHREAD_RWLOCK_T 32
39# define __SIZEOF_PTHREAD_BARRIER_T 20
40#endif
41#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
42#define __SIZEOF_PTHREAD_COND_T 48
43#define __SIZEOF_PTHREAD_CONDATTR_T 4
44#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
45#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
46
47#define __LOCK_ALIGNMENT
48#define __ONCE_ALIGNMENT
49
50#ifndef __x86_64__
51/* Extra attributes for the cleanup functions. */
52# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
53#endif
54
55#endif /* bits/pthreadtypes.h */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/setjmp.h deleted-40
...@@ -1,40 +0,0 @@
1/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18/* Define the machine-dependent type `jmp_buf'. x86-64 version. */
19#ifndef _BITS_SETJMP_H
20#define _BITS_SETJMP_H 1
21
22#if !defined _SETJMP_H && !defined _PTHREAD_H
23# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
24#endif
25
26#include <bits/wordsize.h>
27
28#ifndef _ASM
29
30# if __WORDSIZE == 64
31typedef long int __jmp_buf[8];
32# elif defined __x86_64__
33__extension__ typedef long long int __jmp_buf[8];
34# else
35typedef int __jmp_buf[6];
36# endif
37
38#endif
39
40#endif /* bits/setjmp.h */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/sigcontext.h deleted-196
...@@ -1,196 +0,0 @@
1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _BITS_SIGCONTEXT_H
19#define _BITS_SIGCONTEXT_H 1
20
21#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
22# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
23#endif
24
25#include <bits/types.h>
26
27#define FP_XSTATE_MAGIC1 0x46505853U
28#define FP_XSTATE_MAGIC2 0x46505845U
29#define FP_XSTATE_MAGIC2_SIZE sizeof (FP_XSTATE_MAGIC2)
30
31struct _fpx_sw_bytes
32{
33 __uint32_t magic1;
34 __uint32_t extended_size;
35 __uint64_t xstate_bv;
36 __uint32_t xstate_size;
37 __uint32_t __glibc_reserved1[7];
38};
39
40struct _fpreg
41{
42 unsigned short significand[4];
43 unsigned short exponent;
44};
45
46struct _fpxreg
47{
48 unsigned short significand[4];
49 unsigned short exponent;
50 unsigned short __glibc_reserved1[3];
51};
52
53struct _xmmreg
54{
55 __uint32_t element[4];
56};
57
58
59
60#ifndef __x86_64__
61
62struct _fpstate
63{
64 /* Regular FPU environment. */
65 __uint32_t cw;
66 __uint32_t sw;
67 __uint32_t tag;
68 __uint32_t ipoff;
69 __uint32_t cssel;
70 __uint32_t dataoff;
71 __uint32_t datasel;
72 struct _fpreg _st[8];
73 unsigned short status;
74 unsigned short magic;
75
76 /* FXSR FPU environment. */
77 __uint32_t _fxsr_env[6];
78 __uint32_t mxcsr;
79 __uint32_t __glibc_reserved1;
80 struct _fpxreg _fxsr_st[8];
81 struct _xmmreg _xmm[8];
82 __uint32_t __glibc_reserved2[56];
83};
84
85#ifndef sigcontext_struct
86/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
87 we need sigcontext. Some packages have come to rely on
88 sigcontext_struct being defined on 32-bit x86, so define this for
89 their benefit. */
90# define sigcontext_struct sigcontext
91#endif
92
93#define X86_FXSR_MAGIC 0x0000
94
95struct sigcontext
96{
97 unsigned short gs, __gsh;
98 unsigned short fs, __fsh;
99 unsigned short es, __esh;
100 unsigned short ds, __dsh;
101 unsigned long edi;
102 unsigned long esi;
103 unsigned long ebp;
104 unsigned long esp;
105 unsigned long ebx;
106 unsigned long edx;
107 unsigned long ecx;
108 unsigned long eax;
109 unsigned long trapno;
110 unsigned long err;
111 unsigned long eip;
112 unsigned short cs, __csh;
113 unsigned long eflags;
114 unsigned long esp_at_signal;
115 unsigned short ss, __ssh;
116 struct _fpstate * fpstate;
117 unsigned long oldmask;
118 unsigned long cr2;
119};
120
121#else /* __x86_64__ */
122
123struct _fpstate
124{
125 /* FPU environment matching the 64-bit FXSAVE layout. */
126 __uint16_t cwd;
127 __uint16_t swd;
128 __uint16_t ftw;
129 __uint16_t fop;
130 __uint64_t rip;
131 __uint64_t rdp;
132 __uint32_t mxcsr;
133 __uint32_t mxcr_mask;
134 struct _fpxreg _st[8];
135 struct _xmmreg _xmm[16];
136 __uint32_t __glibc_reserved1[24];
137};
138
139struct sigcontext
140{
141 __uint64_t r8;
142 __uint64_t r9;
143 __uint64_t r10;
144 __uint64_t r11;
145 __uint64_t r12;
146 __uint64_t r13;
147 __uint64_t r14;
148 __uint64_t r15;
149 __uint64_t rdi;
150 __uint64_t rsi;
151 __uint64_t rbp;
152 __uint64_t rbx;
153 __uint64_t rdx;
154 __uint64_t rax;
155 __uint64_t rcx;
156 __uint64_t rsp;
157 __uint64_t rip;
158 __uint64_t eflags;
159 unsigned short cs;
160 unsigned short gs;
161 unsigned short fs;
162 unsigned short __pad0;
163 __uint64_t err;
164 __uint64_t trapno;
165 __uint64_t oldmask;
166 __uint64_t cr2;
167 __extension__ union
168 {
169 struct _fpstate * fpstate;
170 __uint64_t __fpstate_word;
171 };
172 __uint64_t __reserved1 [8];
173};
174
175#endif /* __x86_64__ */
176
177struct _xsave_hdr
178{
179 __uint64_t xstate_bv;
180 __uint64_t __glibc_reserved1[2];
181 __uint64_t __glibc_reserved2[5];
182};
183
184struct _ymmh_state
185{
186 __uint32_t ymmh_space[64];
187};
188
189struct _xstate
190{
191 struct _fpstate fpstate;
192 struct _xsave_hdr xstate_hdr;
193 struct _ymmh_state ymmh;
194};
195
196#endif /* _BITS_SIGCONTEXT_H */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/siginfo-arch.h deleted-17
...@@ -1,17 +0,0 @@
1/* Architecture-specific adjustments to siginfo_t. x86 version. */
2#ifndef _BITS_SIGINFO_ARCH_H
3#define _BITS_SIGINFO_ARCH_H 1
4
5#if defined __x86_64__ && __WORDSIZE == 32
6/* si_utime and si_stime must be 4 byte aligned for x32 to match the
7 kernel. We align siginfo_t to 8 bytes so that si_utime and
8 si_stime are actually aligned to 8 bytes since their offsets are
9 multiple of 8 bytes. Note: with some compilers, the alignment
10 attribute would be ignored if it were put in __SI_CLOCK_T instead
11 of encapsulated in a typedef. */
12typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
13# define __SI_ALIGNMENT __attribute__ ((__aligned__ (8)))
14# define __SI_CLOCK_T __sigchld_clock_t
15#endif
16
17#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/struct_mutex.h deleted-63
...@@ -1,63 +0,0 @@
1/* x86 internal mutex struct definitions.
2 Copyright (C) 2019-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#ifndef _THREAD_MUTEX_INTERNAL_H
20#define _THREAD_MUTEX_INTERNAL_H 1
21
22struct __pthread_mutex_s
23{
24 int __lock;
25 unsigned int __count;
26 int __owner;
27#ifdef __x86_64__
28 unsigned int __nusers;
29#endif
30 /* KIND must stay at this position in the structure to maintain
31 binary compatibility with static initializers. */
32 int __kind;
33#ifdef __x86_64__
34 short __spins;
35 short __elision;
36 __pthread_list_t __list;
37# define __PTHREAD_MUTEX_HAVE_PREV 1
38#else
39 unsigned int __nusers;
40 __extension__ union
41 {
42 struct
43 {
44 short __espins;
45 short __eelision;
46# define __spins __elision_data.__espins
47# define __elision __elision_data.__eelision
48 } __elision_data;
49 __pthread_slist_t __list;
50 };
51# define __PTHREAD_MUTEX_HAVE_PREV 0
52#endif
53};
54
55#ifdef __x86_64__
56# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
57 0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
58#else
59# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
60 0, 0, 0, __kind, 0, { { 0, 0 } }
61#endif
62
63#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/struct_rwlock.h deleted-65
...@@ -1,65 +0,0 @@
1/* x86 internal rwlock struct definitions.
2 Copyright (C) 2019-2021 Free Software Foundation, Inc.
3
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20#ifndef _RWLOCK_INTERNAL_H
21#define _RWLOCK_INTERNAL_H
22
23struct __pthread_rwlock_arch_t
24{
25 unsigned int __readers;
26 unsigned int __writers;
27 unsigned int __wrphase_futex;
28 unsigned int __writers_futex;
29 unsigned int __pad3;
30 unsigned int __pad4;
31#ifdef __x86_64__
32 int __cur_writer;
33 int __shared;
34 signed char __rwelision;
35# ifdef __ILP32__
36 unsigned char __pad1[3];
37# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }
38# else
39 unsigned char __pad1[7];
40# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }
41# endif
42 unsigned long int __pad2;
43 /* FLAGS must stay at this position in the structure to maintain
44 binary compatibility. */
45 unsigned int __flags;
46#else /* __x86_64__ */
47 /* FLAGS must stay at this position in the structure to maintain
48 binary compatibility. */
49 unsigned char __flags;
50 unsigned char __shared;
51 signed char __rwelision;
52 unsigned char __pad2;
53 int __cur_writer;
54#endif
55};
56
57#ifdef __x86_64__
58# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
59 0, 0, 0, 0, 0, 0, 0, 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, __flags
60#else
61# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
62 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0
63#endif
64
65#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/struct_stat.h deleted-165
...@@ -1,165 +0,0 @@
1/* Definition for struct stat.
2 Copyright (C) 2020-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#if !defined _SYS_STAT_H && !defined _FCNTL_H
20# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
21#endif
22
23#ifndef _BITS_STRUCT_STAT_H
24#define _BITS_STRUCT_STAT_H 1
25
26struct stat
27 {
28#ifdef __USE_TIME_BITS64
29# include <bits/struct_stat_time64_helper.h>
30#else
31 __dev_t st_dev; /* Device. */
32# ifndef __x86_64__
33 unsigned short int __pad1;
34# endif
35# if defined __x86_64__ || !defined __USE_FILE_OFFSET64
36 __ino_t st_ino; /* File serial number. */
37# else
38 __ino_t __st_ino; /* 32bit file serial number. */
39# endif
40# ifndef __x86_64__
41 __mode_t st_mode; /* File mode. */
42 __nlink_t st_nlink; /* Link count. */
43# else
44 __nlink_t st_nlink; /* Link count. */
45 __mode_t st_mode; /* File mode. */
46# endif
47 __uid_t st_uid; /* User ID of the file's owner. */
48 __gid_t st_gid; /* Group ID of the file's group.*/
49# ifdef __x86_64__
50 int __pad0;
51# endif
52 __dev_t st_rdev; /* Device number, if device. */
53# ifndef __x86_64__
54 unsigned short int __pad2;
55# endif
56# if defined __x86_64__ || !defined __USE_FILE_OFFSET64
57 __off_t st_size; /* Size of file, in bytes. */
58# else
59 __off64_t st_size; /* Size of file, in bytes. */
60# endif
61 __blksize_t st_blksize; /* Optimal block size for I/O. */
62# if defined __x86_64__ || !defined __USE_FILE_OFFSET64
63 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
64# else
65 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
66# endif
67# ifdef __USE_XOPEN2K8
68 /* Nanosecond resolution timestamps are stored in a format
69 equivalent to 'struct timespec'. This is the type used
70 whenever possible but the Unix namespace rules do not allow the
71 identifier 'timespec' to appear in the <sys/stat.h> header.
72 Therefore we have to handle the use of this header in strictly
73 standard-compliant sources special. */
74 struct timespec st_atim; /* Time of last access. */
75 struct timespec st_mtim; /* Time of last modification. */
76 struct timespec st_ctim; /* Time of last status change. */
77# define st_atime st_atim.tv_sec /* Backward compatibility. */
78# define st_mtime st_mtim.tv_sec
79# define st_ctime st_ctim.tv_sec
80# else
81 __time_t st_atime; /* Time of last access. */
82 __syscall_ulong_t st_atimensec; /* Nscecs of last access. */
83 __time_t st_mtime; /* Time of last modification. */
84 __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */
85 __time_t st_ctime; /* Time of last status change. */
86 __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */
87# endif
88# ifdef __x86_64__
89 __syscall_slong_t __glibc_reserved[3];
90# else
91# ifndef __USE_FILE_OFFSET64
92 unsigned long int __glibc_reserved4;
93 unsigned long int __glibc_reserved5;
94# else
95 __ino64_t st_ino; /* File serial number. */
96# endif
97# endif
98#endif /* __USE_TIME_BITS64 */
99 };
100
101#ifdef __USE_LARGEFILE64
102/* Note stat64 has the same shape as stat for x86-64. */
103struct stat64
104 {
105# ifdef __USE_TIME_BITS64
106# include <bits/struct_stat_time64_helper.h>
107# else
108 __dev_t st_dev; /* Device. */
109# ifdef __x86_64__
110 __ino64_t st_ino; /* File serial number. */
111 __nlink_t st_nlink; /* Link count. */
112 __mode_t st_mode; /* File mode. */
113# else
114 unsigned int __pad1;
115 __ino_t __st_ino; /* 32bit file serial number. */
116 __mode_t st_mode; /* File mode. */
117 __nlink_t st_nlink; /* Link count. */
118# endif
119 __uid_t st_uid; /* User ID of the file's owner. */
120 __gid_t st_gid; /* Group ID of the file's group.*/
121# ifdef __x86_64__
122 int __pad0;
123 __dev_t st_rdev; /* Device number, if device. */
124 __off_t st_size; /* Size of file, in bytes. */
125# else
126 __dev_t st_rdev; /* Device number, if device. */
127 unsigned int __pad2;
128 __off64_t st_size; /* Size of file, in bytes. */
129# endif
130 __blksize_t st_blksize; /* Optimal block size for I/O. */
131 __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
132# ifdef __USE_XOPEN2K8
133 /* Nanosecond resolution timestamps are stored in a format
134 equivalent to 'struct timespec'. This is the type used
135 whenever possible but the Unix namespace rules do not allow the
136 identifier 'timespec' to appear in the <sys/stat.h> header.
137 Therefore we have to handle the use of this header in strictly
138 standard-compliant sources special. */
139 struct timespec st_atim; /* Time of last access. */
140 struct timespec st_mtim; /* Time of last modification. */
141 struct timespec st_ctim; /* Time of last status change. */
142# else
143 __time_t st_atime; /* Time of last access. */
144 __syscall_ulong_t st_atimensec; /* Nscecs of last access. */
145 __time_t st_mtime; /* Time of last modification. */
146 __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */
147 __time_t st_ctime; /* Time of last status change. */
148 __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */
149# endif
150# ifdef __x86_64__
151 __syscall_slong_t __glibc_reserved[3];
152# else
153 __ino64_t st_ino; /* File serial number. */
154# endif
155# endif /* __USE_TIME_BITS64 */
156 };
157#endif
158
159/* Tell code we have these members. */
160#define _STATBUF_ST_BLKSIZE
161#define _STATBUF_ST_RDEV
162/* Nanosecond resolution time values are supported. */
163#define _STATBUF_ST_NSEC
164
165#endif /* _BITS_STRUCT_STAT_H */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/timesize.h deleted-25
...@@ -1,25 +0,0 @@
1/* Bit size of the time_t type at glibc build time, x86-64 and x32 case.
2 Copyright (C) 2018-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#if defined __x86_64__ && defined __ILP32__
20/* For x32, time is 64-bit even though word size is 32-bit. */
21# define __TIMESIZE 64
22#else
23/* For others, time size is word size. */
24# define __TIMESIZE __WORDSIZE
25#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h deleted-38
...@@ -1,38 +0,0 @@
1/* x86 implementation of the semaphore struct semid_ds.
2 Copyright (C) 1995-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_SEM_H
20# error "Never include <bits/types/struct_semid_ds.h> directly; use <sys/sem.h> instead."
21#endif
22
23/* Data structure describing a set of semaphores. */
24struct semid_ds
25{
26#ifdef __USE_TIME_BITS64
27# include <bits/types/struct_semid64_ds_helper.h>
28#else
29 struct ipc_perm sem_perm; /* operation permission struct */
30 __time_t sem_otime; /* last semop() time */
31 __syscall_ulong_t __sem_otime_high;
32 __time_t sem_ctime; /* last time changed by semctl() */
33 __syscall_ulong_t __sem_ctime_high;
34 __syscall_ulong_t sem_nsems; /* number of semaphores in set */
35 __syscall_ulong_t __glibc_reserved3;
36 __syscall_ulong_t __glibc_reserved4;
37#endif
38};
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/typesizes.h deleted-106
...@@ -1,106 +0,0 @@
1/* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version.
2 Copyright (C) 2012-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_TYPES_H
20# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
21#endif
22
23#ifndef _BITS_TYPESIZES_H
24#define _BITS_TYPESIZES_H 1
25
26/* See <bits/types.h> for the meaning of these macros. This file exists so
27 that <bits/types.h> need not vary across different GNU platforms. */
28
29/* X32 kernel interface is 64-bit. */
30#if defined __x86_64__ && defined __ILP32__
31# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE
32# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE
33#else
34# define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
35# define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
36#endif
37
38#define __DEV_T_TYPE __UQUAD_TYPE
39#define __UID_T_TYPE __U32_TYPE
40#define __GID_T_TYPE __U32_TYPE
41#define __INO_T_TYPE __SYSCALL_ULONG_TYPE
42#define __INO64_T_TYPE __UQUAD_TYPE
43#define __MODE_T_TYPE __U32_TYPE
44#ifdef __x86_64__
45# define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE
46# define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE
47#else
48# define __NLINK_T_TYPE __UWORD_TYPE
49# define __FSWORD_T_TYPE __SWORD_TYPE
50#endif
51#define __OFF_T_TYPE __SYSCALL_SLONG_TYPE
52#define __OFF64_T_TYPE __SQUAD_TYPE
53#define __PID_T_TYPE __S32_TYPE
54#define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE
55#define __RLIM64_T_TYPE __UQUAD_TYPE
56#define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE
57#define __BLKCNT64_T_TYPE __SQUAD_TYPE
58#define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE
59#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
60#define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE
61#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
62#define __ID_T_TYPE __U32_TYPE
63#define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE
64#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE
65#define __USECONDS_T_TYPE __U32_TYPE
66#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE
67#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
68#define __DADDR_T_TYPE __S32_TYPE
69#define __KEY_T_TYPE __S32_TYPE
70#define __CLOCKID_T_TYPE __S32_TYPE
71#define __TIMER_T_TYPE void *
72#define __BLKSIZE_T_TYPE __SYSCALL_SLONG_TYPE
73#define __FSID_T_TYPE struct { int __val[2]; }
74#define __SSIZE_T_TYPE __SWORD_TYPE
75#define __CPU_MASK_TYPE __SYSCALL_ULONG_TYPE
76
77#ifdef __x86_64__
78/* Tell the libc code that off_t and off64_t are actually the same type
79 for all ABI purposes, even if possibly expressed as different base types
80 for C type-checking purposes. */
81# define __OFF_T_MATCHES_OFF64_T 1
82
83/* Same for ino_t and ino64_t. */
84# define __INO_T_MATCHES_INO64_T 1
85
86/* And for __rlim_t and __rlim64_t. */
87# define __RLIM_T_MATCHES_RLIM64_T 1
88
89/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
90# define __STATFS_MATCHES_STATFS64 1
91
92/* And for getitimer, setitimer and rusage */
93# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
94#else
95# define __RLIM_T_MATCHES_RLIM64_T 0
96
97# define __STATFS_MATCHES_STATFS64 0
98
99# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
100#endif
101
102/* Number of descriptors that can fit in an `fd_set'. */
103#define __FD_SETSIZE 1024
104
105
106#endif /* bits/typesizes.h */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/bits/wordsize.h deleted-17
...@@ -1,17 +0,0 @@
1/* Determine the wordsize from the preprocessor defines. */
2
3#if defined __x86_64__ && !defined __ILP32__
4# define __WORDSIZE 64
5#else
6# define __WORDSIZE 32
7#define __WORDSIZE32_SIZE_ULONG 0
8#define __WORDSIZE32_PTRDIFF_LONG 0
9#endif
10
11#ifdef __x86_64__
12# define __WORDSIZE_TIME64_COMPAT32 1
13/* Both x86-64 and x32 use the 64-bit system call interface. */
14# define __SYSCALL_WORDSIZE 64
15#else
16# define __WORDSIZE_TIME64_COMPAT32 0
17#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h deleted-43
...@@ -1,43 +0,0 @@
1! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*-
2! Copyright (C) 2019-2021 Free Software Foundation, Inc.
3! This file is part of the GNU C Library.
4!
5! The GNU C Library is free software; you can redistribute it and/or
6! modify it under the terms of the GNU Lesser General Public
7! License as published by the Free Software Foundation; either
8! version 2.1 of the License, or (at your option) any later version.
9!
10! The GNU C Library is distributed in the hope that it will be useful,
11! but WITHOUT ANY WARRANTY; without even the implied warranty of
12! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13! Lesser General Public License for more details.
14!
15! You should have received a copy of the GNU Lesser General Public
16! License along with the GNU C Library; if not, see
17! <https://www.gnu.org/licenses/>.
18
19!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')
20!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64')
21!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64')
22!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64')
23!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64')
24!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64')
25!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64')
26!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64')
27!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64')
28!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64')
29!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64')
30!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64')
31
32!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
33!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
34!GCC$ builtin (sin) attributes simd (notinbranch) if('x32')
35!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32')
36!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32')
37!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32')
38!GCC$ builtin (log) attributes simd (notinbranch) if('x32')
39!GCC$ builtin (logf) attributes simd (notinbranch) if('x32')
40!GCC$ builtin (exp) attributes simd (notinbranch) if('x32')
41!GCC$ builtin (expf) attributes simd (notinbranch) if('x32')
42!GCC$ builtin (pow) attributes simd (notinbranch) if('x32')
43!GCC$ builtin (powf) attributes simd (notinbranch) if('x32')
\ No newline at end of file
lib/libc/include/i386-linux-gnu/fpu_control.h deleted-109
...@@ -1,109 +0,0 @@
1/* FPU control word bits. x86 version.
2 Copyright (C) 1993-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Olaf Flebbe.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _FPU_CONTROL_H
21#define _FPU_CONTROL_H 1
22
23/* Note that this file sets on x86-64 only the x87 FPU, it does not
24 touch the SSE unit. */
25
26/* Here is the dirty part. Set up your 387 through the control word
27 * (cw) register.
28 *
29 * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
30 * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
31 *
32 * IM: Invalid operation mask
33 * DM: Denormalized operand mask
34 * ZM: Zero-divide mask
35 * OM: Overflow mask
36 * UM: Underflow mask
37 * PM: Precision (inexact result) mask
38 *
39 * Mask bit is 1 means no interrupt.
40 *
41 * PC: Precision control
42 * 11 - round to extended precision
43 * 10 - round to double precision
44 * 00 - round to single precision
45 *
46 * RC: Rounding control
47 * 00 - rounding to nearest
48 * 01 - rounding down (toward - infinity)
49 * 10 - rounding up (toward + infinity)
50 * 11 - rounding toward zero
51 *
52 * IC: Infinity control
53 * That is for 8087 and 80287 only.
54 *
55 * The hardware default is 0x037f which we use.
56 */
57
58#include <features.h>
59
60/* masking of interrupts */
61#define _FPU_MASK_IM 0x01
62#define _FPU_MASK_DM 0x02
63#define _FPU_MASK_ZM 0x04
64#define _FPU_MASK_OM 0x08
65#define _FPU_MASK_UM 0x10
66#define _FPU_MASK_PM 0x20
67
68/* precision control */
69#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
70#define _FPU_DOUBLE 0x200
71#define _FPU_SINGLE 0x0
72
73/* rounding control */
74#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
75#define _FPU_RC_DOWN 0x400
76#define _FPU_RC_UP 0x800
77#define _FPU_RC_ZERO 0xC00
78
79#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
80
81
82/* The fdlibm code requires strict IEEE double precision arithmetic,
83 and no interrupts for exceptions, rounding to nearest. */
84
85#define _FPU_DEFAULT 0x037f
86
87/* IEEE: same as above. */
88#define _FPU_IEEE 0x037f
89
90/* Type of the control word. */
91typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
92
93/* Macros for accessing the hardware control word. "*&" is used to
94 work around a bug in older versions of GCC. __volatile__ is used
95 to support combination of writing the control register and reading
96 it back. Without __volatile__, the old value may be used for reading
97 back under compiler optimization.
98
99 Note that the use of these macros is not sufficient anymore with
100 recent hardware nor on x86-64. Some floating point operations are
101 executed in the SSE/SSE2 engines which have their own control and
102 status register. */
103#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
104#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
105
106/* Default control word set at startup. */
107extern fpu_control_t __fpu_control;
108
109#endif /* fpu_control.h */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/gnu/lib-names.h deleted-17
...@@ -1,17 +0,0 @@
1/* This file is automatically generated.
2 It defines macros to allow user program to find the shared
3 library files which come as part of GNU libc. */
4#ifndef __GNU_LIB_NAMES_H
5#define __GNU_LIB_NAMES_H 1
6
7#if !defined __x86_64__
8# include <gnu/lib-names-32.h>
9#endif
10#if defined __x86_64__ && defined __LP64__
11# include <gnu/lib-names-64.h>
12#endif
13#if defined __x86_64__ && defined __ILP32__
14# include <gnu/lib-names-x32.h>
15#endif
16
17#endif /* gnu/lib-names.h */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/gnu/stubs.h deleted-14
...@@ -1,14 +0,0 @@
1/* This file is automatically generated.
2 This file selects the right generated file of `__stub_FUNCTION' macros
3 based on the architecture being compiled for. */
4
5
6#if !defined __x86_64__
7# include <gnu/stubs-32.h>
8#endif
9#if defined __x86_64__ && defined __LP64__
10# include <gnu/stubs-64.h>
11#endif
12#if defined __x86_64__ && defined __ILP32__
13# include <gnu/stubs-x32.h>
14#endif
\ No newline at end of file
lib/libc/include/i386-linux-gnu/sys/elf.h deleted-29
...@@ -1,29 +0,0 @@
1/* Copyright (C) 1998-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_ELF_H
19#define _SYS_ELF_H 1
20
21#ifdef __x86_64__
22# error This header is unsupported on x86-64.
23#else
24# warning "This header is obsolete; use <sys/procfs.h> instead."
25
26# include <sys/procfs.h>
27#endif
28
29#endif /* _SYS_ELF_H */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/sys/ptrace.h deleted-202
...@@ -1,202 +0,0 @@
1/* `ptrace' debugger support interface. Linux/x86 version.
2 Copyright (C) 1996-2021 Free Software Foundation, Inc.
3
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _SYS_PTRACE_H
21#define _SYS_PTRACE_H 1
22
23#include <features.h>
24#include <bits/types.h>
25
26__BEGIN_DECLS
27
28/* Type of the REQUEST argument to `ptrace.' */
29enum __ptrace_request
30{
31 /* Indicate that the process making this request should be traced.
32 All signals received by this process can be intercepted by its
33 parent, and its parent can use the other `ptrace' requests. */
34 PTRACE_TRACEME = 0,
35#define PT_TRACE_ME PTRACE_TRACEME
36
37 /* Return the word in the process's text space at address ADDR. */
38 PTRACE_PEEKTEXT = 1,
39#define PT_READ_I PTRACE_PEEKTEXT
40
41 /* Return the word in the process's data space at address ADDR. */
42 PTRACE_PEEKDATA = 2,
43#define PT_READ_D PTRACE_PEEKDATA
44
45 /* Return the word in the process's user area at offset ADDR. */
46 PTRACE_PEEKUSER = 3,
47#define PT_READ_U PTRACE_PEEKUSER
48
49 /* Write the word DATA into the process's text space at address ADDR. */
50 PTRACE_POKETEXT = 4,
51#define PT_WRITE_I PTRACE_POKETEXT
52
53 /* Write the word DATA into the process's data space at address ADDR. */
54 PTRACE_POKEDATA = 5,
55#define PT_WRITE_D PTRACE_POKEDATA
56
57 /* Write the word DATA into the process's user area at offset ADDR. */
58 PTRACE_POKEUSER = 6,
59#define PT_WRITE_U PTRACE_POKEUSER
60
61 /* Continue the process. */
62 PTRACE_CONT = 7,
63#define PT_CONTINUE PTRACE_CONT
64
65 /* Kill the process. */
66 PTRACE_KILL = 8,
67#define PT_KILL PTRACE_KILL
68
69 /* Single step the process. */
70 PTRACE_SINGLESTEP = 9,
71#define PT_STEP PTRACE_SINGLESTEP
72
73 /* Get all general purpose registers used by a processes. */
74 PTRACE_GETREGS = 12,
75#define PT_GETREGS PTRACE_GETREGS
76
77 /* Set all general purpose registers used by a processes. */
78 PTRACE_SETREGS = 13,
79#define PT_SETREGS PTRACE_SETREGS
80
81 /* Get all floating point registers used by a processes. */
82 PTRACE_GETFPREGS = 14,
83#define PT_GETFPREGS PTRACE_GETFPREGS
84
85 /* Set all floating point registers used by a processes. */
86 PTRACE_SETFPREGS = 15,
87#define PT_SETFPREGS PTRACE_SETFPREGS
88
89 /* Attach to a process that is already running. */
90 PTRACE_ATTACH = 16,
91#define PT_ATTACH PTRACE_ATTACH
92
93 /* Detach from a process attached to with PTRACE_ATTACH. */
94 PTRACE_DETACH = 17,
95#define PT_DETACH PTRACE_DETACH
96
97 /* Get all extended floating point registers used by a processes. */
98 PTRACE_GETFPXREGS = 18,
99#define PT_GETFPXREGS PTRACE_GETFPXREGS
100
101 /* Set all extended floating point registers used by a processes. */
102 PTRACE_SETFPXREGS = 19,
103#define PT_SETFPXREGS PTRACE_SETFPXREGS
104
105 /* Continue and stop at the next entry to or return from syscall. */
106 PTRACE_SYSCALL = 24,
107#define PT_SYSCALL PTRACE_SYSCALL
108
109 /* Get a TLS entry in the GDT. */
110 PTRACE_GET_THREAD_AREA = 25,
111#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
112
113 /* Change a TLS entry in the GDT. */
114 PTRACE_SET_THREAD_AREA = 26,
115#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
116
117#ifdef __x86_64__
118 /* Access TLS data. */
119 PTRACE_ARCH_PRCTL = 30,
120# define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL
121#endif
122
123 /* Continue and stop at the next syscall, it will not be executed. */
124 PTRACE_SYSEMU = 31,
125#define PT_SYSEMU PTRACE_SYSEMU
126
127 /* Single step the process, the next syscall will not be executed. */
128 PTRACE_SYSEMU_SINGLESTEP = 32,
129#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
130
131 /* Execute process until next taken branch. */
132 PTRACE_SINGLEBLOCK = 33,
133#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
134
135 /* Set ptrace filter options. */
136 PTRACE_SETOPTIONS = 0x4200,
137#define PT_SETOPTIONS PTRACE_SETOPTIONS
138
139 /* Get last ptrace message. */
140 PTRACE_GETEVENTMSG = 0x4201,
141#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
142
143 /* Get siginfo for process. */
144 PTRACE_GETSIGINFO = 0x4202,
145#define PT_GETSIGINFO PTRACE_GETSIGINFO
146
147 /* Set new siginfo for process. */
148 PTRACE_SETSIGINFO = 0x4203,
149#define PT_SETSIGINFO PTRACE_SETSIGINFO
150
151 /* Get register content. */
152 PTRACE_GETREGSET = 0x4204,
153#define PTRACE_GETREGSET PTRACE_GETREGSET
154
155 /* Set register content. */
156 PTRACE_SETREGSET = 0x4205,
157#define PTRACE_SETREGSET PTRACE_SETREGSET
158
159 /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
160 signal or group stop state. */
161 PTRACE_SEIZE = 0x4206,
162#define PTRACE_SEIZE PTRACE_SEIZE
163
164 /* Trap seized tracee. */
165 PTRACE_INTERRUPT = 0x4207,
166#define PTRACE_INTERRUPT PTRACE_INTERRUPT
167
168 /* Wait for next group event. */
169 PTRACE_LISTEN = 0x4208,
170#define PTRACE_LISTEN PTRACE_LISTEN
171
172 /* Retrieve siginfo_t structures without removing signals from a queue. */
173 PTRACE_PEEKSIGINFO = 0x4209,
174#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
175
176 /* Get the mask of blocked signals. */
177 PTRACE_GETSIGMASK = 0x420a,
178#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
179
180 /* Change the mask of blocked signals. */
181 PTRACE_SETSIGMASK = 0x420b,
182#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
183
184 /* Get seccomp BPF filters. */
185 PTRACE_SECCOMP_GET_FILTER = 0x420c,
186#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
187
188 /* Get seccomp BPF filter metadata. */
189 PTRACE_SECCOMP_GET_METADATA = 0x420d,
190#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
191
192 /* Get information about system call. */
193 PTRACE_GET_SYSCALL_INFO = 0x420e
194#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
195};
196
197
198#include <bits/ptrace-shared.h>
199
200__END_DECLS
201
202#endif /* _SYS_PTRACE_H */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/sys/ucontext.h deleted-262
...@@ -1,262 +0,0 @@
1/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_UCONTEXT_H
19#define _SYS_UCONTEXT_H 1
20
21#include <features.h>
22
23#include <bits/types.h>
24#include <bits/types/sigset_t.h>
25#include <bits/types/stack_t.h>
26
27
28#ifdef __USE_MISC
29# define __ctx(fld) fld
30#else
31# define __ctx(fld) __ ## fld
32#endif
33
34#ifdef __x86_64__
35
36/* Type for general register. */
37__extension__ typedef long long int greg_t;
38
39/* Number of general registers. */
40#define __NGREG 23
41#ifdef __USE_MISC
42# define NGREG __NGREG
43#endif
44
45/* Container for all general registers. */
46typedef greg_t gregset_t[__NGREG];
47
48#ifdef __USE_GNU
49/* Number of each register in the `gregset_t' array. */
50enum
51{
52 REG_R8 = 0,
53# define REG_R8 REG_R8
54 REG_R9,
55# define REG_R9 REG_R9
56 REG_R10,
57# define REG_R10 REG_R10
58 REG_R11,
59# define REG_R11 REG_R11
60 REG_R12,
61# define REG_R12 REG_R12
62 REG_R13,
63# define REG_R13 REG_R13
64 REG_R14,
65# define REG_R14 REG_R14
66 REG_R15,
67# define REG_R15 REG_R15
68 REG_RDI,
69# define REG_RDI REG_RDI
70 REG_RSI,
71# define REG_RSI REG_RSI
72 REG_RBP,
73# define REG_RBP REG_RBP
74 REG_RBX,
75# define REG_RBX REG_RBX
76 REG_RDX,
77# define REG_RDX REG_RDX
78 REG_RAX,
79# define REG_RAX REG_RAX
80 REG_RCX,
81# define REG_RCX REG_RCX
82 REG_RSP,
83# define REG_RSP REG_RSP
84 REG_RIP,
85# define REG_RIP REG_RIP
86 REG_EFL,
87# define REG_EFL REG_EFL
88 REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */
89# define REG_CSGSFS REG_CSGSFS
90 REG_ERR,
91# define REG_ERR REG_ERR
92 REG_TRAPNO,
93# define REG_TRAPNO REG_TRAPNO
94 REG_OLDMASK,
95# define REG_OLDMASK REG_OLDMASK
96 REG_CR2
97# define REG_CR2 REG_CR2
98};
99#endif
100
101struct _libc_fpxreg
102{
103 unsigned short int __ctx(significand)[4];
104 unsigned short int __ctx(exponent);
105 unsigned short int __glibc_reserved1[3];
106};
107
108struct _libc_xmmreg
109{
110 __uint32_t __ctx(element)[4];
111};
112
113struct _libc_fpstate
114{
115 /* 64-bit FXSAVE format. */
116 __uint16_t __ctx(cwd);
117 __uint16_t __ctx(swd);
118 __uint16_t __ctx(ftw);
119 __uint16_t __ctx(fop);
120 __uint64_t __ctx(rip);
121 __uint64_t __ctx(rdp);
122 __uint32_t __ctx(mxcsr);
123 __uint32_t __ctx(mxcr_mask);
124 struct _libc_fpxreg _st[8];
125 struct _libc_xmmreg _xmm[16];
126 __uint32_t __glibc_reserved1[24];
127};
128
129/* Structure to describe FPU registers. */
130typedef struct _libc_fpstate *fpregset_t;
131
132/* Context to describe whole processor state. */
133typedef struct
134 {
135 gregset_t __ctx(gregs);
136 /* Note that fpregs is a pointer. */
137 fpregset_t __ctx(fpregs);
138 __extension__ unsigned long long __reserved1 [8];
139} mcontext_t;
140
141/* Userlevel context. */
142typedef struct ucontext_t
143 {
144 unsigned long int __ctx(uc_flags);
145 struct ucontext_t *uc_link;
146 stack_t uc_stack;
147 mcontext_t uc_mcontext;
148 sigset_t uc_sigmask;
149 struct _libc_fpstate __fpregs_mem;
150 __extension__ unsigned long long int __ssp[4];
151 } ucontext_t;
152
153#else /* !__x86_64__ */
154
155/* Type for general register. */
156typedef int greg_t;
157
158/* Number of general registers. */
159#define __NGREG 19
160#ifdef __USE_MISC
161# define NGREG __NGREG
162#endif
163
164/* Container for all general registers. */
165typedef greg_t gregset_t[__NGREG];
166
167#ifdef __USE_GNU
168/* Number of each register is the `gregset_t' array. */
169enum
170{
171 REG_GS = 0,
172# define REG_GS REG_GS
173 REG_FS,
174# define REG_FS REG_FS
175 REG_ES,
176# define REG_ES REG_ES
177 REG_DS,
178# define REG_DS REG_DS
179 REG_EDI,
180# define REG_EDI REG_EDI
181 REG_ESI,
182# define REG_ESI REG_ESI
183 REG_EBP,
184# define REG_EBP REG_EBP
185 REG_ESP,
186# define REG_ESP REG_ESP
187 REG_EBX,
188# define REG_EBX REG_EBX
189 REG_EDX,
190# define REG_EDX REG_EDX
191 REG_ECX,
192# define REG_ECX REG_ECX
193 REG_EAX,
194# define REG_EAX REG_EAX
195 REG_TRAPNO,
196# define REG_TRAPNO REG_TRAPNO
197 REG_ERR,
198# define REG_ERR REG_ERR
199 REG_EIP,
200# define REG_EIP REG_EIP
201 REG_CS,
202# define REG_CS REG_CS
203 REG_EFL,
204# define REG_EFL REG_EFL
205 REG_UESP,
206# define REG_UESP REG_UESP
207 REG_SS
208# define REG_SS REG_SS
209};
210#endif
211
212/* Definitions taken from the kernel headers. */
213struct _libc_fpreg
214{
215 unsigned short int __ctx(significand)[4];
216 unsigned short int __ctx(exponent);
217};
218
219struct _libc_fpstate
220{
221 unsigned long int __ctx(cw);
222 unsigned long int __ctx(sw);
223 unsigned long int __ctx(tag);
224 unsigned long int __ctx(ipoff);
225 unsigned long int __ctx(cssel);
226 unsigned long int __ctx(dataoff);
227 unsigned long int __ctx(datasel);
228 struct _libc_fpreg _st[8];
229 unsigned long int __ctx(status);
230};
231
232/* Structure to describe FPU registers. */
233typedef struct _libc_fpstate *fpregset_t;
234
235/* Context to describe whole processor state. */
236typedef struct
237 {
238 gregset_t __ctx(gregs);
239 /* Due to Linux's history we have to use a pointer here. The SysV/i386
240 ABI requires a struct with the values. */
241 fpregset_t __ctx(fpregs);
242 unsigned long int __ctx(oldmask);
243 unsigned long int __ctx(cr2);
244 } mcontext_t;
245
246/* Userlevel context. */
247typedef struct ucontext_t
248 {
249 unsigned long int __ctx(uc_flags);
250 struct ucontext_t *uc_link;
251 stack_t uc_stack;
252 mcontext_t uc_mcontext;
253 sigset_t uc_sigmask;
254 struct _libc_fpstate __fpregs_mem;
255 unsigned long int __ssp[4];
256 } ucontext_t;
257
258#endif /* !__x86_64__ */
259
260#undef __ctx
261
262#endif /* sys/ucontext.h */
\ No newline at end of file
lib/libc/include/i386-linux-gnu/sys/user.h deleted-180
...@@ -1,180 +0,0 @@
1/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_USER_H
19#define _SYS_USER_H 1
20
21/* The whole purpose of this file is for GDB and GDB only. Don't read
22 too much into it. Don't use it for anything other than GDB unless
23 you know what you are doing. */
24
25#ifdef __x86_64__
26
27struct user_fpregs_struct
28{
29 unsigned short int cwd;
30 unsigned short int swd;
31 unsigned short int ftw;
32 unsigned short int fop;
33 __extension__ unsigned long long int rip;
34 __extension__ unsigned long long int rdp;
35 unsigned int mxcsr;
36 unsigned int mxcr_mask;
37 unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
38 unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
39 unsigned int padding[24];
40};
41
42struct user_regs_struct
43{
44 __extension__ unsigned long long int r15;
45 __extension__ unsigned long long int r14;
46 __extension__ unsigned long long int r13;
47 __extension__ unsigned long long int r12;
48 __extension__ unsigned long long int rbp;
49 __extension__ unsigned long long int rbx;
50 __extension__ unsigned long long int r11;
51 __extension__ unsigned long long int r10;
52 __extension__ unsigned long long int r9;
53 __extension__ unsigned long long int r8;
54 __extension__ unsigned long long int rax;
55 __extension__ unsigned long long int rcx;
56 __extension__ unsigned long long int rdx;
57 __extension__ unsigned long long int rsi;
58 __extension__ unsigned long long int rdi;
59 __extension__ unsigned long long int orig_rax;
60 __extension__ unsigned long long int rip;
61 __extension__ unsigned long long int cs;
62 __extension__ unsigned long long int eflags;
63 __extension__ unsigned long long int rsp;
64 __extension__ unsigned long long int ss;
65 __extension__ unsigned long long int fs_base;
66 __extension__ unsigned long long int gs_base;
67 __extension__ unsigned long long int ds;
68 __extension__ unsigned long long int es;
69 __extension__ unsigned long long int fs;
70 __extension__ unsigned long long int gs;
71};
72
73struct user
74{
75 struct user_regs_struct regs;
76 int u_fpvalid;
77 struct user_fpregs_struct i387;
78 __extension__ unsigned long long int u_tsize;
79 __extension__ unsigned long long int u_dsize;
80 __extension__ unsigned long long int u_ssize;
81 __extension__ unsigned long long int start_code;
82 __extension__ unsigned long long int start_stack;
83 __extension__ long long int signal;
84 int reserved;
85 __extension__ union
86 {
87 struct user_regs_struct* u_ar0;
88 __extension__ unsigned long long int __u_ar0_word;
89 };
90 __extension__ union
91 {
92 struct user_fpregs_struct* u_fpstate;
93 __extension__ unsigned long long int __u_fpstate_word;
94 };
95 __extension__ unsigned long long int magic;
96 char u_comm [32];
97 __extension__ unsigned long long int u_debugreg [8];
98};
99
100#else
101/* These are the 32-bit x86 structures. */
102struct user_fpregs_struct
103{
104 long int cwd;
105 long int swd;
106 long int twd;
107 long int fip;
108 long int fcs;
109 long int foo;
110 long int fos;
111 long int st_space [20];
112};
113
114struct user_fpxregs_struct
115{
116 unsigned short int cwd;
117 unsigned short int swd;
118 unsigned short int twd;
119 unsigned short int fop;
120 long int fip;
121 long int fcs;
122 long int foo;
123 long int fos;
124 long int mxcsr;
125 long int reserved;
126 long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
127 long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
128 long int padding[56];
129};
130
131struct user_regs_struct
132{
133 long int ebx;
134 long int ecx;
135 long int edx;
136 long int esi;
137 long int edi;
138 long int ebp;
139 long int eax;
140 long int xds;
141 long int xes;
142 long int xfs;
143 long int xgs;
144 long int orig_eax;
145 long int eip;
146 long int xcs;
147 long int eflags;
148 long int esp;
149 long int xss;
150};
151
152struct user
153{
154 struct user_regs_struct regs;
155 int u_fpvalid;
156 struct user_fpregs_struct i387;
157 unsigned long int u_tsize;
158 unsigned long int u_dsize;
159 unsigned long int u_ssize;
160 unsigned long int start_code;
161 unsigned long int start_stack;
162 long int signal;
163 int reserved;
164 struct user_regs_struct* u_ar0;
165 struct user_fpregs_struct* u_fpstate;
166 unsigned long int magic;
167 char u_comm [32];
168 int u_debugreg [8];
169};
170#endif /* __x86_64__ */
171
172#define PAGE_SHIFT 12
173#define PAGE_SIZE (1UL << PAGE_SHIFT)
174#define PAGE_MASK (~(PAGE_SIZE-1))
175#define NBPG PAGE_SIZE
176#define UPAGES 1
177#define HOST_TEXT_START_ADDR (u.start_code)
178#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
179
180#endif /* _SYS_USER_H */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/a.out.h created+11
...@@ -0,0 +1,11 @@
1#ifndef __A_OUT_GNU_H__
2# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
3#endif
4
5#ifdef __x86_64__
6
7/* Signal to users of this header that this architecture really doesn't
8 support a.out binary format. */
9#define __NO_A_OUT_SUPPORT 1
10
11#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/endianness.h created+11
...@@ -0,0 +1,11 @@
1#ifndef _BITS_ENDIANNESS_H
2#define _BITS_ENDIANNESS_H 1
3
4#ifndef _BITS_ENDIAN_H
5# error "Never use <bits/endianness.h> directly; include <endian.h> instead."
6#endif
7
8/* i386/x86_64 are little-endian. */
9#define __BYTE_ORDER __LITTLE_ENDIAN
10
11#endif /* bits/endianness.h */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/environments.h created+105
...@@ -0,0 +1,105 @@
1/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _UNISTD_H
19# error "Never include this file directly. Use <unistd.h> instead"
20#endif
21
22#include <bits/wordsize.h>
23
24/* This header should define the following symbols under the described
25 situations. A value `1' means that the model is always supported,
26 `-1' means it is never supported. Undefined means it cannot be
27 statically decided.
28
29 _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type
30 _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type
31
32 _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type
33 _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type
34
35 The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG,
36 _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32,
37 _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were
38 used in previous versions of the Unix standard and are available
39 only for compatibility.
40*/
41
42#if __WORDSIZE == 64
43
44/* Environments with 32-bit wide pointers are optionally provided.
45 Therefore following macros aren't defined:
46 # undef _POSIX_V7_ILP32_OFF32
47 # undef _POSIX_V7_ILP32_OFFBIG
48 # undef _POSIX_V6_ILP32_OFF32
49 # undef _POSIX_V6_ILP32_OFFBIG
50 # undef _XBS5_ILP32_OFF32
51 # undef _XBS5_ILP32_OFFBIG
52 and users need to check at runtime. */
53
54/* We also have no use (for now) for an environment with bigger pointers
55 and offsets. */
56# define _POSIX_V7_LPBIG_OFFBIG -1
57# define _POSIX_V6_LPBIG_OFFBIG -1
58# define _XBS5_LPBIG_OFFBIG -1
59
60/* By default we have 64-bit wide `long int', pointers and `off_t'. */
61# define _POSIX_V7_LP64_OFF64 1
62# define _POSIX_V6_LP64_OFF64 1
63# define _XBS5_LP64_OFF64 1
64
65#else /* __WORDSIZE == 32 */
66
67/* We have 32-bit wide `int', `long int' and pointers and all platforms
68 support LFS. -mx32 has 64-bit wide `off_t'. */
69# define _POSIX_V7_ILP32_OFFBIG 1
70# define _POSIX_V6_ILP32_OFFBIG 1
71# define _XBS5_ILP32_OFFBIG 1
72
73# ifndef __x86_64__
74/* -m32 has 32-bit wide `off_t'. */
75# define _POSIX_V7_ILP32_OFF32 1
76# define _POSIX_V6_ILP32_OFF32 1
77# define _XBS5_ILP32_OFF32 1
78# endif
79
80/* We optionally provide an environment with the above size but an 64-bit
81 side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */
82
83/* Environments with 64-bit wide pointers can be provided,
84 so these macros aren't defined:
85 # undef _POSIX_V7_LP64_OFF64
86 # undef _POSIX_V7_LPBIG_OFFBIG
87 # undef _POSIX_V6_LP64_OFF64
88 # undef _POSIX_V6_LPBIG_OFFBIG
89 # undef _XBS5_LP64_OFF64
90 # undef _XBS5_LPBIG_OFFBIG
91 and sysconf tests for it at runtime. */
92
93#endif /* __WORDSIZE == 32 */
94
95#define __ILP32_OFF32_CFLAGS "-m32"
96#define __ILP32_OFF32_LDFLAGS "-m32"
97#if defined __x86_64__ && defined __ILP32__
98# define __ILP32_OFFBIG_CFLAGS "-mx32"
99# define __ILP32_OFFBIG_LDFLAGS "-mx32"
100#else
101# define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
102# define __ILP32_OFFBIG_LDFLAGS "-m32"
103#endif
104#define __LP64_OFF64_CFLAGS "-m64"
105#define __LP64_OFF64_LDFLAGS "-m64"
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/epoll.h created+29
...@@ -0,0 +1,29 @@
1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_EPOLL_H
19# error "Never use <bits/epoll.h> directly; include <sys/epoll.h> instead."
20#endif
21
22/* Flags to be passed to epoll_create1. */
23enum
24 {
25 EPOLL_CLOEXEC = 02000000
26#define EPOLL_CLOEXEC EPOLL_CLOEXEC
27 };
28
29#define __EPOLL_PACKED __attribute__ ((__packed__))
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/fcntl.h created+61
...@@ -0,0 +1,61 @@
1/* O_*, F_*, FD_* bit values for Linux/x86.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _FCNTL_H
20# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
21#endif
22
23#ifdef __x86_64__
24# define __O_LARGEFILE 0
25#endif
26
27#ifdef __x86_64__
28/* Not necessary, we always have 64-bit offsets. */
29# define F_GETLK64 5 /* Get record locking info. */
30# define F_SETLK64 6 /* Set record locking info (non-blocking). */
31# define F_SETLKW64 7 /* Set record locking info (blocking). */
32#endif
33
34
35struct flock
36 {
37 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
38 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
39#ifndef __USE_FILE_OFFSET64
40 __off_t l_start; /* Offset where the lock begins. */
41 __off_t l_len; /* Size of the locked area; zero means until EOF. */
42#else
43 __off64_t l_start; /* Offset where the lock begins. */
44 __off64_t l_len; /* Size of the locked area; zero means until EOF. */
45#endif
46 __pid_t l_pid; /* Process holding the lock. */
47 };
48
49#ifdef __USE_LARGEFILE64
50struct flock64
51 {
52 short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
53 short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
54 __off64_t l_start; /* Offset where the lock begins. */
55 __off64_t l_len; /* Size of the locked area; zero means until EOF. */
56 __pid_t l_pid; /* Process holding the lock. */
57 };
58#endif
59
60/* Include generic Linux declarations. */
61#include <bits/fcntl-linux.h>
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/fenv.h created+116
...@@ -0,0 +1,116 @@
1/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _FENV_H
19# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
20#endif
21
22/* Define bits representing the exception. We use the bit positions
23 of the appropriate bits in the FPU control word. */
24enum
25 {
26 FE_INVALID =
27#define FE_INVALID 0x01
28 FE_INVALID,
29 __FE_DENORM = 0x02,
30 FE_DIVBYZERO =
31#define FE_DIVBYZERO 0x04
32 FE_DIVBYZERO,
33 FE_OVERFLOW =
34#define FE_OVERFLOW 0x08
35 FE_OVERFLOW,
36 FE_UNDERFLOW =
37#define FE_UNDERFLOW 0x10
38 FE_UNDERFLOW,
39 FE_INEXACT =
40#define FE_INEXACT 0x20
41 FE_INEXACT
42 };
43
44#define FE_ALL_EXCEPT \
45 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
46
47/* The ix87 FPU supports all of the four defined rounding modes. We
48 use again the bit positions in the FPU control word as the values
49 for the appropriate macros. */
50enum
51 {
52 FE_TONEAREST =
53#define FE_TONEAREST 0
54 FE_TONEAREST,
55 FE_DOWNWARD =
56#define FE_DOWNWARD 0x400
57 FE_DOWNWARD,
58 FE_UPWARD =
59#define FE_UPWARD 0x800
60 FE_UPWARD,
61 FE_TOWARDZERO =
62#define FE_TOWARDZERO 0xc00
63 FE_TOWARDZERO
64 };
65
66
67/* Type representing exception flags. */
68typedef unsigned short int fexcept_t;
69
70
71/* Type representing floating-point environment. This structure
72 corresponds to the layout of the block written by the `fstenv'
73 instruction and has additional fields for the contents of the MXCSR
74 register as written by the `stmxcsr' instruction. */
75typedef struct
76 {
77 unsigned short int __control_word;
78 unsigned short int __glibc_reserved1;
79 unsigned short int __status_word;
80 unsigned short int __glibc_reserved2;
81 unsigned short int __tags;
82 unsigned short int __glibc_reserved3;
83 unsigned int __eip;
84 unsigned short int __cs_selector;
85 unsigned int __opcode:11;
86 unsigned int __glibc_reserved4:5;
87 unsigned int __data_offset;
88 unsigned short int __data_selector;
89 unsigned short int __glibc_reserved5;
90#ifdef __x86_64__
91 unsigned int __mxcsr;
92#endif
93 }
94fenv_t;
95
96/* If the default argument is used we use this value. */
97#define FE_DFL_ENV ((const fenv_t *) -1)
98
99#ifdef __USE_GNU
100/* Floating-point environment where none of the exception is masked. */
101# define FE_NOMASK_ENV ((const fenv_t *) -2)
102#endif
103
104#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
105/* Type representing floating-point control modes. */
106typedef struct
107 {
108 unsigned short int __control_word;
109 unsigned short int __glibc_reserved;
110 unsigned int __mxcsr;
111 }
112femode_t;
113
114/* Default floating-point control modes. */
115# define FE_DFL_MODE ((const femode_t *) -1L)
116#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/floatn.h created+121
...@@ -0,0 +1,121 @@
1/* Macros to control TS 18661-3 glibc features on x86.
2 Copyright (C) 2017-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_FLOATN_H
20#define _BITS_FLOATN_H
21
22#include <features.h>
23
24/* Defined to 1 if the current compiler invocation provides a
25 floating-point type with the IEEE 754 binary128 format, and this
26 glibc includes corresponding *f128 interfaces for it. The required
27 libgcc support was added some time after the basic compiler
28 support, for x86_64 and x86. */
29#if (defined __x86_64__ \
30 ? __GNUC_PREREQ (4, 3) \
31 : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4)))
32# define __HAVE_FLOAT128 1
33#else
34# define __HAVE_FLOAT128 0
35#endif
36
37/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct
38 from the default float, double and long double types in this glibc. */
39#if __HAVE_FLOAT128
40# define __HAVE_DISTINCT_FLOAT128 1
41#else
42# define __HAVE_DISTINCT_FLOAT128 0
43#endif
44
45/* Defined to 1 if the current compiler invocation provides a
46 floating-point type with the right format for _Float64x, and this
47 glibc includes corresponding *f64x interfaces for it. */
48#define __HAVE_FLOAT64X 1
49
50/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format
51 of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has
52 the format of _Float128, which must be different from that of long
53 double. */
54#define __HAVE_FLOAT64X_LONG_DOUBLE 1
55
56#ifndef __ASSEMBLER__
57
58/* Defined to concatenate the literal suffix to be used with _Float128
59 types, if __HAVE_FLOAT128 is 1. */
60# if __HAVE_FLOAT128
61# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
62/* The literal suffix f128 exists only since GCC 7.0. */
63# define __f128(x) x##q
64# else
65# define __f128(x) x##f128
66# endif
67# endif
68
69/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
70# if __HAVE_FLOAT128
71# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
72/* Add a typedef for older GCC compilers which don't natively support
73 _Complex _Float128. */
74typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
75# define __CFLOAT128 __cfloat128
76# else
77# define __CFLOAT128 _Complex _Float128
78# endif
79# endif
80
81/* The remaining of this file provides support for older compilers. */
82# if __HAVE_FLOAT128
83
84/* The type _Float128 exists only since GCC 7.0. */
85# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
86typedef __float128 _Float128;
87# endif
88
89/* __builtin_huge_valf128 doesn't exist before GCC 7.0. */
90# if !__GNUC_PREREQ (7, 0)
91# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ())
92# endif
93
94/* Older GCC has only a subset of built-in functions for _Float128 on
95 x86, and __builtin_infq is not usable in static initializers.
96 Converting a narrower sNaN to _Float128 produces a quiet NaN, so
97 attempts to use _Float128 sNaNs will not work properly with older
98 compilers. */
99# if !__GNUC_PREREQ (7, 0)
100# define __builtin_copysignf128 __builtin_copysignq
101# define __builtin_fabsf128 __builtin_fabsq
102# define __builtin_inff128() ((_Float128) __builtin_inf ())
103# define __builtin_nanf128(x) ((_Float128) __builtin_nan (x))
104# define __builtin_nansf128(x) ((_Float128) __builtin_nans (x))
105# endif
106
107/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*,
108 e.g.: __builtin_signbitf128, before GCC 6. However, there has never
109 been a __builtin_signbitf128 in GCC and the type-generic builtin is
110 only available since GCC 6. */
111# if !__GNUC_PREREQ (6, 0)
112# define __builtin_signbitf128 __signbitf128
113# endif
114
115# endif
116
117#endif /* !__ASSEMBLER__. */
118
119#include <bits/floatn-common.h>
120
121#endif /* _BITS_FLOATN_H */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/flt-eval-method.h created+33
...@@ -0,0 +1,33 @@
1/* Define __GLIBC_FLT_EVAL_METHOD. x86 version.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never use <bits/flt-eval-method.h> directly; include <math.h> instead."
21#endif
22
23#ifdef __FLT_EVAL_METHOD__
24# if __FLT_EVAL_METHOD__ == -1
25# define __GLIBC_FLT_EVAL_METHOD 2
26# else
27# define __GLIBC_FLT_EVAL_METHOD __FLT_EVAL_METHOD__
28# endif
29#elif defined __x86_64__
30# define __GLIBC_FLT_EVAL_METHOD 0
31#else
32# define __GLIBC_FLT_EVAL_METHOD 2
33#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/fp-logb.h created+24
...@@ -0,0 +1,24 @@
1/* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. x86 version.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never use <bits/fp-logb.h> directly; include <math.h> instead."
21#endif
22
23#define __FP_LOGB0_IS_MIN 1
24#define __FP_LOGBNAN_IS_MIN 1
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/indirect-return.h created+37
...@@ -0,0 +1,37 @@
1/* Definition of __INDIRECT_RETURN. x86 version.
2 Copyright (C) 2018-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _UCONTEXT_H
20# error "Never include <bits/indirect-return.h> directly; use <ucontext.h> instead."
21#endif
22
23/* On x86, swapcontext returns via indirect branch when the shadow stack
24 is enabled. Define __INDIRECT_RETURN to indicate whether swapcontext
25 returns via indirect branch. */
26#if defined __CET__ && (__CET__ & 2) != 0
27# if __glibc_has_attribute (__indirect_return__)
28# define __INDIRECT_RETURN __attribute__ ((__indirect_return__))
29# else
30/* Newer compilers provide the indirect_return attribute, but without
31 it we can use returns_twice to affect the optimizer in the same
32 way and avoid unsafe optimizations. */
33# define __INDIRECT_RETURN __attribute__ ((__returns_twice__))
34# endif
35#else
36# define __INDIRECT_RETURN
37#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/ipctypes.h created+33
...@@ -0,0 +1,33 @@
1/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM.
2 Copyright (C) 2012-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_IPC_H
20# error "Never use <bits/ipctypes.h> directly; include <sys/ipc.h> instead."
21#endif
22
23#ifndef _BITS_IPCTYPES_H
24#define _BITS_IPCTYPES_H 1
25
26/* Used in `struct shmid_ds'. */
27# ifdef __x86_64__
28typedef int __ipc_pid_t;
29# else
30typedef unsigned short int __ipc_pid_t;
31# endif
32
33#endif /* bits/ipctypes.h */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/iscanonical.h created+54
...@@ -0,0 +1,54 @@
1/* Define iscanonical macro. ldbl-96 version.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never use <bits/iscanonical.h> directly; include <math.h> instead."
21#endif
22
23extern int __iscanonicall (long double __x)
24 __THROW __attribute__ ((__const__));
25#define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1)
26#define __iscanonical(x) ((void) (__typeof (x)) (x), 1)
27#if __HAVE_DISTINCT_FLOAT128
28# define __iscanonicalf128(x) ((void) (__typeof (x)) (x), 1)
29#endif
30
31/* Return nonzero value if X is canonical. In IEEE interchange binary
32 formats, all values are canonical, but the argument must still be
33 converted to its semantic type for any exceptions arising from the
34 conversion, before being discarded; in extended precision, there
35 are encodings that are not consistently handled as corresponding to
36 any particular value of the type, and we return 0 for those. */
37#ifndef __cplusplus
38# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x))
39#else
40/* In C++ mode, __MATH_TG cannot be used, because it relies on
41 __builtin_types_compatible_p, which is a C-only builtin. On the
42 other hand, overloading provides the means to distinguish between
43 the floating-point types. The overloading resolution will match
44 the correct parameter (regardless of type qualifiers (i.e.: const
45 and volatile)). */
46extern "C++" {
47inline int iscanonical (float __val) { return __iscanonicalf (__val); }
48inline int iscanonical (double __val) { return __iscanonical (__val); }
49inline int iscanonical (long double __val) { return __iscanonicall (__val); }
50# if __HAVE_DISTINCT_FLOAT128
51inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); }
52# endif
53}
54#endif /* __cplusplus */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/link.h created+159
...@@ -0,0 +1,159 @@
1/* Copyright (C) 2004-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINK_H
19# error "Never include <bits/link.h> directly; use <link.h> instead."
20#endif
21
22
23#ifndef __x86_64__
24/* Registers for entry into PLT on IA-32. */
25typedef struct La_i86_regs
26{
27 uint32_t lr_edx;
28 uint32_t lr_ecx;
29 uint32_t lr_eax;
30 uint32_t lr_ebp;
31 uint32_t lr_esp;
32} La_i86_regs;
33
34/* Return values for calls from PLT on IA-32. */
35typedef struct La_i86_retval
36{
37 uint32_t lrv_eax;
38 uint32_t lrv_edx;
39 long double lrv_st0;
40 long double lrv_st1;
41 uint64_t lrv_bnd0;
42 uint64_t lrv_bnd1;
43} La_i86_retval;
44
45
46__BEGIN_DECLS
47
48extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
49 uintptr_t *__refcook,
50 uintptr_t *__defcook,
51 La_i86_regs *__regs,
52 unsigned int *__flags,
53 const char *__symname,
54 long int *__framesizep);
55extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
56 uintptr_t *__refcook,
57 uintptr_t *__defcook,
58 const La_i86_regs *__inregs,
59 La_i86_retval *__outregs,
60 const char *symname);
61
62__END_DECLS
63
64#else
65
66/* Registers for entry into PLT on x86-64. */
67# if __GNUC_PREREQ (4,0)
68typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16)));
69typedef float La_x86_64_ymm
70 __attribute__ ((__vector_size__ (32), __aligned__ (16)));
71typedef double La_x86_64_zmm
72 __attribute__ ((__vector_size__ (64), __aligned__ (16)));
73# else
74typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__)));
75# endif
76
77typedef union
78{
79# if __GNUC_PREREQ (4,0)
80 La_x86_64_ymm ymm[2];
81 La_x86_64_zmm zmm[1];
82# endif
83 La_x86_64_xmm xmm[4];
84} La_x86_64_vector __attribute__ ((__aligned__ (16)));
85
86typedef struct La_x86_64_regs
87{
88 uint64_t lr_rdx;
89 uint64_t lr_r8;
90 uint64_t lr_r9;
91 uint64_t lr_rcx;
92 uint64_t lr_rsi;
93 uint64_t lr_rdi;
94 uint64_t lr_rbp;
95 uint64_t lr_rsp;
96 La_x86_64_xmm lr_xmm[8];
97 La_x86_64_vector lr_vector[8];
98#ifndef __ILP32__
99 __int128_t lr_bnd[4];
100#endif
101} La_x86_64_regs;
102
103/* Return values for calls from PLT on x86-64. */
104typedef struct La_x86_64_retval
105{
106 uint64_t lrv_rax;
107 uint64_t lrv_rdx;
108 La_x86_64_xmm lrv_xmm0;
109 La_x86_64_xmm lrv_xmm1;
110 long double lrv_st0;
111 long double lrv_st1;
112 La_x86_64_vector lrv_vector0;
113 La_x86_64_vector lrv_vector1;
114#ifndef __ILP32__
115 __int128_t lrv_bnd0;
116 __int128_t lrv_bnd1;
117#endif
118} La_x86_64_retval;
119
120#define La_x32_regs La_x86_64_regs
121#define La_x32_retval La_x86_64_retval
122
123__BEGIN_DECLS
124
125extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym,
126 unsigned int __ndx,
127 uintptr_t *__refcook,
128 uintptr_t *__defcook,
129 La_x86_64_regs *__regs,
130 unsigned int *__flags,
131 const char *__symname,
132 long int *__framesizep);
133extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym,
134 unsigned int __ndx,
135 uintptr_t *__refcook,
136 uintptr_t *__defcook,
137 const La_x86_64_regs *__inregs,
138 La_x86_64_retval *__outregs,
139 const char *__symname);
140
141extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym,
142 unsigned int __ndx,
143 uintptr_t *__refcook,
144 uintptr_t *__defcook,
145 La_x32_regs *__regs,
146 unsigned int *__flags,
147 const char *__symname,
148 long int *__framesizep);
149extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym,
150 unsigned int __ndx,
151 uintptr_t *__refcook,
152 uintptr_t *__defcook,
153 const La_x32_regs *__inregs,
154 La_x32_retval *__outregs,
155 const char *__symname);
156
157__END_DECLS
158
159#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/long-double.h created+21
...@@ -0,0 +1,21 @@
1/* Properties of long double type. ldbl-96 version.
2 Copyright (C) 2016-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* long double is distinct from double, so there is nothing to
20 define here. */
21#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/math-vector.h created+63
...@@ -0,0 +1,63 @@
1/* Platform-specific SIMD declarations of math functions.
2 Copyright (C) 2014-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never include <bits/math-vector.h> directly;\
21 include <math.h> instead."
22#endif
23
24/* Get default empty definitions for simd declarations. */
25#include <bits/libm-simd-decl-stubs.h>
26
27#if defined __x86_64__ && defined __FAST_MATH__
28# if defined _OPENMP && _OPENMP >= 201307
29/* OpenMP case. */
30# define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch")
31# elif __GNUC_PREREQ (6,0)
32/* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)). */
33# define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch")))
34# endif
35
36# ifdef __DECL_SIMD_x86_64
37# undef __DECL_SIMD_cos
38# define __DECL_SIMD_cos __DECL_SIMD_x86_64
39# undef __DECL_SIMD_cosf
40# define __DECL_SIMD_cosf __DECL_SIMD_x86_64
41# undef __DECL_SIMD_sin
42# define __DECL_SIMD_sin __DECL_SIMD_x86_64
43# undef __DECL_SIMD_sinf
44# define __DECL_SIMD_sinf __DECL_SIMD_x86_64
45# undef __DECL_SIMD_sincos
46# define __DECL_SIMD_sincos __DECL_SIMD_x86_64
47# undef __DECL_SIMD_sincosf
48# define __DECL_SIMD_sincosf __DECL_SIMD_x86_64
49# undef __DECL_SIMD_log
50# define __DECL_SIMD_log __DECL_SIMD_x86_64
51# undef __DECL_SIMD_logf
52# define __DECL_SIMD_logf __DECL_SIMD_x86_64
53# undef __DECL_SIMD_exp
54# define __DECL_SIMD_exp __DECL_SIMD_x86_64
55# undef __DECL_SIMD_expf
56# define __DECL_SIMD_expf __DECL_SIMD_x86_64
57# undef __DECL_SIMD_pow
58# define __DECL_SIMD_pow __DECL_SIMD_x86_64
59# undef __DECL_SIMD_powf
60# define __DECL_SIMD_powf __DECL_SIMD_x86_64
61
62# endif
63#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/mman.h created+34
...@@ -0,0 +1,34 @@
1/* Definitions for POSIX memory map interface. Linux/x86_64 version.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_MMAN_H
20# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
21#endif
22
23/* The following definitions basically come from the kernel headers.
24 But the kernel header is not namespace clean. */
25
26/* Other flags. */
27#ifdef __USE_MISC
28# define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */
29#endif
30
31#include <bits/mman-map-flags-generic.h>
32
33/* Include generic Linux declarations. */
34#include <bits/mman-linux.h>
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/procfs-id.h created+30
...@@ -0,0 +1,30 @@
1/* Types of pr_uid and pr_gid in struct elf_prpsinfo. x86 version.
2 Copyright (C) 2018-2021 Free Software Foundation, Inc.
3
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _SYS_PROCFS_H
21# error "Never include <bits/procfs-id.h> directly; use <sys/procfs.h> instead."
22#endif
23
24#if __WORDSIZE == 32
25typedef unsigned short int __pr_uid_t;
26typedef unsigned short int __pr_gid_t;
27#else
28typedef unsigned int __pr_uid_t;
29typedef unsigned int __pr_gid_t;
30#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/procfs.h created+50
...@@ -0,0 +1,50 @@
1/* Types for registers for sys/procfs.h. x86 version.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_PROCFS_H
20# error "Never include <bits/procfs.h> directly; use <sys/procfs.h> instead."
21#endif
22
23/* Type for a general-purpose register. */
24#ifdef __x86_64__
25__extension__ typedef unsigned long long elf_greg_t;
26#else
27typedef unsigned long elf_greg_t;
28#endif
29
30/* And the whole bunch of them. We could have used `struct
31 user_regs_struct' directly in the typedef, but tradition says that
32 the register set is an array, which does have some peculiar
33 semantics, so leave it that way. */
34#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t))
35typedef elf_greg_t elf_gregset_t[ELF_NGREG];
36
37#ifndef __x86_64__
38/* Register set for the floating-point registers. */
39typedef struct user_fpregs_struct elf_fpregset_t;
40
41/* Register set for the extended floating-point registers. Includes
42 the Pentium III SSE registers in addition to the classic
43 floating-point stuff. */
44typedef struct user_fpxregs_struct elf_fpxregset_t;
45#else
46/* Register set for the extended floating-point registers. Includes
47 the Pentium III SSE registers in addition to the classic
48 floating-point stuff. */
49typedef struct user_fpregs_struct elf_fpregset_t;
50#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/pthreadtypes-arch.h created+55
...@@ -0,0 +1,55 @@
1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _BITS_PTHREADTYPES_ARCH_H
19#define _BITS_PTHREADTYPES_ARCH_H 1
20
21#include <bits/wordsize.h>
22
23#ifdef __x86_64__
24# if __WORDSIZE == 64
25# define __SIZEOF_PTHREAD_MUTEX_T 40
26# define __SIZEOF_PTHREAD_ATTR_T 56
27# define __SIZEOF_PTHREAD_RWLOCK_T 56
28# define __SIZEOF_PTHREAD_BARRIER_T 32
29# else
30# define __SIZEOF_PTHREAD_MUTEX_T 32
31# define __SIZEOF_PTHREAD_ATTR_T 32
32# define __SIZEOF_PTHREAD_RWLOCK_T 44
33# define __SIZEOF_PTHREAD_BARRIER_T 20
34# endif
35#else
36# define __SIZEOF_PTHREAD_MUTEX_T 24
37# define __SIZEOF_PTHREAD_ATTR_T 36
38# define __SIZEOF_PTHREAD_RWLOCK_T 32
39# define __SIZEOF_PTHREAD_BARRIER_T 20
40#endif
41#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
42#define __SIZEOF_PTHREAD_COND_T 48
43#define __SIZEOF_PTHREAD_CONDATTR_T 4
44#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
45#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
46
47#define __LOCK_ALIGNMENT
48#define __ONCE_ALIGNMENT
49
50#ifndef __x86_64__
51/* Extra attributes for the cleanup functions. */
52# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
53#endif
54
55#endif /* bits/pthreadtypes.h */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/setjmp.h created+40
...@@ -0,0 +1,40 @@
1/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18/* Define the machine-dependent type `jmp_buf'. x86-64 version. */
19#ifndef _BITS_SETJMP_H
20#define _BITS_SETJMP_H 1
21
22#if !defined _SETJMP_H && !defined _PTHREAD_H
23# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
24#endif
25
26#include <bits/wordsize.h>
27
28#ifndef _ASM
29
30# if __WORDSIZE == 64
31typedef long int __jmp_buf[8];
32# elif defined __x86_64__
33__extension__ typedef long long int __jmp_buf[8];
34# else
35typedef int __jmp_buf[6];
36# endif
37
38#endif
39
40#endif /* bits/setjmp.h */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/sigcontext.h created+196
...@@ -0,0 +1,196 @@
1/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _BITS_SIGCONTEXT_H
19#define _BITS_SIGCONTEXT_H 1
20
21#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
22# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
23#endif
24
25#include <bits/types.h>
26
27#define FP_XSTATE_MAGIC1 0x46505853U
28#define FP_XSTATE_MAGIC2 0x46505845U
29#define FP_XSTATE_MAGIC2_SIZE sizeof (FP_XSTATE_MAGIC2)
30
31struct _fpx_sw_bytes
32{
33 __uint32_t magic1;
34 __uint32_t extended_size;
35 __uint64_t xstate_bv;
36 __uint32_t xstate_size;
37 __uint32_t __glibc_reserved1[7];
38};
39
40struct _fpreg
41{
42 unsigned short significand[4];
43 unsigned short exponent;
44};
45
46struct _fpxreg
47{
48 unsigned short significand[4];
49 unsigned short exponent;
50 unsigned short __glibc_reserved1[3];
51};
52
53struct _xmmreg
54{
55 __uint32_t element[4];
56};
57
58
59
60#ifndef __x86_64__
61
62struct _fpstate
63{
64 /* Regular FPU environment. */
65 __uint32_t cw;
66 __uint32_t sw;
67 __uint32_t tag;
68 __uint32_t ipoff;
69 __uint32_t cssel;
70 __uint32_t dataoff;
71 __uint32_t datasel;
72 struct _fpreg _st[8];
73 unsigned short status;
74 unsigned short magic;
75
76 /* FXSR FPU environment. */
77 __uint32_t _fxsr_env[6];
78 __uint32_t mxcsr;
79 __uint32_t __glibc_reserved1;
80 struct _fpxreg _fxsr_st[8];
81 struct _xmmreg _xmm[8];
82 __uint32_t __glibc_reserved2[56];
83};
84
85#ifndef sigcontext_struct
86/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
87 we need sigcontext. Some packages have come to rely on
88 sigcontext_struct being defined on 32-bit x86, so define this for
89 their benefit. */
90# define sigcontext_struct sigcontext
91#endif
92
93#define X86_FXSR_MAGIC 0x0000
94
95struct sigcontext
96{
97 unsigned short gs, __gsh;
98 unsigned short fs, __fsh;
99 unsigned short es, __esh;
100 unsigned short ds, __dsh;
101 unsigned long edi;
102 unsigned long esi;
103 unsigned long ebp;
104 unsigned long esp;
105 unsigned long ebx;
106 unsigned long edx;
107 unsigned long ecx;
108 unsigned long eax;
109 unsigned long trapno;
110 unsigned long err;
111 unsigned long eip;
112 unsigned short cs, __csh;
113 unsigned long eflags;
114 unsigned long esp_at_signal;
115 unsigned short ss, __ssh;
116 struct _fpstate * fpstate;
117 unsigned long oldmask;
118 unsigned long cr2;
119};
120
121#else /* __x86_64__ */
122
123struct _fpstate
124{
125 /* FPU environment matching the 64-bit FXSAVE layout. */
126 __uint16_t cwd;
127 __uint16_t swd;
128 __uint16_t ftw;
129 __uint16_t fop;
130 __uint64_t rip;
131 __uint64_t rdp;
132 __uint32_t mxcsr;
133 __uint32_t mxcr_mask;
134 struct _fpxreg _st[8];
135 struct _xmmreg _xmm[16];
136 __uint32_t __glibc_reserved1[24];
137};
138
139struct sigcontext
140{
141 __uint64_t r8;
142 __uint64_t r9;
143 __uint64_t r10;
144 __uint64_t r11;
145 __uint64_t r12;
146 __uint64_t r13;
147 __uint64_t r14;
148 __uint64_t r15;
149 __uint64_t rdi;
150 __uint64_t rsi;
151 __uint64_t rbp;
152 __uint64_t rbx;
153 __uint64_t rdx;
154 __uint64_t rax;
155 __uint64_t rcx;
156 __uint64_t rsp;
157 __uint64_t rip;
158 __uint64_t eflags;
159 unsigned short cs;
160 unsigned short gs;
161 unsigned short fs;
162 unsigned short __pad0;
163 __uint64_t err;
164 __uint64_t trapno;
165 __uint64_t oldmask;
166 __uint64_t cr2;
167 __extension__ union
168 {
169 struct _fpstate * fpstate;
170 __uint64_t __fpstate_word;
171 };
172 __uint64_t __reserved1 [8];
173};
174
175#endif /* __x86_64__ */
176
177struct _xsave_hdr
178{
179 __uint64_t xstate_bv;
180 __uint64_t __glibc_reserved1[2];
181 __uint64_t __glibc_reserved2[5];
182};
183
184struct _ymmh_state
185{
186 __uint32_t ymmh_space[64];
187};
188
189struct _xstate
190{
191 struct _fpstate fpstate;
192 struct _xsave_hdr xstate_hdr;
193 struct _ymmh_state ymmh;
194};
195
196#endif /* _BITS_SIGCONTEXT_H */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/siginfo-arch.h created+17
...@@ -0,0 +1,17 @@
1/* Architecture-specific adjustments to siginfo_t. x86 version. */
2#ifndef _BITS_SIGINFO_ARCH_H
3#define _BITS_SIGINFO_ARCH_H 1
4
5#if defined __x86_64__ && __WORDSIZE == 32
6/* si_utime and si_stime must be 4 byte aligned for x32 to match the
7 kernel. We align siginfo_t to 8 bytes so that si_utime and
8 si_stime are actually aligned to 8 bytes since their offsets are
9 multiple of 8 bytes. Note: with some compilers, the alignment
10 attribute would be ignored if it were put in __SI_CLOCK_T instead
11 of encapsulated in a typedef. */
12typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
13# define __SI_ALIGNMENT __attribute__ ((__aligned__ (8)))
14# define __SI_CLOCK_T __sigchld_clock_t
15#endif
16
17#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/struct_mutex.h created+63
...@@ -0,0 +1,63 @@
1/* x86 internal mutex struct definitions.
2 Copyright (C) 2019-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#ifndef _THREAD_MUTEX_INTERNAL_H
20#define _THREAD_MUTEX_INTERNAL_H 1
21
22struct __pthread_mutex_s
23{
24 int __lock;
25 unsigned int __count;
26 int __owner;
27#ifdef __x86_64__
28 unsigned int __nusers;
29#endif
30 /* KIND must stay at this position in the structure to maintain
31 binary compatibility with static initializers. */
32 int __kind;
33#ifdef __x86_64__
34 short __spins;
35 short __elision;
36 __pthread_list_t __list;
37# define __PTHREAD_MUTEX_HAVE_PREV 1
38#else
39 unsigned int __nusers;
40 __extension__ union
41 {
42 struct
43 {
44 short __espins;
45 short __eelision;
46# define __spins __elision_data.__espins
47# define __elision __elision_data.__eelision
48 } __elision_data;
49 __pthread_slist_t __list;
50 };
51# define __PTHREAD_MUTEX_HAVE_PREV 0
52#endif
53};
54
55#ifdef __x86_64__
56# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
57 0, 0, 0, 0, __kind, 0, 0, { 0, 0 }
58#else
59# define __PTHREAD_MUTEX_INITIALIZER(__kind) \
60 0, 0, 0, __kind, 0, { { 0, 0 } }
61#endif
62
63#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/struct_rwlock.h created+65
...@@ -0,0 +1,65 @@
1/* x86 internal rwlock struct definitions.
2 Copyright (C) 2019-2021 Free Software Foundation, Inc.
3
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20#ifndef _RWLOCK_INTERNAL_H
21#define _RWLOCK_INTERNAL_H
22
23struct __pthread_rwlock_arch_t
24{
25 unsigned int __readers;
26 unsigned int __writers;
27 unsigned int __wrphase_futex;
28 unsigned int __writers_futex;
29 unsigned int __pad3;
30 unsigned int __pad4;
31#ifdef __x86_64__
32 int __cur_writer;
33 int __shared;
34 signed char __rwelision;
35# ifdef __ILP32__
36 unsigned char __pad1[3];
37# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }
38# else
39 unsigned char __pad1[7];
40# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }
41# endif
42 unsigned long int __pad2;
43 /* FLAGS must stay at this position in the structure to maintain
44 binary compatibility. */
45 unsigned int __flags;
46#else /* __x86_64__ */
47 /* FLAGS must stay at this position in the structure to maintain
48 binary compatibility. */
49 unsigned char __flags;
50 unsigned char __shared;
51 signed char __rwelision;
52 unsigned char __pad2;
53 int __cur_writer;
54#endif
55};
56
57#ifdef __x86_64__
58# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
59 0, 0, 0, 0, 0, 0, 0, 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, __flags
60#else
61# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
62 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0
63#endif
64
65#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/struct_stat.h created+165
...@@ -0,0 +1,165 @@
1/* Definition for struct stat.
2 Copyright (C) 2020-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#if !defined _SYS_STAT_H && !defined _FCNTL_H
20# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
21#endif
22
23#ifndef _BITS_STRUCT_STAT_H
24#define _BITS_STRUCT_STAT_H 1
25
26struct stat
27 {
28#ifdef __USE_TIME_BITS64
29# include <bits/struct_stat_time64_helper.h>
30#else
31 __dev_t st_dev; /* Device. */
32# ifndef __x86_64__
33 unsigned short int __pad1;
34# endif
35# if defined __x86_64__ || !defined __USE_FILE_OFFSET64
36 __ino_t st_ino; /* File serial number. */
37# else
38 __ino_t __st_ino; /* 32bit file serial number. */
39# endif
40# ifndef __x86_64__
41 __mode_t st_mode; /* File mode. */
42 __nlink_t st_nlink; /* Link count. */
43# else
44 __nlink_t st_nlink; /* Link count. */
45 __mode_t st_mode; /* File mode. */
46# endif
47 __uid_t st_uid; /* User ID of the file's owner. */
48 __gid_t st_gid; /* Group ID of the file's group.*/
49# ifdef __x86_64__
50 int __pad0;
51# endif
52 __dev_t st_rdev; /* Device number, if device. */
53# ifndef __x86_64__
54 unsigned short int __pad2;
55# endif
56# if defined __x86_64__ || !defined __USE_FILE_OFFSET64
57 __off_t st_size; /* Size of file, in bytes. */
58# else
59 __off64_t st_size; /* Size of file, in bytes. */
60# endif
61 __blksize_t st_blksize; /* Optimal block size for I/O. */
62# if defined __x86_64__ || !defined __USE_FILE_OFFSET64
63 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
64# else
65 __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
66# endif
67# ifdef __USE_XOPEN2K8
68 /* Nanosecond resolution timestamps are stored in a format
69 equivalent to 'struct timespec'. This is the type used
70 whenever possible but the Unix namespace rules do not allow the
71 identifier 'timespec' to appear in the <sys/stat.h> header.
72 Therefore we have to handle the use of this header in strictly
73 standard-compliant sources special. */
74 struct timespec st_atim; /* Time of last access. */
75 struct timespec st_mtim; /* Time of last modification. */
76 struct timespec st_ctim; /* Time of last status change. */
77# define st_atime st_atim.tv_sec /* Backward compatibility. */
78# define st_mtime st_mtim.tv_sec
79# define st_ctime st_ctim.tv_sec
80# else
81 __time_t st_atime; /* Time of last access. */
82 __syscall_ulong_t st_atimensec; /* Nscecs of last access. */
83 __time_t st_mtime; /* Time of last modification. */
84 __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */
85 __time_t st_ctime; /* Time of last status change. */
86 __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */
87# endif
88# ifdef __x86_64__
89 __syscall_slong_t __glibc_reserved[3];
90# else
91# ifndef __USE_FILE_OFFSET64
92 unsigned long int __glibc_reserved4;
93 unsigned long int __glibc_reserved5;
94# else
95 __ino64_t st_ino; /* File serial number. */
96# endif
97# endif
98#endif /* __USE_TIME_BITS64 */
99 };
100
101#ifdef __USE_LARGEFILE64
102/* Note stat64 has the same shape as stat for x86-64. */
103struct stat64
104 {
105# ifdef __USE_TIME_BITS64
106# include <bits/struct_stat_time64_helper.h>
107# else
108 __dev_t st_dev; /* Device. */
109# ifdef __x86_64__
110 __ino64_t st_ino; /* File serial number. */
111 __nlink_t st_nlink; /* Link count. */
112 __mode_t st_mode; /* File mode. */
113# else
114 unsigned int __pad1;
115 __ino_t __st_ino; /* 32bit file serial number. */
116 __mode_t st_mode; /* File mode. */
117 __nlink_t st_nlink; /* Link count. */
118# endif
119 __uid_t st_uid; /* User ID of the file's owner. */
120 __gid_t st_gid; /* Group ID of the file's group.*/
121# ifdef __x86_64__
122 int __pad0;
123 __dev_t st_rdev; /* Device number, if device. */
124 __off_t st_size; /* Size of file, in bytes. */
125# else
126 __dev_t st_rdev; /* Device number, if device. */
127 unsigned int __pad2;
128 __off64_t st_size; /* Size of file, in bytes. */
129# endif
130 __blksize_t st_blksize; /* Optimal block size for I/O. */
131 __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
132# ifdef __USE_XOPEN2K8
133 /* Nanosecond resolution timestamps are stored in a format
134 equivalent to 'struct timespec'. This is the type used
135 whenever possible but the Unix namespace rules do not allow the
136 identifier 'timespec' to appear in the <sys/stat.h> header.
137 Therefore we have to handle the use of this header in strictly
138 standard-compliant sources special. */
139 struct timespec st_atim; /* Time of last access. */
140 struct timespec st_mtim; /* Time of last modification. */
141 struct timespec st_ctim; /* Time of last status change. */
142# else
143 __time_t st_atime; /* Time of last access. */
144 __syscall_ulong_t st_atimensec; /* Nscecs of last access. */
145 __time_t st_mtime; /* Time of last modification. */
146 __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */
147 __time_t st_ctime; /* Time of last status change. */
148 __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */
149# endif
150# ifdef __x86_64__
151 __syscall_slong_t __glibc_reserved[3];
152# else
153 __ino64_t st_ino; /* File serial number. */
154# endif
155# endif /* __USE_TIME_BITS64 */
156 };
157#endif
158
159/* Tell code we have these members. */
160#define _STATBUF_ST_BLKSIZE
161#define _STATBUF_ST_RDEV
162/* Nanosecond resolution time values are supported. */
163#define _STATBUF_ST_NSEC
164
165#endif /* _BITS_STRUCT_STAT_H */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/timesize.h created+25
...@@ -0,0 +1,25 @@
1/* Bit size of the time_t type at glibc build time, x86-64 and x32 case.
2 Copyright (C) 2018-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#if defined __x86_64__ && defined __ILP32__
20/* For x32, time is 64-bit even though word size is 32-bit. */
21# define __TIMESIZE 64
22#else
23/* For others, time size is word size. */
24# define __TIMESIZE __WORDSIZE
25#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/types/struct_semid_ds.h created+38
...@@ -0,0 +1,38 @@
1/* x86 implementation of the semaphore struct semid_ds.
2 Copyright (C) 1995-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_SEM_H
20# error "Never include <bits/types/struct_semid_ds.h> directly; use <sys/sem.h> instead."
21#endif
22
23/* Data structure describing a set of semaphores. */
24struct semid_ds
25{
26#ifdef __USE_TIME_BITS64
27# include <bits/types/struct_semid64_ds_helper.h>
28#else
29 struct ipc_perm sem_perm; /* operation permission struct */
30 __time_t sem_otime; /* last semop() time */
31 __syscall_ulong_t __sem_otime_high;
32 __time_t sem_ctime; /* last time changed by semctl() */
33 __syscall_ulong_t __sem_ctime_high;
34 __syscall_ulong_t sem_nsems; /* number of semaphores in set */
35 __syscall_ulong_t __glibc_reserved3;
36 __syscall_ulong_t __glibc_reserved4;
37#endif
38};
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/typesizes.h created+106
...@@ -0,0 +1,106 @@
1/* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version.
2 Copyright (C) 2012-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_TYPES_H
20# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
21#endif
22
23#ifndef _BITS_TYPESIZES_H
24#define _BITS_TYPESIZES_H 1
25
26/* See <bits/types.h> for the meaning of these macros. This file exists so
27 that <bits/types.h> need not vary across different GNU platforms. */
28
29/* X32 kernel interface is 64-bit. */
30#if defined __x86_64__ && defined __ILP32__
31# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE
32# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE
33#else
34# define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
35# define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
36#endif
37
38#define __DEV_T_TYPE __UQUAD_TYPE
39#define __UID_T_TYPE __U32_TYPE
40#define __GID_T_TYPE __U32_TYPE
41#define __INO_T_TYPE __SYSCALL_ULONG_TYPE
42#define __INO64_T_TYPE __UQUAD_TYPE
43#define __MODE_T_TYPE __U32_TYPE
44#ifdef __x86_64__
45# define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE
46# define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE
47#else
48# define __NLINK_T_TYPE __UWORD_TYPE
49# define __FSWORD_T_TYPE __SWORD_TYPE
50#endif
51#define __OFF_T_TYPE __SYSCALL_SLONG_TYPE
52#define __OFF64_T_TYPE __SQUAD_TYPE
53#define __PID_T_TYPE __S32_TYPE
54#define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE
55#define __RLIM64_T_TYPE __UQUAD_TYPE
56#define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE
57#define __BLKCNT64_T_TYPE __SQUAD_TYPE
58#define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE
59#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
60#define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE
61#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
62#define __ID_T_TYPE __U32_TYPE
63#define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE
64#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE
65#define __USECONDS_T_TYPE __U32_TYPE
66#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE
67#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
68#define __DADDR_T_TYPE __S32_TYPE
69#define __KEY_T_TYPE __S32_TYPE
70#define __CLOCKID_T_TYPE __S32_TYPE
71#define __TIMER_T_TYPE void *
72#define __BLKSIZE_T_TYPE __SYSCALL_SLONG_TYPE
73#define __FSID_T_TYPE struct { int __val[2]; }
74#define __SSIZE_T_TYPE __SWORD_TYPE
75#define __CPU_MASK_TYPE __SYSCALL_ULONG_TYPE
76
77#ifdef __x86_64__
78/* Tell the libc code that off_t and off64_t are actually the same type
79 for all ABI purposes, even if possibly expressed as different base types
80 for C type-checking purposes. */
81# define __OFF_T_MATCHES_OFF64_T 1
82
83/* Same for ino_t and ino64_t. */
84# define __INO_T_MATCHES_INO64_T 1
85
86/* And for __rlim_t and __rlim64_t. */
87# define __RLIM_T_MATCHES_RLIM64_T 1
88
89/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
90# define __STATFS_MATCHES_STATFS64 1
91
92/* And for getitimer, setitimer and rusage */
93# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
94#else
95# define __RLIM_T_MATCHES_RLIM64_T 0
96
97# define __STATFS_MATCHES_STATFS64 0
98
99# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
100#endif
101
102/* Number of descriptors that can fit in an `fd_set'. */
103#define __FD_SETSIZE 1024
104
105
106#endif /* bits/typesizes.h */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/bits/wordsize.h created+17
...@@ -0,0 +1,17 @@
1/* Determine the wordsize from the preprocessor defines. */
2
3#if defined __x86_64__ && !defined __ILP32__
4# define __WORDSIZE 64
5#else
6# define __WORDSIZE 32
7#define __WORDSIZE32_SIZE_ULONG 0
8#define __WORDSIZE32_PTRDIFF_LONG 0
9#endif
10
11#ifdef __x86_64__
12# define __WORDSIZE_TIME64_COMPAT32 1
13/* Both x86-64 and x32 use the 64-bit system call interface. */
14# define __SYSCALL_WORDSIZE 64
15#else
16# define __WORDSIZE_TIME64_COMPAT32 0
17#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/finclude/math-vector-fortran.h created+43
...@@ -0,0 +1,43 @@
1! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*-
2! Copyright (C) 2019-2021 Free Software Foundation, Inc.
3! This file is part of the GNU C Library.
4!
5! The GNU C Library is free software; you can redistribute it and/or
6! modify it under the terms of the GNU Lesser General Public
7! License as published by the Free Software Foundation; either
8! version 2.1 of the License, or (at your option) any later version.
9!
10! The GNU C Library is distributed in the hope that it will be useful,
11! but WITHOUT ANY WARRANTY; without even the implied warranty of
12! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13! Lesser General Public License for more details.
14!
15! You should have received a copy of the GNU Lesser General Public
16! License along with the GNU C Library; if not, see
17! <https://www.gnu.org/licenses/>.
18
19!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')
20!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64')
21!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64')
22!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64')
23!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64')
24!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64')
25!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64')
26!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64')
27!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64')
28!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64')
29!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64')
30!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64')
31
32!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
33!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
34!GCC$ builtin (sin) attributes simd (notinbranch) if('x32')
35!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32')
36!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32')
37!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32')
38!GCC$ builtin (log) attributes simd (notinbranch) if('x32')
39!GCC$ builtin (logf) attributes simd (notinbranch) if('x32')
40!GCC$ builtin (exp) attributes simd (notinbranch) if('x32')
41!GCC$ builtin (expf) attributes simd (notinbranch) if('x32')
42!GCC$ builtin (pow) attributes simd (notinbranch) if('x32')
43!GCC$ builtin (powf) attributes simd (notinbranch) if('x32')
\ No newline at end of file
lib/libc/include/x86-linux-gnu/fpu_control.h created+109
...@@ -0,0 +1,109 @@
1/* FPU control word bits. x86 version.
2 Copyright (C) 1993-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Olaf Flebbe.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _FPU_CONTROL_H
21#define _FPU_CONTROL_H 1
22
23/* Note that this file sets on x86-64 only the x87 FPU, it does not
24 touch the SSE unit. */
25
26/* Here is the dirty part. Set up your 387 through the control word
27 * (cw) register.
28 *
29 * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
30 * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
31 *
32 * IM: Invalid operation mask
33 * DM: Denormalized operand mask
34 * ZM: Zero-divide mask
35 * OM: Overflow mask
36 * UM: Underflow mask
37 * PM: Precision (inexact result) mask
38 *
39 * Mask bit is 1 means no interrupt.
40 *
41 * PC: Precision control
42 * 11 - round to extended precision
43 * 10 - round to double precision
44 * 00 - round to single precision
45 *
46 * RC: Rounding control
47 * 00 - rounding to nearest
48 * 01 - rounding down (toward - infinity)
49 * 10 - rounding up (toward + infinity)
50 * 11 - rounding toward zero
51 *
52 * IC: Infinity control
53 * That is for 8087 and 80287 only.
54 *
55 * The hardware default is 0x037f which we use.
56 */
57
58#include <features.h>
59
60/* masking of interrupts */
61#define _FPU_MASK_IM 0x01
62#define _FPU_MASK_DM 0x02
63#define _FPU_MASK_ZM 0x04
64#define _FPU_MASK_OM 0x08
65#define _FPU_MASK_UM 0x10
66#define _FPU_MASK_PM 0x20
67
68/* precision control */
69#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
70#define _FPU_DOUBLE 0x200
71#define _FPU_SINGLE 0x0
72
73/* rounding control */
74#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
75#define _FPU_RC_DOWN 0x400
76#define _FPU_RC_UP 0x800
77#define _FPU_RC_ZERO 0xC00
78
79#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
80
81
82/* The fdlibm code requires strict IEEE double precision arithmetic,
83 and no interrupts for exceptions, rounding to nearest. */
84
85#define _FPU_DEFAULT 0x037f
86
87/* IEEE: same as above. */
88#define _FPU_IEEE 0x037f
89
90/* Type of the control word. */
91typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
92
93/* Macros for accessing the hardware control word. "*&" is used to
94 work around a bug in older versions of GCC. __volatile__ is used
95 to support combination of writing the control register and reading
96 it back. Without __volatile__, the old value may be used for reading
97 back under compiler optimization.
98
99 Note that the use of these macros is not sufficient anymore with
100 recent hardware nor on x86-64. Some floating point operations are
101 executed in the SSE/SSE2 engines which have their own control and
102 status register. */
103#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
104#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
105
106/* Default control word set at startup. */
107extern fpu_control_t __fpu_control;
108
109#endif /* fpu_control.h */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/gnu/lib-names.h created+17
...@@ -0,0 +1,17 @@
1/* This file is automatically generated.
2 It defines macros to allow user program to find the shared
3 library files which come as part of GNU libc. */
4#ifndef __GNU_LIB_NAMES_H
5#define __GNU_LIB_NAMES_H 1
6
7#if !defined __x86_64__
8# include <gnu/lib-names-32.h>
9#endif
10#if defined __x86_64__ && defined __LP64__
11# include <gnu/lib-names-64.h>
12#endif
13#if defined __x86_64__ && defined __ILP32__
14# include <gnu/lib-names-x32.h>
15#endif
16
17#endif /* gnu/lib-names.h */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/gnu/stubs.h created+14
...@@ -0,0 +1,14 @@
1/* This file is automatically generated.
2 This file selects the right generated file of `__stub_FUNCTION' macros
3 based on the architecture being compiled for. */
4
5
6#if !defined __x86_64__
7# include <gnu/stubs-32.h>
8#endif
9#if defined __x86_64__ && defined __LP64__
10# include <gnu/stubs-64.h>
11#endif
12#if defined __x86_64__ && defined __ILP32__
13# include <gnu/stubs-x32.h>
14#endif
\ No newline at end of file
lib/libc/include/x86-linux-gnu/sys/elf.h created+29
...@@ -0,0 +1,29 @@
1/* Copyright (C) 1998-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_ELF_H
19#define _SYS_ELF_H 1
20
21#ifdef __x86_64__
22# error This header is unsupported on x86-64.
23#else
24# warning "This header is obsolete; use <sys/procfs.h> instead."
25
26# include <sys/procfs.h>
27#endif
28
29#endif /* _SYS_ELF_H */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/sys/ptrace.h created+202
...@@ -0,0 +1,202 @@
1/* `ptrace' debugger support interface. Linux/x86 version.
2 Copyright (C) 1996-2021 Free Software Foundation, Inc.
3
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _SYS_PTRACE_H
21#define _SYS_PTRACE_H 1
22
23#include <features.h>
24#include <bits/types.h>
25
26__BEGIN_DECLS
27
28/* Type of the REQUEST argument to `ptrace.' */
29enum __ptrace_request
30{
31 /* Indicate that the process making this request should be traced.
32 All signals received by this process can be intercepted by its
33 parent, and its parent can use the other `ptrace' requests. */
34 PTRACE_TRACEME = 0,
35#define PT_TRACE_ME PTRACE_TRACEME
36
37 /* Return the word in the process's text space at address ADDR. */
38 PTRACE_PEEKTEXT = 1,
39#define PT_READ_I PTRACE_PEEKTEXT
40
41 /* Return the word in the process's data space at address ADDR. */
42 PTRACE_PEEKDATA = 2,
43#define PT_READ_D PTRACE_PEEKDATA
44
45 /* Return the word in the process's user area at offset ADDR. */
46 PTRACE_PEEKUSER = 3,
47#define PT_READ_U PTRACE_PEEKUSER
48
49 /* Write the word DATA into the process's text space at address ADDR. */
50 PTRACE_POKETEXT = 4,
51#define PT_WRITE_I PTRACE_POKETEXT
52
53 /* Write the word DATA into the process's data space at address ADDR. */
54 PTRACE_POKEDATA = 5,
55#define PT_WRITE_D PTRACE_POKEDATA
56
57 /* Write the word DATA into the process's user area at offset ADDR. */
58 PTRACE_POKEUSER = 6,
59#define PT_WRITE_U PTRACE_POKEUSER
60
61 /* Continue the process. */
62 PTRACE_CONT = 7,
63#define PT_CONTINUE PTRACE_CONT
64
65 /* Kill the process. */
66 PTRACE_KILL = 8,
67#define PT_KILL PTRACE_KILL
68
69 /* Single step the process. */
70 PTRACE_SINGLESTEP = 9,
71#define PT_STEP PTRACE_SINGLESTEP
72
73 /* Get all general purpose registers used by a processes. */
74 PTRACE_GETREGS = 12,
75#define PT_GETREGS PTRACE_GETREGS
76
77 /* Set all general purpose registers used by a processes. */
78 PTRACE_SETREGS = 13,
79#define PT_SETREGS PTRACE_SETREGS
80
81 /* Get all floating point registers used by a processes. */
82 PTRACE_GETFPREGS = 14,
83#define PT_GETFPREGS PTRACE_GETFPREGS
84
85 /* Set all floating point registers used by a processes. */
86 PTRACE_SETFPREGS = 15,
87#define PT_SETFPREGS PTRACE_SETFPREGS
88
89 /* Attach to a process that is already running. */
90 PTRACE_ATTACH = 16,
91#define PT_ATTACH PTRACE_ATTACH
92
93 /* Detach from a process attached to with PTRACE_ATTACH. */
94 PTRACE_DETACH = 17,
95#define PT_DETACH PTRACE_DETACH
96
97 /* Get all extended floating point registers used by a processes. */
98 PTRACE_GETFPXREGS = 18,
99#define PT_GETFPXREGS PTRACE_GETFPXREGS
100
101 /* Set all extended floating point registers used by a processes. */
102 PTRACE_SETFPXREGS = 19,
103#define PT_SETFPXREGS PTRACE_SETFPXREGS
104
105 /* Continue and stop at the next entry to or return from syscall. */
106 PTRACE_SYSCALL = 24,
107#define PT_SYSCALL PTRACE_SYSCALL
108
109 /* Get a TLS entry in the GDT. */
110 PTRACE_GET_THREAD_AREA = 25,
111#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
112
113 /* Change a TLS entry in the GDT. */
114 PTRACE_SET_THREAD_AREA = 26,
115#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
116
117#ifdef __x86_64__
118 /* Access TLS data. */
119 PTRACE_ARCH_PRCTL = 30,
120# define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL
121#endif
122
123 /* Continue and stop at the next syscall, it will not be executed. */
124 PTRACE_SYSEMU = 31,
125#define PT_SYSEMU PTRACE_SYSEMU
126
127 /* Single step the process, the next syscall will not be executed. */
128 PTRACE_SYSEMU_SINGLESTEP = 32,
129#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
130
131 /* Execute process until next taken branch. */
132 PTRACE_SINGLEBLOCK = 33,
133#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
134
135 /* Set ptrace filter options. */
136 PTRACE_SETOPTIONS = 0x4200,
137#define PT_SETOPTIONS PTRACE_SETOPTIONS
138
139 /* Get last ptrace message. */
140 PTRACE_GETEVENTMSG = 0x4201,
141#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
142
143 /* Get siginfo for process. */
144 PTRACE_GETSIGINFO = 0x4202,
145#define PT_GETSIGINFO PTRACE_GETSIGINFO
146
147 /* Set new siginfo for process. */
148 PTRACE_SETSIGINFO = 0x4203,
149#define PT_SETSIGINFO PTRACE_SETSIGINFO
150
151 /* Get register content. */
152 PTRACE_GETREGSET = 0x4204,
153#define PTRACE_GETREGSET PTRACE_GETREGSET
154
155 /* Set register content. */
156 PTRACE_SETREGSET = 0x4205,
157#define PTRACE_SETREGSET PTRACE_SETREGSET
158
159 /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect
160 signal or group stop state. */
161 PTRACE_SEIZE = 0x4206,
162#define PTRACE_SEIZE PTRACE_SEIZE
163
164 /* Trap seized tracee. */
165 PTRACE_INTERRUPT = 0x4207,
166#define PTRACE_INTERRUPT PTRACE_INTERRUPT
167
168 /* Wait for next group event. */
169 PTRACE_LISTEN = 0x4208,
170#define PTRACE_LISTEN PTRACE_LISTEN
171
172 /* Retrieve siginfo_t structures without removing signals from a queue. */
173 PTRACE_PEEKSIGINFO = 0x4209,
174#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO
175
176 /* Get the mask of blocked signals. */
177 PTRACE_GETSIGMASK = 0x420a,
178#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK
179
180 /* Change the mask of blocked signals. */
181 PTRACE_SETSIGMASK = 0x420b,
182#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
183
184 /* Get seccomp BPF filters. */
185 PTRACE_SECCOMP_GET_FILTER = 0x420c,
186#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
187
188 /* Get seccomp BPF filter metadata. */
189 PTRACE_SECCOMP_GET_METADATA = 0x420d,
190#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
191
192 /* Get information about system call. */
193 PTRACE_GET_SYSCALL_INFO = 0x420e
194#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
195};
196
197
198#include <bits/ptrace-shared.h>
199
200__END_DECLS
201
202#endif /* _SYS_PTRACE_H */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/sys/ucontext.h created+262
...@@ -0,0 +1,262 @@
1/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_UCONTEXT_H
19#define _SYS_UCONTEXT_H 1
20
21#include <features.h>
22
23#include <bits/types.h>
24#include <bits/types/sigset_t.h>
25#include <bits/types/stack_t.h>
26
27
28#ifdef __USE_MISC
29# define __ctx(fld) fld
30#else
31# define __ctx(fld) __ ## fld
32#endif
33
34#ifdef __x86_64__
35
36/* Type for general register. */
37__extension__ typedef long long int greg_t;
38
39/* Number of general registers. */
40#define __NGREG 23
41#ifdef __USE_MISC
42# define NGREG __NGREG
43#endif
44
45/* Container for all general registers. */
46typedef greg_t gregset_t[__NGREG];
47
48#ifdef __USE_GNU
49/* Number of each register in the `gregset_t' array. */
50enum
51{
52 REG_R8 = 0,
53# define REG_R8 REG_R8
54 REG_R9,
55# define REG_R9 REG_R9
56 REG_R10,
57# define REG_R10 REG_R10
58 REG_R11,
59# define REG_R11 REG_R11
60 REG_R12,
61# define REG_R12 REG_R12
62 REG_R13,
63# define REG_R13 REG_R13
64 REG_R14,
65# define REG_R14 REG_R14
66 REG_R15,
67# define REG_R15 REG_R15
68 REG_RDI,
69# define REG_RDI REG_RDI
70 REG_RSI,
71# define REG_RSI REG_RSI
72 REG_RBP,
73# define REG_RBP REG_RBP
74 REG_RBX,
75# define REG_RBX REG_RBX
76 REG_RDX,
77# define REG_RDX REG_RDX
78 REG_RAX,
79# define REG_RAX REG_RAX
80 REG_RCX,
81# define REG_RCX REG_RCX
82 REG_RSP,
83# define REG_RSP REG_RSP
84 REG_RIP,
85# define REG_RIP REG_RIP
86 REG_EFL,
87# define REG_EFL REG_EFL
88 REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */
89# define REG_CSGSFS REG_CSGSFS
90 REG_ERR,
91# define REG_ERR REG_ERR
92 REG_TRAPNO,
93# define REG_TRAPNO REG_TRAPNO
94 REG_OLDMASK,
95# define REG_OLDMASK REG_OLDMASK
96 REG_CR2
97# define REG_CR2 REG_CR2
98};
99#endif
100
101struct _libc_fpxreg
102{
103 unsigned short int __ctx(significand)[4];
104 unsigned short int __ctx(exponent);
105 unsigned short int __glibc_reserved1[3];
106};
107
108struct _libc_xmmreg
109{
110 __uint32_t __ctx(element)[4];
111};
112
113struct _libc_fpstate
114{
115 /* 64-bit FXSAVE format. */
116 __uint16_t __ctx(cwd);
117 __uint16_t __ctx(swd);
118 __uint16_t __ctx(ftw);
119 __uint16_t __ctx(fop);
120 __uint64_t __ctx(rip);
121 __uint64_t __ctx(rdp);
122 __uint32_t __ctx(mxcsr);
123 __uint32_t __ctx(mxcr_mask);
124 struct _libc_fpxreg _st[8];
125 struct _libc_xmmreg _xmm[16];
126 __uint32_t __glibc_reserved1[24];
127};
128
129/* Structure to describe FPU registers. */
130typedef struct _libc_fpstate *fpregset_t;
131
132/* Context to describe whole processor state. */
133typedef struct
134 {
135 gregset_t __ctx(gregs);
136 /* Note that fpregs is a pointer. */
137 fpregset_t __ctx(fpregs);
138 __extension__ unsigned long long __reserved1 [8];
139} mcontext_t;
140
141/* Userlevel context. */
142typedef struct ucontext_t
143 {
144 unsigned long int __ctx(uc_flags);
145 struct ucontext_t *uc_link;
146 stack_t uc_stack;
147 mcontext_t uc_mcontext;
148 sigset_t uc_sigmask;
149 struct _libc_fpstate __fpregs_mem;
150 __extension__ unsigned long long int __ssp[4];
151 } ucontext_t;
152
153#else /* !__x86_64__ */
154
155/* Type for general register. */
156typedef int greg_t;
157
158/* Number of general registers. */
159#define __NGREG 19
160#ifdef __USE_MISC
161# define NGREG __NGREG
162#endif
163
164/* Container for all general registers. */
165typedef greg_t gregset_t[__NGREG];
166
167#ifdef __USE_GNU
168/* Number of each register is the `gregset_t' array. */
169enum
170{
171 REG_GS = 0,
172# define REG_GS REG_GS
173 REG_FS,
174# define REG_FS REG_FS
175 REG_ES,
176# define REG_ES REG_ES
177 REG_DS,
178# define REG_DS REG_DS
179 REG_EDI,
180# define REG_EDI REG_EDI
181 REG_ESI,
182# define REG_ESI REG_ESI
183 REG_EBP,
184# define REG_EBP REG_EBP
185 REG_ESP,
186# define REG_ESP REG_ESP
187 REG_EBX,
188# define REG_EBX REG_EBX
189 REG_EDX,
190# define REG_EDX REG_EDX
191 REG_ECX,
192# define REG_ECX REG_ECX
193 REG_EAX,
194# define REG_EAX REG_EAX
195 REG_TRAPNO,
196# define REG_TRAPNO REG_TRAPNO
197 REG_ERR,
198# define REG_ERR REG_ERR
199 REG_EIP,
200# define REG_EIP REG_EIP
201 REG_CS,
202# define REG_CS REG_CS
203 REG_EFL,
204# define REG_EFL REG_EFL
205 REG_UESP,
206# define REG_UESP REG_UESP
207 REG_SS
208# define REG_SS REG_SS
209};
210#endif
211
212/* Definitions taken from the kernel headers. */
213struct _libc_fpreg
214{
215 unsigned short int __ctx(significand)[4];
216 unsigned short int __ctx(exponent);
217};
218
219struct _libc_fpstate
220{
221 unsigned long int __ctx(cw);
222 unsigned long int __ctx(sw);
223 unsigned long int __ctx(tag);
224 unsigned long int __ctx(ipoff);
225 unsigned long int __ctx(cssel);
226 unsigned long int __ctx(dataoff);
227 unsigned long int __ctx(datasel);
228 struct _libc_fpreg _st[8];
229 unsigned long int __ctx(status);
230};
231
232/* Structure to describe FPU registers. */
233typedef struct _libc_fpstate *fpregset_t;
234
235/* Context to describe whole processor state. */
236typedef struct
237 {
238 gregset_t __ctx(gregs);
239 /* Due to Linux's history we have to use a pointer here. The SysV/i386
240 ABI requires a struct with the values. */
241 fpregset_t __ctx(fpregs);
242 unsigned long int __ctx(oldmask);
243 unsigned long int __ctx(cr2);
244 } mcontext_t;
245
246/* Userlevel context. */
247typedef struct ucontext_t
248 {
249 unsigned long int __ctx(uc_flags);
250 struct ucontext_t *uc_link;
251 stack_t uc_stack;
252 mcontext_t uc_mcontext;
253 sigset_t uc_sigmask;
254 struct _libc_fpstate __fpregs_mem;
255 unsigned long int __ssp[4];
256 } ucontext_t;
257
258#endif /* !__x86_64__ */
259
260#undef __ctx
261
262#endif /* sys/ucontext.h */
\ No newline at end of file
lib/libc/include/x86-linux-gnu/sys/user.h created+180
...@@ -0,0 +1,180 @@
1/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_USER_H
19#define _SYS_USER_H 1
20
21/* The whole purpose of this file is for GDB and GDB only. Don't read
22 too much into it. Don't use it for anything other than GDB unless
23 you know what you are doing. */
24
25#ifdef __x86_64__
26
27struct user_fpregs_struct
28{
29 unsigned short int cwd;
30 unsigned short int swd;
31 unsigned short int ftw;
32 unsigned short int fop;
33 __extension__ unsigned long long int rip;
34 __extension__ unsigned long long int rdp;
35 unsigned int mxcsr;
36 unsigned int mxcr_mask;
37 unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
38 unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
39 unsigned int padding[24];
40};
41
42struct user_regs_struct
43{
44 __extension__ unsigned long long int r15;
45 __extension__ unsigned long long int r14;
46 __extension__ unsigned long long int r13;
47 __extension__ unsigned long long int r12;
48 __extension__ unsigned long long int rbp;
49 __extension__ unsigned long long int rbx;
50 __extension__ unsigned long long int r11;
51 __extension__ unsigned long long int r10;
52 __extension__ unsigned long long int r9;
53 __extension__ unsigned long long int r8;
54 __extension__ unsigned long long int rax;
55 __extension__ unsigned long long int rcx;
56 __extension__ unsigned long long int rdx;
57 __extension__ unsigned long long int rsi;
58 __extension__ unsigned long long int rdi;
59 __extension__ unsigned long long int orig_rax;
60 __extension__ unsigned long long int rip;
61 __extension__ unsigned long long int cs;
62 __extension__ unsigned long long int eflags;
63 __extension__ unsigned long long int rsp;
64 __extension__ unsigned long long int ss;
65 __extension__ unsigned long long int fs_base;
66 __extension__ unsigned long long int gs_base;
67 __extension__ unsigned long long int ds;
68 __extension__ unsigned long long int es;
69 __extension__ unsigned long long int fs;
70 __extension__ unsigned long long int gs;
71};
72
73struct user
74{
75 struct user_regs_struct regs;
76 int u_fpvalid;
77 struct user_fpregs_struct i387;
78 __extension__ unsigned long long int u_tsize;
79 __extension__ unsigned long long int u_dsize;
80 __extension__ unsigned long long int u_ssize;
81 __extension__ unsigned long long int start_code;
82 __extension__ unsigned long long int start_stack;
83 __extension__ long long int signal;
84 int reserved;
85 __extension__ union
86 {
87 struct user_regs_struct* u_ar0;
88 __extension__ unsigned long long int __u_ar0_word;
89 };
90 __extension__ union
91 {
92 struct user_fpregs_struct* u_fpstate;
93 __extension__ unsigned long long int __u_fpstate_word;
94 };
95 __extension__ unsigned long long int magic;
96 char u_comm [32];
97 __extension__ unsigned long long int u_debugreg [8];
98};
99
100#else
101/* These are the 32-bit x86 structures. */
102struct user_fpregs_struct
103{
104 long int cwd;
105 long int swd;
106 long int twd;
107 long int fip;
108 long int fcs;
109 long int foo;
110 long int fos;
111 long int st_space [20];
112};
113
114struct user_fpxregs_struct
115{
116 unsigned short int cwd;
117 unsigned short int swd;
118 unsigned short int twd;
119 unsigned short int fop;
120 long int fip;
121 long int fcs;
122 long int foo;
123 long int fos;
124 long int mxcsr;
125 long int reserved;
126 long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
127 long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
128 long int padding[56];
129};
130
131struct user_regs_struct
132{
133 long int ebx;
134 long int ecx;
135 long int edx;
136 long int esi;
137 long int edi;
138 long int ebp;
139 long int eax;
140 long int xds;
141 long int xes;
142 long int xfs;
143 long int xgs;
144 long int orig_eax;
145 long int eip;
146 long int xcs;
147 long int eflags;
148 long int esp;
149 long int xss;
150};
151
152struct user
153{
154 struct user_regs_struct regs;
155 int u_fpvalid;
156 struct user_fpregs_struct i387;
157 unsigned long int u_tsize;
158 unsigned long int u_dsize;
159 unsigned long int u_ssize;
160 unsigned long int start_code;
161 unsigned long int start_stack;
162 long int signal;
163 int reserved;
164 struct user_regs_struct* u_ar0;
165 struct user_fpregs_struct* u_fpstate;
166 unsigned long int magic;
167 char u_comm [32];
168 int u_debugreg [8];
169};
170#endif /* __x86_64__ */
171
172#define PAGE_SHIFT 12
173#define PAGE_SIZE (1UL << PAGE_SHIFT)
174#define PAGE_MASK (~(PAGE_SIZE-1))
175#define NBPG PAGE_SIZE
176#define UPAGES 1
177#define HOST_TEXT_START_ADDR (u.start_code)
178#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
179
180#endif /* _SYS_USER_H */
\ No newline at end of file
lib/ssp.zig+1-1
...@@ -35,7 +35,7 @@ export fn __chk_fail() callconv(.C) noreturn {...@@ -35,7 +35,7 @@ export fn __chk_fail() callconv(.C) noreturn {
35 @panic("buffer overflow detected");35 @panic("buffer overflow detected");
36}36}
3737
38// Emitted when targeting some architectures (eg. i386)38// Emitted when targeting some architectures (eg. x86)
39// XXX: This symbol should be hidden39// XXX: This symbol should be hidden
40export fn __stack_chk_fail_local() callconv(.C) noreturn {40export fn __stack_chk_fail_local() callconv(.C) noreturn {
41 __stack_chk_fail();41 __stack_chk_fail();
lib/std/Thread.zig+4-4
...@@ -753,7 +753,7 @@ const LinuxThreadImpl = struct {...@@ -753,7 +753,7 @@ const LinuxThreadImpl = struct {
753 /// https://github.com/ifduyue/musl/search?q=__unmapself753 /// https://github.com/ifduyue/musl/search?q=__unmapself
754 fn freeAndExit(self: *ThreadCompletion) noreturn {754 fn freeAndExit(self: *ThreadCompletion) noreturn {
755 switch (target.cpu.arch) {755 switch (target.cpu.arch) {
756 .i386 => asm volatile (756 .x86 => asm volatile (
757 \\ movl $91, %%eax757 \\ movl $91, %%eax
758 \\ movl %[ptr], %%ebx758 \\ movl %[ptr], %%ebx
759 \\ movl %[len], %%ecx759 \\ movl %[len], %%ecx
...@@ -959,10 +959,10 @@ const LinuxThreadImpl = struct {...@@ -959,10 +959,10 @@ const LinuxThreadImpl = struct {
959 else => |e| return e,959 else => |e| return e,
960 };960 };
961961
962 // Prepare the TLS segment and prepare a user_desc struct when needed on i386962 // Prepare the TLS segment and prepare a user_desc struct when needed on x86
963 var tls_ptr = os.linux.tls.prepareTLS(mapped[tls_offset..]);963 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;964 var user_desc: if (target.cpu.arch == .x86) os.linux.user_desc else void = undefined;
965 if (target.cpu.arch == .i386) {965 if (target.cpu.arch == .x86) {
966 defer tls_ptr = @ptrToInt(&user_desc);966 defer tls_ptr = @ptrToInt(&user_desc);
967 user_desc = .{967 user_desc = .{
968 .entry_number = os.linux.tls.tls_image.gdt_entry_number,968 .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 {...@@ -44,7 +44,7 @@ pub inline fn spinLoopHint() void {
44 // No-op instruction that can hint to save (or share with a hardware-thread)44 // No-op instruction that can hint to save (or share with a hardware-thread)
45 // pipelining/power resources45 // pipelining/power resources
46 // https://software.intel.com/content/www/us/en/develop/articles/benefitting-power-and-performance-sleep-loops.html46 // 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
49 // No-op instruction that serves as a hardware-thread resource yield hint.49 // No-op instruction that serves as a hardware-thread resource yield hint.
50 // https://stackoverflow.com/a/758894150 // https://stackoverflow.com/a/7588941
lib/std/build.zig+2-2
...@@ -2978,12 +2978,12 @@ pub const LibExeObjStep = struct {...@@ -2978,12 +2978,12 @@ pub const LibExeObjStep = struct {
2978 if (glibc_dir_arg) |dir| {2978 if (glibc_dir_arg) |dir| {
2979 // TODO look into making this a call to `linuxTriple`. This2979 // TODO look into making this a call to `linuxTriple`. This
2980 // needs the directory to be called "i686" rather than2980 // 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.
2982 const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";2982 const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";
2983 const cpu_arch = self.target.getCpuArch();2983 const cpu_arch = self.target.getCpuArch();
2984 const os_tag = self.target.getOsTag();2984 const os_tag = self.target.getOsTag();
2985 const abi = self.target.getAbi();2985 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)
2987 "i686"2987 "i686"
2988 else2988 else
2989 @tagName(cpu_arch);2989 @tagName(cpu_arch);
lib/std/build/EmulatableRunStep.zig+2-2
...@@ -95,12 +95,12 @@ fn make(step: *Step) !void {...@@ -95,12 +95,12 @@ fn make(step: *Step) !void {
95 if (glibc_dir_arg) |dir| {95 if (glibc_dir_arg) |dir| {
96 // TODO look into making this a call to `linuxTriple`. This96 // TODO look into making this a call to `linuxTriple`. This
97 // needs the directory to be called "i686" rather than97 // 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.
99 const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";99 const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}";
100 const cpu_arch = self.exe.target.getCpuArch();100 const cpu_arch = self.exe.target.getCpuArch();
101 const os_tag = self.exe.target.getOsTag();101 const os_tag = self.exe.target.getOsTag();
102 const abi = self.exe.target.getAbi();102 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)
104 "i686"104 "i686"
105 else105 else
106 @tagName(cpu_arch);106 @tagName(cpu_arch);
lib/std/c/freebsd.zig+1-1
...@@ -1444,7 +1444,7 @@ pub const E = enum(u16) {...@@ -1444,7 +1444,7 @@ pub const E = enum(u16) {
1444};1444};
14451445
1446pub const MINSIGSTKSZ = switch (builtin.cpu.arch) {1446pub const MINSIGSTKSZ = switch (builtin.cpu.arch) {
1447 .i386, .x86_64 => 2048,1447 .x86, .x86_64 => 2048,
1448 .arm, .aarch64 => 4096,1448 .arm, .aarch64 => 4096,
1449 else => @compileError("MINSIGSTKSZ not defined for this architecture"),1449 else => @compileError("MINSIGSTKSZ not defined for this architecture"),
1450};1450};
lib/std/c/netbsd.zig+4-4
...@@ -80,7 +80,7 @@ pub const pthread_cond_t = extern struct {...@@ -80,7 +80,7 @@ pub const pthread_cond_t = extern struct {
80pub const pthread_rwlock_t = extern struct {80pub const pthread_rwlock_t = extern struct {
81 magic: c_uint = 0x99990009,81 magic: c_uint = 0x99990009,
82 interlock: switch (builtin.cpu.arch) {82 interlock: switch (builtin.cpu.arch) {
83 .aarch64, .sparc, .x86_64, .i386 => u8,83 .aarch64, .sparc, .x86_64, .x86 => u8,
84 .arm, .powerpc => c_int,84 .arm, .powerpc => c_int,
85 else => unreachable,85 else => unreachable,
86 } = 0,86 } = 0,
...@@ -97,7 +97,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) {...@@ -97,7 +97,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) {
97 .aarch64, .aarch64_be, .aarch64_32 => u8,97 .aarch64, .aarch64_be, .aarch64_32 => u8,
98 .mips, .mipsel, .mips64, .mips64el => u32,98 .mips, .mipsel, .mips64, .mips64el => u32,
99 .powerpc, .powerpc64, .powerpc64le => i32,99 .powerpc, .powerpc64, .powerpc64le => i32,
100 .i386, .x86_64 => u8,100 .x86, .x86_64 => u8,
101 .arm, .armeb, .thumb, .thumbeb => i32,101 .arm, .armeb, .thumb, .thumbeb => i32,
102 .sparc, .sparcel, .sparc64 => u8,102 .sparc, .sparcel, .sparc64 => u8,
103 .riscv32, .riscv64 => u32,103 .riscv32, .riscv64 => u32,
...@@ -105,7 +105,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) {...@@ -105,7 +105,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) {
105};105};
106106
107const padded_pthread_spin_t = switch (builtin.cpu.arch) {107const padded_pthread_spin_t = switch (builtin.cpu.arch) {
108 .i386, .x86_64 => u32,108 .x86, .x86_64 => u32,
109 .sparc, .sparcel, .sparc64 => u32,109 .sparc, .sparcel, .sparc64 => u32,
110 else => pthread_spin_t,110 else => pthread_spin_t,
111};111};
...@@ -1067,7 +1067,7 @@ pub const ucontext_t = extern struct {...@@ -1067,7 +1067,7 @@ pub const ucontext_t = extern struct {
1067 mcontext: mcontext_t,1067 mcontext: mcontext_t,
1068 __pad: [1068 __pad: [
1069 switch (builtin.cpu.arch) {1069 switch (builtin.cpu.arch) {
1070 .i386 => 4,1070 .x86 => 4,
1071 .mips, .mipsel, .mips64, .mips64el => 14,1071 .mips, .mipsel, .mips64, .mips64el => 14,
1072 .arm, .armeb, .thumb, .thumbeb => 1,1072 .arm, .armeb, .thumb, .thumbeb => 1,
1073 .sparc, .sparcel, .sparc64 => if (@sizeOf(usize) == 4) 43 else 8,1073 .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) {...@@ -1247,7 +1247,7 @@ pub const E = enum(u16) {
1247};1247};
12481248
1249const _MAX_PAGE_SHIFT = switch (builtin.cpu.arch) {1249const _MAX_PAGE_SHIFT = switch (builtin.cpu.arch) {
1250 .i386 => 12,1250 .x86 => 12,
1251 .sparc64 => 13,1251 .sparc64 => 13,
1252};1252};
1253pub const MINSIGSTKSZ = 1 << _MAX_PAGE_SHIFT;1253pub const MINSIGSTKSZ = 1 << _MAX_PAGE_SHIFT;
lib/std/coff.zig+2-2
...@@ -1025,7 +1025,7 @@ pub const MachineType = enum(u16) {...@@ -1025,7 +1025,7 @@ pub const MachineType = enum(u16) {
1025 .powerpc => .POWERPC,1025 .powerpc => .POWERPC,
1026 .riscv32 => .RISCV32,1026 .riscv32 => .RISCV32,
1027 .thumb => .Thumb,1027 .thumb => .Thumb,
1028 .i386 => .I386,1028 .x86 => .I386,
1029 .aarch64 => .ARM64,1029 .aarch64 => .ARM64,
1030 .riscv64 => .RISCV64,1030 .riscv64 => .RISCV64,
1031 .x86_64 => .X64,1031 .x86_64 => .X64,
...@@ -1040,7 +1040,7 @@ pub const MachineType = enum(u16) {...@@ -1040,7 +1040,7 @@ pub const MachineType = enum(u16) {
1040 .POWERPC => .powerpc,1040 .POWERPC => .powerpc,
1041 .RISCV32 => .riscv32,1041 .RISCV32 => .riscv32,
1042 .Thumb => .thumb,1042 .Thumb => .thumb,
1043 .I386 => .i386,1043 .I386 => .x86,
1044 .ARM64 => .aarch64,1044 .ARM64 => .aarch64,
1045 .RISCV64 => .riscv64,1045 .RISCV64 => .riscv64,
1046 .X64 => .x86_64,1046 .X64 => .x86_64,
lib/std/debug.zig+3-3
...@@ -182,7 +182,7 @@ pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void {...@@ -182,7 +182,7 @@ pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void {
182 // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid182 // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid
183 // an overflow. We do not need to signal `StackIterator` as it will correctly detect this183 // an overflow. We do not need to signal `StackIterator` as it will correctly detect this
184 // condition on the subsequent iteration and return `null` thus terminating the loop.184 // condition on the subsequent iteration and return `null` thus terminating the loop.
185 // same behaviour for i386-windows-msvc185 // same behaviour for x86-windows-msvc
186 const address = if (return_address == 0) return_address else return_address - 1;186 const address = if (return_address == 0) return_address else return_address - 1;
187 printSourceAtAddress(debug_info, stderr, address, tty_config) catch return;187 printSourceAtAddress(debug_info, stderr, address, tty_config) catch return;
188 }188 }
...@@ -568,7 +568,7 @@ pub fn writeCurrentStackTrace(...@@ -568,7 +568,7 @@ pub fn writeCurrentStackTrace(
568 // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid568 // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid
569 // an overflow. We do not need to signal `StackIterator` as it will correctly detect this569 // an overflow. We do not need to signal `StackIterator` as it will correctly detect this
570 // condition on the subsequent iteration and return `null` thus terminating the loop.570 // condition on the subsequent iteration and return `null` thus terminating the loop.
571 // same behaviour for i386-windows-msvc571 // same behaviour for x86-windows-msvc
572 const address = if (return_address == 0) return_address else return_address - 1;572 const address = if (return_address == 0) return_address else return_address - 1;
573 try printSourceAtAddress(debug_info, out_stream, address, tty_config);573 try printSourceAtAddress(debug_info, out_stream, address, tty_config);
574 }574 }
...@@ -1922,7 +1922,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any...@@ -1922,7 +1922,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
1922 }1922 }
19231923
1924 switch (native_arch) {1924 switch (native_arch) {
1925 .i386 => {1925 .x86 => {
1926 const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));1926 const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
1927 const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]);1927 const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]);
1928 const bp = @intCast(usize, ctx.mcontext.gregs[os.REG.EBP]);1928 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) {...@@ -1502,7 +1502,7 @@ pub const EM = enum(u16) {
1502 .MIPS_RS3_LE => .mipsel,1502 .MIPS_RS3_LE => .mipsel,
1503 .PPC => .powerpc,1503 .PPC => .powerpc,
1504 .SPARC => .sparc,1504 .SPARC => .sparc,
1505 .@"386" => .i386,1505 .@"386" => .x86,
1506 .XCORE => .xcore,1506 .XCORE => .xcore,
1507 .CSR_KALIMBA => .kalimba,1507 .CSR_KALIMBA => .kalimba,
1508 .LANAI => .lanai,1508 .LANAI => .lanai,
lib/std/macho.zig+2-2
...@@ -1201,7 +1201,7 @@ pub const MH_DEAD_STRIPPABLE_DYLIB = 0x400000;...@@ -1201,7 +1201,7 @@ pub const MH_DEAD_STRIPPABLE_DYLIB = 0x400000;
1201/// Contains a section of type S_THREAD_LOCAL_VARIABLES1201/// Contains a section of type S_THREAD_LOCAL_VARIABLES
1202pub const MH_HAS_TLV_DESCRIPTORS = 0x800000;1202pub 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.
1205pub const MH_NO_HEAP_EXECUTION = 0x1000000;1205pub const MH_NO_HEAP_EXECUTION = 0x1000000;
12061206
1207/// The code was linked for use in an application extension.1207/// The code was linked for use in an application extension.
...@@ -1444,7 +1444,7 @@ pub const S_ATTR_NO_DEAD_STRIP = 0x10000000;...@@ -1444,7 +1444,7 @@ pub const S_ATTR_NO_DEAD_STRIP = 0x10000000;
1444/// blocks are live if they reference live blocks1444/// blocks are live if they reference live blocks
1445pub const S_ATTR_LIVE_SUPPORT = 0x8000000;1445pub const S_ATTR_LIVE_SUPPORT = 0x8000000;
14461446
1447/// used with i386 code stubs written on by dyld1447/// used with x86 code stubs written on by dyld
1448pub const S_ATTR_SELF_MODIFYING_CODE = 0x4000000;1448pub const S_ATTR_SELF_MODIFYING_CODE = 0x4000000;
14491449
1450/// section contains some machine instructions1450/// section contains some machine instructions
lib/std/os/linux.zig+22-22
...@@ -33,7 +33,7 @@ const syscall_bits = switch (native_arch) {...@@ -33,7 +33,7 @@ const syscall_bits = switch (native_arch) {
33};33};
3434
35const arch_bits = switch (native_arch) {35const arch_bits = switch (native_arch) {
36 .i386 => @import("linux/i386.zig"),36 .x86 => @import("linux/x86.zig"),
37 .x86_64 => @import("linux/x86_64.zig"),37 .x86_64 => @import("linux/x86_64.zig"),
38 .aarch64 => @import("linux/arm64.zig"),38 .aarch64 => @import("linux/arm64.zig"),
39 .arm, .thumb => @import("linux/arm-eabi.zig"),39 .arm, .thumb => @import("linux/arm-eabi.zig"),
...@@ -94,7 +94,7 @@ pub const SECCOMP = @import("linux/seccomp.zig");...@@ -94,7 +94,7 @@ pub const SECCOMP = @import("linux/seccomp.zig");
9494
95pub const syscalls = @import("linux/syscalls.zig");95pub const syscalls = @import("linux/syscalls.zig");
96pub const SYS = switch (@import("builtin").cpu.arch) {96pub const SYS = switch (@import("builtin").cpu.arch) {
97 .i386 => syscalls.X86,97 .x86 => syscalls.X86,
98 .x86_64 => syscalls.X64,98 .x86_64 => syscalls.X64,
99 .aarch64 => syscalls.Arm64,99 .aarch64 => syscalls.Arm64,
100 .arm, .thumb => syscalls.Arm,100 .arm, .thumb => syscalls.Arm,
...@@ -1198,42 +1198,42 @@ pub fn sigismember(set: *const sigset_t, sig: u6) bool {...@@ -1198,42 +1198,42 @@ pub fn sigismember(set: *const sigset_t, sig: u6) bool {
1198}1198}
11991199
1200pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize {1200pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize {
1201 if (native_arch == .i386) {1201 if (native_arch == .x86) {
1202 return socketcall(SC.getsockname, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) });1202 return socketcall(SC.getsockname, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) });
1203 }1203 }
1204 return syscall3(.getsockname, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len));1204 return syscall3(.getsockname, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len));
1205}1205}
12061206
1207pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize {1207pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize {
1208 if (native_arch == .i386) {1208 if (native_arch == .x86) {
1209 return socketcall(SC.getpeername, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) });1209 return socketcall(SC.getpeername, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) });
1210 }1210 }
1211 return syscall3(.getpeername, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len));1211 return syscall3(.getpeername, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len));
1212}1212}
12131213
1214pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize {1214pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize {
1215 if (native_arch == .i386) {1215 if (native_arch == .x86) {
1216 return socketcall(SC.socket, &[3]usize{ domain, socket_type, protocol });1216 return socketcall(SC.socket, &[3]usize{ domain, socket_type, protocol });
1217 }1217 }
1218 return syscall3(.socket, domain, socket_type, protocol);1218 return syscall3(.socket, domain, socket_type, protocol);
1219}1219}
12201220
1221pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize {1221pub 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) {
1223 return socketcall(SC.setsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen) });1223 return socketcall(SC.setsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen) });
1224 }1224 }
1225 return syscall5(.setsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen));1225 return syscall5(.setsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen));
1226}1226}
12271227
1228pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize {1228pub 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) {
1230 return socketcall(SC.getsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen) });1230 return socketcall(SC.getsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen) });
1231 }1231 }
1232 return syscall5(.getsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen));1232 return syscall5(.getsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen));
1233}1233}
12341234
1235pub fn sendmsg(fd: i32, msg: *const std.x.os.Socket.Message, flags: c_int) usize {1235pub 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) {
1237 return socketcall(SC.sendmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) });1237 return socketcall(SC.sendmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) });
1238 }1238 }
1239 return syscall3(.sendmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)));1239 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...@@ -1280,49 +1280,49 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize
1280}1280}
12811281
1282pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize {1282pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize {
1283 if (native_arch == .i386) {1283 if (native_arch == .x86) {
1284 return socketcall(SC.connect, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len });1284 return socketcall(SC.connect, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len });
1285 }1285 }
1286 return syscall3(.connect, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len);1286 return syscall3(.connect, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len);
1287}1287}
12881288
1289pub fn recvmsg(fd: i32, msg: *std.x.os.Socket.Message, flags: c_int) usize {1289pub fn recvmsg(fd: i32, msg: *std.x.os.Socket.Message, flags: c_int) usize {
1290 if (native_arch == .i386) {1290 if (native_arch == .x86) {
1291 return socketcall(SC.recvmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) });1291 return socketcall(SC.recvmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) });
1292 }1292 }
1293 return syscall3(.recvmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)));1293 return syscall3(.recvmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)));
1294}1294}
12951295
1296pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize {1296pub 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) {
1298 return socketcall(SC.recvfrom, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen) });1298 return socketcall(SC.recvfrom, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen) });
1299 }1299 }
1300 return syscall6(.recvfrom, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen));1300 return syscall6(.recvfrom, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen));
1301}1301}
13021302
1303pub fn shutdown(fd: i32, how: i32) usize {1303pub fn shutdown(fd: i32, how: i32) usize {
1304 if (native_arch == .i386) {1304 if (native_arch == .x86) {
1305 return socketcall(SC.shutdown, &[2]usize{ @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)) });1305 return socketcall(SC.shutdown, &[2]usize{ @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)) });
1306 }1306 }
1307 return syscall2(.shutdown, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)));1307 return syscall2(.shutdown, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)));
1308}1308}
13091309
1310pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize {1310pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize {
1311 if (native_arch == .i386) {1311 if (native_arch == .x86) {
1312 return socketcall(SC.bind, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len) });1312 return socketcall(SC.bind, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len) });
1313 }1313 }
1314 return syscall3(.bind, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len));1314 return syscall3(.bind, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len));
1315}1315}
13161316
1317pub fn listen(fd: i32, backlog: u32) usize {1317pub fn listen(fd: i32, backlog: u32) usize {
1318 if (native_arch == .i386) {1318 if (native_arch == .x86) {
1319 return socketcall(SC.listen, &[2]usize{ @bitCast(usize, @as(isize, fd)), backlog });1319 return socketcall(SC.listen, &[2]usize{ @bitCast(usize, @as(isize, fd)), backlog });
1320 }1320 }
1321 return syscall2(.listen, @bitCast(usize, @as(isize, fd)), backlog);1321 return syscall2(.listen, @bitCast(usize, @as(isize, fd)), backlog);
1322}1322}
13231323
1324pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize {1324pub 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) {
1326 return socketcall(SC.sendto, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen) });1326 return socketcall(SC.sendto, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen) });
1327 }1327 }
1328 return syscall6(.sendto, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen));1328 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 {...@@ -1349,21 +1349,21 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize {
1349}1349}
13501350
1351pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: *[2]i32) usize {1351pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: *[2]i32) usize {
1352 if (native_arch == .i386) {1352 if (native_arch == .x86) {
1353 return socketcall(SC.socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd) });1353 return socketcall(SC.socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd) });
1354 }1354 }
1355 return syscall4(.socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd));1355 return syscall4(.socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd));
1356}1356}
13571357
1358pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize {1358pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize {
1359 if (native_arch == .i386) {1359 if (native_arch == .x86) {
1360 return socketcall(SC.accept, &[4]usize{ fd, addr, len, 0 });1360 return socketcall(SC.accept, &[4]usize{ fd, addr, len, 0 });
1361 }1361 }
1362 return accept4(fd, addr, len, 0);1362 return accept4(fd, addr, len, 0);
1363}1363}
13641364
1365pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize {1365pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize {
1366 if (native_arch == .i386) {1366 if (native_arch == .x86) {
1367 return socketcall(SC.accept4, &[4]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags });1367 return socketcall(SC.accept4, &[4]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags });
1368 }1368 }
1369 return syscall4(.accept4, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags);1369 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 {...@@ -3459,12 +3459,12 @@ pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {
3459}3459}
34603460
3461pub const MINSIGSTKSZ = switch (native_arch) {3461pub const MINSIGSTKSZ = switch (native_arch) {
3462 .i386, .x86_64, .arm, .mipsel => 2048,3462 .x86, .x86_64, .arm, .mipsel => 2048,
3463 .aarch64 => 5120,3463 .aarch64 => 5120,
3464 else => @compileError("MINSIGSTKSZ not defined for this architecture"),3464 else => @compileError("MINSIGSTKSZ not defined for this architecture"),
3465};3465};
3466pub const SIGSTKSZ = switch (native_arch) {3466pub const SIGSTKSZ = switch (native_arch) {
3467 .i386, .x86_64, .arm, .mipsel => 8192,3467 .x86, .x86_64, .arm, .mipsel => 8192,
3468 .aarch64 => 16384,3468 .aarch64 => 16384,
3469 else => @compileError("SIGSTKSZ not defined for this architecture"),3469 else => @compileError("SIGSTKSZ not defined for this architecture"),
3470};3470};
...@@ -5631,7 +5631,7 @@ pub const AUDIT = struct {...@@ -5631,7 +5631,7 @@ pub const AUDIT = struct {
5631 const LE = 0x40000000;5631 const LE = 0x40000000;
56325632
5633 pub const current: AUDIT.ARCH = switch (native_arch) {5633 pub const current: AUDIT.ARCH = switch (native_arch) {
5634 .i386 => .I386,5634 .x86 => .X86,
5635 .x86_64 => .X86_64,5635 .x86_64 => .X86_64,
5636 .aarch64 => .AARCH64,5636 .aarch64 => .AARCH64,
5637 .arm, .thumb => .ARM,5637 .arm, .thumb => .ARM,
...@@ -5650,7 +5650,7 @@ pub const AUDIT = struct {...@@ -5650,7 +5650,7 @@ pub const AUDIT = struct {
5650 ARMEB = toAudit(.armeb),5650 ARMEB = toAudit(.armeb),
5651 CSKY = toAudit(.csky),5651 CSKY = toAudit(.csky),
5652 HEXAGON = @enumToInt(std.elf.EM.HEXAGON),5652 HEXAGON = @enumToInt(std.elf.EM.HEXAGON),
5653 I386 = toAudit(.i386),5653 X86 = toAudit(.x86),
5654 M68K = toAudit(.m68k),5654 M68K = toAudit(.m68k),
5655 MIPS = toAudit(.mips),5655 MIPS = toAudit(.mips),
5656 MIPSEL = toAudit(.mips) | LE,5656 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;...@@ -11,7 +11,7 @@ const R_RISCV_RELATIVE = 3;
11const R_SPARC_RELATIVE = 22;11const R_SPARC_RELATIVE = 22;
1212
13const R_RELATIVE = switch (builtin.cpu.arch) {13const R_RELATIVE = switch (builtin.cpu.arch) {
14 .i386 => R_386_RELATIVE,14 .x86 => R_386_RELATIVE,
15 .x86_64 => R_AMD64_RELATIVE,15 .x86_64 => R_AMD64_RELATIVE,
16 .arm => R_ARM_RELATIVE,16 .arm => R_ARM_RELATIVE,
17 .aarch64 => R_AARCH64_RELATIVE,17 .aarch64 => R_AARCH64_RELATIVE,
...@@ -24,7 +24,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {...@@ -24,7 +24,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
24// relocation that, at this point, is not yet applied.24// relocation that, at this point, is not yet applied.
25fn getDynamicSymbol() [*]elf.Dyn {25fn getDynamicSymbol() [*]elf.Dyn {
26 return switch (builtin.cpu.arch) {26 return switch (builtin.cpu.arch) {
27 .i386 => asm volatile (27 .x86 => asm volatile (
28 \\ .weak _DYNAMIC28 \\ .weak _DYNAMIC
29 \\ .hidden _DYNAMIC29 \\ .hidden _DYNAMIC
30 \\ call 1f30 \\ call 1f
lib/std/os/linux/tls.zig+4-4
...@@ -30,7 +30,7 @@ const native_arch = @import("builtin").cpu.arch;...@@ -30,7 +30,7 @@ const native_arch = @import("builtin").cpu.arch;
30// `-- The thread pointer register points here30// `-- The thread pointer register points here
31//31//
32// The structure of the TCB is not defined by the ABI so we reserve enough space32// 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 a33// for a single pointer as some architectures such as x86 and x86_64 need a
34// pointer to the TCB block itself at the address pointed by the tp.34// pointer to the TCB block itself at the address pointed by the tp.
35//35//
36// In this case the control structure and DTV are placed one after another right36// In this case the control structure and DTV are placed one after another right
...@@ -49,7 +49,7 @@ const TLSVariant = enum {...@@ -49,7 +49,7 @@ const TLSVariant = enum {
4949
50const tls_variant = switch (native_arch) {50const tls_variant = switch (native_arch) {
51 .arm, .armeb, .thumb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => TLSVariant.VariantI,51 .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,
53 else => @compileError("undefined tls_variant for this architecture"),53 else => @compileError("undefined tls_variant for this architecture"),
54};54};
5555
...@@ -102,7 +102,7 @@ const TLSImage = struct {...@@ -102,7 +102,7 @@ const TLSImage = struct {
102 dtv_offset: usize,102 dtv_offset: usize,
103 data_offset: usize,103 data_offset: usize,
104 data_size: usize,104 data_size: usize,
105 // Only used on the i386 architecture105 // Only used on the x86 architecture
106 gdt_entry_number: usize,106 gdt_entry_number: usize,
107};107};
108108
...@@ -110,7 +110,7 @@ pub var tls_image: TLSImage = undefined;...@@ -110,7 +110,7 @@ pub var tls_image: TLSImage = undefined;
110110
111pub fn setThreadPointer(addr: usize) void {111pub fn setThreadPointer(addr: usize) void {
112 switch (native_arch) {112 switch (native_arch) {
113 .i386 => {113 .x86 => {
114 var user_desc = std.os.linux.user_desc{114 var user_desc = std.os.linux.user_desc{
115 .entry_number = tls_image.gdt_entry_number,115 .entry_number = tls_image.gdt_entry_number,
116 .base_addr = addr,116 .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" {...@@ -746,7 +746,7 @@ test "sigaction" {
746 return error.SkipZigTest;746 return error.SkipZigTest;
747747
748 // https://github.com/ziglang/zig/issues/7427748 // 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)
750 return error.SkipZigTest;750 return error.SkipZigTest;
751751
752 const S = struct {752 const S = struct {
lib/std/os/windows.zig+3-3
...@@ -1750,7 +1750,7 @@ pub fn UnlockFile(...@@ -1750,7 +1750,7 @@ pub fn UnlockFile(
17501750
1751pub fn teb() *TEB {1751pub fn teb() *TEB {
1752 return switch (native_arch) {1752 return switch (native_arch) {
1753 .i386 => asm volatile (1753 .x86 => asm volatile (
1754 \\ movl %%fs:0x18, %[ptr]1754 \\ movl %%fs:0x18, %[ptr]
1755 : [ptr] "=r" (-> *TEB),1755 : [ptr] "=r" (-> *TEB),
1756 ),1756 ),
...@@ -2053,7 +2053,7 @@ pub const STD_OUTPUT_HANDLE = maxInt(DWORD) - 11 + 1;...@@ -2053,7 +2053,7 @@ pub const STD_OUTPUT_HANDLE = maxInt(DWORD) - 11 + 1;
2053/// The standard error device. Initially, this is the active console screen buffer, CONOUT$.2053/// The standard error device. Initially, this is the active console screen buffer, CONOUT$.
2054pub const STD_ERROR_HANDLE = maxInt(DWORD) - 12 + 1;2054pub 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)
2057 .Stdcall2057 .Stdcall
2058else2058else
2059 .C;2059 .C;
...@@ -3019,7 +3019,7 @@ pub const EXCEPTION_RECORD = extern struct {...@@ -3019,7 +3019,7 @@ pub const EXCEPTION_RECORD = extern struct {
3019};3019};
30203020
3021pub usingnamespace switch (native_arch) {3021pub usingnamespace switch (native_arch) {
3022 .i386 => struct {3022 .x86 => struct {
3023 pub const FLOATING_SAVE_AREA = extern struct {3023 pub const FLOATING_SAVE_AREA = extern struct {
3024 ControlWord: DWORD,3024 ControlWord: DWORD,
3025 StatusWord: DWORD,3025 StatusWord: DWORD,
lib/std/start.zig+2-2
...@@ -275,7 +275,7 @@ fn _start() callconv(.Naked) noreturn {...@@ -275,7 +275,7 @@ fn _start() callconv(.Naked) noreturn {
275 \\ andq $-16, %%rsp275 \\ andq $-16, %%rsp
276 \\ call _posixCallMainAndExit276 \\ call _posixCallMainAndExit
277 ),277 ),
278 .i386 => asm volatile (278 .x86 => asm volatile (
279 \\ xorl %%ebp, %%ebp279 \\ xorl %%ebp, %%ebp
280 \\ movl %%esp, argc_argv_ptr280 \\ movl %%esp, argc_argv_ptr
281 \\ andl $-16, %%esp281 \\ andl $-16, %%esp
...@@ -307,7 +307,7 @@ fn _start() callconv(.Naked) noreturn {...@@ -307,7 +307,7 @@ fn _start() callconv(.Naked) noreturn {
307 : [argc] "={rsp}" (-> [*]usize),307 : [argc] "={rsp}" (-> [*]usize),
308 );308 );
309 },309 },
310 .i386 => {310 .x86 => {
311 argc_argv_ptr = asm volatile (311 argc_argv_ptr = asm volatile (
312 \\ xor %%ebp, %%ebp312 \\ xor %%ebp, %%ebp
313 : [argc] "={esp}" (-> [*]usize),313 : [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") =...@@ -8,7 +8,7 @@ export var __xl_a: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLA") =
8export var __xl_z: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLZ") = null;8export var __xl_z: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLZ") = null;
99
10comptime {10comptime {
11 if (builtin.target.cpu.arch == .i386) {11 if (builtin.target.cpu.arch == .x86) {
12 // The __tls_array is the offset of the ThreadLocalStoragePointer field12 // The __tls_array is the offset of the ThreadLocalStoragePointer field
13 // in the TEB block whose base address held in the %fs segment.13 // in the TEB block whose base address held in the %fs segment.
14 asm (14 asm (
lib/std/target.zig+16-16
...@@ -850,7 +850,7 @@ pub const Target = struct {...@@ -850,7 +850,7 @@ pub const Target = struct {
850 tcele,850 tcele,
851 thumb,851 thumb,
852 thumbeb,852 thumbeb,
853 i386,853 x86,
854 x86_64,854 x86_64,
855 xcore,855 xcore,
856 nvptx,856 nvptx,
...@@ -879,7 +879,7 @@ pub const Target = struct {...@@ -879,7 +879,7 @@ pub const Target = struct {
879879
880 pub fn isX86(arch: Arch) bool {880 pub fn isX86(arch: Arch) bool {
881 return switch (arch) {881 return switch (arch) {
882 .i386, .x86_64 => true,882 .x86, .x86_64 => true,
883 else => false,883 else => false,
884 };884 };
885 }885 }
...@@ -999,7 +999,7 @@ pub const Target = struct {...@@ -999,7 +999,7 @@ pub const Target = struct {
999 .tcele => .NONE,999 .tcele => .NONE,
1000 .thumb => .ARM,1000 .thumb => .ARM,
1001 .thumbeb => .ARM,1001 .thumbeb => .ARM,
1002 .i386 => .@"386",1002 .x86 => .@"386",
1003 .xcore => .XCORE,1003 .xcore => .XCORE,
1004 .nvptx => .NONE,1004 .nvptx => .NONE,
1005 .amdil => .NONE,1005 .amdil => .NONE,
...@@ -1063,7 +1063,7 @@ pub const Target = struct {...@@ -1063,7 +1063,7 @@ pub const Target = struct {
1063 .tcele => .Unknown,1063 .tcele => .Unknown,
1064 .thumb => .Thumb,1064 .thumb => .Thumb,
1065 .thumbeb => .Thumb,1065 .thumbeb => .Thumb,
1066 .i386 => .I386,1066 .x86 => .I386,
1067 .xcore => .Unknown,1067 .xcore => .Unknown,
1068 .nvptx => .Unknown,1068 .nvptx => .Unknown,
1069 .amdil => .Unknown,1069 .amdil => .Unknown,
...@@ -1134,7 +1134,7 @@ pub const Target = struct {...@@ -1134,7 +1134,7 @@ pub const Target = struct {
1134 .r600,1134 .r600,
1135 .riscv32,1135 .riscv32,
1136 .riscv64,1136 .riscv64,
1137 .i386,1137 .x86,
1138 .x86_64,1138 .x86_64,
1139 .wasm32,1139 .wasm32,
1140 .wasm64,1140 .wasm64,
...@@ -1179,7 +1179,7 @@ pub const Target = struct {...@@ -1179,7 +1179,7 @@ pub const Target = struct {
1179 const is_nvptx = arch == .nvptx or arch == .nvptx64;1179 const is_nvptx = arch == .nvptx or arch == .nvptx64;
1180 return switch (address_space) {1180 return switch (address_space) {
1181 .generic => true,1181 .generic => true,
1182 .fs, .gs, .ss => arch == .x86_64 or arch == .i386,1182 .fs, .gs, .ss => arch == .x86_64 or arch == .x86,
1183 .global, .constant, .local, .shared => arch == .amdgcn or is_nvptx,1183 .global, .constant, .local, .shared => arch == .amdgcn or is_nvptx,
1184 .param => is_nvptx,1184 .param => is_nvptx,
1185 };1185 };
...@@ -1211,7 +1211,7 @@ pub const Target = struct {...@@ -1211,7 +1211,7 @@ pub const Target = struct {
1211 .tcele,1211 .tcele,
1212 .thumb,1212 .thumb,
1213 .thumbeb,1213 .thumbeb,
1214 .i386,1214 .x86,
1215 .xcore,1215 .xcore,
1216 .nvptx,1216 .nvptx,
1217 .amdil,1217 .amdil,
...@@ -1267,7 +1267,7 @@ pub const Target = struct {...@@ -1267,7 +1267,7 @@ pub const Target = struct {
1267 .riscv32, .riscv64 => "riscv",1267 .riscv32, .riscv64 => "riscv",
1268 .sparc, .sparc64, .sparcel => "sparc",1268 .sparc, .sparc64, .sparcel => "sparc",
1269 .s390x => "s390x",1269 .s390x => "s390x",
1270 .i386, .x86_64 => "x86",1270 .x86, .x86_64 => "x86",
1271 .nvptx, .nvptx64 => "nvptx",1271 .nvptx, .nvptx64 => "nvptx",
1272 .wasm32, .wasm64 => "wasm",1272 .wasm32, .wasm64 => "wasm",
1273 .spirv32, .spirv64 => "spir-v",1273 .spirv32, .spirv64 => "spir-v",
...@@ -1291,7 +1291,7 @@ pub const Target = struct {...@@ -1291,7 +1291,7 @@ pub const Target = struct {
1291 .sparc, .sparc64, .sparcel => &sparc.all_features,1291 .sparc, .sparc64, .sparcel => &sparc.all_features,
1292 .spirv32, .spirv64 => &spirv.all_features,1292 .spirv32, .spirv64 => &spirv.all_features,
1293 .s390x => &s390x.all_features,1293 .s390x => &s390x.all_features,
1294 .i386, .x86_64 => &x86.all_features,1294 .x86, .x86_64 => &x86.all_features,
1295 .nvptx, .nvptx64 => &nvptx.all_features,1295 .nvptx, .nvptx64 => &nvptx.all_features,
1296 .ve => &ve.all_features,1296 .ve => &ve.all_features,
1297 .wasm32, .wasm64 => &wasm.all_features,1297 .wasm32, .wasm64 => &wasm.all_features,
...@@ -1315,7 +1315,7 @@ pub const Target = struct {...@@ -1315,7 +1315,7 @@ pub const Target = struct {
1315 .riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu),1315 .riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu),
1316 .sparc, .sparc64, .sparcel => comptime allCpusFromDecls(sparc.cpu),1316 .sparc, .sparc64, .sparcel => comptime allCpusFromDecls(sparc.cpu),
1317 .s390x => comptime allCpusFromDecls(s390x.cpu),1317 .s390x => comptime allCpusFromDecls(s390x.cpu),
1318 .i386, .x86_64 => comptime allCpusFromDecls(x86.cpu),1318 .x86, .x86_64 => comptime allCpusFromDecls(x86.cpu),
1319 .nvptx, .nvptx64 => comptime allCpusFromDecls(nvptx.cpu),1319 .nvptx, .nvptx64 => comptime allCpusFromDecls(nvptx.cpu),
1320 .ve => comptime allCpusFromDecls(ve.cpu),1320 .ve => comptime allCpusFromDecls(ve.cpu),
1321 .wasm32, .wasm64 => comptime allCpusFromDecls(wasm.cpu),1321 .wasm32, .wasm64 => comptime allCpusFromDecls(wasm.cpu),
...@@ -1377,7 +1377,7 @@ pub const Target = struct {...@@ -1377,7 +1377,7 @@ pub const Target = struct {
1377 .sparc, .sparcel => &sparc.cpu.generic,1377 .sparc, .sparcel => &sparc.cpu.generic,
1378 .sparc64 => &sparc.cpu.v9, // 64-bit SPARC needs v9 as the baseline1378 .sparc64 => &sparc.cpu.v9, // 64-bit SPARC needs v9 as the baseline
1379 .s390x => &s390x.cpu.generic,1379 .s390x => &s390x.cpu.generic,
1380 .i386 => &x86.cpu.i386,1380 .x86 => &x86.cpu.x86,
1381 .x86_64 => &x86.cpu.x86_64,1381 .x86_64 => &x86.cpu.x86_64,
1382 .nvptx, .nvptx64 => &nvptx.cpu.sm_20,1382 .nvptx, .nvptx64 => &nvptx.cpu.sm_20,
1383 .ve => &ve.cpu.generic,1383 .ve => &ve.cpu.generic,
...@@ -1392,7 +1392,7 @@ pub const Target = struct {...@@ -1392,7 +1392,7 @@ pub const Target = struct {
1392 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,1392 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,
1393 .riscv32 => &riscv.cpu.baseline_rv32,1393 .riscv32 => &riscv.cpu.baseline_rv32,
1394 .riscv64 => &riscv.cpu.baseline_rv64,1394 .riscv64 => &riscv.cpu.baseline_rv64,
1395 .i386 => &x86.cpu.pentium4,1395 .x86 => &x86.cpu.pentium4,
1396 .nvptx, .nvptx64 => &nvptx.cpu.sm_20,1396 .nvptx, .nvptx64 => &nvptx.cpu.sm_20,
1397 .sparc, .sparcel => &sparc.cpu.v8,1397 .sparc, .sparcel => &sparc.cpu.v8,
13981398
...@@ -1622,7 +1622,7 @@ pub const Target = struct {...@@ -1622,7 +1622,7 @@ pub const Target = struct {
1622 .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"),1622 .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"),
1623 .solaris => return copy(&result, "/lib/64/ld.so.1"),1623 .solaris => return copy(&result, "/lib/64/ld.so.1"),
1624 .linux => switch (self.cpu.arch) {1624 .linux => switch (self.cpu.arch) {
1625 .i386,1625 .x86,
1626 .sparc,1626 .sparc,
1627 .sparcel,1627 .sparcel,
1628 => return copy(&result, "/lib/ld-linux.so.2"),1628 => return copy(&result, "/lib/ld-linux.so.2"),
...@@ -1771,7 +1771,7 @@ pub const Target = struct {...@@ -1771,7 +1771,7 @@ pub const Target = struct {
1771 /// 5c arm little-endian ARM1771 /// 5c arm little-endian ARM
1772 /// 6c amd64 AMD64 and compatibles (e.g., Intel EM64T)1772 /// 6c amd64 AMD64 and compatibles (e.g., Intel EM64T)
1773 /// 7c arm64 ARM64 (ARMv8)1773 /// 7c arm64 ARM64 (ARMv8)
1774 /// 8c 386 Intel i386, i486, Pentium, etc.1774 /// 8c 386 Intel x86, i486, Pentium, etc.
1775 /// kc sparc Sun SPARC1775 /// kc sparc Sun SPARC
1776 /// qc power Power PC1776 /// qc power Power PC
1777 /// vc mips big-endian MIPS 3000 family1777 /// vc mips big-endian MIPS 3000 family
...@@ -1780,7 +1780,7 @@ pub const Target = struct {...@@ -1780,7 +1780,7 @@ pub const Target = struct {
1780 .arm => ".5",1780 .arm => ".5",
1781 .x86_64 => ".6",1781 .x86_64 => ".6",
1782 .aarch64 => ".7",1782 .aarch64 => ".7",
1783 .i386 => ".8",1783 .x86 => ".8",
1784 .sparc => ".k",1784 .sparc => ".k",
1785 .powerpc, .powerpcle => ".q",1785 .powerpc, .powerpcle => ".q",
1786 .mips, .mipsel => ".v",1786 .mips, .mipsel => ".v",
...@@ -1815,7 +1815,7 @@ pub const Target = struct {...@@ -1815,7 +1815,7 @@ pub const Target = struct {
1815 .wasm64,1815 .wasm64,
1816 => 8,1816 => 8,
18171817
1818 .i386 => return switch (target.os.tag) {1818 .x86 => return switch (target.os.tag) {
1819 .windows, .uefi => 8,1819 .windows, .uefi => 8,
1820 else => 4,1820 else => 4,
1821 },1821 },
lib/std/target/x86.zig+2-2
...@@ -2040,8 +2040,8 @@ pub const cpu = struct {...@@ -2040,8 +2040,8 @@ pub const cpu = struct {
2040 .xsaveopt,2040 .xsaveopt,
2041 }),2041 }),
2042 };2042 };
2043 pub const @"i386" = CpuModel{2043 pub const x86 = CpuModel{
2044 .name = "i386",2044 .name = "x86",
2045 .llvm_name = "i386",2045 .llvm_name = "i386",
2046 .features = featureSet(&[_]Feature{2046 .features = featureSet(&[_]Feature{
2047 .slow_unaligned_mem_16,2047 .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:...@@ -8,7 +8,7 @@ pub fn doClientRequest(default: usize, request: usize, a1: usize, a2: usize, a3:
8 }8 }
99
10 switch (builtin.target.cpu.arch) {10 switch (builtin.target.cpu.arch) {
11 .i386 => {11 .x86 => {
12 return asm volatile (12 return asm volatile (
13 \\ roll $3, %%edi ; roll $13, %%edi13 \\ roll $3, %%edi ; roll $13, %%edi
14 \\ roll $29, %%edi ; roll $19, %%edi14 \\ roll $29, %%edi ; roll $19, %%edi
lib/std/zig/CrossTarget.zig+1-1
...@@ -592,7 +592,7 @@ pub const VcpkgLinkage = std.builtin.LinkMode;...@@ -592,7 +592,7 @@ pub const VcpkgLinkage = std.builtin.LinkMode;
592/// Returned slice must be freed by the caller.592/// Returned slice must be freed by the caller.
593pub fn vcpkgTriplet(self: CrossTarget, allocator: mem.Allocator, linkage: VcpkgLinkage) ![]u8 {593pub fn vcpkgTriplet(self: CrossTarget, allocator: mem.Allocator, linkage: VcpkgLinkage) ![]u8 {
594 const arch = switch (self.getCpuArch()) {594 const arch = switch (self.getCpuArch()) {
595 .i386 => "x86",595 .x86 => "x86",
596 .x86_64 => "x64",596 .x86_64 => "x64",
597597
598 .arm,598 .arm,
lib/std/zig/system/NativeTargetInfo.zig+5-5
...@@ -199,11 +199,11 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo {...@@ -199,11 +199,11 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo {
199 // For x86, we need to populate some CPU feature flags depending on architecture199 // For x86, we need to populate some CPU feature flags depending on architecture
200 // and mode:200 // and mode:
201 // * 16bit_mode => if the abi is code16201 // * 16bit_mode => if the abi is code16
202 // * 32bit_mode => if the arch is i386202 // * 32bit_mode => if the arch is x86
203 // However, the "mode" flags can be used as overrides, so if the user explicitly203 // However, the "mode" flags can be used as overrides, so if the user explicitly
204 // sets one of them, that takes precedence.204 // sets one of them, that takes precedence.
205 switch (cpu_arch) {205 switch (cpu_arch) {
206 .i386 => {206 .x86 => {
207 if (!std.Target.x86.featureSetHasAny(cross_target.cpu_features_add, .{207 if (!std.Target.x86.featureSetHasAny(cross_target.cpu_features_add, .{
208 .@"16bit_mode", .@"32bit_mode",208 .@"16bit_mode", .@"32bit_mode",
209 })) {209 })) {
...@@ -969,7 +969,7 @@ fn detectNativeCpuAndFeatures(cpu_arch: Target.Cpu.Arch, os: Target.Os, cross_ta...@@ -969,7 +969,7 @@ fn detectNativeCpuAndFeatures(cpu_arch: Target.Cpu.Arch, os: Target.Os, cross_ta
969 // although it is a runtime value, is guaranteed to be one of the architectures in the set969 // although it is a runtime value, is guaranteed to be one of the architectures in the set
970 // of the respective switch prong.970 // of the respective switch prong.
971 switch (builtin.cpu.arch) {971 switch (builtin.cpu.arch) {
972 .x86_64, .i386 => {972 .x86_64, .x86 => {
973 return @import("x86.zig").detectNativeCpuAndFeatures(cpu_arch, os, cross_target);973 return @import("x86.zig").detectNativeCpuAndFeatures(cpu_arch, os, cross_target);
974 },974 },
975 else => {},975 else => {},
...@@ -1019,7 +1019,7 @@ pub fn getExternalExecutor(...@@ -1019,7 +1019,7 @@ pub fn getExternalExecutor(
1019 if (host.target.cpu.arch == candidate.target.cpu.arch)1019 if (host.target.cpu.arch == candidate.target.cpu.arch)
1020 break :cpu_ok true;1020 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)
1023 break :cpu_ok true;1023 break :cpu_ok true;
10241024
1025 if (host.target.cpu.arch == .aarch64 and candidate.target.cpu.arch == .arm)1025 if (host.target.cpu.arch == .aarch64 and candidate.target.cpu.arch == .arm)
...@@ -1068,7 +1068,7 @@ pub fn getExternalExecutor(...@@ -1068,7 +1068,7 @@ pub fn getExternalExecutor(
1068 .arm => Executor{ .qemu = "qemu-arm" },1068 .arm => Executor{ .qemu = "qemu-arm" },
1069 .armeb => Executor{ .qemu = "qemu-armeb" },1069 .armeb => Executor{ .qemu = "qemu-armeb" },
1070 .hexagon => Executor{ .qemu = "qemu-hexagon" },1070 .hexagon => Executor{ .qemu = "qemu-hexagon" },
1071 .i386 => Executor{ .qemu = "qemu-i386" },1071 .x86 => Executor{ .qemu = "qemu-i386" },
1072 .m68k => Executor{ .qemu = "qemu-m68k" },1072 .m68k => Executor{ .qemu = "qemu-m68k" },
1073 .mips => Executor{ .qemu = "qemu-mips" },1073 .mips => Executor{ .qemu = "qemu-mips" },
1074 .mipsel => Executor{ .qemu = "qemu-mipsel" },1074 .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...@@ -80,7 +80,7 @@ fn detectIntelProcessor(cpu: *Target.Cpu, family: u32, model: u32, brand_id: u32
80 }80 }
81 switch (family) {81 switch (family) {
82 3 => {82 3 => {
83 cpu.model = &Target.x86.cpu.i386;83 cpu.model = &Target.x86.cpu.x86;
84 return;84 return;
85 },85 },
86 4 => {86 4 => {
src/Compilation.zig+2-2
...@@ -4281,7 +4281,7 @@ pub fn addCCArgs(...@@ -4281,7 +4281,7 @@ pub fn addCCArgs(
4281 },4281 },
4282 .ios, .tvos, .watchos => switch (target.cpu.arch) {4282 .ios, .tvos, .watchos => switch (target.cpu.arch) {
4283 // Pass the proper -m<os>-version-min argument for darwin.4283 // Pass the proper -m<os>-version-min argument for darwin.
4284 .i386, .x86_64 => {4284 .x86, .x86_64 => {
4285 const ver = target.os.version_range.semver.min;4285 const ver = target.os.version_range.semver.min;
4286 try argv.append(try std.fmt.allocPrint(4286 try argv.append(try std.fmt.allocPrint(
4287 arena,4287 arena,
...@@ -4969,7 +4969,7 @@ pub fn getZigBackend(comp: Compilation) std.builtin.CompilerBackend {...@@ -4969,7 +4969,7 @@ pub fn getZigBackend(comp: Compilation) std.builtin.CompilerBackend {
4969 .wasm32, .wasm64 => std.builtin.CompilerBackend.stage2_wasm,4969 .wasm32, .wasm64 => std.builtin.CompilerBackend.stage2_wasm,
4970 .arm, .armeb, .thumb, .thumbeb => .stage2_arm,4970 .arm, .armeb, .thumb, .thumbeb => .stage2_arm,
4971 .x86_64 => .stage2_x86_64,4971 .x86_64 => .stage2_x86_64,
4972 .i386 => .stage2_x86,4972 .x86 => .stage2_x86,
4973 .aarch64, .aarch64_be, .aarch64_32 => .stage2_aarch64,4973 .aarch64, .aarch64_be, .aarch64_32 => .stage2_aarch64,
4974 .riscv64 => .stage2_riscv64,4974 .riscv64 => .stage2_riscv64,
4975 .sparc64 => .stage2_sparc64,4975 .sparc64 => .stage2_sparc64,
src/Sema.zig+7-7
...@@ -8415,20 +8415,20 @@ fn funcCommon(...@@ -8415,20 +8415,20 @@ fn funcCommon(
8415 if (switch (cc_workaround) {8415 if (switch (cc_workaround) {
8416 .Unspecified, .C, .Naked, .Async, .Inline => null,8416 .Unspecified, .C, .Naked, .Async, .Inline => null,
8417 .Interrupt => switch (arch) {8417 .Interrupt => switch (arch) {
8418 .i386, .x86_64, .avr, .msp430 => null,8418 .x86, .x86_64, .avr, .msp430 => null,
8419 else => @as([]const u8, "i386, x86_64, AVR, and MSP430"),8419 else => @as([]const u8, "x86, x86_64, AVR, and MSP430"),
8420 },8420 },
8421 .Signal => switch (arch) {8421 .Signal => switch (arch) {
8422 .avr => null,8422 .avr => null,
8423 else => @as([]const u8, "AVR"),8423 else => @as([]const u8, "AVR"),
8424 },8424 },
8425 .Stdcall, .Fastcall, .Thiscall => switch (arch) {8425 .Stdcall, .Fastcall, .Thiscall => switch (arch) {
8426 .i386 => null,8426 .x86 => null,
8427 else => @as([]const u8, "i386"),8427 else => @as([]const u8, "x86"),
8428 },8428 },
8429 .Vectorcall => switch (arch) {8429 .Vectorcall => switch (arch) {
8430 .i386, .aarch64, .aarch64_be, .aarch64_32 => null,8430 .x86, .aarch64, .aarch64_be, .aarch64_32 => null,
8431 else => @as([]const u8, "i386 and AArch64"),8431 else => @as([]const u8, "x86 and AArch64"),
8432 },8432 },
8433 .APCS, .AAPCS, .AAPCSVFP => switch (arch) {8433 .APCS, .AAPCS, .AAPCSVFP => switch (arch) {
8434 .arm, .armeb, .aarch64, .aarch64_be, .aarch64_32, .thumb, .thumbeb => null,8434 .arm, .armeb, .aarch64, .aarch64_be, .aarch64_32, .thumb, .thumbeb => null,
...@@ -30813,7 +30813,7 @@ pub fn analyzeAddressSpace(...@@ -30813,7 +30813,7 @@ pub fn analyzeAddressSpace(
3081330813
30814 const supported = switch (address_space) {30814 const supported = switch (address_space) {
30815 .generic => true,30815 .generic => true,
30816 .gs, .fs, .ss => (arch == .i386 or arch == .x86_64) and ctx == .pointer,30816 .gs, .fs, .ss => (arch == .x86 or arch == .x86_64) and ctx == .pointer,
30817 // TODO: check that .shared and .local are left uninitialized30817 // TODO: check that .shared and .local are left uninitialized
30818 .param => is_nv,30818 .param => is_nv,
30819 .global, .shared, .local => is_gpu,30819 .global, .shared, .local => is_gpu,
src/codegen.zig+1-1
...@@ -110,7 +110,7 @@ pub fn generateFunction(...@@ -110,7 +110,7 @@ pub fn generateFunction(
110 //.tcele => return Function(.tcele).generate(bin_file, src_loc, func, air, liveness, code, debug_output),110 //.tcele => return Function(.tcele).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
111 //.thumb => return Function(.thumb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),111 //.thumb => return Function(.thumb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
112 //.thumbeb => return Function(.thumbeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),112 //.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),
114 .x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),114 .x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
115 //.xcore => return Function(.xcore).generate(bin_file, src_loc, func, air, liveness, code, debug_output),115 //.xcore => return Function(.xcore).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
116 //.nvptx => return Function(.nvptx).generate(bin_file, src_loc, func, air, liveness, code, debug_output),116 //.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 {...@@ -70,7 +70,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 {
70 .tcele => "tcele",70 .tcele => "tcele",
71 .thumb => "thumb",71 .thumb => "thumb",
72 .thumbeb => "thumbeb",72 .thumbeb => "thumbeb",
73 .i386 => "i386",73 .x86 => "i386",
74 .x86_64 => "x86_64",74 .x86_64 => "x86_64",
75 .xcore => "xcore",75 .xcore => "xcore",
76 .nvptx => "nvptx",76 .nvptx => "nvptx",
...@@ -282,7 +282,7 @@ pub fn targetArch(arch_tag: std.Target.Cpu.Arch) llvm.ArchType {...@@ -282,7 +282,7 @@ pub fn targetArch(arch_tag: std.Target.Cpu.Arch) llvm.ArchType {
282 .tcele => .tcele,282 .tcele => .tcele,
283 .thumb => .thumb,283 .thumb => .thumb,
284 .thumbeb => .thumbeb,284 .thumbeb => .thumbeb,
285 .i386 => .x86,285 .x86 => .x86,
286 .x86_64 => .x86_64,286 .x86_64 => .x86_64,
287 .xcore => .xcore,287 .xcore => .xcore,
288 .nvptx => .nvptx,288 .nvptx => .nvptx,
...@@ -6195,7 +6195,7 @@ pub const FuncGen = struct {...@@ -6195,7 +6195,7 @@ pub const FuncGen = struct {
6195 // here then we may risk tripping LLVM bugs since anything not used by Clang tends6195 // here then we may risk tripping LLVM bugs since anything not used by Clang tends
6196 // to be buggy and regress often.6196 // to be buggy and regress often.
6197 switch (target.cpu.arch) {6197 switch (target.cpu.arch) {
6198 .x86_64, .i386 => {6198 .x86_64, .x86 => {
6199 if (total_i != 0) try llvm_constraints.append(self.gpa, ',');6199 if (total_i != 0) try llvm_constraints.append(self.gpa, ',');
6200 try llvm_constraints.appendSlice(self.gpa, "~{dirflag},~{fpsr},~{flags}");6200 try llvm_constraints.appendSlice(self.gpa, "~{dirflag},~{fpsr},~{flags}");
6201 total_i += 3;6201 total_i += 3;
...@@ -9275,7 +9275,7 @@ pub const FuncGen = struct {...@@ -9275,7 +9275,7 @@ pub const FuncGen = struct {
9275 switch (prefetch.cache) {9275 switch (prefetch.cache) {
9276 .instruction => switch (target.cpu.arch) {9276 .instruction => switch (target.cpu.arch) {
9277 .x86_64,9277 .x86_64,
9278 .i386,9278 .x86,
9279 .powerpc,9279 .powerpc,
9280 .powerpcle,9280 .powerpcle,
9281 .powerpc64,9281 .powerpc64,
...@@ -9856,7 +9856,7 @@ fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {...@@ -9856,7 +9856,7 @@ fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void {
9856 llvm.LLVMInitializeWebAssemblyAsmPrinter();9856 llvm.LLVMInitializeWebAssemblyAsmPrinter();
9857 llvm.LLVMInitializeWebAssemblyAsmParser();9857 llvm.LLVMInitializeWebAssemblyAsmParser();
9858 },9858 },
9859 .i386, .x86_64 => {9859 .x86, .x86_64 => {
9860 llvm.LLVMInitializeX86Target();9860 llvm.LLVMInitializeX86Target();
9861 llvm.LLVMInitializeX86TargetInfo();9861 llvm.LLVMInitializeX86TargetInfo();
9862 llvm.LLVMInitializeX86TargetMC();9862 llvm.LLVMInitializeX86TargetMC();
...@@ -9968,7 +9968,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca...@@ -9968,7 +9968,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca
9968 .Stdcall => .X86_StdCall,9968 .Stdcall => .X86_StdCall,
9969 .Fastcall => .X86_FastCall,9969 .Fastcall => .X86_FastCall,
9970 .Vectorcall => return switch (target.cpu.arch) {9970 .Vectorcall => return switch (target.cpu.arch) {
9971 .i386, .x86_64 => .X86_VectorCall,9971 .x86, .x86_64 => .X86_VectorCall,
9972 .aarch64, .aarch64_be, .aarch64_32 => .AArch64_VectorCall,9972 .aarch64, .aarch64_be, .aarch64_32 => .AArch64_VectorCall,
9973 else => unreachable,9973 else => unreachable,
9974 },9974 },
...@@ -9977,7 +9977,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca...@@ -9977,7 +9977,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca
9977 .AAPCS => .ARM_AAPCS,9977 .AAPCS => .ARM_AAPCS,
9978 .AAPCSVFP => .ARM_AAPCS_VFP,9978 .AAPCSVFP => .ARM_AAPCS_VFP,
9979 .Interrupt => return switch (target.cpu.arch) {9979 .Interrupt => return switch (target.cpu.arch) {
9980 .i386, .x86_64 => .X86_INTR,9980 .x86, .x86_64 => .X86_INTR,
9981 .avr => .AVR_INTR,9981 .avr => .AVR_INTR,
9982 .msp430 => .MSP430_INTR,9982 .msp430 => .MSP430_INTR,
9983 else => unreachable,9983 else => unreachable,
...@@ -9999,7 +9999,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca...@@ -9999,7 +9999,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca
9999/// Convert a zig-address space to an llvm address space.9999/// Convert a zig-address space to an llvm address space.
10000fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: std.Target) c_uint {10000fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: std.Target) c_uint {
10001 return switch (target.cpu.arch) {10001 return switch (target.cpu.arch) {
10002 .i386, .x86_64 => switch (address_space) {10002 .x86, .x86_64 => switch (address_space) {
10003 .generic => llvm.address_space.default,10003 .generic => llvm.address_space.default,
10004 .gs => llvm.address_space.x86.gs,10004 .gs => llvm.address_space.x86.gs,
10005 .fs => llvm.address_space.x86.fs,10005 .fs => llvm.address_space.x86.fs,
...@@ -10714,7 +10714,7 @@ fn isScalar(ty: Type) bool {...@@ -10714,7 +10714,7 @@ fn isScalar(ty: Type) bool {
10714/// and false if we expect LLVM to crash if it counters an x86_fp80 type.10714/// and false if we expect LLVM to crash if it counters an x86_fp80 type.
10715fn backendSupportsF80(target: std.Target) bool {10715fn backendSupportsF80(target: std.Target) bool {
10716 return switch (target.cpu.arch) {10716 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),
10718 else => false,10718 else => false,
10719 };10719 };
10720}10720}
src/crash_report.zig+1-1
...@@ -205,7 +205,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any...@@ -205,7 +205,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any
205 };205 };
206206
207 const stack_ctx: StackContext = switch (builtin.cpu.arch) {207 const stack_ctx: StackContext = switch (builtin.cpu.arch) {
208 .i386 => ctx: {208 .x86 => ctx: {
209 const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));209 const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
210 const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]);210 const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]);
211 const bp = @intCast(usize, ctx.mcontext.gregs[os.REG.EBP]);211 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 {...@@ -327,7 +327,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
327 });327 });
328 try add_include_dirs(comp, arena, &args);328 try add_include_dirs(comp, arena, &args);
329329
330 if (target.cpu.arch == .i386) {330 if (target.cpu.arch == .x86) {
331 // This prevents i386/sysdep.h from trying to do some331 // This prevents i386/sysdep.h from trying to do some
332 // silly and unnecessary inline asm hack that uses weird332 // silly and unnecessary inline asm hack that uses weird
333 // syntax that clang does not support.333 // syntax that clang does not support.
...@@ -406,7 +406,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![...@@ -406,7 +406,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![
406 }406 }
407 } else if (arch == .x86_64) {407 } else if (arch == .x86_64) {
408 try result.appendSlice("x86_64");408 try result.appendSlice("x86_64");
409 } else if (arch == .i386) {409 } else if (arch == .x86) {
410 try result.appendSlice("i386");410 try result.appendSlice("i386");
411 } else if (is_aarch64) {411 } else if (is_aarch64) {
412 try result.appendSlice("aarch64");412 try result.appendSlice("aarch64");
...@@ -504,7 +504,7 @@ fn add_include_dirs_arch(...@@ -504,7 +504,7 @@ fn add_include_dirs_arch(
504 opt_nptl: ?[]const u8,504 opt_nptl: ?[]const u8,
505 dir: []const u8,505 dir: []const u8,
506) error{OutOfMemory}!void {506) error{OutOfMemory}!void {
507 const is_x86 = arch == .i386 or arch == .x86_64;507 const is_x86 = arch == .x86 or arch == .x86_64;
508 const is_aarch64 = arch == .aarch64 or arch == .aarch64_be;508 const is_aarch64 = arch == .aarch64 or arch == .aarch64_be;
509 const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le;509 const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le;
510 const is_sparc = arch == .sparc or arch == .sparcel or arch == .sparc64;510 const is_sparc = arch == .sparc or arch == .sparcel or arch == .sparc64;
...@@ -521,7 +521,7 @@ fn add_include_dirs_arch(...@@ -521,7 +521,7 @@ fn add_include_dirs_arch(
521 try args.append("-I");521 try args.append("-I");
522 try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64" }));522 try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64" }));
523 }523 }
524 } else if (arch == .i386) {524 } else if (arch == .x86) {
525 if (opt_nptl) |nptl| {525 if (opt_nptl) |nptl| {
526 try args.append("-I");526 try args.append("-I");
527 try args.append(try path.join(arena, &[_][]const u8{ dir, "i386", nptl }));527 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 {...@@ -408,7 +408,7 @@ pub const LibCInstallation = struct {
408 defer result_buf.deinit();408 defer result_buf.deinit();
409409
410 const arch_sub_dir = switch (builtin.target.cpu.arch) {410 const arch_sub_dir = switch (builtin.target.cpu.arch) {
411 .i386 => "x86",411 .x86 => "x86",
412 .x86_64 => "x64",412 .x86_64 => "x64",
413 .arm, .armeb => "arm",413 .arm, .armeb => "arm",
414 .aarch64 => "arm64",414 .aarch64 => "arm64",
...@@ -472,7 +472,7 @@ pub const LibCInstallation = struct {...@@ -472,7 +472,7 @@ pub const LibCInstallation = struct {
472 defer result_buf.deinit();472 defer result_buf.deinit();
473473
474 const arch_sub_dir = switch (builtin.target.cpu.arch) {474 const arch_sub_dir = switch (builtin.target.cpu.arch) {
475 .i386 => "x86",475 .x86 => "x86",
476 .x86_64 => "x64",476 .x86_64 => "x64",
477 .arm, .armeb => "arm",477 .arm, .armeb => "arm",
478 .aarch64 => "arm64",478 .aarch64 => "arm64",
src/link/Coff.zig+1-1
...@@ -1294,7 +1294,7 @@ pub fn updateDeclExports(...@@ -1294,7 +1294,7 @@ pub fn updateDeclExports(
1294 const exported_decl = module.declPtr(exp.exported_decl);1294 const exported_decl = module.declPtr(exp.exported_decl);
1295 if (exported_decl.getFunction() == null) continue;1295 if (exported_decl.getFunction() == null) continue;
1296 const winapi_cc = switch (self.base.options.target.cpu.arch) {1296 const winapi_cc = switch (self.base.options.target.cpu.arch) {
1297 .i386 => std.builtin.CallingConvention.Stdcall,1297 .x86 => std.builtin.CallingConvention.Stdcall,
1298 else => std.builtin.CallingConvention.C,1298 else => std.builtin.CallingConvention.C,
1299 };1299 };
1300 const decl_cc = exported_decl.ty.fnCallingConvention();1300 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...@@ -197,7 +197,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
197 try argv.append(try std.fmt.allocPrint(arena, "-BASE:{d}", .{image_base}));197 try argv.append(try std.fmt.allocPrint(arena, "-BASE:{d}", .{image_base}));
198 }198 }
199199
200 if (target.cpu.arch == .i386) {200 if (target.cpu.arch == .x86) {
201 try argv.append("-MACHINE:X86");201 try argv.append("-MACHINE:X86");
202 } else if (target.cpu.arch == .x86_64) {202 } else if (target.cpu.arch == .x86_64) {
203 try argv.append("-MACHINE:X64");203 try argv.append("-MACHINE:X64");
...@@ -380,7 +380,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod...@@ -380,7 +380,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
380 if (target.abi.isGnu()) {380 if (target.abi.isGnu()) {
381 try argv.append("-lldmingw");381 try argv.append("-lldmingw");
382382
383 if (target.cpu.arch == .i386) {383 if (target.cpu.arch == .x86) {
384 try argv.append("-ALTERNATENAME:__image_base__=___ImageBase");384 try argv.append("-ALTERNATENAME:__image_base__=___ImageBase");
385 } else {385 } else {
386 try argv.append("-ALTERNATENAME:__image_base__=__ImageBase");386 try argv.append("-ALTERNATENAME:__image_base__=__ImageBase");
...@@ -388,7 +388,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod...@@ -388,7 +388,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
388388
389 if (is_dyn_lib) {389 if (is_dyn_lib) {
390 try argv.append(try comp.get_libc_crt_file(arena, "dllcrt2.obj"));390 try argv.append(try comp.get_libc_crt_file(arena, "dllcrt2.obj"));
391 if (target.cpu.arch == .i386) {391 if (target.cpu.arch == .x86) {
392 try argv.append("-ALTERNATENAME:__DllMainCRTStartup@12=_DllMainCRTStartup@12");392 try argv.append("-ALTERNATENAME:__DllMainCRTStartup@12=_DllMainCRTStartup@12");
393 } else {393 } else {
394 try argv.append("-ALTERNATENAME:_DllMainCRTStartup=DllMainCRTStartup");394 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 {...@@ -3004,7 +3004,7 @@ fn sectHeaderTo32(shdr: elf.Elf64_Shdr) elf.Elf32_Shdr {
30043004
3005fn getLDMOption(target: std.Target) ?[]const u8 {3005fn getLDMOption(target: std.Target) ?[]const u8 {
3006 switch (target.cpu.arch) {3006 switch (target.cpu.arch) {
3007 .i386 => return "elf_i386",3007 .x86 => return "elf_i386",
3008 .aarch64 => return "aarch64linux",3008 .aarch64 => return "aarch64linux",
3009 .aarch64_be => return "aarch64_be_linux",3009 .aarch64_be => return "aarch64_be_linux",
3010 .arm, .thumb => return "armelf_linux_eabi",3010 .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 {...@@ -150,7 +150,7 @@ pub fn defaultBaseAddrs(arch: std.Target.Cpu.Arch) Bases {
150 .text = 0x200028,150 .text = 0x200028,
151 .data = 0x400000,151 .data = 0x400000,
152 },152 },
153 .i386 => .{153 .x86 => .{
154 // header size => 32 => 0x20154 // header size => 32 => 0x20
155 .text = 0x200020,155 .text = 0x200020,
156 .data = 0x400000,156 .data = 0x400000,
src/link/Plan9/aout.zig+2-2
...@@ -109,7 +109,7 @@ pub const R_MAGIC = _MAGIC(HDR_MAGIC, 28); // arm64...@@ -109,7 +109,7 @@ pub const R_MAGIC = _MAGIC(HDR_MAGIC, 28); // arm64
109109
110pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 {110pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 {
111 return switch (arch) {111 return switch (arch) {
112 .i386 => I_MAGIC,112 .x86 => I_MAGIC,
113 .sparc => K_MAGIC, // TODO should sparc64 and sparcel go here?113 .sparc => K_MAGIC, // TODO should sparc64 and sparcel go here?
114 .mips => V_MAGIC,114 .mips => V_MAGIC,
115 .arm => E_MAGIC,115 .arm => E_MAGIC,
...@@ -124,7 +124,7 @@ pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 {...@@ -124,7 +124,7 @@ pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 {
124/// gets the quantization of pc for the arch124/// gets the quantization of pc for the arch
125pub fn getPCQuant(arch: std.Target.Cpu.Arch) !u8 {125pub fn getPCQuant(arch: std.Target.Cpu.Arch) !u8 {
126 return switch (arch) {126 return switch (arch) {
127 .i386, .x86_64 => 1,127 .x86, .x86_64 => 1,
128 .powerpc, .powerpc64, .mips, .sparc, .arm, .aarch64 => 4,128 .powerpc, .powerpc64, .mips, .sparc, .arm, .aarch64 => 4,
129 else => error.ArchNotSupportedByPlan9,129 else => error.ArchNotSupportedByPlan9,
130 };130 };
src/mingw.zig+4-4
...@@ -128,7 +128,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {...@@ -128,7 +128,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
128 .extra_flags = extra_flags,128 .extra_flags = extra_flags,
129 };129 };
130 }130 }
131 if (comp.getTarget().cpu.arch == .i386) {131 if (comp.getTarget().cpu.arch == .x86) {
132 for (msvcrt_i386_src) |dep| {132 for (msvcrt_i386_src) |dep| {
133 (try c_source_files.addOne()).* = .{133 (try c_source_files.addOne()).* = .{
134 .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{134 .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{
...@@ -180,7 +180,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {...@@ -180,7 +180,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
180 };180 };
181 }181 }
182 const target = comp.getTarget();182 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) {
184 for (mingwex_x86_src) |dep| {184 for (mingwex_x86_src) |dep| {
185 (try c_source_files.addOne()).* = .{185 (try c_source_files.addOne()).* = .{
186 .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{186 .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 {...@@ -338,7 +338,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {
338 });338 });
339339
340 const target_def_arg = switch (target.cpu.arch) {340 const target_def_arg = switch (target.cpu.arch) {
341 .i386 => "-DDEF_I386",341 .x86 => "-DDEF_I386",
342 .x86_64 => "-DDEF_X64",342 .x86_64 => "-DDEF_X64",
343 .arm, .armeb, .thumb, .thumbeb, .aarch64_32 => "-DDEF_ARM32",343 .arm, .armeb, .thumb, .thumbeb, .aarch64_32 => "-DDEF_ARM32",
344 .aarch64, .aarch64_be => "-DDEF_ARM64",344 .aarch64, .aarch64_be => "-DDEF_ARM64",
...@@ -434,7 +434,7 @@ fn findDef(comp: *Compilation, allocator: Allocator, lib_name: []const u8) ![]u8...@@ -434,7 +434,7 @@ fn findDef(comp: *Compilation, allocator: Allocator, lib_name: []const u8) ![]u8
434 const target = comp.getTarget();434 const target = comp.getTarget();
435435
436 const lib_path = switch (target.cpu.arch) {436 const lib_path = switch (target.cpu.arch) {
437 .i386 => "lib32",437 .x86 => "lib32",
438 .x86_64 => "lib64",438 .x86_64 => "lib64",
439 .arm, .armeb, .thumb, .thumbeb, .aarch64_32 => "libarm32",439 .arm, .armeb, .thumb, .thumbeb, .aarch64_32 => "libarm32",
440 .aarch64, .aarch64_be => "libarm64",440 .aarch64, .aarch64_be => "libarm64",
src/musl.zig+1-1
...@@ -262,7 +262,7 @@ pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {...@@ -262,7 +262,7 @@ pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 {
262 switch (arch) {262 switch (arch) {
263 .aarch64, .aarch64_be => return "aarch64",263 .aarch64, .aarch64_be => return "aarch64",
264 .arm, .armeb, .thumb, .thumbeb => return "arm",264 .arm, .armeb, .thumb, .thumbeb => return "arm",
265 .i386 => return "i386",265 .x86 => return "i386",
266 .mips, .mipsel => return "mips",266 .mips, .mipsel => return "mips",
267 .mips64el, .mips64 => return "mips64",267 .mips64el, .mips64 => return "mips64",
268 .powerpc => return "powerpc",268 .powerpc => return "powerpc",
src/target.zig+9-9
...@@ -35,9 +35,9 @@ pub const available_libcs = [_]ArchOsAbi{...@@ -35,9 +35,9 @@ pub const available_libcs = [_]ArchOsAbi{
35 .{ .arch = .arm, .os = .windows, .abi = .gnu },35 .{ .arch = .arm, .os = .windows, .abi = .gnu },
36 .{ .arch = .csky, .os = .linux, .abi = .gnueabi },36 .{ .arch = .csky, .os = .linux, .abi = .gnueabi },
37 .{ .arch = .csky, .os = .linux, .abi = .gnueabihf },37 .{ .arch = .csky, .os = .linux, .abi = .gnueabihf },
38 .{ .arch = .i386, .os = .linux, .abi = .gnu },38 .{ .arch = .x86, .os = .linux, .abi = .gnu },
39 .{ .arch = .i386, .os = .linux, .abi = .musl },39 .{ .arch = .x86, .os = .linux, .abi = .musl },
40 .{ .arch = .i386, .os = .windows, .abi = .gnu },40 .{ .arch = .x86, .os = .windows, .abi = .gnu },
41 .{ .arch = .m68k, .os = .linux, .abi = .gnu },41 .{ .arch = .m68k, .os = .linux, .abi = .gnu },
42 .{ .arch = .m68k, .os = .linux, .abi = .musl },42 .{ .arch = .m68k, .os = .linux, .abi = .musl },
43 .{ .arch = .mips64el, .os = .linux, .abi = .gnuabi64 },43 .{ .arch = .mips64el, .os = .linux, .abi = .gnuabi64 },
...@@ -137,7 +137,7 @@ pub fn osArchName(target: std.Target) [:0]const u8 {...@@ -137,7 +137,7 @@ pub fn osArchName(target: std.Target) [:0]const u8 {
137 .powerpc, .powerpcle, .powerpc64, .powerpc64le => "powerpc",137 .powerpc, .powerpcle, .powerpc64, .powerpc64le => "powerpc",
138 .riscv32, .riscv64 => "riscv",138 .riscv32, .riscv64 => "riscv",
139 .sparc, .sparcel, .sparc64 => "sparc",139 .sparc, .sparcel, .sparc64 => "sparc",
140 .i386, .x86_64 => "x86",140 .x86, .x86_64 => "x86",
141 else => @tagName(target.cpu.arch),141 else => @tagName(target.cpu.arch),
142 },142 },
143 else => @tagName(target.cpu.arch),143 else => @tagName(target.cpu.arch),
...@@ -278,7 +278,7 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {...@@ -278,7 +278,7 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
278 .tcele,278 .tcele,
279 .thumb,279 .thumb,
280 .thumbeb,280 .thumbeb,
281 .i386,281 .x86,
282 .x86_64,282 .x86_64,
283 .xcore,283 .xcore,
284 .nvptx,284 .nvptx,
...@@ -319,7 +319,7 @@ pub fn selfHostedBackendIsAsRobustAsLlvm(target: std.Target) bool {...@@ -319,7 +319,7 @@ pub fn selfHostedBackendIsAsRobustAsLlvm(target: std.Target) bool {
319319
320pub fn supportsStackProbing(target: std.Target) bool {320pub fn supportsStackProbing(target: std.Target) bool {
321 return target.os.tag != .windows and target.os.tag != .uefi and321 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);
323}323}
324324
325pub fn supportsStackProtector(target: std.Target) bool {325pub fn supportsStackProtector(target: std.Target) bool {
...@@ -431,7 +431,7 @@ pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.Mode {...@@ -431,7 +431,7 @@ pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.Mode {
431pub fn hasRedZone(target: std.Target) bool {431pub fn hasRedZone(target: std.Target) bool {
432 return switch (target.cpu.arch) {432 return switch (target.cpu.arch) {
433 .x86_64,433 .x86_64,
434 .i386,434 .x86,
435 .powerpc,435 .powerpc,
436 .powerpc64,436 .powerpc64,
437 .powerpc64le,437 .powerpc64le,
...@@ -550,7 +550,7 @@ pub fn atomicPtrAlignment(...@@ -550,7 +550,7 @@ pub fn atomicPtrAlignment(
550 .tcele,550 .tcele,
551 .thumb,551 .thumb,
552 .thumbeb,552 .thumbeb,
553 .i386,553 .x86,
554 .xcore,554 .xcore,
555 .amdil,555 .amdil,
556 .hsail,556 .hsail,
...@@ -655,7 +655,7 @@ pub fn addrSpaceCastIsValid(...@@ -655,7 +655,7 @@ pub fn addrSpaceCastIsValid(
655) bool {655) bool {
656 const arch = target.cpu.arch;656 const arch = target.cpu.arch;
657 switch (arch) {657 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),
659 .nvptx64, .nvptx, .amdgcn => {659 .nvptx64, .nvptx, .amdgcn => {
660 const to_generic = arch.supportsAddressSpace(from) and to == .generic;660 const to_generic = arch.supportsAddressSpace(from) and to == .generic;
661 const from_generic = arch.supportsAddressSpace(to) and from == .generic;661 const from_generic = arch.supportsAddressSpace(to) and from == .generic;
src/type.zig+9-9
...@@ -6650,7 +6650,7 @@ pub const CType = enum {...@@ -6650,7 +6650,7 @@ pub const CType = enum {
6650 .long, .ulong => return target.cpu.arch.ptrBitWidth(),6650 .long, .ulong => return target.cpu.arch.ptrBitWidth(),
6651 .longlong, .ulonglong, .double => return 64,6651 .longlong, .ulonglong, .double => return 64,
6652 .longdouble => switch (target.cpu.arch) {6652 .longdouble => switch (target.cpu.arch) {
6653 .i386 => switch (target.abi) {6653 .x86 => switch (target.abi) {
6654 .android => return 64,6654 .android => return 64,
6655 else => return 80,6655 else => return 80,
6656 },6656 },
...@@ -6738,7 +6738,7 @@ pub const CType = enum {...@@ -6738,7 +6738,7 @@ pub const CType = enum {
6738 .long, .ulong => return target.cpu.arch.ptrBitWidth(),6738 .long, .ulong => return target.cpu.arch.ptrBitWidth(),
6739 .longlong, .ulonglong, .double => return 64,6739 .longlong, .ulonglong, .double => return 64,
6740 .longdouble => switch (target.cpu.arch) {6740 .longdouble => switch (target.cpu.arch) {
6741 .i386 => switch (target.abi) {6741 .x86 => switch (target.abi) {
6742 .android => return 64,6742 .android => return 64,
6743 else => return 80,6743 else => return 80,
6744 },6744 },
...@@ -6792,7 +6792,7 @@ pub const CType = enum {...@@ -6792,7 +6792,7 @@ pub const CType = enum {
6792 },6792 },
67936793
6794 .windows, .uefi => switch (target.cpu.arch) {6794 .windows, .uefi => switch (target.cpu.arch) {
6795 .i386 => switch (self) {6795 .x86 => switch (self) {
6796 .short, .ushort => return 16,6796 .short, .ushort => return 16,
6797 .int, .uint, .float => return 32,6797 .int, .uint, .float => return 32,
6798 .long, .ulong => return 32,6798 .long, .ulong => return 32,
...@@ -6828,7 +6828,7 @@ pub const CType = enum {...@@ -6828,7 +6828,7 @@ pub const CType = enum {
6828 .short, .ushort => return 16,6828 .short, .ushort => return 16,
6829 .int, .uint, .float => return 32,6829 .int, .uint, .float => return 32,
6830 .long, .ulong => switch (target.cpu.arch) {6830 .long, .ulong => switch (target.cpu.arch) {
6831 .i386, .arm, .aarch64_32 => return 32,6831 .x86, .arm, .aarch64_32 => return 32,
6832 .x86_64 => switch (target.abi) {6832 .x86_64 => switch (target.abi) {
6833 .gnux32, .muslx32 => return 32,6833 .gnux32, .muslx32 => return 32,
6834 else => return 64,6834 else => return 64,
...@@ -6837,7 +6837,7 @@ pub const CType = enum {...@@ -6837,7 +6837,7 @@ pub const CType = enum {
6837 },6837 },
6838 .longlong, .ulonglong, .double => return 64,6838 .longlong, .ulonglong, .double => return 64,
6839 .longdouble => switch (target.cpu.arch) {6839 .longdouble => switch (target.cpu.arch) {
6840 .i386 => switch (target.abi) {6840 .x86 => switch (target.abi) {
6841 .android => return 64,6841 .android => return 64,
6842 else => return 80,6842 else => return 80,
6843 },6843 },
...@@ -6896,7 +6896,7 @@ pub const CType = enum {...@@ -6896,7 +6896,7 @@ pub const CType = enum {
6896 .short, .ushort => return 2,6896 .short, .ushort => return 2,
6897 else => return 1,6897 else => return 1,
6898 },6898 },
6899 .i386 => switch (target.os.tag) {6899 .x86 => switch (target.os.tag) {
6900 .windows, .uefi => switch (self) {6900 .windows, .uefi => switch (self) {
6901 .longlong, .ulonglong, .double => return 8,6901 .longlong, .ulonglong, .double => return 8,
6902 .longdouble => switch (target.abi) {6902 .longdouble => switch (target.abi) {
...@@ -6937,7 +6937,7 @@ pub const CType = enum {...@@ -6937,7 +6937,7 @@ pub const CType = enum {
69376937
6938 .arc,6938 .arc,
6939 .csky,6939 .csky,
6940 .i386,6940 .x86,
6941 .xcore,6941 .xcore,
6942 .dxil,6942 .dxil,
6943 .loongarch32,6943 .loongarch32,
...@@ -7034,7 +7034,7 @@ pub const CType = enum {...@@ -7034,7 +7034,7 @@ pub const CType = enum {
7034 .double => return 4,7034 .double => return 4,
7035 .longlong, .ulonglong => return 8,7035 .longlong, .ulonglong => return 8,
7036 },7036 },
7037 .i386 => switch (target.os.tag) {7037 .x86 => switch (target.os.tag) {
7038 .windows, .uefi => switch (self) {7038 .windows, .uefi => switch (self) {
7039 .longdouble => switch (target.abi) {7039 .longdouble => switch (target.abi) {
7040 .gnu, .gnuilp32, .cygnus => return 4,7040 .gnu, .gnuilp32, .cygnus => return 4,
...@@ -7087,7 +7087,7 @@ pub const CType = enum {...@@ -7087,7 +7087,7 @@ pub const CType = enum {
7087 .bpfeb,7087 .bpfeb,
7088 .hexagon,7088 .hexagon,
7089 .hsail64,7089 .hsail64,
7090 .i386,7090 .x86,
7091 .loongarch64,7091 .loongarch64,
7092 .m68k,7092 .m68k,
7093 .mips,7093 .mips,
src/windows_sdk.cpp+5-5
...@@ -21,7 +21,7 @@ struct ZigWindowsSDKPrivate {...@@ -21,7 +21,7 @@ struct ZigWindowsSDKPrivate {
2121
22enum NativeArch {22enum NativeArch {
23 NativeArchArm,23 NativeArchArm,
24 NativeArchi386,24 NativeArchx86,
25 NativeArchx86_64,25 NativeArchx86_64,
26 NativeArchAarch64,26 NativeArchAarch64,
27};27};
...@@ -29,7 +29,7 @@ enum NativeArch {...@@ -29,7 +29,7 @@ enum NativeArch {
29#if defined(_M_ARM) || defined(__arm_)29#if defined(_M_ARM) || defined(__arm_)
30static const NativeArch native_arch = NativeArchArm;30static const NativeArch native_arch = NativeArchArm;
31#elif defined(_M_IX86) || defined(__i386__)31#elif defined(_M_IX86) || defined(__i386__)
32static const NativeArch native_arch = NativeArchi386;32static const NativeArch native_arch = NativeArchx86;
33#elif defined(_M_X64) || defined(__x86_64__)33#elif defined(_M_X64) || defined(__x86_64__)
34static const NativeArch native_arch = NativeArchx86_64;34static const NativeArch native_arch = NativeArchx86_64;
35#elif defined(_M_ARM64) || defined(__aarch64__)35#elif defined(_M_ARM64) || defined(__aarch64__)
...@@ -110,7 +110,7 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) {...@@ -110,7 +110,7 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) {
110 fclose(tools_file);110 fclose(tools_file);
111 out_append_ptr += sprintf(out_append_ptr, "VC\\Tools\\MSVC\\%s\\lib\\", tmp_path);111 out_append_ptr += sprintf(out_append_ptr, "VC\\Tools\\MSVC\\%s\\lib\\", tmp_path);
112 switch (native_arch) {112 switch (native_arch) {
113 case NativeArchi386:113 case NativeArchx86:
114 out_append_ptr += sprintf(out_append_ptr, "x86\\");114 out_append_ptr += sprintf(out_append_ptr, "x86\\");
115 break;115 break;
116 case NativeArchx86_64:116 case NativeArchx86_64:
...@@ -158,7 +158,7 @@ com_done:;...@@ -158,7 +158,7 @@ com_done:;
158 char *tmp_buf_append_ptr = tmp_buf + (cb_data - 1);158 char *tmp_buf_append_ptr = tmp_buf + (cb_data - 1);
159 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "VC\\Lib\\");159 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "VC\\Lib\\");
160 switch (native_arch) {160 switch (native_arch) {
161 case NativeArchi386:161 case NativeArchx86:
162 //x86 is in the root of the Lib folder162 //x86 is in the root of the Lib folder
163 break;163 break;
164 case NativeArchx86_64:164 case NativeArchx86_64:
...@@ -219,7 +219,7 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) {...@@ -219,7 +219,7 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) {
219 case NativeArchx86_64:219 case NativeArchx86_64:
220 option_name = "OptionId.DesktopCPPx64";220 option_name = "OptionId.DesktopCPPx64";
221 break;221 break;
222 case NativeArchi386:222 case NativeArchx86:
223 option_name = "OptionId.DesktopCPPx86";223 option_name = "OptionId.DesktopCPPx86";
224 break;224 break;
225 default:225 default:
test/behavior/align.zig+1-1
...@@ -107,7 +107,7 @@ test "alignment and size of structs with 128-bit fields" {...@@ -107,7 +107,7 @@ test "alignment and size of structs with 128-bit fields" {
107 .u129_size = 24,107 .u129_size = 24,
108 },108 },
109109
110 .i386 => switch (builtin.os.tag) {110 .x86 => switch (builtin.os.tag) {
111 .windows => .{111 .windows => .{
112 .a_align = 8,112 .a_align = 8,
113 .a_size = 16,113 .a_size = 16,
test/behavior/floatop.zig+1-1
...@@ -5,7 +5,7 @@ const math = std.math;...@@ -5,7 +5,7 @@ const math = std.math;
5const pi = std.math.pi;5const pi = std.math.pi;
6const e = std.math.e;6const e = std.math.e;
7const has_f80_rt = switch (builtin.cpu.arch) {7const has_f80_rt = switch (builtin.cpu.arch) {
8 .x86_64, .i386 => true,8 .x86_64, .x86 => true,
9 else => false,9 else => false,
10};10};
1111
test/behavior/fn.zig+2-2
...@@ -150,9 +150,9 @@ test "extern struct with stdcallcc fn pointer" {...@@ -150,9 +150,9 @@ test "extern struct with stdcallcc fn pointer" {
150 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;150 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
151151
152 const S = extern struct {152 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 {
156 return 1234;156 return 1234;
157 }157 }
158 };158 };
test/behavior/struct.zig+1-1
...@@ -1109,7 +1109,7 @@ test "packed struct with undefined initializers" {...@@ -1109,7 +1109,7 @@ test "packed struct with undefined initializers" {
1109 var p: P = undefined;1109 var p: P = undefined;
1110 p = P{ .a = 2, .b = 4, .c = 6 };1110 p = P{ .a = 2, .b = 4, .c = 6 };
1111 // Make sure the compiler doesn't touch the unprefixed fields.1111 // Make sure the compiler doesn't touch the unprefixed fields.
1112 // Use expect since i386-linux doesn't like expectEqual1112 // Use expect since x86-linux doesn't like expectEqual
1113 try expect(p.a == 2);1113 try expect(p.a == 2);
1114 try expect(p.b == 4);1114 try expect(p.b == 4);
1115 try expect(p.c == 6);1115 try expect(p.c == 6);
test/behavior/vector.zig+1-1
...@@ -639,7 +639,7 @@ test "vector shift operators" {...@@ -639,7 +639,7 @@ test "vector shift operators" {
639 };639 };
640640
641 switch (builtin.target.cpu.arch) {641 switch (builtin.target.cpu.arch) {
642 .i386,642 .x86,
643 .aarch64,643 .aarch64,
644 .aarch64_be,644 .aarch64_be,
645 .aarch64_32,645 .aarch64_32,
test/c_abi/main.zig+10-10
...@@ -2,7 +2,7 @@ const std = @import("std");...@@ -2,7 +2,7 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const print = std.debug.print;3const print = std.debug.print;
4const expect = std.testing.expect;4const expect = std.testing.expect;
5const has_i128 = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isARM() and5const has_i128 = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isARM() and
6 !builtin.cpu.arch.isMIPS() and !builtin.cpu.arch.isPPC();6 !builtin.cpu.arch.isMIPS() and !builtin.cpu.arch.isPPC();
77
8extern fn run_c_tests() void;8extern fn run_c_tests() void;
...@@ -153,7 +153,7 @@ export fn zig_bool(x: bool) void {...@@ -153,7 +153,7 @@ export fn zig_bool(x: bool) void {
153// https://github.com/ziglang/zig/issues/8465153// https://github.com/ziglang/zig/issues/8465
154//154//
155// For now, we have no way of referring to the _Complex C types from Zig,155// 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)
157const ComplexFloat = extern struct {157const ComplexFloat = extern struct {
158 real: f32,158 real: f32,
159 imag: f32,159 imag: f32,
...@@ -170,7 +170,7 @@ extern fn c_cmultd_comp(a_r: f64, a_i: f64, b_r: f64, b_i: f64) ComplexDouble;...@@ -170,7 +170,7 @@ extern fn c_cmultd_comp(a_r: f64, a_i: f64, b_r: f64, b_i: f64) ComplexDouble;
170extern fn c_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat;170extern fn c_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat;
171extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble;171extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble;
172172
173const complex_abi_compatible = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isMIPS() and173const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isMIPS() and
174 !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV();174 !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV();
175175
176test "C ABI complex float" {176test "C ABI complex float" {
...@@ -323,7 +323,7 @@ extern fn c_med_struct_mixed(MedStructMixed) void;...@@ -323,7 +323,7 @@ extern fn c_med_struct_mixed(MedStructMixed) void;
323extern fn c_ret_med_struct_mixed() MedStructMixed;323extern fn c_ret_med_struct_mixed() MedStructMixed;
324324
325test "C ABI medium struct of ints and floats" {325test "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;
327 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;327 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
328 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;328 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
329 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;329 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
...@@ -356,7 +356,7 @@ extern fn c_small_struct_ints(SmallStructInts) void;...@@ -356,7 +356,7 @@ extern fn c_small_struct_ints(SmallStructInts) void;
356extern fn c_ret_small_struct_ints() SmallStructInts;356extern fn c_ret_small_struct_ints() SmallStructInts;
357357
358test "C ABI small struct of ints" {358test "C ABI small struct of ints" {
359 if (builtin.cpu.arch == .i386) return error.SkipZigTest;359 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
360 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;360 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
361 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;361 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
362 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;362 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
...@@ -438,7 +438,7 @@ const SplitStructInt = extern struct {...@@ -438,7 +438,7 @@ const SplitStructInt = extern struct {
438extern fn c_split_struct_ints(SplitStructInt) void;438extern fn c_split_struct_ints(SplitStructInt) void;
439439
440test "C ABI split struct of ints" {440test "C ABI split struct of ints" {
441 if (builtin.cpu.arch == .i386) return error.SkipZigTest;441 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
442 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;442 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
443 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;443 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
444 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;444 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
...@@ -466,7 +466,7 @@ extern fn c_split_struct_mixed(SplitStructMixed) void;...@@ -466,7 +466,7 @@ extern fn c_split_struct_mixed(SplitStructMixed) void;
466extern fn c_ret_split_struct_mixed() SplitStructMixed;466extern fn c_ret_split_struct_mixed() SplitStructMixed;
467467
468test "C ABI split struct of ints and floats" {468test "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;
470 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;470 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
471 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;471 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
472 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;472 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
...@@ -729,7 +729,7 @@ extern fn c_struct_with_array(StructWithArray) void;...@@ -729,7 +729,7 @@ extern fn c_struct_with_array(StructWithArray) void;
729extern fn c_ret_struct_with_array() StructWithArray;729extern fn c_ret_struct_with_array() StructWithArray;
730730
731test "Struct with array as padding." {731test "Struct with array as padding." {
732 if (builtin.cpu.arch == .i386) return error.SkipZigTest;732 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
733 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;733 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
734 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;734 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;
735 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;735 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
...@@ -783,7 +783,7 @@ extern fn c_small_vec(SmallVec) void;...@@ -783,7 +783,7 @@ extern fn c_small_vec(SmallVec) void;
783extern fn c_ret_small_vec() SmallVec;783extern fn c_ret_small_vec() SmallVec;
784784
785test "small simd vector" {785test "small simd vector" {
786 if (builtin.cpu.arch == .i386) return error.SkipZigTest;786 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
787 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;787 if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest;
788788
789 c_small_vec(.{ 1, 2 });789 c_small_vec(.{ 1, 2 });
...@@ -820,7 +820,7 @@ extern fn c_ptr_size_float_struct(Vector2) void;...@@ -820,7 +820,7 @@ extern fn c_ptr_size_float_struct(Vector2) void;
820extern fn c_ret_ptr_size_float_struct() Vector2;820extern fn c_ret_ptr_size_float_struct() Vector2;
821821
822test "C ABI pointer sized float struct" {822test "C ABI pointer sized float struct" {
823 if (builtin.cpu.arch == .i386) return error.SkipZigTest;823 if (builtin.cpu.arch == .x86) return error.SkipZigTest;
824 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;824 if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest;
825 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;825 if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest;
826 if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest;826 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 {}...@@ -4,4 +4,4 @@ export fn entry() callconv(.Interrupt) void {}
4// backend=stage24// backend=stage2
5// target=aarch64-linux-none5// target=aarch64-linux-none
6//6//
7// :1:29: error: callconv 'Interrupt' is only available on i386, x86_64, AVR, and MSP430, not aarch647// :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 {...@@ -18,6 +18,6 @@ export fn entry3() void {
18// backend=stage218// backend=stage2
19// target=x86_64-linux-none19// target=x86_64-linux-none
20//20//
21// :1:28: error: callconv 'Stdcall' is only available on i386, not x86_6421// :1:28: error: callconv 'Stdcall' is only available on x86, not x86_64
22// :2:28: error: callconv 'Fastcall' is only available on i386, not x86_6422// :2:28: error: callconv 'Fastcall' is only available on x86, not x86_64
23// :3:28: error: callconv 'Thiscall' is only available on i386, not x86_6423// :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 {}...@@ -4,4 +4,4 @@ export fn entry() callconv(.Vectorcall) void {}
4// backend=stage24// backend=stage2
5// target=x86_64-linux-none5// target=x86_64-linux-none
6//6//
7// :1:29: error: callconv 'Vectorcall' is only available on i386 and AArch64, not x86_647// :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: {...@@ -163,14 +163,14 @@ const test_targets = blk: {
163163
164 .{164 .{
165 .target = .{165 .target = .{
166 .cpu_arch = .i386,166 .cpu_arch = .x86,
167 .os_tag = .linux,167 .os_tag = .linux,
168 .abi = .none,168 .abi = .none,
169 },169 },
170 },170 },
171 .{171 .{
172 .target = .{172 .target = .{
173 .cpu_arch = .i386,173 .cpu_arch = .x86,
174 .os_tag = .linux,174 .os_tag = .linux,
175 .abi = .musl,175 .abi = .musl,
176 },176 },
...@@ -178,7 +178,7 @@ const test_targets = blk: {...@@ -178,7 +178,7 @@ const test_targets = blk: {
178 },178 },
179 .{179 .{
180 .target = .{180 .target = .{
181 .cpu_arch = .i386,181 .cpu_arch = .x86,
182 .os_tag = .linux,182 .os_tag = .linux,
183 .abi = .gnu,183 .abi = .gnu,
184 },184 },
...@@ -387,7 +387,7 @@ const test_targets = blk: {...@@ -387,7 +387,7 @@ const test_targets = blk: {
387387
388 .{388 .{
389 .target = .{389 .target = .{
390 .cpu_arch = .i386,390 .cpu_arch = .x86,
391 .os_tag = .windows,391 .os_tag = .windows,
392 .abi = .msvc,392 .abi = .msvc,
393 },393 },
...@@ -403,7 +403,7 @@ const test_targets = blk: {...@@ -403,7 +403,7 @@ const test_targets = blk: {
403403
404 .{404 .{
405 .target = .{405 .target = .{
406 .cpu_arch = .i386,406 .cpu_arch = .x86,
407 .os_tag = .windows,407 .os_tag = .windows,
408 .abi = .gnu,408 .abi = .gnu,
409 },409 },
...@@ -1279,7 +1279,7 @@ const c_abi_targets = [_]CrossTarget{...@@ -1279,7 +1279,7 @@ const c_abi_targets = [_]CrossTarget{
1279 .abi = .musl,1279 .abi = .musl,
1280 },1280 },
1281 .{1281 .{
1282 .cpu_arch = .i386,1282 .cpu_arch = .x86,
1283 .os_tag = .linux,1283 .os_tag = .linux,
1284 .abi = .musl,1284 .abi = .musl,
1285 },1285 },
test/translate_c.zig+1-1
...@@ -1775,7 +1775,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -1775,7 +1775,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
1775 }1775 }
17761776
1777 cases.addWithTarget("Calling convention", .{1777 cases.addWithTarget("Calling convention", .{
1778 .cpu_arch = .i386,1778 .cpu_arch = .x86,
1779 .os_tag = .linux,1779 .os_tag = .linux,
1780 .abi = .none,1780 .abi = .none,
1781 },1781 },
tools/gen_stubs.zig+7-7
...@@ -2,7 +2,7 @@...@@ -2,7 +2,7 @@
2//! ./gen_stubs /path/to/musl/build-all >libc.S2//! ./gen_stubs /path/to/musl/build-all >libc.S
3//!3//!
4//! The directory 'build-all' is expected to contain these subdirectories:4//! The directory 'build-all' is expected to contain these subdirectories:
5//! arm i386 mips mips64 powerpc powerpc64 riscv64 x86_645//! arm x86 mips mips64 powerpc powerpc64 riscv64 x86_64
6//!6//!
7//! ...each with 'lib/libc.so' inside of them.7//! ...each with 'lib/libc.so' inside of them.
8//!8//!
...@@ -30,7 +30,7 @@ const native_endian = @import("builtin").target.cpu.arch.endian();...@@ -30,7 +30,7 @@ const native_endian = @import("builtin").target.cpu.arch.endian();
3030
31const arches: [7]std.Target.Cpu.Arch = blk: {31const arches: [7]std.Target.Cpu.Arch = blk: {
32 var result: [7]std.Target.Cpu.Arch = undefined;32 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| {
34 result[archIndex(arch)] = arch;34 result[archIndex(arch)] = arch;
35 }35 }
36 break :blk result;36 break :blk result;
...@@ -56,7 +56,7 @@ const MultiSym = struct {...@@ -56,7 +56,7 @@ const MultiSym = struct {
56 fn is32Only(ms: MultiSym) bool {56 fn is32Only(ms: MultiSym) bool {
57 return ms.present[archIndex(.riscv64)] == false and57 return ms.present[archIndex(.riscv64)] == false and
58 ms.present[archIndex(.mips)] == true and58 ms.present[archIndex(.mips)] == true and
59 ms.present[archIndex(.i386)] == true and59 ms.present[archIndex(.x86)] == true and
60 ms.present[archIndex(.x86_64)] == false and60 ms.present[archIndex(.x86_64)] == false and
61 ms.present[archIndex(.powerpc)] == true and61 ms.present[archIndex(.powerpc)] == true and
62 ms.present[archIndex(.powerpc64)] == false and62 ms.present[archIndex(.powerpc64)] == false and
...@@ -97,7 +97,7 @@ const MultiSym = struct {...@@ -97,7 +97,7 @@ const MultiSym = struct {
97 const map = .{97 const map = .{
98 .{ .riscv64, 8 },98 .{ .riscv64, 8 },
99 .{ .mips, 4 },99 .{ .mips, 4 },
100 .{ .i386, 4 },100 .{ .x86, 4 },
101 .{ .x86_64, 8 },101 .{ .x86_64, 8 },
102 .{ .powerpc, 4 },102 .{ .powerpc, 4 },
103 .{ .powerpc64, 8 },103 .{ .powerpc64, 8 },
...@@ -118,7 +118,7 @@ const MultiSym = struct {...@@ -118,7 +118,7 @@ const MultiSym = struct {
118 const map = .{118 const map = .{
119 .{ .riscv64, 16 },119 .{ .riscv64, 16 },
120 .{ .mips, 8 },120 .{ .mips, 8 },
121 .{ .i386, 8 },121 .{ .x86, 8 },
122 .{ .x86_64, 16 },122 .{ .x86_64, 16 },
123 .{ .powerpc, 8 },123 .{ .powerpc, 8 },
124 .{ .powerpc64, 16 },124 .{ .powerpc64, 16 },
...@@ -139,7 +139,7 @@ const MultiSym = struct {...@@ -139,7 +139,7 @@ const MultiSym = struct {
139 const map = .{139 const map = .{
140 .{ .riscv64, 2 },140 .{ .riscv64, 2 },
141 .{ .mips, 1 },141 .{ .mips, 1 },
142 .{ .i386, 1 },142 .{ .x86, 1 },
143 .{ .x86_64, 2 },143 .{ .x86_64, 2 },
144 .{ .powerpc, 1 },144 .{ .powerpc, 1 },
145 .{ .powerpc64, 2 },145 .{ .powerpc64, 2 },
...@@ -555,7 +555,7 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {...@@ -555,7 +555,7 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 {
555 // zig fmt: off555 // zig fmt: off
556 .riscv64 => 0,556 .riscv64 => 0,
557 .mips => 1,557 .mips => 1,
558 .i386 => 2,558 .x86 => 2,
559 .x86_64 => 3,559 .x86_64 => 3,
560 .powerpc => 4,560 .powerpc => 4,
561 .powerpc64 => 5,561 .powerpc64 => 5,
tools/process_headers.zig+3-3
...@@ -96,7 +96,7 @@ const glibc_targets = [_]LibCTarget{...@@ -96,7 +96,7 @@ const glibc_targets = [_]LibCTarget{
96 },96 },
97 LibCTarget{97 LibCTarget{
98 .name = "i686-linux-gnu",98 .name = "i686-linux-gnu",
99 .arch = MultiArch{ .specific = Arch.i386 },99 .arch = MultiArch{ .specific = Arch.x86 },
100 .abi = MultiAbi{ .specific = Abi.gnu },100 .abi = MultiAbi{ .specific = Abi.gnu },
101 },101 },
102 LibCTarget{102 LibCTarget{
...@@ -208,8 +208,8 @@ const musl_targets = [_]LibCTarget{...@@ -208,8 +208,8 @@ const musl_targets = [_]LibCTarget{
208 .abi = MultiAbi.musl,208 .abi = MultiAbi.musl,
209 },209 },
210 LibCTarget{210 LibCTarget{
211 .name = "i386",211 .name = "x86",
212 .arch = MultiArch{ .specific = .i386 },212 .arch = MultiArch{ .specific = .x86 },
213 .abi = MultiAbi.musl,213 .abi = MultiAbi.musl,
214 },214 },
215 LibCTarget{215 LibCTarget{