diff --git a/doc/langref.html.in b/doc/langref.html.in index 4097c7b67a213c686284defcb9e339380dce4d00..5d82a1df603578f27ad8d6c047d0ddfc014dd783 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -5126,7 +5126,7 @@ const builtin = @import("builtin"); const native_arch = builtin.cpu.arch; const expect = std.testing.expect; -const WINAPI: std.builtin.CallingConvention = if (native_arch == .i386) .Stdcall else .C; +const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .Stdcall else .C; extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn; test "foo" { @@ -5165,7 +5165,7 @@ export fn sub(a: i8, b: i8) i8 { return a - b; } // at link time, when linking statically, or at runtime, when linking // dynamically. // The callconv specifier changes the calling convention of the function. -const WINAPI: std.builtin.CallingConvention = if (native_arch == .i386) .Stdcall else .C; +const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .Stdcall else .C; extern "kernel32" fn ExitProcess(exit_code: u32) callconv(WINAPI) noreturn; extern "c" fn atan2(a: f64, b: f64) f64; @@ -7487,7 +7487,7 @@ volatile ( : "rcx", "r11" );{#end_syntax_block#}

- For i386 and x86_64 targets, the syntax is AT&T syntax, rather than the more + For x86 and x86_64 targets, the syntax is AT&T syntax, rather than the more popular Intel syntax. This is due to technical constraints; assembly parsing is provided by LLVM and its support for Intel syntax is buggy and not well tested.

@@ -11608,7 +11608,7 @@ Architectures: v5 v5te v4t - i386 + x86 x86_64 (native) xcore nvptx @@ -11687,8 +11687,8 @@ Available libcs: arm-linux-gnueabihf arm-linux-musleabi arm-linux-musleabihf - i386-linux-gnu - i386-linux-musl + x86-linux-gnu + x86-linux-musl mips64el-linux-gnuabi64 mips64el-linux-gnuabin32 mips64el-linux-musl diff --git a/lib/c.zig b/lib/c.zig index c9fa912c359f2719de0a1e6611d5b787435afbd1..82f9f5b2e17267d965856b24315bed4573b5b87a 100644 --- a/lib/c.zig +++ b/lib/c.zig @@ -190,7 +190,7 @@ test "strncmp" { // across .o file boundaries. fix comptime @ptrCast of nakedcc functions. fn clone() callconv(.Naked) void { switch (native_arch) { - .i386 => { + .x86 => { // __clone(func, stack, flags, arg, ptid, tls, ctid) // +8, +12, +16, +20, +24, +28, +32 // syscall(SYS_clone, flags, stack, ptid, tls, ctid) diff --git a/lib/compiler_rt/aulldiv.zig b/lib/compiler_rt/aulldiv.zig index d9517c6d10f3da3cf367a1dab501a7239990aa0c..3443e6ca092110126ecd3813771b934f001f18d9 100644 --- a/lib/compiler_rt/aulldiv.zig +++ b/lib/compiler_rt/aulldiv.zig @@ -7,7 +7,7 @@ const common = @import("common.zig"); pub const panic = common.panic; comptime { - if (arch == .i386 and abi == .msvc) { + if (arch == .x86 and abi == .msvc) { // Don't let LLVM apply the stdcall name mangling on those MSVC builtins @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage }); @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage }); diff --git a/lib/compiler_rt/aullrem.zig b/lib/compiler_rt/aullrem.zig index 43821eb9d3c2ccce3a671590bf93deb171c6d6a3..6960e1ecebca936a3352c7d0fb7a87195c40e548 100644 --- a/lib/compiler_rt/aullrem.zig +++ b/lib/compiler_rt/aullrem.zig @@ -7,7 +7,7 @@ const common = @import("common.zig"); pub const panic = common.panic; comptime { - if (arch == .i386 and abi == .msvc) { + if (arch == .x86 and abi == .msvc) { // Don't let LLVM apply the stdcall name mangling on those MSVC builtins @export(_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage }); @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage }); diff --git a/lib/compiler_rt/clear_cache.zig b/lib/compiler_rt/clear_cache.zig index d2dbfea39ff9bff85433bec16a50d9375df88f8b..93e6846ae579eca117f73206977de347fc7d0221 100644 --- a/lib/compiler_rt/clear_cache.zig +++ b/lib/compiler_rt/clear_cache.zig @@ -17,7 +17,7 @@ comptime { fn clear_cache(start: usize, end: usize) callconv(.C) void { const x86 = switch (arch) { - .i386, .x86_64 => true, + .x86, .x86_64 => true, else => false, }; const arm32 = switch (arch) { diff --git a/lib/compiler_rt/common.zig b/lib/compiler_rt/common.zig index 7c39cef1e5f544ca5276fa245e29f362a7913fd3..2d373031e5e84a29168d9351434b6b133c03f290 100644 --- a/lib/compiler_rt/common.zig +++ b/lib/compiler_rt/common.zig @@ -48,7 +48,7 @@ pub const gnu_f16_abi = switch (builtin.cpu.arch) { .x86_64, => false, - .i386 => true, + .x86 => true, .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) { .eabi, .eabihf => false, @@ -79,7 +79,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ? pub const F16T = switch (builtin.cpu.arch) { .aarch64, .aarch64_be, .aarch64_32 => f16, .riscv64 => if (builtin.zig_backend == .stage1) u16 else f16, - .i386, .x86_64 => f16, + .x86, .x86_64 => f16, else => u16, }; diff --git a/lib/compiler_rt/divti3.zig b/lib/compiler_rt/divti3.zig index b99a9081a46e2eb073c40d749fc8d083f170be9e..6899cd323f59c71f18c63e8feb2cfac03b46bd56 100644 --- a/lib/compiler_rt/divti3.zig +++ b/lib/compiler_rt/divti3.zig @@ -9,7 +9,7 @@ pub const panic = common.panic; comptime { if (builtin.os.tag == .windows) { switch (arch) { - .i386 => { + .x86 => { @export(__divti3, .{ .name = "__divti3", .linkage = common.linkage }); }, .x86_64 => { diff --git a/lib/compiler_rt/extendf_test.zig b/lib/compiler_rt/extendf_test.zig index 1d88c0c4fa6d3e7f8b338a98920c0585c74e9e48..9857cf91f9ad478db03f63f69bd1751130363caf 100644 --- a/lib/compiler_rt/extendf_test.zig +++ b/lib/compiler_rt/extendf_test.zig @@ -140,7 +140,7 @@ test "extendhfsf2" { try test__extendhfsf2(0x7f00, 0x7fe00000); // sNaN // On x86 the NaN becomes quiet because the return is pushed on the x87 // stack due to ABI requirements - if (builtin.target.cpu.arch != .i386 and builtin.target.os.tag == .windows) + if (builtin.target.cpu.arch != .x86 and builtin.target.os.tag == .windows) try test__extendhfsf2(0x7c01, 0x7f802000); // sNaN try test__extendhfsf2(0, 0); // 0 diff --git a/lib/compiler_rt/stack_probe.zig b/lib/compiler_rt/stack_probe.zig index 22f0f936ce1754523b5b509bd0d42f40d9ad24b6..c24b9278099c08a87f9d97fde2891ceaff01ce0a 100644 --- a/lib/compiler_rt/stack_probe.zig +++ b/lib/compiler_rt/stack_probe.zig @@ -30,7 +30,7 @@ comptime { } switch (arch) { - .i386, + .x86, .x86_64, => { @export(zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage }); @@ -69,7 +69,7 @@ pub fn zig_probe_stack() callconv(.Naked) void { \\ ret ); }, - .i386 => { + .x86 => { // %eax = probe length, %esp = stack pointer asm volatile ( \\ push %%ecx @@ -121,7 +121,7 @@ fn win_probe_stack_only() void { \\ ret ); }, - .i386 => { + .x86 => { asm volatile ( \\ push %%ecx \\ push %%eax @@ -191,7 +191,7 @@ fn win_probe_stack_adjust_sp() void { \\ ret ); }, - .i386 => { + .x86 => { asm volatile ( \\ push %%ecx \\ cmp $0x1000,%%eax @@ -243,7 +243,7 @@ pub fn __chkstk() callconv(.Naked) void { if (comptime arch.isAARCH64()) { @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); } else switch (arch) { - .i386 => @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}), + .x86 => @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}), .x86_64 => @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}), else => unreachable, } diff --git a/lib/libc/glibc/abilists b/lib/libc/glibc/abilists index 179e3f6f3fb50cb33fbe6e0e9f52da77859b78d5..538183b11e790735b4f6359a96636f7489288bd6 100644 Binary files a/lib/libc/glibc/abilists and b/lib/libc/glibc/abilists differ diff --git a/lib/libc/include/i386-linux-gnu/bits/a.out.h b/lib/libc/include/i386-linux-gnu/bits/a.out.h deleted file mode 100644 index 3c81a52dbb722d43ee30bdaace3ea88e01ffc8cf..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/a.out.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __A_OUT_GNU_H__ -# error "Never use directly; include instead." -#endif - -#ifdef __x86_64__ - -/* Signal to users of this header that this architecture really doesn't - support a.out binary format. */ -#define __NO_A_OUT_SUPPORT 1 - -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/endianness.h b/lib/libc/include/i386-linux-gnu/bits/endianness.h deleted file mode 100644 index 80180b782e3b603bfd65bb9a42ca99beda21a318..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/endianness.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _BITS_ENDIANNESS_H -#define _BITS_ENDIANNESS_H 1 - -#ifndef _BITS_ENDIAN_H -# error "Never use directly; include instead." -#endif - -/* i386/x86_64 are little-endian. */ -#define __BYTE_ORDER __LITTLE_ENDIAN - -#endif /* bits/endianness.h */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/environments.h b/lib/libc/include/i386-linux-gnu/bits/environments.h deleted file mode 100644 index 72a871ff4de397f64f5f7cf4b5f5e70a6f02c59d..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/environments.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright (C) 1999-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _UNISTD_H -# error "Never include this file directly. Use instead" -#endif - -#include - -/* This header should define the following symbols under the described - situations. A value `1' means that the model is always supported, - `-1' means it is never supported. Undefined means it cannot be - statically decided. - - _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type - _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type - - _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type - _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type - - The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, - _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, - _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were - used in previous versions of the Unix standard and are available - only for compatibility. -*/ - -#if __WORDSIZE == 64 - -/* Environments with 32-bit wide pointers are optionally provided. - Therefore following macros aren't defined: - # undef _POSIX_V7_ILP32_OFF32 - # undef _POSIX_V7_ILP32_OFFBIG - # undef _POSIX_V6_ILP32_OFF32 - # undef _POSIX_V6_ILP32_OFFBIG - # undef _XBS5_ILP32_OFF32 - # undef _XBS5_ILP32_OFFBIG - and users need to check at runtime. */ - -/* We also have no use (for now) for an environment with bigger pointers - and offsets. */ -# define _POSIX_V7_LPBIG_OFFBIG -1 -# define _POSIX_V6_LPBIG_OFFBIG -1 -# define _XBS5_LPBIG_OFFBIG -1 - -/* By default we have 64-bit wide `long int', pointers and `off_t'. */ -# define _POSIX_V7_LP64_OFF64 1 -# define _POSIX_V6_LP64_OFF64 1 -# define _XBS5_LP64_OFF64 1 - -#else /* __WORDSIZE == 32 */ - -/* We have 32-bit wide `int', `long int' and pointers and all platforms - support LFS. -mx32 has 64-bit wide `off_t'. */ -# define _POSIX_V7_ILP32_OFFBIG 1 -# define _POSIX_V6_ILP32_OFFBIG 1 -# define _XBS5_ILP32_OFFBIG 1 - -# ifndef __x86_64__ -/* -m32 has 32-bit wide `off_t'. */ -# define _POSIX_V7_ILP32_OFF32 1 -# define _POSIX_V6_ILP32_OFF32 1 -# define _XBS5_ILP32_OFF32 1 -# endif - -/* We optionally provide an environment with the above size but an 64-bit - side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ - -/* Environments with 64-bit wide pointers can be provided, - so these macros aren't defined: - # undef _POSIX_V7_LP64_OFF64 - # undef _POSIX_V7_LPBIG_OFFBIG - # undef _POSIX_V6_LP64_OFF64 - # undef _POSIX_V6_LPBIG_OFFBIG - # undef _XBS5_LP64_OFF64 - # undef _XBS5_LPBIG_OFFBIG - and sysconf tests for it at runtime. */ - -#endif /* __WORDSIZE == 32 */ - -#define __ILP32_OFF32_CFLAGS "-m32" -#define __ILP32_OFF32_LDFLAGS "-m32" -#if defined __x86_64__ && defined __ILP32__ -# define __ILP32_OFFBIG_CFLAGS "-mx32" -# define __ILP32_OFFBIG_LDFLAGS "-mx32" -#else -# define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -# define __ILP32_OFFBIG_LDFLAGS "-m32" -#endif -#define __LP64_OFF64_CFLAGS "-m64" -#define __LP64_OFF64_LDFLAGS "-m64" \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/epoll.h b/lib/libc/include/i386-linux-gnu/bits/epoll.h deleted file mode 100644 index 4bda3c54ef2f9331ac170b7e33d85aa1d55004bd..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/epoll.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2002-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_EPOLL_H -# error "Never use directly; include instead." -#endif - -/* Flags to be passed to epoll_create1. */ -enum - { - EPOLL_CLOEXEC = 02000000 -#define EPOLL_CLOEXEC EPOLL_CLOEXEC - }; - -#define __EPOLL_PACKED __attribute__ ((__packed__)) \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/fcntl.h b/lib/libc/include/i386-linux-gnu/bits/fcntl.h deleted file mode 100644 index de1b65f104f965926417c07a8466d61ed6bd5fc4..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/fcntl.h +++ /dev/null @@ -1,61 +0,0 @@ -/* O_*, F_*, FD_* bit values for Linux/x86. - Copyright (C) 2001-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _FCNTL_H -# error "Never use directly; include instead." -#endif - -#ifdef __x86_64__ -# define __O_LARGEFILE 0 -#endif - -#ifdef __x86_64__ -/* Not necessary, we always have 64-bit offsets. */ -# define F_GETLK64 5 /* Get record locking info. */ -# define F_SETLK64 6 /* Set record locking info (non-blocking). */ -# define F_SETLKW64 7 /* Set record locking info (blocking). */ -#endif - - -struct flock - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ -#ifndef __USE_FILE_OFFSET64 - __off_t l_start; /* Offset where the lock begins. */ - __off_t l_len; /* Size of the locked area; zero means until EOF. */ -#else - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ -#endif - __pid_t l_pid; /* Process holding the lock. */ - }; - -#ifdef __USE_LARGEFILE64 -struct flock64 - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ - __pid_t l_pid; /* Process holding the lock. */ - }; -#endif - -/* Include generic Linux declarations. */ -#include \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/fenv.h b/lib/libc/include/i386-linux-gnu/bits/fenv.h deleted file mode 100644 index dd01ba9442e7648df13d829ffb4c664fe0c30af5..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/fenv.h +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright (C) 1997-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _FENV_H -# error "Never use directly; include instead." -#endif - -/* Define bits representing the exception. We use the bit positions - of the appropriate bits in the FPU control word. */ -enum - { - FE_INVALID = -#define FE_INVALID 0x01 - FE_INVALID, - __FE_DENORM = 0x02, - FE_DIVBYZERO = -#define FE_DIVBYZERO 0x04 - FE_DIVBYZERO, - FE_OVERFLOW = -#define FE_OVERFLOW 0x08 - FE_OVERFLOW, - FE_UNDERFLOW = -#define FE_UNDERFLOW 0x10 - FE_UNDERFLOW, - FE_INEXACT = -#define FE_INEXACT 0x20 - FE_INEXACT - }; - -#define FE_ALL_EXCEPT \ - (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) - -/* The ix87 FPU supports all of the four defined rounding modes. We - use again the bit positions in the FPU control word as the values - for the appropriate macros. */ -enum - { - FE_TONEAREST = -#define FE_TONEAREST 0 - FE_TONEAREST, - FE_DOWNWARD = -#define FE_DOWNWARD 0x400 - FE_DOWNWARD, - FE_UPWARD = -#define FE_UPWARD 0x800 - FE_UPWARD, - FE_TOWARDZERO = -#define FE_TOWARDZERO 0xc00 - FE_TOWARDZERO - }; - - -/* Type representing exception flags. */ -typedef unsigned short int fexcept_t; - - -/* Type representing floating-point environment. This structure - corresponds to the layout of the block written by the `fstenv' - instruction and has additional fields for the contents of the MXCSR - register as written by the `stmxcsr' instruction. */ -typedef struct - { - unsigned short int __control_word; - unsigned short int __glibc_reserved1; - unsigned short int __status_word; - unsigned short int __glibc_reserved2; - unsigned short int __tags; - unsigned short int __glibc_reserved3; - unsigned int __eip; - unsigned short int __cs_selector; - unsigned int __opcode:11; - unsigned int __glibc_reserved4:5; - unsigned int __data_offset; - unsigned short int __data_selector; - unsigned short int __glibc_reserved5; -#ifdef __x86_64__ - unsigned int __mxcsr; -#endif - } -fenv_t; - -/* If the default argument is used we use this value. */ -#define FE_DFL_ENV ((const fenv_t *) -1) - -#ifdef __USE_GNU -/* Floating-point environment where none of the exception is masked. */ -# define FE_NOMASK_ENV ((const fenv_t *) -2) -#endif - -#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) -/* Type representing floating-point control modes. */ -typedef struct - { - unsigned short int __control_word; - unsigned short int __glibc_reserved; - unsigned int __mxcsr; - } -femode_t; - -/* Default floating-point control modes. */ -# define FE_DFL_MODE ((const femode_t *) -1L) -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/floatn.h b/lib/libc/include/i386-linux-gnu/bits/floatn.h deleted file mode 100644 index 5818af200103f563ab8b3b89776b1fe2dd8de761..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/floatn.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Macros to control TS 18661-3 glibc features on x86. - Copyright (C) 2017-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_FLOATN_H -#define _BITS_FLOATN_H - -#include - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the IEEE 754 binary128 format, and this - glibc includes corresponding *f128 interfaces for it. The required - libgcc support was added some time after the basic compiler - support, for x86_64 and x86. */ -#if (defined __x86_64__ \ - ? __GNUC_PREREQ (4, 3) \ - : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) -# define __HAVE_FLOAT128 1 -#else -# define __HAVE_FLOAT128 0 -#endif - -/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct - from the default float, double and long double types in this glibc. */ -#if __HAVE_FLOAT128 -# define __HAVE_DISTINCT_FLOAT128 1 -#else -# define __HAVE_DISTINCT_FLOAT128 0 -#endif - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the right format for _Float64x, and this - glibc includes corresponding *f64x interfaces for it. */ -#define __HAVE_FLOAT64X 1 - -/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format - of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has - the format of _Float128, which must be different from that of long - double. */ -#define __HAVE_FLOAT64X_LONG_DOUBLE 1 - -#ifndef __ASSEMBLER__ - -/* Defined to concatenate the literal suffix to be used with _Float128 - types, if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -/* The literal suffix f128 exists only since GCC 7.0. */ -# define __f128(x) x##q -# else -# define __f128(x) x##f128 -# endif -# endif - -/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -/* Add a typedef for older GCC compilers which don't natively support - _Complex _Float128. */ -typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); -# define __CFLOAT128 __cfloat128 -# else -# define __CFLOAT128 _Complex _Float128 -# endif -# endif - -/* The remaining of this file provides support for older compilers. */ -# if __HAVE_FLOAT128 - -/* The type _Float128 exists only since GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -typedef __float128 _Float128; -# endif - -/* __builtin_huge_valf128 doesn't exist before GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) -# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ()) -# endif - -/* Older GCC has only a subset of built-in functions for _Float128 on - x86, and __builtin_infq is not usable in static initializers. - Converting a narrower sNaN to _Float128 produces a quiet NaN, so - attempts to use _Float128 sNaNs will not work properly with older - compilers. */ -# if !__GNUC_PREREQ (7, 0) -# define __builtin_copysignf128 __builtin_copysignq -# define __builtin_fabsf128 __builtin_fabsq -# define __builtin_inff128() ((_Float128) __builtin_inf ()) -# define __builtin_nanf128(x) ((_Float128) __builtin_nan (x)) -# define __builtin_nansf128(x) ((_Float128) __builtin_nans (x)) -# endif - -/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*, - e.g.: __builtin_signbitf128, before GCC 6. However, there has never - been a __builtin_signbitf128 in GCC and the type-generic builtin is - only available since GCC 6. */ -# if !__GNUC_PREREQ (6, 0) -# define __builtin_signbitf128 __signbitf128 -# endif - -# endif - -#endif /* !__ASSEMBLER__. */ - -#include - -#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/flt-eval-method.h b/lib/libc/include/i386-linux-gnu/bits/flt-eval-method.h deleted file mode 100644 index c714d6ed236f37ba47c46b07f0427d7f4fede23d..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/flt-eval-method.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Define __GLIBC_FLT_EVAL_METHOD. x86 version. - Copyright (C) 2016-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -#ifdef __FLT_EVAL_METHOD__ -# if __FLT_EVAL_METHOD__ == -1 -# define __GLIBC_FLT_EVAL_METHOD 2 -# else -# define __GLIBC_FLT_EVAL_METHOD __FLT_EVAL_METHOD__ -# endif -#elif defined __x86_64__ -# define __GLIBC_FLT_EVAL_METHOD 0 -#else -# define __GLIBC_FLT_EVAL_METHOD 2 -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/fp-logb.h b/lib/libc/include/i386-linux-gnu/bits/fp-logb.h deleted file mode 100644 index 7c1bfa72bd5add534071850e5c498ad6e8b1db53..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/fp-logb.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. x86 version. - Copyright (C) 2016-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -#define __FP_LOGB0_IS_MIN 1 -#define __FP_LOGBNAN_IS_MIN 1 \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/indirect-return.h b/lib/libc/include/i386-linux-gnu/bits/indirect-return.h deleted file mode 100644 index 4bf822a84c03e71ba8cb75841166546da1e5af40..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/indirect-return.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Definition of __INDIRECT_RETURN. x86 version. - Copyright (C) 2018-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _UCONTEXT_H -# error "Never include directly; use instead." -#endif - -/* On x86, swapcontext returns via indirect branch when the shadow stack - is enabled. Define __INDIRECT_RETURN to indicate whether swapcontext - returns via indirect branch. */ -#if defined __CET__ && (__CET__ & 2) != 0 -# if __glibc_has_attribute (__indirect_return__) -# define __INDIRECT_RETURN __attribute__ ((__indirect_return__)) -# else -/* Newer compilers provide the indirect_return attribute, but without - it we can use returns_twice to affect the optimizer in the same - way and avoid unsafe optimizations. */ -# define __INDIRECT_RETURN __attribute__ ((__returns_twice__)) -# endif -#else -# define __INDIRECT_RETURN -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/ipctypes.h b/lib/libc/include/i386-linux-gnu/bits/ipctypes.h deleted file mode 100644 index 9c301e1a3cdd67c3daafe5762ba5f02e77768d3d..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/ipctypes.h +++ /dev/null @@ -1,33 +0,0 @@ -/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_IPC_H -# error "Never use directly; include instead." -#endif - -#ifndef _BITS_IPCTYPES_H -#define _BITS_IPCTYPES_H 1 - -/* Used in `struct shmid_ds'. */ -# ifdef __x86_64__ -typedef int __ipc_pid_t; -# else -typedef unsigned short int __ipc_pid_t; -# endif - -#endif /* bits/ipctypes.h */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/iscanonical.h b/lib/libc/include/i386-linux-gnu/bits/iscanonical.h deleted file mode 100644 index 8e6c0d05f5016f5a498a62ab68c72468d0142931..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/iscanonical.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Define iscanonical macro. ldbl-96 version. - Copyright (C) 2016-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -extern int __iscanonicall (long double __x) - __THROW __attribute__ ((__const__)); -#define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1) -#define __iscanonical(x) ((void) (__typeof (x)) (x), 1) -#if __HAVE_DISTINCT_FLOAT128 -# define __iscanonicalf128(x) ((void) (__typeof (x)) (x), 1) -#endif - -/* Return nonzero value if X is canonical. In IEEE interchange binary - formats, all values are canonical, but the argument must still be - converted to its semantic type for any exceptions arising from the - conversion, before being discarded; in extended precision, there - are encodings that are not consistently handled as corresponding to - any particular value of the type, and we return 0 for those. */ -#ifndef __cplusplus -# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) -#else -/* In C++ mode, __MATH_TG cannot be used, because it relies on - __builtin_types_compatible_p, which is a C-only builtin. On the - other hand, overloading provides the means to distinguish between - the floating-point types. The overloading resolution will match - the correct parameter (regardless of type qualifiers (i.e.: const - and volatile)). */ -extern "C++" { -inline int iscanonical (float __val) { return __iscanonicalf (__val); } -inline int iscanonical (double __val) { return __iscanonical (__val); } -inline int iscanonical (long double __val) { return __iscanonicall (__val); } -# if __HAVE_DISTINCT_FLOAT128 -inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); } -# endif -} -#endif /* __cplusplus */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/link.h b/lib/libc/include/i386-linux-gnu/bits/link.h deleted file mode 100644 index 9774e993a3c9e35dfe6698df6815cd2828ae570a..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/link.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright (C) 2004-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LINK_H -# error "Never include directly; use instead." -#endif - - -#ifndef __x86_64__ -/* Registers for entry into PLT on IA-32. */ -typedef struct La_i86_regs -{ - uint32_t lr_edx; - uint32_t lr_ecx; - uint32_t lr_eax; - uint32_t lr_ebp; - uint32_t lr_esp; -} La_i86_regs; - -/* Return values for calls from PLT on IA-32. */ -typedef struct La_i86_retval -{ - uint32_t lrv_eax; - uint32_t lrv_edx; - long double lrv_st0; - long double lrv_st1; - uint64_t lrv_bnd0; - uint64_t lrv_bnd1; -} La_i86_retval; - - -__BEGIN_DECLS - -extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - La_i86_regs *__regs, - unsigned int *__flags, - const char *__symname, - long int *__framesizep); -extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - const La_i86_regs *__inregs, - La_i86_retval *__outregs, - const char *symname); - -__END_DECLS - -#else - -/* Registers for entry into PLT on x86-64. */ -# if __GNUC_PREREQ (4,0) -typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16))); -typedef float La_x86_64_ymm - __attribute__ ((__vector_size__ (32), __aligned__ (16))); -typedef double La_x86_64_zmm - __attribute__ ((__vector_size__ (64), __aligned__ (16))); -# else -typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__))); -# endif - -typedef union -{ -# if __GNUC_PREREQ (4,0) - La_x86_64_ymm ymm[2]; - La_x86_64_zmm zmm[1]; -# endif - La_x86_64_xmm xmm[4]; -} La_x86_64_vector __attribute__ ((__aligned__ (16))); - -typedef struct La_x86_64_regs -{ - uint64_t lr_rdx; - uint64_t lr_r8; - uint64_t lr_r9; - uint64_t lr_rcx; - uint64_t lr_rsi; - uint64_t lr_rdi; - uint64_t lr_rbp; - uint64_t lr_rsp; - La_x86_64_xmm lr_xmm[8]; - La_x86_64_vector lr_vector[8]; -#ifndef __ILP32__ - __int128_t lr_bnd[4]; -#endif -} La_x86_64_regs; - -/* Return values for calls from PLT on x86-64. */ -typedef struct La_x86_64_retval -{ - uint64_t lrv_rax; - uint64_t lrv_rdx; - La_x86_64_xmm lrv_xmm0; - La_x86_64_xmm lrv_xmm1; - long double lrv_st0; - long double lrv_st1; - La_x86_64_vector lrv_vector0; - La_x86_64_vector lrv_vector1; -#ifndef __ILP32__ - __int128_t lrv_bnd0; - __int128_t lrv_bnd1; -#endif -} La_x86_64_retval; - -#define La_x32_regs La_x86_64_regs -#define La_x32_retval La_x86_64_retval - -__BEGIN_DECLS - -extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym, - unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - La_x86_64_regs *__regs, - unsigned int *__flags, - const char *__symname, - long int *__framesizep); -extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym, - unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - const La_x86_64_regs *__inregs, - La_x86_64_retval *__outregs, - const char *__symname); - -extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym, - unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - La_x32_regs *__regs, - unsigned int *__flags, - const char *__symname, - long int *__framesizep); -extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym, - unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - const La_x32_regs *__inregs, - La_x32_retval *__outregs, - const char *__symname); - -__END_DECLS - -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/long-double.h b/lib/libc/include/i386-linux-gnu/bits/long-double.h deleted file mode 100644 index ef3832bc80d643a47f2501845cab95ac4316e201..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/long-double.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Properties of long double type. ldbl-96 version. - Copyright (C) 2016-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* long double is distinct from double, so there is nothing to - define here. */ -#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/math-vector.h b/lib/libc/include/i386-linux-gnu/bits/math-vector.h deleted file mode 100644 index 6e94f42ca81228bdf7d5e17ac829538784422e31..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/math-vector.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Platform-specific SIMD declarations of math functions. - Copyright (C) 2014-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never include directly;\ - include instead." -#endif - -/* Get default empty definitions for simd declarations. */ -#include - -#if defined __x86_64__ && defined __FAST_MATH__ -# if defined _OPENMP && _OPENMP >= 201307 -/* OpenMP case. */ -# define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch") -# elif __GNUC_PREREQ (6,0) -/* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)). */ -# define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch"))) -# endif - -# ifdef __DECL_SIMD_x86_64 -# undef __DECL_SIMD_cos -# define __DECL_SIMD_cos __DECL_SIMD_x86_64 -# undef __DECL_SIMD_cosf -# define __DECL_SIMD_cosf __DECL_SIMD_x86_64 -# undef __DECL_SIMD_sin -# define __DECL_SIMD_sin __DECL_SIMD_x86_64 -# undef __DECL_SIMD_sinf -# define __DECL_SIMD_sinf __DECL_SIMD_x86_64 -# undef __DECL_SIMD_sincos -# define __DECL_SIMD_sincos __DECL_SIMD_x86_64 -# undef __DECL_SIMD_sincosf -# define __DECL_SIMD_sincosf __DECL_SIMD_x86_64 -# undef __DECL_SIMD_log -# define __DECL_SIMD_log __DECL_SIMD_x86_64 -# undef __DECL_SIMD_logf -# define __DECL_SIMD_logf __DECL_SIMD_x86_64 -# undef __DECL_SIMD_exp -# define __DECL_SIMD_exp __DECL_SIMD_x86_64 -# undef __DECL_SIMD_expf -# define __DECL_SIMD_expf __DECL_SIMD_x86_64 -# undef __DECL_SIMD_pow -# define __DECL_SIMD_pow __DECL_SIMD_x86_64 -# undef __DECL_SIMD_powf -# define __DECL_SIMD_powf __DECL_SIMD_x86_64 - -# endif -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/mman.h b/lib/libc/include/i386-linux-gnu/bits/mman.h deleted file mode 100644 index 8c96873c8645fe386f2467e9974b3492891bd97c..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/mman.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Definitions for POSIX memory map interface. Linux/x86_64 version. - Copyright (C) 2001-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_MMAN_H -# error "Never use directly; include instead." -#endif - -/* The following definitions basically come from the kernel headers. - But the kernel header is not namespace clean. */ - -/* Other flags. */ -#ifdef __USE_MISC -# define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */ -#endif - -#include - -/* Include generic Linux declarations. */ -#include \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/procfs-id.h b/lib/libc/include/i386-linux-gnu/bits/procfs-id.h deleted file mode 100644 index bada981489a50a58b41189cdf5bdfad7ed071498..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/procfs-id.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Types of pr_uid and pr_gid in struct elf_prpsinfo. x86 version. - Copyright (C) 2018-2021 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PROCFS_H -# error "Never include directly; use instead." -#endif - -#if __WORDSIZE == 32 -typedef unsigned short int __pr_uid_t; -typedef unsigned short int __pr_gid_t; -#else -typedef unsigned int __pr_uid_t; -typedef unsigned int __pr_gid_t; -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/procfs.h b/lib/libc/include/i386-linux-gnu/bits/procfs.h deleted file mode 100644 index b670484f2a498dd677f674a0200e1e1c3fdfe939..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/procfs.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Types for registers for sys/procfs.h. x86 version. - Copyright (C) 2001-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PROCFS_H -# error "Never include directly; use instead." -#endif - -/* Type for a general-purpose register. */ -#ifdef __x86_64__ -__extension__ typedef unsigned long long elf_greg_t; -#else -typedef unsigned long elf_greg_t; -#endif - -/* And the whole bunch of them. We could have used `struct - user_regs_struct' directly in the typedef, but tradition says that - the register set is an array, which does have some peculiar - semantics, so leave it that way. */ -#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t)) -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -#ifndef __x86_64__ -/* Register set for the floating-point registers. */ -typedef struct user_fpregs_struct elf_fpregset_t; - -/* Register set for the extended floating-point registers. Includes - the Pentium III SSE registers in addition to the classic - floating-point stuff. */ -typedef struct user_fpxregs_struct elf_fpxregset_t; -#else -/* Register set for the extended floating-point registers. Includes - the Pentium III SSE registers in addition to the classic - floating-point stuff. */ -typedef struct user_fpregs_struct elf_fpregset_t; -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/i386-linux-gnu/bits/pthreadtypes-arch.h deleted file mode 100644 index 89b363fb2c690c0e4257ace9972e54af6ae09741..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/pthreadtypes-arch.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2002-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_PTHREADTYPES_ARCH_H -#define _BITS_PTHREADTYPES_ARCH_H 1 - -#include - -#ifdef __x86_64__ -# if __WORDSIZE == 64 -# define __SIZEOF_PTHREAD_MUTEX_T 40 -# define __SIZEOF_PTHREAD_ATTR_T 56 -# define __SIZEOF_PTHREAD_RWLOCK_T 56 -# define __SIZEOF_PTHREAD_BARRIER_T 32 -# else -# define __SIZEOF_PTHREAD_MUTEX_T 32 -# define __SIZEOF_PTHREAD_ATTR_T 32 -# define __SIZEOF_PTHREAD_RWLOCK_T 44 -# define __SIZEOF_PTHREAD_BARRIER_T 20 -# endif -#else -# define __SIZEOF_PTHREAD_MUTEX_T 24 -# define __SIZEOF_PTHREAD_ATTR_T 36 -# define __SIZEOF_PTHREAD_RWLOCK_T 32 -# define __SIZEOF_PTHREAD_BARRIER_T 20 -#endif -#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -#define __SIZEOF_PTHREAD_COND_T 48 -#define __SIZEOF_PTHREAD_CONDATTR_T 4 -#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 - -#define __LOCK_ALIGNMENT -#define __ONCE_ALIGNMENT - -#ifndef __x86_64__ -/* Extra attributes for the cleanup functions. */ -# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1))) -#endif - -#endif /* bits/pthreadtypes.h */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/setjmp.h b/lib/libc/include/i386-linux-gnu/bits/setjmp.h deleted file mode 100644 index 9e96a2ff9876995f8c9b65a4a586e17984ebead4..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/setjmp.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 2001-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Define the machine-dependent type `jmp_buf'. x86-64 version. */ -#ifndef _BITS_SETJMP_H -#define _BITS_SETJMP_H 1 - -#if !defined _SETJMP_H && !defined _PTHREAD_H -# error "Never include directly; use instead." -#endif - -#include - -#ifndef _ASM - -# if __WORDSIZE == 64 -typedef long int __jmp_buf[8]; -# elif defined __x86_64__ -__extension__ typedef long long int __jmp_buf[8]; -# else -typedef int __jmp_buf[6]; -# endif - -#endif - -#endif /* bits/setjmp.h */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/sigcontext.h b/lib/libc/include/i386-linux-gnu/bits/sigcontext.h deleted file mode 100644 index 4f03980c986b772d0857e8065cdc360f171819a1..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/sigcontext.h +++ /dev/null @@ -1,196 +0,0 @@ -/* Copyright (C) 2002-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_SIGCONTEXT_H -#define _BITS_SIGCONTEXT_H 1 - -#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H -# error "Never use directly; include instead." -#endif - -#include - -#define FP_XSTATE_MAGIC1 0x46505853U -#define FP_XSTATE_MAGIC2 0x46505845U -#define FP_XSTATE_MAGIC2_SIZE sizeof (FP_XSTATE_MAGIC2) - -struct _fpx_sw_bytes -{ - __uint32_t magic1; - __uint32_t extended_size; - __uint64_t xstate_bv; - __uint32_t xstate_size; - __uint32_t __glibc_reserved1[7]; -}; - -struct _fpreg -{ - unsigned short significand[4]; - unsigned short exponent; -}; - -struct _fpxreg -{ - unsigned short significand[4]; - unsigned short exponent; - unsigned short __glibc_reserved1[3]; -}; - -struct _xmmreg -{ - __uint32_t element[4]; -}; - - - -#ifndef __x86_64__ - -struct _fpstate -{ - /* Regular FPU environment. */ - __uint32_t cw; - __uint32_t sw; - __uint32_t tag; - __uint32_t ipoff; - __uint32_t cssel; - __uint32_t dataoff; - __uint32_t datasel; - struct _fpreg _st[8]; - unsigned short status; - unsigned short magic; - - /* FXSR FPU environment. */ - __uint32_t _fxsr_env[6]; - __uint32_t mxcsr; - __uint32_t __glibc_reserved1; - struct _fpxreg _fxsr_st[8]; - struct _xmmreg _xmm[8]; - __uint32_t __glibc_reserved2[56]; -}; - -#ifndef sigcontext_struct -/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but - we need sigcontext. Some packages have come to rely on - sigcontext_struct being defined on 32-bit x86, so define this for - their benefit. */ -# define sigcontext_struct sigcontext -#endif - -#define X86_FXSR_MAGIC 0x0000 - -struct sigcontext -{ - unsigned short gs, __gsh; - unsigned short fs, __fsh; - unsigned short es, __esh; - unsigned short ds, __dsh; - unsigned long edi; - unsigned long esi; - unsigned long ebp; - unsigned long esp; - unsigned long ebx; - unsigned long edx; - unsigned long ecx; - unsigned long eax; - unsigned long trapno; - unsigned long err; - unsigned long eip; - unsigned short cs, __csh; - unsigned long eflags; - unsigned long esp_at_signal; - unsigned short ss, __ssh; - struct _fpstate * fpstate; - unsigned long oldmask; - unsigned long cr2; -}; - -#else /* __x86_64__ */ - -struct _fpstate -{ - /* FPU environment matching the 64-bit FXSAVE layout. */ - __uint16_t cwd; - __uint16_t swd; - __uint16_t ftw; - __uint16_t fop; - __uint64_t rip; - __uint64_t rdp; - __uint32_t mxcsr; - __uint32_t mxcr_mask; - struct _fpxreg _st[8]; - struct _xmmreg _xmm[16]; - __uint32_t __glibc_reserved1[24]; -}; - -struct sigcontext -{ - __uint64_t r8; - __uint64_t r9; - __uint64_t r10; - __uint64_t r11; - __uint64_t r12; - __uint64_t r13; - __uint64_t r14; - __uint64_t r15; - __uint64_t rdi; - __uint64_t rsi; - __uint64_t rbp; - __uint64_t rbx; - __uint64_t rdx; - __uint64_t rax; - __uint64_t rcx; - __uint64_t rsp; - __uint64_t rip; - __uint64_t eflags; - unsigned short cs; - unsigned short gs; - unsigned short fs; - unsigned short __pad0; - __uint64_t err; - __uint64_t trapno; - __uint64_t oldmask; - __uint64_t cr2; - __extension__ union - { - struct _fpstate * fpstate; - __uint64_t __fpstate_word; - }; - __uint64_t __reserved1 [8]; -}; - -#endif /* __x86_64__ */ - -struct _xsave_hdr -{ - __uint64_t xstate_bv; - __uint64_t __glibc_reserved1[2]; - __uint64_t __glibc_reserved2[5]; -}; - -struct _ymmh_state -{ - __uint32_t ymmh_space[64]; -}; - -struct _xstate -{ - struct _fpstate fpstate; - struct _xsave_hdr xstate_hdr; - struct _ymmh_state ymmh; -}; - -#endif /* _BITS_SIGCONTEXT_H */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/siginfo-arch.h b/lib/libc/include/i386-linux-gnu/bits/siginfo-arch.h deleted file mode 100644 index 0f430f0772f24dfdb5a002a318a8850ee64526f1..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/siginfo-arch.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Architecture-specific adjustments to siginfo_t. x86 version. */ -#ifndef _BITS_SIGINFO_ARCH_H -#define _BITS_SIGINFO_ARCH_H 1 - -#if defined __x86_64__ && __WORDSIZE == 32 -/* si_utime and si_stime must be 4 byte aligned for x32 to match the - kernel. We align siginfo_t to 8 bytes so that si_utime and - si_stime are actually aligned to 8 bytes since their offsets are - multiple of 8 bytes. Note: with some compilers, the alignment - attribute would be ignored if it were put in __SI_CLOCK_T instead - of encapsulated in a typedef. */ -typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t; -# define __SI_ALIGNMENT __attribute__ ((__aligned__ (8))) -# define __SI_CLOCK_T __sigchld_clock_t -#endif - -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/struct_mutex.h b/lib/libc/include/i386-linux-gnu/bits/struct_mutex.h deleted file mode 100644 index 89c18f35e00b222cbca0673621fd40bbdf31b69c..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/struct_mutex.h +++ /dev/null @@ -1,63 +0,0 @@ -/* x86 internal mutex struct definitions. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _THREAD_MUTEX_INTERNAL_H -#define _THREAD_MUTEX_INTERNAL_H 1 - -struct __pthread_mutex_s -{ - int __lock; - unsigned int __count; - int __owner; -#ifdef __x86_64__ - unsigned int __nusers; -#endif - /* KIND must stay at this position in the structure to maintain - binary compatibility with static initializers. */ - int __kind; -#ifdef __x86_64__ - short __spins; - short __elision; - __pthread_list_t __list; -# define __PTHREAD_MUTEX_HAVE_PREV 1 -#else - unsigned int __nusers; - __extension__ union - { - struct - { - short __espins; - short __eelision; -# define __spins __elision_data.__espins -# define __elision __elision_data.__eelision - } __elision_data; - __pthread_slist_t __list; - }; -# define __PTHREAD_MUTEX_HAVE_PREV 0 -#endif -}; - -#ifdef __x86_64__ -# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ - 0, 0, 0, 0, __kind, 0, 0, { 0, 0 } -#else -# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ - 0, 0, 0, __kind, 0, { { 0, 0 } } -#endif - -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/i386-linux-gnu/bits/struct_rwlock.h deleted file mode 100644 index 022106d66cdb4ff8e0f82bc8aa2eb9e80ea0a466..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/struct_rwlock.h +++ /dev/null @@ -1,65 +0,0 @@ -/* x86 internal rwlock struct definitions. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _RWLOCK_INTERNAL_H -#define _RWLOCK_INTERNAL_H - -struct __pthread_rwlock_arch_t -{ - unsigned int __readers; - unsigned int __writers; - unsigned int __wrphase_futex; - unsigned int __writers_futex; - unsigned int __pad3; - unsigned int __pad4; -#ifdef __x86_64__ - int __cur_writer; - int __shared; - signed char __rwelision; -# ifdef __ILP32__ - unsigned char __pad1[3]; -# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 } -# else - unsigned char __pad1[7]; -# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 } -# endif - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned int __flags; -#else /* __x86_64__ */ - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; - unsigned char __shared; - signed char __rwelision; - unsigned char __pad2; - int __cur_writer; -#endif -}; - -#ifdef __x86_64__ -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, __flags -#else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 -#endif - -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/struct_stat.h b/lib/libc/include/i386-linux-gnu/bits/struct_stat.h deleted file mode 100644 index b3674c73c43565b0ff30101aae4a4baeccb6c838..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/struct_stat.h +++ /dev/null @@ -1,165 +0,0 @@ -/* Definition for struct stat. - Copyright (C) 2020-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STRUCT_STAT_H -#define _BITS_STRUCT_STAT_H 1 - -struct stat - { -#ifdef __USE_TIME_BITS64 -# include -#else - __dev_t st_dev; /* Device. */ -# ifndef __x86_64__ - unsigned short int __pad1; -# endif -# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -# else - __ino_t __st_ino; /* 32bit file serial number. */ -# endif -# ifndef __x86_64__ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -# else - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -# endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ -# ifdef __x86_64__ - int __pad0; -# endif - __dev_t st_rdev; /* Device number, if device. */ -# ifndef __x86_64__ - unsigned short int __pad2; -# endif -# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -# else - __off64_t st_size; /* Size of file, in bytes. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ -# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# endif -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ -# endif -# ifdef __x86_64__ - __syscall_slong_t __glibc_reserved[3]; -# else -# ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -# else - __ino64_t st_ino; /* File serial number. */ -# endif -# endif -#endif /* __USE_TIME_BITS64 */ - }; - -#ifdef __USE_LARGEFILE64 -/* Note stat64 has the same shape as stat for x86-64. */ -struct stat64 - { -# ifdef __USE_TIME_BITS64 -# include -# else - __dev_t st_dev; /* Device. */ -# ifdef __x86_64__ - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -# else - unsigned int __pad1; - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -# endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ -# ifdef __x86_64__ - int __pad0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -# else - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ -# endif -# ifdef __x86_64__ - __syscall_slong_t __glibc_reserved[3]; -# else - __ino64_t st_ino; /* File serial number. */ -# endif -# endif /* __USE_TIME_BITS64 */ - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/timesize.h b/lib/libc/include/i386-linux-gnu/bits/timesize.h deleted file mode 100644 index a1ca40d632af2e5cda7f954f5736f67cc53d37fb..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/timesize.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Bit size of the time_t type at glibc build time, x86-64 and x32 case. - Copyright (C) 2018-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if defined __x86_64__ && defined __ILP32__ -/* For x32, time is 64-bit even though word size is 32-bit. */ -# define __TIMESIZE 64 -#else -/* For others, time size is word size. */ -# define __TIMESIZE __WORDSIZE -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h deleted file mode 100644 index 6713836d1eec4e7203af5dc633a480ec0e9d58e8..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h +++ /dev/null @@ -1,38 +0,0 @@ -/* x86 implementation of the semaphore struct semid_ds. - Copyright (C) 1995-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SEM_H -# error "Never include directly; use instead." -#endif - -/* Data structure describing a set of semaphores. */ -struct semid_ds -{ -#ifdef __USE_TIME_BITS64 -# include -#else - struct ipc_perm sem_perm; /* operation permission struct */ - __time_t sem_otime; /* last semop() time */ - __syscall_ulong_t __sem_otime_high; - __time_t sem_ctime; /* last time changed by semctl() */ - __syscall_ulong_t __sem_ctime_high; - __syscall_ulong_t sem_nsems; /* number of semaphores in set */ - __syscall_ulong_t __glibc_reserved3; - __syscall_ulong_t __glibc_reserved4; -#endif -}; \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/typesizes.h b/lib/libc/include/i386-linux-gnu/bits/typesizes.h deleted file mode 100644 index 654f1c7b873efd6317245ed5dae99e75da8808cf..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/typesizes.h +++ /dev/null @@ -1,106 +0,0 @@ -/* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_TYPES_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_TYPESIZES_H -#define _BITS_TYPESIZES_H 1 - -/* See for the meaning of these macros. This file exists so - that need not vary across different GNU platforms. */ - -/* X32 kernel interface is 64-bit. */ -#if defined __x86_64__ && defined __ILP32__ -# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE -# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE -#else -# define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE -# define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE -#endif - -#define __DEV_T_TYPE __UQUAD_TYPE -#define __UID_T_TYPE __U32_TYPE -#define __GID_T_TYPE __U32_TYPE -#define __INO_T_TYPE __SYSCALL_ULONG_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE -#define __MODE_T_TYPE __U32_TYPE -#ifdef __x86_64__ -# define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE -# define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE -#else -# define __NLINK_T_TYPE __UWORD_TYPE -# define __FSWORD_T_TYPE __SWORD_TYPE -#endif -#define __OFF_T_TYPE __SYSCALL_SLONG_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE -#define __PID_T_TYPE __S32_TYPE -#define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE -#define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE -#define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE -#define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE -#define __ID_T_TYPE __U32_TYPE -#define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE -#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE -#define __USECONDS_T_TYPE __U32_TYPE -#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE -#define __SUSECONDS64_T_TYPE __SQUAD_TYPE -#define __DADDR_T_TYPE __S32_TYPE -#define __KEY_T_TYPE __S32_TYPE -#define __CLOCKID_T_TYPE __S32_TYPE -#define __TIMER_T_TYPE void * -#define __BLKSIZE_T_TYPE __SYSCALL_SLONG_TYPE -#define __FSID_T_TYPE struct { int __val[2]; } -#define __SSIZE_T_TYPE __SWORD_TYPE -#define __CPU_MASK_TYPE __SYSCALL_ULONG_TYPE - -#ifdef __x86_64__ -/* Tell the libc code that off_t and off64_t are actually the same type - for all ABI purposes, even if possibly expressed as different base types - for C type-checking purposes. */ -# define __OFF_T_MATCHES_OFF64_T 1 - -/* Same for ino_t and ino64_t. */ -# define __INO_T_MATCHES_INO64_T 1 - -/* And for __rlim_t and __rlim64_t. */ -# define __RLIM_T_MATCHES_RLIM64_T 1 - -/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ -# define __STATFS_MATCHES_STATFS64 1 - -/* And for getitimer, setitimer and rusage */ -# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 -#else -# define __RLIM_T_MATCHES_RLIM64_T 0 - -# define __STATFS_MATCHES_STATFS64 0 - -# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 -#endif - -/* Number of descriptors that can fit in an `fd_set'. */ -#define __FD_SETSIZE 1024 - - -#endif /* bits/typesizes.h */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/bits/wordsize.h b/lib/libc/include/i386-linux-gnu/bits/wordsize.h deleted file mode 100644 index 0bf84a4e99cb32b6b553e893e23b135d3b1723ee..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/bits/wordsize.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Determine the wordsize from the preprocessor defines. */ - -#if defined __x86_64__ && !defined __ILP32__ -# define __WORDSIZE 64 -#else -# define __WORDSIZE 32 -#define __WORDSIZE32_SIZE_ULONG 0 -#define __WORDSIZE32_PTRDIFF_LONG 0 -#endif - -#ifdef __x86_64__ -# define __WORDSIZE_TIME64_COMPAT32 1 -/* Both x86-64 and x32 use the 64-bit system call interface. */ -# define __SYSCALL_WORDSIZE 64 -#else -# define __WORDSIZE_TIME64_COMPAT32 0 -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h b/lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h deleted file mode 100644 index 5fdbe52a3c2c28d20e0a502018ba95d3dedf0dbb..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/finclude/math-vector-fortran.h +++ /dev/null @@ -1,43 +0,0 @@ -! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- -! Copyright (C) 2019-2021 Free Software Foundation, Inc. -! This file is part of the GNU C Library. -! -! The GNU C Library is free software; you can redistribute it and/or -! modify it under the terms of the GNU Lesser General Public -! License as published by the Free Software Foundation; either -! version 2.1 of the License, or (at your option) any later version. -! -! The GNU C Library is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY; without even the implied warranty of -! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -! Lesser General Public License for more details. -! -! You should have received a copy of the GNU Lesser General Public -! License along with the GNU C Library; if not, see -! . - -!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') -!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') - -!GCC$ builtin (cos) attributes simd (notinbranch) if('x32') -!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') -!GCC$ builtin (sin) attributes simd (notinbranch) if('x32') -!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') -!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') -!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') -!GCC$ builtin (log) attributes simd (notinbranch) if('x32') -!GCC$ builtin (logf) attributes simd (notinbranch) if('x32') -!GCC$ builtin (exp) attributes simd (notinbranch) if('x32') -!GCC$ builtin (expf) attributes simd (notinbranch) if('x32') -!GCC$ builtin (pow) attributes simd (notinbranch) if('x32') -!GCC$ builtin (powf) attributes simd (notinbranch) if('x32') \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/fpu_control.h b/lib/libc/include/i386-linux-gnu/fpu_control.h deleted file mode 100644 index 533e2da0d0872f74cf7b3e5f2dff94b6bd0faf8b..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/fpu_control.h +++ /dev/null @@ -1,109 +0,0 @@ -/* FPU control word bits. x86 version. - Copyright (C) 1993-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Olaf Flebbe. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _FPU_CONTROL_H -#define _FPU_CONTROL_H 1 - -/* Note that this file sets on x86-64 only the x87 FPU, it does not - touch the SSE unit. */ - -/* Here is the dirty part. Set up your 387 through the control word - * (cw) register. - * - * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0 - * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM - * - * IM: Invalid operation mask - * DM: Denormalized operand mask - * ZM: Zero-divide mask - * OM: Overflow mask - * UM: Underflow mask - * PM: Precision (inexact result) mask - * - * Mask bit is 1 means no interrupt. - * - * PC: Precision control - * 11 - round to extended precision - * 10 - round to double precision - * 00 - round to single precision - * - * RC: Rounding control - * 00 - rounding to nearest - * 01 - rounding down (toward - infinity) - * 10 - rounding up (toward + infinity) - * 11 - rounding toward zero - * - * IC: Infinity control - * That is for 8087 and 80287 only. - * - * The hardware default is 0x037f which we use. - */ - -#include - -/* masking of interrupts */ -#define _FPU_MASK_IM 0x01 -#define _FPU_MASK_DM 0x02 -#define _FPU_MASK_ZM 0x04 -#define _FPU_MASK_OM 0x08 -#define _FPU_MASK_UM 0x10 -#define _FPU_MASK_PM 0x20 - -/* precision control */ -#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */ -#define _FPU_DOUBLE 0x200 -#define _FPU_SINGLE 0x0 - -/* rounding control */ -#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */ -#define _FPU_RC_DOWN 0x400 -#define _FPU_RC_UP 0x800 -#define _FPU_RC_ZERO 0xC00 - -#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */ - - -/* The fdlibm code requires strict IEEE double precision arithmetic, - and no interrupts for exceptions, rounding to nearest. */ - -#define _FPU_DEFAULT 0x037f - -/* IEEE: same as above. */ -#define _FPU_IEEE 0x037f - -/* Type of the control word. */ -typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); - -/* Macros for accessing the hardware control word. "*&" is used to - work around a bug in older versions of GCC. __volatile__ is used - to support combination of writing the control register and reading - it back. Without __volatile__, the old value may be used for reading - back under compiler optimization. - - Note that the use of these macros is not sufficient anymore with - recent hardware nor on x86-64. Some floating point operations are - executed in the SSE/SSE2 engines which have their own control and - status register. */ -#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) -#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) - -/* Default control word set at startup. */ -extern fpu_control_t __fpu_control; - -#endif /* fpu_control.h */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/gnu/lib-names.h b/lib/libc/include/i386-linux-gnu/gnu/lib-names.h deleted file mode 100644 index aafc03bf7e212c37484434bef0cce2e59e87bf41..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/gnu/lib-names.h +++ /dev/null @@ -1,17 +0,0 @@ -/* This file is automatically generated. - It defines macros to allow user program to find the shared - library files which come as part of GNU libc. */ -#ifndef __GNU_LIB_NAMES_H -#define __GNU_LIB_NAMES_H 1 - -#if !defined __x86_64__ -# include -#endif -#if defined __x86_64__ && defined __LP64__ -# include -#endif -#if defined __x86_64__ && defined __ILP32__ -# include -#endif - -#endif /* gnu/lib-names.h */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/gnu/stubs.h b/lib/libc/include/i386-linux-gnu/gnu/stubs.h deleted file mode 100644 index a4c9b5f09725c302dd474bd91961d25023f1187c..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/gnu/stubs.h +++ /dev/null @@ -1,14 +0,0 @@ -/* This file is automatically generated. - This file selects the right generated file of `__stub_FUNCTION' macros - based on the architecture being compiled for. */ - - -#if !defined __x86_64__ -# include -#endif -#if defined __x86_64__ && defined __LP64__ -# include -#endif -#if defined __x86_64__ && defined __ILP32__ -# include -#endif \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/sys/elf.h b/lib/libc/include/i386-linux-gnu/sys/elf.h deleted file mode 100644 index 3731950870454d873c2b72e16be14b6dbf2c0ab9..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/sys/elf.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 1998-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_ELF_H -#define _SYS_ELF_H 1 - -#ifdef __x86_64__ -# error This header is unsupported on x86-64. -#else -# warning "This header is obsolete; use instead." - -# include -#endif - -#endif /* _SYS_ELF_H */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/sys/ptrace.h b/lib/libc/include/i386-linux-gnu/sys/ptrace.h deleted file mode 100644 index 461e83ae9c84fe8476edce9df017325981f5873e..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/sys/ptrace.h +++ /dev/null @@ -1,202 +0,0 @@ -/* `ptrace' debugger support interface. Linux/x86 version. - Copyright (C) 1996-2021 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_PTRACE_H -#define _SYS_PTRACE_H 1 - -#include -#include - -__BEGIN_DECLS - -/* Type of the REQUEST argument to `ptrace.' */ -enum __ptrace_request -{ - /* Indicate that the process making this request should be traced. - All signals received by this process can be intercepted by its - parent, and its parent can use the other `ptrace' requests. */ - PTRACE_TRACEME = 0, -#define PT_TRACE_ME PTRACE_TRACEME - - /* Return the word in the process's text space at address ADDR. */ - PTRACE_PEEKTEXT = 1, -#define PT_READ_I PTRACE_PEEKTEXT - - /* Return the word in the process's data space at address ADDR. */ - PTRACE_PEEKDATA = 2, -#define PT_READ_D PTRACE_PEEKDATA - - /* Return the word in the process's user area at offset ADDR. */ - PTRACE_PEEKUSER = 3, -#define PT_READ_U PTRACE_PEEKUSER - - /* Write the word DATA into the process's text space at address ADDR. */ - PTRACE_POKETEXT = 4, -#define PT_WRITE_I PTRACE_POKETEXT - - /* Write the word DATA into the process's data space at address ADDR. */ - PTRACE_POKEDATA = 5, -#define PT_WRITE_D PTRACE_POKEDATA - - /* Write the word DATA into the process's user area at offset ADDR. */ - PTRACE_POKEUSER = 6, -#define PT_WRITE_U PTRACE_POKEUSER - - /* Continue the process. */ - PTRACE_CONT = 7, -#define PT_CONTINUE PTRACE_CONT - - /* Kill the process. */ - PTRACE_KILL = 8, -#define PT_KILL PTRACE_KILL - - /* Single step the process. */ - PTRACE_SINGLESTEP = 9, -#define PT_STEP PTRACE_SINGLESTEP - - /* Get all general purpose registers used by a processes. */ - PTRACE_GETREGS = 12, -#define PT_GETREGS PTRACE_GETREGS - - /* Set all general purpose registers used by a processes. */ - PTRACE_SETREGS = 13, -#define PT_SETREGS PTRACE_SETREGS - - /* Get all floating point registers used by a processes. */ - PTRACE_GETFPREGS = 14, -#define PT_GETFPREGS PTRACE_GETFPREGS - - /* Set all floating point registers used by a processes. */ - PTRACE_SETFPREGS = 15, -#define PT_SETFPREGS PTRACE_SETFPREGS - - /* Attach to a process that is already running. */ - PTRACE_ATTACH = 16, -#define PT_ATTACH PTRACE_ATTACH - - /* Detach from a process attached to with PTRACE_ATTACH. */ - PTRACE_DETACH = 17, -#define PT_DETACH PTRACE_DETACH - - /* Get all extended floating point registers used by a processes. */ - PTRACE_GETFPXREGS = 18, -#define PT_GETFPXREGS PTRACE_GETFPXREGS - - /* Set all extended floating point registers used by a processes. */ - PTRACE_SETFPXREGS = 19, -#define PT_SETFPXREGS PTRACE_SETFPXREGS - - /* Continue and stop at the next entry to or return from syscall. */ - PTRACE_SYSCALL = 24, -#define PT_SYSCALL PTRACE_SYSCALL - - /* Get a TLS entry in the GDT. */ - PTRACE_GET_THREAD_AREA = 25, -#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA - - /* Change a TLS entry in the GDT. */ - PTRACE_SET_THREAD_AREA = 26, -#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA - -#ifdef __x86_64__ - /* Access TLS data. */ - PTRACE_ARCH_PRCTL = 30, -# define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL -#endif - - /* Continue and stop at the next syscall, it will not be executed. */ - PTRACE_SYSEMU = 31, -#define PT_SYSEMU PTRACE_SYSEMU - - /* Single step the process, the next syscall will not be executed. */ - PTRACE_SYSEMU_SINGLESTEP = 32, -#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP - - /* Execute process until next taken branch. */ - PTRACE_SINGLEBLOCK = 33, -#define PT_STEPBLOCK PTRACE_SINGLEBLOCK - - /* Set ptrace filter options. */ - PTRACE_SETOPTIONS = 0x4200, -#define PT_SETOPTIONS PTRACE_SETOPTIONS - - /* Get last ptrace message. */ - PTRACE_GETEVENTMSG = 0x4201, -#define PT_GETEVENTMSG PTRACE_GETEVENTMSG - - /* Get siginfo for process. */ - PTRACE_GETSIGINFO = 0x4202, -#define PT_GETSIGINFO PTRACE_GETSIGINFO - - /* Set new siginfo for process. */ - PTRACE_SETSIGINFO = 0x4203, -#define PT_SETSIGINFO PTRACE_SETSIGINFO - - /* Get register content. */ - PTRACE_GETREGSET = 0x4204, -#define PTRACE_GETREGSET PTRACE_GETREGSET - - /* Set register content. */ - PTRACE_SETREGSET = 0x4205, -#define PTRACE_SETREGSET PTRACE_SETREGSET - - /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect - signal or group stop state. */ - PTRACE_SEIZE = 0x4206, -#define PTRACE_SEIZE PTRACE_SEIZE - - /* Trap seized tracee. */ - PTRACE_INTERRUPT = 0x4207, -#define PTRACE_INTERRUPT PTRACE_INTERRUPT - - /* Wait for next group event. */ - PTRACE_LISTEN = 0x4208, -#define PTRACE_LISTEN PTRACE_LISTEN - - /* Retrieve siginfo_t structures without removing signals from a queue. */ - PTRACE_PEEKSIGINFO = 0x4209, -#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO - - /* Get the mask of blocked signals. */ - PTRACE_GETSIGMASK = 0x420a, -#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK - - /* Change the mask of blocked signals. */ - PTRACE_SETSIGMASK = 0x420b, -#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK - - /* Get seccomp BPF filters. */ - PTRACE_SECCOMP_GET_FILTER = 0x420c, -#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER - - /* Get seccomp BPF filter metadata. */ - PTRACE_SECCOMP_GET_METADATA = 0x420d, -#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA - - /* Get information about system call. */ - PTRACE_GET_SYSCALL_INFO = 0x420e -#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO -}; - - -#include - -__END_DECLS - -#endif /* _SYS_PTRACE_H */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/sys/ucontext.h b/lib/libc/include/i386-linux-gnu/sys/ucontext.h deleted file mode 100644 index f961c6aef830a8f4b65333c4d32e344ab0d73bc4..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/sys/ucontext.h +++ /dev/null @@ -1,262 +0,0 @@ -/* Copyright (C) 2001-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include -#include - - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -#ifdef __x86_64__ - -/* Type for general register. */ -__extension__ typedef long long int greg_t; - -/* Number of general registers. */ -#define __NGREG 23 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_GNU -/* Number of each register in the `gregset_t' array. */ -enum -{ - REG_R8 = 0, -# define REG_R8 REG_R8 - REG_R9, -# define REG_R9 REG_R9 - REG_R10, -# define REG_R10 REG_R10 - REG_R11, -# define REG_R11 REG_R11 - REG_R12, -# define REG_R12 REG_R12 - REG_R13, -# define REG_R13 REG_R13 - REG_R14, -# define REG_R14 REG_R14 - REG_R15, -# define REG_R15 REG_R15 - REG_RDI, -# define REG_RDI REG_RDI - REG_RSI, -# define REG_RSI REG_RSI - REG_RBP, -# define REG_RBP REG_RBP - REG_RBX, -# define REG_RBX REG_RBX - REG_RDX, -# define REG_RDX REG_RDX - REG_RAX, -# define REG_RAX REG_RAX - REG_RCX, -# define REG_RCX REG_RCX - REG_RSP, -# define REG_RSP REG_RSP - REG_RIP, -# define REG_RIP REG_RIP - REG_EFL, -# define REG_EFL REG_EFL - REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */ -# define REG_CSGSFS REG_CSGSFS - REG_ERR, -# define REG_ERR REG_ERR - REG_TRAPNO, -# define REG_TRAPNO REG_TRAPNO - REG_OLDMASK, -# define REG_OLDMASK REG_OLDMASK - REG_CR2 -# define REG_CR2 REG_CR2 -}; -#endif - -struct _libc_fpxreg -{ - unsigned short int __ctx(significand)[4]; - unsigned short int __ctx(exponent); - unsigned short int __glibc_reserved1[3]; -}; - -struct _libc_xmmreg -{ - __uint32_t __ctx(element)[4]; -}; - -struct _libc_fpstate -{ - /* 64-bit FXSAVE format. */ - __uint16_t __ctx(cwd); - __uint16_t __ctx(swd); - __uint16_t __ctx(ftw); - __uint16_t __ctx(fop); - __uint64_t __ctx(rip); - __uint64_t __ctx(rdp); - __uint32_t __ctx(mxcsr); - __uint32_t __ctx(mxcr_mask); - struct _libc_fpxreg _st[8]; - struct _libc_xmmreg _xmm[16]; - __uint32_t __glibc_reserved1[24]; -}; - -/* Structure to describe FPU registers. */ -typedef struct _libc_fpstate *fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - gregset_t __ctx(gregs); - /* Note that fpregs is a pointer. */ - fpregset_t __ctx(fpregs); - __extension__ unsigned long long __reserved1 [8]; -} mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long int __ctx(uc_flags); - struct ucontext_t *uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - sigset_t uc_sigmask; - struct _libc_fpstate __fpregs_mem; - __extension__ unsigned long long int __ssp[4]; - } ucontext_t; - -#else /* !__x86_64__ */ - -/* Type for general register. */ -typedef int greg_t; - -/* Number of general registers. */ -#define __NGREG 19 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_GNU -/* Number of each register is the `gregset_t' array. */ -enum -{ - REG_GS = 0, -# define REG_GS REG_GS - REG_FS, -# define REG_FS REG_FS - REG_ES, -# define REG_ES REG_ES - REG_DS, -# define REG_DS REG_DS - REG_EDI, -# define REG_EDI REG_EDI - REG_ESI, -# define REG_ESI REG_ESI - REG_EBP, -# define REG_EBP REG_EBP - REG_ESP, -# define REG_ESP REG_ESP - REG_EBX, -# define REG_EBX REG_EBX - REG_EDX, -# define REG_EDX REG_EDX - REG_ECX, -# define REG_ECX REG_ECX - REG_EAX, -# define REG_EAX REG_EAX - REG_TRAPNO, -# define REG_TRAPNO REG_TRAPNO - REG_ERR, -# define REG_ERR REG_ERR - REG_EIP, -# define REG_EIP REG_EIP - REG_CS, -# define REG_CS REG_CS - REG_EFL, -# define REG_EFL REG_EFL - REG_UESP, -# define REG_UESP REG_UESP - REG_SS -# define REG_SS REG_SS -}; -#endif - -/* Definitions taken from the kernel headers. */ -struct _libc_fpreg -{ - unsigned short int __ctx(significand)[4]; - unsigned short int __ctx(exponent); -}; - -struct _libc_fpstate -{ - unsigned long int __ctx(cw); - unsigned long int __ctx(sw); - unsigned long int __ctx(tag); - unsigned long int __ctx(ipoff); - unsigned long int __ctx(cssel); - unsigned long int __ctx(dataoff); - unsigned long int __ctx(datasel); - struct _libc_fpreg _st[8]; - unsigned long int __ctx(status); -}; - -/* Structure to describe FPU registers. */ -typedef struct _libc_fpstate *fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - gregset_t __ctx(gregs); - /* Due to Linux's history we have to use a pointer here. The SysV/i386 - ABI requires a struct with the values. */ - fpregset_t __ctx(fpregs); - unsigned long int __ctx(oldmask); - unsigned long int __ctx(cr2); - } mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long int __ctx(uc_flags); - struct ucontext_t *uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - sigset_t uc_sigmask; - struct _libc_fpstate __fpregs_mem; - unsigned long int __ssp[4]; - } ucontext_t; - -#endif /* !__x86_64__ */ - -#undef __ctx - -#endif /* sys/ucontext.h */ \ No newline at end of file diff --git a/lib/libc/include/i386-linux-gnu/sys/user.h b/lib/libc/include/i386-linux-gnu/sys/user.h deleted file mode 100644 index 0f64e565eb618846a993dde7c108a5be4aa545c6..0000000000000000000000000000000000000000 --- a/lib/libc/include/i386-linux-gnu/sys/user.h +++ /dev/null @@ -1,180 +0,0 @@ -/* Copyright (C) 2001-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_USER_H -#define _SYS_USER_H 1 - -/* The whole purpose of this file is for GDB and GDB only. Don't read - too much into it. Don't use it for anything other than GDB unless - you know what you are doing. */ - -#ifdef __x86_64__ - -struct user_fpregs_struct -{ - unsigned short int cwd; - unsigned short int swd; - unsigned short int ftw; - unsigned short int fop; - __extension__ unsigned long long int rip; - __extension__ unsigned long long int rdp; - unsigned int mxcsr; - unsigned int mxcr_mask; - unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ - unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ - unsigned int padding[24]; -}; - -struct user_regs_struct -{ - __extension__ unsigned long long int r15; - __extension__ unsigned long long int r14; - __extension__ unsigned long long int r13; - __extension__ unsigned long long int r12; - __extension__ unsigned long long int rbp; - __extension__ unsigned long long int rbx; - __extension__ unsigned long long int r11; - __extension__ unsigned long long int r10; - __extension__ unsigned long long int r9; - __extension__ unsigned long long int r8; - __extension__ unsigned long long int rax; - __extension__ unsigned long long int rcx; - __extension__ unsigned long long int rdx; - __extension__ unsigned long long int rsi; - __extension__ unsigned long long int rdi; - __extension__ unsigned long long int orig_rax; - __extension__ unsigned long long int rip; - __extension__ unsigned long long int cs; - __extension__ unsigned long long int eflags; - __extension__ unsigned long long int rsp; - __extension__ unsigned long long int ss; - __extension__ unsigned long long int fs_base; - __extension__ unsigned long long int gs_base; - __extension__ unsigned long long int ds; - __extension__ unsigned long long int es; - __extension__ unsigned long long int fs; - __extension__ unsigned long long int gs; -}; - -struct user -{ - struct user_regs_struct regs; - int u_fpvalid; - struct user_fpregs_struct i387; - __extension__ unsigned long long int u_tsize; - __extension__ unsigned long long int u_dsize; - __extension__ unsigned long long int u_ssize; - __extension__ unsigned long long int start_code; - __extension__ unsigned long long int start_stack; - __extension__ long long int signal; - int reserved; - __extension__ union - { - struct user_regs_struct* u_ar0; - __extension__ unsigned long long int __u_ar0_word; - }; - __extension__ union - { - struct user_fpregs_struct* u_fpstate; - __extension__ unsigned long long int __u_fpstate_word; - }; - __extension__ unsigned long long int magic; - char u_comm [32]; - __extension__ unsigned long long int u_debugreg [8]; -}; - -#else -/* These are the 32-bit x86 structures. */ -struct user_fpregs_struct -{ - long int cwd; - long int swd; - long int twd; - long int fip; - long int fcs; - long int foo; - long int fos; - long int st_space [20]; -}; - -struct user_fpxregs_struct -{ - unsigned short int cwd; - unsigned short int swd; - unsigned short int twd; - unsigned short int fop; - long int fip; - long int fcs; - long int foo; - long int fos; - long int mxcsr; - long int reserved; - long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ - long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ - long int padding[56]; -}; - -struct user_regs_struct -{ - long int ebx; - long int ecx; - long int edx; - long int esi; - long int edi; - long int ebp; - long int eax; - long int xds; - long int xes; - long int xfs; - long int xgs; - long int orig_eax; - long int eip; - long int xcs; - long int eflags; - long int esp; - long int xss; -}; - -struct user -{ - struct user_regs_struct regs; - int u_fpvalid; - struct user_fpregs_struct i387; - unsigned long int u_tsize; - unsigned long int u_dsize; - unsigned long int u_ssize; - unsigned long int start_code; - unsigned long int start_stack; - long int signal; - int reserved; - struct user_regs_struct* u_ar0; - struct user_fpregs_struct* u_fpstate; - unsigned long int magic; - char u_comm [32]; - int u_debugreg [8]; -}; -#endif /* __x86_64__ */ - -#define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) -#define NBPG PAGE_SIZE -#define UPAGES 1 -#define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) - -#endif /* _SYS_USER_H */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/a.out.h b/lib/libc/include/x86-linux-gnu/bits/a.out.h new file mode 100644 index 0000000000000000000000000000000000000000..3c81a52dbb722d43ee30bdaace3ea88e01ffc8cf --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/a.out.h @@ -0,0 +1,11 @@ +#ifndef __A_OUT_GNU_H__ +# error "Never use directly; include instead." +#endif + +#ifdef __x86_64__ + +/* Signal to users of this header that this architecture really doesn't + support a.out binary format. */ +#define __NO_A_OUT_SUPPORT 1 + +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/endianness.h b/lib/libc/include/x86-linux-gnu/bits/endianness.h new file mode 100644 index 0000000000000000000000000000000000000000..80180b782e3b603bfd65bb9a42ca99beda21a318 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* i386/x86_64 are little-endian. */ +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* bits/endianness.h */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/environments.h b/lib/libc/include/x86-linux-gnu/bits/environments.h new file mode 100644 index 0000000000000000000000000000000000000000..72a871ff4de397f64f5f7cf4b5f5e70a6f02c59d --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/environments.h @@ -0,0 +1,105 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _UNISTD_H +# error "Never include this file directly. Use instead" +#endif + +#include + +/* This header should define the following symbols under the described + situations. A value `1' means that the model is always supported, + `-1' means it is never supported. Undefined means it cannot be + statically decided. + + _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type + _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type + + _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type + _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type + + The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, + _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, + _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were + used in previous versions of the Unix standard and are available + only for compatibility. +*/ + +#if __WORDSIZE == 64 + +/* Environments with 32-bit wide pointers are optionally provided. + Therefore following macros aren't defined: + # undef _POSIX_V7_ILP32_OFF32 + # undef _POSIX_V7_ILP32_OFFBIG + # undef _POSIX_V6_ILP32_OFF32 + # undef _POSIX_V6_ILP32_OFFBIG + # undef _XBS5_ILP32_OFF32 + # undef _XBS5_ILP32_OFFBIG + and users need to check at runtime. */ + +/* We also have no use (for now) for an environment with bigger pointers + and offsets. */ +# define _POSIX_V7_LPBIG_OFFBIG -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* By default we have 64-bit wide `long int', pointers and `off_t'. */ +# define _POSIX_V7_LP64_OFF64 1 +# define _POSIX_V6_LP64_OFF64 1 +# define _XBS5_LP64_OFF64 1 + +#else /* __WORDSIZE == 32 */ + +/* We have 32-bit wide `int', `long int' and pointers and all platforms + support LFS. -mx32 has 64-bit wide `off_t'. */ +# define _POSIX_V7_ILP32_OFFBIG 1 +# define _POSIX_V6_ILP32_OFFBIG 1 +# define _XBS5_ILP32_OFFBIG 1 + +# ifndef __x86_64__ +/* -m32 has 32-bit wide `off_t'. */ +# define _POSIX_V7_ILP32_OFF32 1 +# define _POSIX_V6_ILP32_OFF32 1 +# define _XBS5_ILP32_OFF32 1 +# endif + +/* We optionally provide an environment with the above size but an 64-bit + side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ + +/* Environments with 64-bit wide pointers can be provided, + so these macros aren't defined: + # undef _POSIX_V7_LP64_OFF64 + # undef _POSIX_V7_LPBIG_OFFBIG + # undef _POSIX_V6_LP64_OFF64 + # undef _POSIX_V6_LPBIG_OFFBIG + # undef _XBS5_LP64_OFF64 + # undef _XBS5_LPBIG_OFFBIG + and sysconf tests for it at runtime. */ + +#endif /* __WORDSIZE == 32 */ + +#define __ILP32_OFF32_CFLAGS "-m32" +#define __ILP32_OFF32_LDFLAGS "-m32" +#if defined __x86_64__ && defined __ILP32__ +# define __ILP32_OFFBIG_CFLAGS "-mx32" +# define __ILP32_OFFBIG_LDFLAGS "-mx32" +#else +# define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +# define __ILP32_OFFBIG_LDFLAGS "-m32" +#endif +#define __LP64_OFF64_CFLAGS "-m64" +#define __LP64_OFF64_LDFLAGS "-m64" \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/epoll.h b/lib/libc/include/x86-linux-gnu/bits/epoll.h new file mode 100644 index 0000000000000000000000000000000000000000..4bda3c54ef2f9331ac170b7e33d85aa1d55004bd --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/epoll.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_EPOLL_H +# error "Never use directly; include instead." +#endif + +/* Flags to be passed to epoll_create1. */ +enum + { + EPOLL_CLOEXEC = 02000000 +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + }; + +#define __EPOLL_PACKED __attribute__ ((__packed__)) \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/fcntl.h b/lib/libc/include/x86-linux-gnu/bits/fcntl.h new file mode 100644 index 0000000000000000000000000000000000000000..de1b65f104f965926417c07a8466d61ed6bd5fc4 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/fcntl.h @@ -0,0 +1,61 @@ +/* O_*, F_*, FD_* bit values for Linux/x86. + Copyright (C) 2001-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + +#ifdef __x86_64__ +# define __O_LARGEFILE 0 +#endif + +#ifdef __x86_64__ +/* Not necessary, we always have 64-bit offsets. */ +# define F_GETLK64 5 /* Get record locking info. */ +# define F_SETLK64 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW64 7 /* Set record locking info (blocking). */ +#endif + + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Include generic Linux declarations. */ +#include \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/fenv.h b/lib/libc/include/x86-linux-gnu/bits/fenv.h new file mode 100644 index 0000000000000000000000000000000000000000..dd01ba9442e7648df13d829ffb4c664fe0c30af5 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/fenv.h @@ -0,0 +1,116 @@ +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _FENV_H +# error "Never use directly; include instead." +#endif + +/* Define bits representing the exception. We use the bit positions + of the appropriate bits in the FPU control word. */ +enum + { + FE_INVALID = +#define FE_INVALID 0x01 + FE_INVALID, + __FE_DENORM = 0x02, + FE_DIVBYZERO = +#define FE_DIVBYZERO 0x04 + FE_DIVBYZERO, + FE_OVERFLOW = +#define FE_OVERFLOW 0x08 + FE_OVERFLOW, + FE_UNDERFLOW = +#define FE_UNDERFLOW 0x10 + FE_UNDERFLOW, + FE_INEXACT = +#define FE_INEXACT 0x20 + FE_INEXACT + }; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* The ix87 FPU supports all of the four defined rounding modes. We + use again the bit positions in the FPU control word as the values + for the appropriate macros. */ +enum + { + FE_TONEAREST = +#define FE_TONEAREST 0 + FE_TONEAREST, + FE_DOWNWARD = +#define FE_DOWNWARD 0x400 + FE_DOWNWARD, + FE_UPWARD = +#define FE_UPWARD 0x800 + FE_UPWARD, + FE_TOWARDZERO = +#define FE_TOWARDZERO 0xc00 + FE_TOWARDZERO + }; + + +/* Type representing exception flags. */ +typedef unsigned short int fexcept_t; + + +/* Type representing floating-point environment. This structure + corresponds to the layout of the block written by the `fstenv' + instruction and has additional fields for the contents of the MXCSR + register as written by the `stmxcsr' instruction. */ +typedef struct + { + unsigned short int __control_word; + unsigned short int __glibc_reserved1; + unsigned short int __status_word; + unsigned short int __glibc_reserved2; + unsigned short int __tags; + unsigned short int __glibc_reserved3; + unsigned int __eip; + unsigned short int __cs_selector; + unsigned int __opcode:11; + unsigned int __glibc_reserved4:5; + unsigned int __data_offset; + unsigned short int __data_selector; + unsigned short int __glibc_reserved5; +#ifdef __x86_64__ + unsigned int __mxcsr; +#endif + } +fenv_t; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((const fenv_t *) -1) + +#ifdef __USE_GNU +/* Floating-point environment where none of the exception is masked. */ +# define FE_NOMASK_ENV ((const fenv_t *) -2) +#endif + +#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) +/* Type representing floating-point control modes. */ +typedef struct + { + unsigned short int __control_word; + unsigned short int __glibc_reserved; + unsigned int __mxcsr; + } +femode_t; + +/* Default floating-point control modes. */ +# define FE_DFL_MODE ((const femode_t *) -1L) +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/floatn.h b/lib/libc/include/x86-linux-gnu/bits/floatn.h new file mode 100644 index 0000000000000000000000000000000000000000..5818af200103f563ab8b3b89776b1fe2dd8de761 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/floatn.h @@ -0,0 +1,121 @@ +/* Macros to control TS 18661-3 glibc features on x86. + Copyright (C) 2017-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_FLOATN_H +#define _BITS_FLOATN_H + +#include + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this + glibc includes corresponding *f128 interfaces for it. The required + libgcc support was added some time after the basic compiler + support, for x86_64 and x86. */ +#if (defined __x86_64__ \ + ? __GNUC_PREREQ (4, 3) \ + : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) +# define __HAVE_FLOAT128 1 +#else +# define __HAVE_FLOAT128 0 +#endif + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#if __HAVE_FLOAT128 +# define __HAVE_DISTINCT_FLOAT128 1 +#else +# define __HAVE_DISTINCT_FLOAT128 0 +#endif + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 1 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 1 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. */ +# if __HAVE_FLOAT128 +# if !__GNUC_PREREQ (7, 0) || defined __cplusplus +/* The literal suffix f128 exists only since GCC 7.0. */ +# define __f128(x) x##q +# else +# define __f128(x) x##f128 +# endif +# endif + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ +# if __HAVE_FLOAT128 +# if !__GNUC_PREREQ (7, 0) || defined __cplusplus +/* Add a typedef for older GCC compilers which don't natively support + _Complex _Float128. */ +typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); +# define __CFLOAT128 __cfloat128 +# else +# define __CFLOAT128 _Complex _Float128 +# endif +# endif + +/* The remaining of this file provides support for older compilers. */ +# if __HAVE_FLOAT128 + +/* The type _Float128 exists only since GCC 7.0. */ +# if !__GNUC_PREREQ (7, 0) || defined __cplusplus +typedef __float128 _Float128; +# endif + +/* __builtin_huge_valf128 doesn't exist before GCC 7.0. */ +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ()) +# endif + +/* Older GCC has only a subset of built-in functions for _Float128 on + x86, and __builtin_infq is not usable in static initializers. + Converting a narrower sNaN to _Float128 produces a quiet NaN, so + attempts to use _Float128 sNaNs will not work properly with older + compilers. */ +# if !__GNUC_PREREQ (7, 0) +# define __builtin_copysignf128 __builtin_copysignq +# define __builtin_fabsf128 __builtin_fabsq +# define __builtin_inff128() ((_Float128) __builtin_inf ()) +# define __builtin_nanf128(x) ((_Float128) __builtin_nan (x)) +# define __builtin_nansf128(x) ((_Float128) __builtin_nans (x)) +# endif + +/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*, + e.g.: __builtin_signbitf128, before GCC 6. However, there has never + been a __builtin_signbitf128 in GCC and the type-generic builtin is + only available since GCC 6. */ +# if !__GNUC_PREREQ (6, 0) +# define __builtin_signbitf128 __signbitf128 +# endif + +# endif + +#endif /* !__ASSEMBLER__. */ + +#include + +#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/flt-eval-method.h b/lib/libc/include/x86-linux-gnu/bits/flt-eval-method.h new file mode 100644 index 0000000000000000000000000000000000000000..c714d6ed236f37ba47c46b07f0427d7f4fede23d --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/flt-eval-method.h @@ -0,0 +1,33 @@ +/* Define __GLIBC_FLT_EVAL_METHOD. x86 version. + Copyright (C) 2016-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#ifdef __FLT_EVAL_METHOD__ +# if __FLT_EVAL_METHOD__ == -1 +# define __GLIBC_FLT_EVAL_METHOD 2 +# else +# define __GLIBC_FLT_EVAL_METHOD __FLT_EVAL_METHOD__ +# endif +#elif defined __x86_64__ +# define __GLIBC_FLT_EVAL_METHOD 0 +#else +# define __GLIBC_FLT_EVAL_METHOD 2 +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/fp-logb.h b/lib/libc/include/x86-linux-gnu/bits/fp-logb.h new file mode 100644 index 0000000000000000000000000000000000000000..7c1bfa72bd5add534071850e5c498ad6e8b1db53 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/fp-logb.h @@ -0,0 +1,24 @@ +/* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN. x86 version. + Copyright (C) 2016-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#define __FP_LOGB0_IS_MIN 1 +#define __FP_LOGBNAN_IS_MIN 1 \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/indirect-return.h b/lib/libc/include/x86-linux-gnu/bits/indirect-return.h new file mode 100644 index 0000000000000000000000000000000000000000..4bf822a84c03e71ba8cb75841166546da1e5af40 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/indirect-return.h @@ -0,0 +1,37 @@ +/* Definition of __INDIRECT_RETURN. x86 version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _UCONTEXT_H +# error "Never include directly; use instead." +#endif + +/* On x86, swapcontext returns via indirect branch when the shadow stack + is enabled. Define __INDIRECT_RETURN to indicate whether swapcontext + returns via indirect branch. */ +#if defined __CET__ && (__CET__ & 2) != 0 +# if __glibc_has_attribute (__indirect_return__) +# define __INDIRECT_RETURN __attribute__ ((__indirect_return__)) +# else +/* Newer compilers provide the indirect_return attribute, but without + it we can use returns_twice to affect the optimizer in the same + way and avoid unsafe optimizations. */ +# define __INDIRECT_RETURN __attribute__ ((__returns_twice__)) +# endif +#else +# define __INDIRECT_RETURN +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/ipctypes.h b/lib/libc/include/x86-linux-gnu/bits/ipctypes.h new file mode 100644 index 0000000000000000000000000000000000000000..9c301e1a3cdd67c3daafe5762ba5f02e77768d3d --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/ipctypes.h @@ -0,0 +1,33 @@ +/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. + Copyright (C) 2012-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_IPC_H +# error "Never use directly; include instead." +#endif + +#ifndef _BITS_IPCTYPES_H +#define _BITS_IPCTYPES_H 1 + +/* Used in `struct shmid_ds'. */ +# ifdef __x86_64__ +typedef int __ipc_pid_t; +# else +typedef unsigned short int __ipc_pid_t; +# endif + +#endif /* bits/ipctypes.h */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/iscanonical.h b/lib/libc/include/x86-linux-gnu/bits/iscanonical.h new file mode 100644 index 0000000000000000000000000000000000000000..8e6c0d05f5016f5a498a62ab68c72468d0142931 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/iscanonical.h @@ -0,0 +1,54 @@ +/* Define iscanonical macro. ldbl-96 version. + Copyright (C) 2016-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +extern int __iscanonicall (long double __x) + __THROW __attribute__ ((__const__)); +#define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1) +#define __iscanonical(x) ((void) (__typeof (x)) (x), 1) +#if __HAVE_DISTINCT_FLOAT128 +# define __iscanonicalf128(x) ((void) (__typeof (x)) (x), 1) +#endif + +/* Return nonzero value if X is canonical. In IEEE interchange binary + formats, all values are canonical, but the argument must still be + converted to its semantic type for any exceptions arising from the + conversion, before being discarded; in extended precision, there + are encodings that are not consistently handled as corresponding to + any particular value of the type, and we return 0 for those. */ +#ifndef __cplusplus +# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) +#else +/* In C++ mode, __MATH_TG cannot be used, because it relies on + __builtin_types_compatible_p, which is a C-only builtin. On the + other hand, overloading provides the means to distinguish between + the floating-point types. The overloading resolution will match + the correct parameter (regardless of type qualifiers (i.e.: const + and volatile)). */ +extern "C++" { +inline int iscanonical (float __val) { return __iscanonicalf (__val); } +inline int iscanonical (double __val) { return __iscanonical (__val); } +inline int iscanonical (long double __val) { return __iscanonicall (__val); } +# if __HAVE_DISTINCT_FLOAT128 +inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); } +# endif +} +#endif /* __cplusplus */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/link.h b/lib/libc/include/x86-linux-gnu/bits/link.h new file mode 100644 index 0000000000000000000000000000000000000000..9774e993a3c9e35dfe6698df6815cd2828ae570a --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/link.h @@ -0,0 +1,159 @@ +/* Copyright (C) 2004-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _LINK_H +# error "Never include directly; use instead." +#endif + + +#ifndef __x86_64__ +/* Registers for entry into PLT on IA-32. */ +typedef struct La_i86_regs +{ + uint32_t lr_edx; + uint32_t lr_ecx; + uint32_t lr_eax; + uint32_t lr_ebp; + uint32_t lr_esp; +} La_i86_regs; + +/* Return values for calls from PLT on IA-32. */ +typedef struct La_i86_retval +{ + uint32_t lrv_eax; + uint32_t lrv_edx; + long double lrv_st0; + long double lrv_st1; + uint64_t lrv_bnd0; + uint64_t lrv_bnd1; +} La_i86_retval; + + +__BEGIN_DECLS + +extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_i86_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_i86_regs *__inregs, + La_i86_retval *__outregs, + const char *symname); + +__END_DECLS + +#else + +/* Registers for entry into PLT on x86-64. */ +# if __GNUC_PREREQ (4,0) +typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16))); +typedef float La_x86_64_ymm + __attribute__ ((__vector_size__ (32), __aligned__ (16))); +typedef double La_x86_64_zmm + __attribute__ ((__vector_size__ (64), __aligned__ (16))); +# else +typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__))); +# endif + +typedef union +{ +# if __GNUC_PREREQ (4,0) + La_x86_64_ymm ymm[2]; + La_x86_64_zmm zmm[1]; +# endif + La_x86_64_xmm xmm[4]; +} La_x86_64_vector __attribute__ ((__aligned__ (16))); + +typedef struct La_x86_64_regs +{ + uint64_t lr_rdx; + uint64_t lr_r8; + uint64_t lr_r9; + uint64_t lr_rcx; + uint64_t lr_rsi; + uint64_t lr_rdi; + uint64_t lr_rbp; + uint64_t lr_rsp; + La_x86_64_xmm lr_xmm[8]; + La_x86_64_vector lr_vector[8]; +#ifndef __ILP32__ + __int128_t lr_bnd[4]; +#endif +} La_x86_64_regs; + +/* Return values for calls from PLT on x86-64. */ +typedef struct La_x86_64_retval +{ + uint64_t lrv_rax; + uint64_t lrv_rdx; + La_x86_64_xmm lrv_xmm0; + La_x86_64_xmm lrv_xmm1; + long double lrv_st0; + long double lrv_st1; + La_x86_64_vector lrv_vector0; + La_x86_64_vector lrv_vector1; +#ifndef __ILP32__ + __int128_t lrv_bnd0; + __int128_t lrv_bnd1; +#endif +} La_x86_64_retval; + +#define La_x32_regs La_x86_64_regs +#define La_x32_retval La_x86_64_retval + +__BEGIN_DECLS + +extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_x86_64_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_x86_64_regs *__inregs, + La_x86_64_retval *__outregs, + const char *__symname); + +extern Elf32_Addr la_x32_gnu_pltenter (Elf32_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_x32_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_x32_gnu_pltexit (Elf32_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_x32_regs *__inregs, + La_x32_retval *__outregs, + const char *__symname); + +__END_DECLS + +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/long-double.h b/lib/libc/include/x86-linux-gnu/bits/long-double.h new file mode 100644 index 0000000000000000000000000000000000000000..ef3832bc80d643a47f2501845cab95ac4316e201 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/long-double.h @@ -0,0 +1,21 @@ +/* Properties of long double type. ldbl-96 version. + Copyright (C) 2016-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* long double is distinct from double, so there is nothing to + define here. */ +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/math-vector.h b/lib/libc/include/x86-linux-gnu/bits/math-vector.h new file mode 100644 index 0000000000000000000000000000000000000000..6e94f42ca81228bdf7d5e17ac829538784422e31 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/math-vector.h @@ -0,0 +1,63 @@ +/* Platform-specific SIMD declarations of math functions. + Copyright (C) 2014-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _MATH_H +# error "Never include directly;\ + include instead." +#endif + +/* Get default empty definitions for simd declarations. */ +#include + +#if defined __x86_64__ && defined __FAST_MATH__ +# if defined _OPENMP && _OPENMP >= 201307 +/* OpenMP case. */ +# define __DECL_SIMD_x86_64 _Pragma ("omp declare simd notinbranch") +# elif __GNUC_PREREQ (6,0) +/* W/o OpenMP use GCC 6.* __attribute__ ((__simd__)). */ +# define __DECL_SIMD_x86_64 __attribute__ ((__simd__ ("notinbranch"))) +# endif + +# ifdef __DECL_SIMD_x86_64 +# undef __DECL_SIMD_cos +# define __DECL_SIMD_cos __DECL_SIMD_x86_64 +# undef __DECL_SIMD_cosf +# define __DECL_SIMD_cosf __DECL_SIMD_x86_64 +# undef __DECL_SIMD_sin +# define __DECL_SIMD_sin __DECL_SIMD_x86_64 +# undef __DECL_SIMD_sinf +# define __DECL_SIMD_sinf __DECL_SIMD_x86_64 +# undef __DECL_SIMD_sincos +# define __DECL_SIMD_sincos __DECL_SIMD_x86_64 +# undef __DECL_SIMD_sincosf +# define __DECL_SIMD_sincosf __DECL_SIMD_x86_64 +# undef __DECL_SIMD_log +# define __DECL_SIMD_log __DECL_SIMD_x86_64 +# undef __DECL_SIMD_logf +# define __DECL_SIMD_logf __DECL_SIMD_x86_64 +# undef __DECL_SIMD_exp +# define __DECL_SIMD_exp __DECL_SIMD_x86_64 +# undef __DECL_SIMD_expf +# define __DECL_SIMD_expf __DECL_SIMD_x86_64 +# undef __DECL_SIMD_pow +# define __DECL_SIMD_pow __DECL_SIMD_x86_64 +# undef __DECL_SIMD_powf +# define __DECL_SIMD_powf __DECL_SIMD_x86_64 + +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/mman.h b/lib/libc/include/x86-linux-gnu/bits/mman.h new file mode 100644 index 0000000000000000000000000000000000000000..8c96873c8645fe386f2467e9974b3492891bd97c --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/mman.h @@ -0,0 +1,34 @@ +/* Definitions for POSIX memory map interface. Linux/x86_64 version. + Copyright (C) 2001-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + +/* Other flags. */ +#ifdef __USE_MISC +# define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */ +#endif + +#include + +/* Include generic Linux declarations. */ +#include \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/procfs-id.h b/lib/libc/include/x86-linux-gnu/bits/procfs-id.h new file mode 100644 index 0000000000000000000000000000000000000000..bada981489a50a58b41189cdf5bdfad7ed071498 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/procfs-id.h @@ -0,0 +1,30 @@ +/* Types of pr_uid and pr_gid in struct elf_prpsinfo. x86 version. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_PROCFS_H +# error "Never include directly; use instead." +#endif + +#if __WORDSIZE == 32 +typedef unsigned short int __pr_uid_t; +typedef unsigned short int __pr_gid_t; +#else +typedef unsigned int __pr_uid_t; +typedef unsigned int __pr_gid_t; +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/procfs.h b/lib/libc/include/x86-linux-gnu/bits/procfs.h new file mode 100644 index 0000000000000000000000000000000000000000..b670484f2a498dd677f674a0200e1e1c3fdfe939 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/procfs.h @@ -0,0 +1,50 @@ +/* Types for registers for sys/procfs.h. x86 version. + Copyright (C) 2001-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_PROCFS_H +# error "Never include directly; use instead." +#endif + +/* Type for a general-purpose register. */ +#ifdef __x86_64__ +__extension__ typedef unsigned long long elf_greg_t; +#else +typedef unsigned long elf_greg_t; +#endif + +/* And the whole bunch of them. We could have used `struct + user_regs_struct' directly in the typedef, but tradition says that + the register set is an array, which does have some peculiar + semantics, so leave it that way. */ +#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +#ifndef __x86_64__ +/* Register set for the floating-point registers. */ +typedef struct user_fpregs_struct elf_fpregset_t; + +/* Register set for the extended floating-point registers. Includes + the Pentium III SSE registers in addition to the classic + floating-point stuff. */ +typedef struct user_fpxregs_struct elf_fpxregset_t; +#else +/* Register set for the extended floating-point registers. Includes + the Pentium III SSE registers in addition to the classic + floating-point stuff. */ +typedef struct user_fpregs_struct elf_fpregset_t; +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/x86-linux-gnu/bits/pthreadtypes-arch.h new file mode 100644 index 0000000000000000000000000000000000000000..89b363fb2c690c0e4257ace9972e54af6ae09741 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/pthreadtypes-arch.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_PTHREADTYPES_ARCH_H +#define _BITS_PTHREADTYPES_ARCH_H 1 + +#include + +#ifdef __x86_64__ +# if __WORDSIZE == 64 +# define __SIZEOF_PTHREAD_MUTEX_T 40 +# define __SIZEOF_PTHREAD_ATTR_T 56 +# define __SIZEOF_PTHREAD_RWLOCK_T 56 +# define __SIZEOF_PTHREAD_BARRIER_T 32 +# else +# define __SIZEOF_PTHREAD_MUTEX_T 32 +# define __SIZEOF_PTHREAD_ATTR_T 32 +# define __SIZEOF_PTHREAD_RWLOCK_T 44 +# define __SIZEOF_PTHREAD_BARRIER_T 20 +# endif +#else +# define __SIZEOF_PTHREAD_MUTEX_T 24 +# define __SIZEOF_PTHREAD_ATTR_T 36 +# define __SIZEOF_PTHREAD_RWLOCK_T 32 +# define __SIZEOF_PTHREAD_BARRIER_T 20 +#endif +#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +#define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 +#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + +#define __LOCK_ALIGNMENT +#define __ONCE_ALIGNMENT + +#ifndef __x86_64__ +/* Extra attributes for the cleanup functions. */ +# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1))) +#endif + +#endif /* bits/pthreadtypes.h */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/setjmp.h b/lib/libc/include/x86-linux-gnu/bits/setjmp.h new file mode 100644 index 0000000000000000000000000000000000000000..9e96a2ff9876995f8c9b65a4a586e17984ebead4 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/setjmp.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Define the machine-dependent type `jmp_buf'. x86-64 version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H +# error "Never include directly; use instead." +#endif + +#include + +#ifndef _ASM + +# if __WORDSIZE == 64 +typedef long int __jmp_buf[8]; +# elif defined __x86_64__ +__extension__ typedef long long int __jmp_buf[8]; +# else +typedef int __jmp_buf[6]; +# endif + +#endif + +#endif /* bits/setjmp.h */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/sigcontext.h b/lib/libc/include/x86-linux-gnu/bits/sigcontext.h new file mode 100644 index 0000000000000000000000000000000000000000..4f03980c986b772d0857e8065cdc360f171819a1 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/sigcontext.h @@ -0,0 +1,196 @@ +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_SIGCONTEXT_H +#define _BITS_SIGCONTEXT_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never use directly; include instead." +#endif + +#include + +#define FP_XSTATE_MAGIC1 0x46505853U +#define FP_XSTATE_MAGIC2 0x46505845U +#define FP_XSTATE_MAGIC2_SIZE sizeof (FP_XSTATE_MAGIC2) + +struct _fpx_sw_bytes +{ + __uint32_t magic1; + __uint32_t extended_size; + __uint64_t xstate_bv; + __uint32_t xstate_size; + __uint32_t __glibc_reserved1[7]; +}; + +struct _fpreg +{ + unsigned short significand[4]; + unsigned short exponent; +}; + +struct _fpxreg +{ + unsigned short significand[4]; + unsigned short exponent; + unsigned short __glibc_reserved1[3]; +}; + +struct _xmmreg +{ + __uint32_t element[4]; +}; + + + +#ifndef __x86_64__ + +struct _fpstate +{ + /* Regular FPU environment. */ + __uint32_t cw; + __uint32_t sw; + __uint32_t tag; + __uint32_t ipoff; + __uint32_t cssel; + __uint32_t dataoff; + __uint32_t datasel; + struct _fpreg _st[8]; + unsigned short status; + unsigned short magic; + + /* FXSR FPU environment. */ + __uint32_t _fxsr_env[6]; + __uint32_t mxcsr; + __uint32_t __glibc_reserved1; + struct _fpxreg _fxsr_st[8]; + struct _xmmreg _xmm[8]; + __uint32_t __glibc_reserved2[56]; +}; + +#ifndef sigcontext_struct +/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but + we need sigcontext. Some packages have come to rely on + sigcontext_struct being defined on 32-bit x86, so define this for + their benefit. */ +# define sigcontext_struct sigcontext +#endif + +#define X86_FXSR_MAGIC 0x0000 + +struct sigcontext +{ + unsigned short gs, __gsh; + unsigned short fs, __fsh; + unsigned short es, __esh; + unsigned short ds, __dsh; + unsigned long edi; + unsigned long esi; + unsigned long ebp; + unsigned long esp; + unsigned long ebx; + unsigned long edx; + unsigned long ecx; + unsigned long eax; + unsigned long trapno; + unsigned long err; + unsigned long eip; + unsigned short cs, __csh; + unsigned long eflags; + unsigned long esp_at_signal; + unsigned short ss, __ssh; + struct _fpstate * fpstate; + unsigned long oldmask; + unsigned long cr2; +}; + +#else /* __x86_64__ */ + +struct _fpstate +{ + /* FPU environment matching the 64-bit FXSAVE layout. */ + __uint16_t cwd; + __uint16_t swd; + __uint16_t ftw; + __uint16_t fop; + __uint64_t rip; + __uint64_t rdp; + __uint32_t mxcsr; + __uint32_t mxcr_mask; + struct _fpxreg _st[8]; + struct _xmmreg _xmm[16]; + __uint32_t __glibc_reserved1[24]; +}; + +struct sigcontext +{ + __uint64_t r8; + __uint64_t r9; + __uint64_t r10; + __uint64_t r11; + __uint64_t r12; + __uint64_t r13; + __uint64_t r14; + __uint64_t r15; + __uint64_t rdi; + __uint64_t rsi; + __uint64_t rbp; + __uint64_t rbx; + __uint64_t rdx; + __uint64_t rax; + __uint64_t rcx; + __uint64_t rsp; + __uint64_t rip; + __uint64_t eflags; + unsigned short cs; + unsigned short gs; + unsigned short fs; + unsigned short __pad0; + __uint64_t err; + __uint64_t trapno; + __uint64_t oldmask; + __uint64_t cr2; + __extension__ union + { + struct _fpstate * fpstate; + __uint64_t __fpstate_word; + }; + __uint64_t __reserved1 [8]; +}; + +#endif /* __x86_64__ */ + +struct _xsave_hdr +{ + __uint64_t xstate_bv; + __uint64_t __glibc_reserved1[2]; + __uint64_t __glibc_reserved2[5]; +}; + +struct _ymmh_state +{ + __uint32_t ymmh_space[64]; +}; + +struct _xstate +{ + struct _fpstate fpstate; + struct _xsave_hdr xstate_hdr; + struct _ymmh_state ymmh; +}; + +#endif /* _BITS_SIGCONTEXT_H */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/siginfo-arch.h b/lib/libc/include/x86-linux-gnu/bits/siginfo-arch.h new file mode 100644 index 0000000000000000000000000000000000000000..0f430f0772f24dfdb5a002a318a8850ee64526f1 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/siginfo-arch.h @@ -0,0 +1,17 @@ +/* Architecture-specific adjustments to siginfo_t. x86 version. */ +#ifndef _BITS_SIGINFO_ARCH_H +#define _BITS_SIGINFO_ARCH_H 1 + +#if defined __x86_64__ && __WORDSIZE == 32 +/* si_utime and si_stime must be 4 byte aligned for x32 to match the + kernel. We align siginfo_t to 8 bytes so that si_utime and + si_stime are actually aligned to 8 bytes since their offsets are + multiple of 8 bytes. Note: with some compilers, the alignment + attribute would be ignored if it were put in __SI_CLOCK_T instead + of encapsulated in a typedef. */ +typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t; +# define __SI_ALIGNMENT __attribute__ ((__aligned__ (8))) +# define __SI_CLOCK_T __sigchld_clock_t +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/struct_mutex.h b/lib/libc/include/x86-linux-gnu/bits/struct_mutex.h new file mode 100644 index 0000000000000000000000000000000000000000..89c18f35e00b222cbca0673621fd40bbdf31b69c --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/struct_mutex.h @@ -0,0 +1,63 @@ +/* x86 internal mutex struct definitions. + Copyright (C) 2019-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _THREAD_MUTEX_INTERNAL_H +#define _THREAD_MUTEX_INTERNAL_H 1 + +struct __pthread_mutex_s +{ + int __lock; + unsigned int __count; + int __owner; +#ifdef __x86_64__ + unsigned int __nusers; +#endif + /* KIND must stay at this position in the structure to maintain + binary compatibility with static initializers. */ + int __kind; +#ifdef __x86_64__ + short __spins; + short __elision; + __pthread_list_t __list; +# define __PTHREAD_MUTEX_HAVE_PREV 1 +#else + unsigned int __nusers; + __extension__ union + { + struct + { + short __espins; + short __eelision; +# define __spins __elision_data.__espins +# define __elision __elision_data.__eelision + } __elision_data; + __pthread_slist_t __list; + }; +# define __PTHREAD_MUTEX_HAVE_PREV 0 +#endif +}; + +#ifdef __x86_64__ +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, 0, __kind, 0, 0, { 0, 0 } +#else +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, __kind, 0, { { 0, 0 } } +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/x86-linux-gnu/bits/struct_rwlock.h new file mode 100644 index 0000000000000000000000000000000000000000..022106d66cdb4ff8e0f82bc8aa2eb9e80ea0a466 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/struct_rwlock.h @@ -0,0 +1,65 @@ +/* x86 internal rwlock struct definitions. + Copyright (C) 2019-2021 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _RWLOCK_INTERNAL_H +#define _RWLOCK_INTERNAL_H + +struct __pthread_rwlock_arch_t +{ + unsigned int __readers; + unsigned int __writers; + unsigned int __wrphase_futex; + unsigned int __writers_futex; + unsigned int __pad3; + unsigned int __pad4; +#ifdef __x86_64__ + int __cur_writer; + int __shared; + signed char __rwelision; +# ifdef __ILP32__ + unsigned char __pad1[3]; +# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 } +# else + unsigned char __pad1[7]; +# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 } +# endif + unsigned long int __pad2; + /* FLAGS must stay at this position in the structure to maintain + binary compatibility. */ + unsigned int __flags; +#else /* __x86_64__ */ + /* FLAGS must stay at this position in the structure to maintain + binary compatibility. */ + unsigned char __flags; + unsigned char __shared; + signed char __rwelision; + unsigned char __pad2; + int __cur_writer; +#endif +}; + +#ifdef __x86_64__ +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, __flags +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/struct_stat.h b/lib/libc/include/x86-linux-gnu/bits/struct_stat.h new file mode 100644 index 0000000000000000000000000000000000000000..b3674c73c43565b0ff30101aae4a4baeccb6c838 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/struct_stat.h @@ -0,0 +1,165 @@ +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#if !defined _SYS_STAT_H && !defined _FCNTL_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 + +struct stat + { +#ifdef __USE_TIME_BITS64 +# include +#else + __dev_t st_dev; /* Device. */ +# ifndef __x86_64__ + unsigned short int __pad1; +# endif +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 + __ino_t st_ino; /* File serial number. */ +# else + __ino_t __st_ino; /* 32bit file serial number. */ +# endif +# ifndef __x86_64__ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ +# else + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ +# endif + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ +# ifdef __x86_64__ + int __pad0; +# endif + __dev_t st_rdev; /* Device number, if device. */ +# ifndef __x86_64__ + unsigned short int __pad2; +# endif +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 + __off_t st_size; /* Size of file, in bytes. */ +# else + __off64_t st_size; /* Size of file, in bytes. */ +# endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ +# else + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# endif +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else + __time_t st_atime; /* Time of last access. */ + __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ +# endif +# ifdef __x86_64__ + __syscall_slong_t __glibc_reserved[3]; +# else +# ifndef __USE_FILE_OFFSET64 + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# else + __ino64_t st_ino; /* File serial number. */ +# endif +# endif +#endif /* __USE_TIME_BITS64 */ + }; + +#ifdef __USE_LARGEFILE64 +/* Note stat64 has the same shape as stat for x86-64. */ +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ +# ifdef __x86_64__ + __ino64_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ +# else + unsigned int __pad1; + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ +# endif + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ +# ifdef __x86_64__ + int __pad0; + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ +# else + __dev_t st_rdev; /* Device number, if device. */ + unsigned int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ +# endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ +# endif +# ifdef __x86_64__ + __syscall_slong_t __glibc_reserved[3]; +# else + __ino64_t st_ino; /* File serial number. */ +# endif +# endif /* __USE_TIME_BITS64 */ + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV +/* Nanosecond resolution time values are supported. */ +#define _STATBUF_ST_NSEC + +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/timesize.h b/lib/libc/include/x86-linux-gnu/bits/timesize.h new file mode 100644 index 0000000000000000000000000000000000000000..a1ca40d632af2e5cda7f954f5736f67cc53d37fb --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/timesize.h @@ -0,0 +1,25 @@ +/* Bit size of the time_t type at glibc build time, x86-64 and x32 case. + Copyright (C) 2018-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#if defined __x86_64__ && defined __ILP32__ +/* For x32, time is 64-bit even though word size is 32-bit. */ +# define __TIMESIZE 64 +#else +/* For others, time size is word size. */ +# define __TIMESIZE __WORDSIZE +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/x86-linux-gnu/bits/types/struct_semid_ds.h new file mode 100644 index 0000000000000000000000000000000000000000..6713836d1eec4e7203af5dc633a480ec0e9d58e8 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/types/struct_semid_ds.h @@ -0,0 +1,38 @@ +/* x86 implementation of the semaphore struct semid_ds. + Copyright (C) 1995-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm sem_perm; /* operation permission struct */ + __time_t sem_otime; /* last semop() time */ + __syscall_ulong_t __sem_otime_high; + __time_t sem_ctime; /* last time changed by semctl() */ + __syscall_ulong_t __sem_ctime_high; + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + __syscall_ulong_t __glibc_reserved3; + __syscall_ulong_t __glibc_reserved4; +#endif +}; \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/typesizes.h b/lib/libc/include/x86-linux-gnu/bits/typesizes.h new file mode 100644 index 0000000000000000000000000000000000000000..654f1c7b873efd6317245ed5dae99e75da8808cf --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/typesizes.h @@ -0,0 +1,106 @@ +/* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. + Copyright (C) 2012-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TYPESIZES_H +#define _BITS_TYPESIZES_H 1 + +/* See for the meaning of these macros. This file exists so + that need not vary across different GNU platforms. */ + +/* X32 kernel interface is 64-bit. */ +#if defined __x86_64__ && defined __ILP32__ +# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE +# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE +#else +# define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE +# define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE +#endif + +#define __DEV_T_TYPE __UQUAD_TYPE +#define __UID_T_TYPE __U32_TYPE +#define __GID_T_TYPE __U32_TYPE +#define __INO_T_TYPE __SYSCALL_ULONG_TYPE +#define __INO64_T_TYPE __UQUAD_TYPE +#define __MODE_T_TYPE __U32_TYPE +#ifdef __x86_64__ +# define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE +# define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE +#else +# define __NLINK_T_TYPE __UWORD_TYPE +# define __FSWORD_T_TYPE __SWORD_TYPE +#endif +#define __OFF_T_TYPE __SYSCALL_SLONG_TYPE +#define __OFF64_T_TYPE __SQUAD_TYPE +#define __PID_T_TYPE __S32_TYPE +#define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE +#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE +#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __ID_T_TYPE __U32_TYPE +#define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE +#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE +#define __USECONDS_T_TYPE __U32_TYPE +#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE +#define __DADDR_T_TYPE __S32_TYPE +#define __KEY_T_TYPE __S32_TYPE +#define __CLOCKID_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * +#define __BLKSIZE_T_TYPE __SYSCALL_SLONG_TYPE +#define __FSID_T_TYPE struct { int __val[2]; } +#define __SSIZE_T_TYPE __SWORD_TYPE +#define __CPU_MASK_TYPE __SYSCALL_ULONG_TYPE + +#ifdef __x86_64__ +/* Tell the libc code that off_t and off64_t are actually the same type + for all ABI purposes, even if possibly expressed as different base types + for C type-checking purposes. */ +# define __OFF_T_MATCHES_OFF64_T 1 + +/* Same for ino_t and ino64_t. */ +# define __INO_T_MATCHES_INO64_T 1 + +/* And for __rlim_t and __rlim64_t. */ +# define __RLIM_T_MATCHES_RLIM64_T 1 + +/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ +# define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 +#else +# define __RLIM_T_MATCHES_RLIM64_T 0 + +# define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 +#endif + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +#endif /* bits/typesizes.h */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/wordsize.h b/lib/libc/include/x86-linux-gnu/bits/wordsize.h new file mode 100644 index 0000000000000000000000000000000000000000..0bf84a4e99cb32b6b553e893e23b135d3b1723ee --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/bits/wordsize.h @@ -0,0 +1,17 @@ +/* Determine the wordsize from the preprocessor defines. */ + +#if defined __x86_64__ && !defined __ILP32__ +# define __WORDSIZE 64 +#else +# define __WORDSIZE 32 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +#endif + +#ifdef __x86_64__ +# define __WORDSIZE_TIME64_COMPAT32 1 +/* Both x86-64 and x32 use the 64-bit system call interface. */ +# define __SYSCALL_WORDSIZE 64 +#else +# define __WORDSIZE_TIME64_COMPAT32 0 +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/finclude/math-vector-fortran.h b/lib/libc/include/x86-linux-gnu/finclude/math-vector-fortran.h new file mode 100644 index 0000000000000000000000000000000000000000..5fdbe52a3c2c28d20e0a502018ba95d3dedf0dbb --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/finclude/math-vector-fortran.h @@ -0,0 +1,43 @@ +! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*- +! Copyright (C) 2019-2021 Free Software Foundation, Inc. +! This file is part of the GNU C Library. +! +! The GNU C Library is free software; you can redistribute it and/or +! modify it under the terms of the GNU Lesser General Public +! License as published by the Free Software Foundation; either +! version 2.1 of the License, or (at your option) any later version. +! +! The GNU C Library is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +! Lesser General Public License for more details. +! +! You should have received a copy of the GNU Lesser General Public +! License along with the GNU C Library; if not, see +! . + +!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64') +!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') + +!GCC$ builtin (cos) attributes simd (notinbranch) if('x32') +!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32') +!GCC$ builtin (sin) attributes simd (notinbranch) if('x32') +!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32') +!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32') +!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32') +!GCC$ builtin (log) attributes simd (notinbranch) if('x32') +!GCC$ builtin (logf) attributes simd (notinbranch) if('x32') +!GCC$ builtin (exp) attributes simd (notinbranch) if('x32') +!GCC$ builtin (expf) attributes simd (notinbranch) if('x32') +!GCC$ builtin (pow) attributes simd (notinbranch) if('x32') +!GCC$ builtin (powf) attributes simd (notinbranch) if('x32') \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/fpu_control.h b/lib/libc/include/x86-linux-gnu/fpu_control.h new file mode 100644 index 0000000000000000000000000000000000000000..533e2da0d0872f74cf7b3e5f2dff94b6bd0faf8b --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/fpu_control.h @@ -0,0 +1,109 @@ +/* FPU control word bits. x86 version. + Copyright (C) 1993-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Olaf Flebbe. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _FPU_CONTROL_H +#define _FPU_CONTROL_H 1 + +/* Note that this file sets on x86-64 only the x87 FPU, it does not + touch the SSE unit. */ + +/* Here is the dirty part. Set up your 387 through the control word + * (cw) register. + * + * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0 + * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM + * + * IM: Invalid operation mask + * DM: Denormalized operand mask + * ZM: Zero-divide mask + * OM: Overflow mask + * UM: Underflow mask + * PM: Precision (inexact result) mask + * + * Mask bit is 1 means no interrupt. + * + * PC: Precision control + * 11 - round to extended precision + * 10 - round to double precision + * 00 - round to single precision + * + * RC: Rounding control + * 00 - rounding to nearest + * 01 - rounding down (toward - infinity) + * 10 - rounding up (toward + infinity) + * 11 - rounding toward zero + * + * IC: Infinity control + * That is for 8087 and 80287 only. + * + * The hardware default is 0x037f which we use. + */ + +#include + +/* masking of interrupts */ +#define _FPU_MASK_IM 0x01 +#define _FPU_MASK_DM 0x02 +#define _FPU_MASK_ZM 0x04 +#define _FPU_MASK_OM 0x08 +#define _FPU_MASK_UM 0x10 +#define _FPU_MASK_PM 0x20 + +/* precision control */ +#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */ +#define _FPU_DOUBLE 0x200 +#define _FPU_SINGLE 0x0 + +/* rounding control */ +#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */ +#define _FPU_RC_DOWN 0x400 +#define _FPU_RC_UP 0x800 +#define _FPU_RC_ZERO 0xC00 + +#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */ + + +/* The fdlibm code requires strict IEEE double precision arithmetic, + and no interrupts for exceptions, rounding to nearest. */ + +#define _FPU_DEFAULT 0x037f + +/* IEEE: same as above. */ +#define _FPU_IEEE 0x037f + +/* Type of the control word. */ +typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); + +/* Macros for accessing the hardware control word. "*&" is used to + work around a bug in older versions of GCC. __volatile__ is used + to support combination of writing the control register and reading + it back. Without __volatile__, the old value may be used for reading + back under compiler optimization. + + Note that the use of these macros is not sufficient anymore with + recent hardware nor on x86-64. Some floating point operations are + executed in the SSE/SSE2 engines which have their own control and + status register. */ +#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) +#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) + +/* Default control word set at startup. */ +extern fpu_control_t __fpu_control; + +#endif /* fpu_control.h */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/gnu/lib-names.h b/lib/libc/include/x86-linux-gnu/gnu/lib-names.h new file mode 100644 index 0000000000000000000000000000000000000000..aafc03bf7e212c37484434bef0cce2e59e87bf41 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/gnu/lib-names.h @@ -0,0 +1,17 @@ +/* This file is automatically generated. + It defines macros to allow user program to find the shared + library files which come as part of GNU libc. */ +#ifndef __GNU_LIB_NAMES_H +#define __GNU_LIB_NAMES_H 1 + +#if !defined __x86_64__ +# include +#endif +#if defined __x86_64__ && defined __LP64__ +# include +#endif +#if defined __x86_64__ && defined __ILP32__ +# include +#endif + +#endif /* gnu/lib-names.h */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/gnu/stubs.h b/lib/libc/include/x86-linux-gnu/gnu/stubs.h new file mode 100644 index 0000000000000000000000000000000000000000..a4c9b5f09725c302dd474bd91961d25023f1187c --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/gnu/stubs.h @@ -0,0 +1,14 @@ +/* This file is automatically generated. + This file selects the right generated file of `__stub_FUNCTION' macros + based on the architecture being compiled for. */ + + +#if !defined __x86_64__ +# include +#endif +#if defined __x86_64__ && defined __LP64__ +# include +#endif +#if defined __x86_64__ && defined __ILP32__ +# include +#endif \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/sys/elf.h b/lib/libc/include/x86-linux-gnu/sys/elf.h new file mode 100644 index 0000000000000000000000000000000000000000..3731950870454d873c2b72e16be14b6dbf2c0ab9 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/sys/elf.h @@ -0,0 +1,29 @@ +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_ELF_H +#define _SYS_ELF_H 1 + +#ifdef __x86_64__ +# error This header is unsupported on x86-64. +#else +# warning "This header is obsolete; use instead." + +# include +#endif + +#endif /* _SYS_ELF_H */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/sys/ptrace.h b/lib/libc/include/x86-linux-gnu/sys/ptrace.h new file mode 100644 index 0000000000000000000000000000000000000000..461e83ae9c84fe8476edce9df017325981f5873e --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/sys/ptrace.h @@ -0,0 +1,202 @@ +/* `ptrace' debugger support interface. Linux/x86 version. + Copyright (C) 1996-2021 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_PTRACE_H +#define _SYS_PTRACE_H 1 + +#include +#include + +__BEGIN_DECLS + +/* Type of the REQUEST argument to `ptrace.' */ +enum __ptrace_request +{ + /* Indicate that the process making this request should be traced. + All signals received by this process can be intercepted by its + parent, and its parent can use the other `ptrace' requests. */ + PTRACE_TRACEME = 0, +#define PT_TRACE_ME PTRACE_TRACEME + + /* Return the word in the process's text space at address ADDR. */ + PTRACE_PEEKTEXT = 1, +#define PT_READ_I PTRACE_PEEKTEXT + + /* Return the word in the process's data space at address ADDR. */ + PTRACE_PEEKDATA = 2, +#define PT_READ_D PTRACE_PEEKDATA + + /* Return the word in the process's user area at offset ADDR. */ + PTRACE_PEEKUSER = 3, +#define PT_READ_U PTRACE_PEEKUSER + + /* Write the word DATA into the process's text space at address ADDR. */ + PTRACE_POKETEXT = 4, +#define PT_WRITE_I PTRACE_POKETEXT + + /* Write the word DATA into the process's data space at address ADDR. */ + PTRACE_POKEDATA = 5, +#define PT_WRITE_D PTRACE_POKEDATA + + /* Write the word DATA into the process's user area at offset ADDR. */ + PTRACE_POKEUSER = 6, +#define PT_WRITE_U PTRACE_POKEUSER + + /* Continue the process. */ + PTRACE_CONT = 7, +#define PT_CONTINUE PTRACE_CONT + + /* Kill the process. */ + PTRACE_KILL = 8, +#define PT_KILL PTRACE_KILL + + /* Single step the process. */ + PTRACE_SINGLESTEP = 9, +#define PT_STEP PTRACE_SINGLESTEP + + /* Get all general purpose registers used by a processes. */ + PTRACE_GETREGS = 12, +#define PT_GETREGS PTRACE_GETREGS + + /* Set all general purpose registers used by a processes. */ + PTRACE_SETREGS = 13, +#define PT_SETREGS PTRACE_SETREGS + + /* Get all floating point registers used by a processes. */ + PTRACE_GETFPREGS = 14, +#define PT_GETFPREGS PTRACE_GETFPREGS + + /* Set all floating point registers used by a processes. */ + PTRACE_SETFPREGS = 15, +#define PT_SETFPREGS PTRACE_SETFPREGS + + /* Attach to a process that is already running. */ + PTRACE_ATTACH = 16, +#define PT_ATTACH PTRACE_ATTACH + + /* Detach from a process attached to with PTRACE_ATTACH. */ + PTRACE_DETACH = 17, +#define PT_DETACH PTRACE_DETACH + + /* Get all extended floating point registers used by a processes. */ + PTRACE_GETFPXREGS = 18, +#define PT_GETFPXREGS PTRACE_GETFPXREGS + + /* Set all extended floating point registers used by a processes. */ + PTRACE_SETFPXREGS = 19, +#define PT_SETFPXREGS PTRACE_SETFPXREGS + + /* Continue and stop at the next entry to or return from syscall. */ + PTRACE_SYSCALL = 24, +#define PT_SYSCALL PTRACE_SYSCALL + + /* Get a TLS entry in the GDT. */ + PTRACE_GET_THREAD_AREA = 25, +#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA + + /* Change a TLS entry in the GDT. */ + PTRACE_SET_THREAD_AREA = 26, +#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA + +#ifdef __x86_64__ + /* Access TLS data. */ + PTRACE_ARCH_PRCTL = 30, +# define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL +#endif + + /* Continue and stop at the next syscall, it will not be executed. */ + PTRACE_SYSEMU = 31, +#define PT_SYSEMU PTRACE_SYSEMU + + /* Single step the process, the next syscall will not be executed. */ + PTRACE_SYSEMU_SINGLESTEP = 32, +#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP + + /* Execute process until next taken branch. */ + PTRACE_SINGLEBLOCK = 33, +#define PT_STEPBLOCK PTRACE_SINGLEBLOCK + + /* Set ptrace filter options. */ + PTRACE_SETOPTIONS = 0x4200, +#define PT_SETOPTIONS PTRACE_SETOPTIONS + + /* Get last ptrace message. */ + PTRACE_GETEVENTMSG = 0x4201, +#define PT_GETEVENTMSG PTRACE_GETEVENTMSG + + /* Get siginfo for process. */ + PTRACE_GETSIGINFO = 0x4202, +#define PT_GETSIGINFO PTRACE_GETSIGINFO + + /* Set new siginfo for process. */ + PTRACE_SETSIGINFO = 0x4203, +#define PT_SETSIGINFO PTRACE_SETSIGINFO + + /* Get register content. */ + PTRACE_GETREGSET = 0x4204, +#define PTRACE_GETREGSET PTRACE_GETREGSET + + /* Set register content. */ + PTRACE_SETREGSET = 0x4205, +#define PTRACE_SETREGSET PTRACE_SETREGSET + + /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect + signal or group stop state. */ + PTRACE_SEIZE = 0x4206, +#define PTRACE_SEIZE PTRACE_SEIZE + + /* Trap seized tracee. */ + PTRACE_INTERRUPT = 0x4207, +#define PTRACE_INTERRUPT PTRACE_INTERRUPT + + /* Wait for next group event. */ + PTRACE_LISTEN = 0x4208, +#define PTRACE_LISTEN PTRACE_LISTEN + + /* Retrieve siginfo_t structures without removing signals from a queue. */ + PTRACE_PEEKSIGINFO = 0x4209, +#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO + + /* Get the mask of blocked signals. */ + PTRACE_GETSIGMASK = 0x420a, +#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK + + /* Change the mask of blocked signals. */ + PTRACE_SETSIGMASK = 0x420b, +#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK + + /* Get seccomp BPF filters. */ + PTRACE_SECCOMP_GET_FILTER = 0x420c, +#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER + + /* Get seccomp BPF filter metadata. */ + PTRACE_SECCOMP_GET_METADATA = 0x420d, +#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA + + /* Get information about system call. */ + PTRACE_GET_SYSCALL_INFO = 0x420e +#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO +}; + + +#include + +__END_DECLS + +#endif /* _SYS_PTRACE_H */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/sys/ucontext.h b/lib/libc/include/x86-linux-gnu/sys/ucontext.h new file mode 100644 index 0000000000000000000000000000000000000000..f961c6aef830a8f4b65333c4d32e344ab0d73bc4 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/sys/ucontext.h @@ -0,0 +1,262 @@ +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include + +#include +#include +#include + + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +#ifdef __x86_64__ + +/* Type for general register. */ +__extension__ typedef long long int greg_t; + +/* Number of general registers. */ +#define __NGREG 23 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_GNU +/* Number of each register in the `gregset_t' array. */ +enum +{ + REG_R8 = 0, +# define REG_R8 REG_R8 + REG_R9, +# define REG_R9 REG_R9 + REG_R10, +# define REG_R10 REG_R10 + REG_R11, +# define REG_R11 REG_R11 + REG_R12, +# define REG_R12 REG_R12 + REG_R13, +# define REG_R13 REG_R13 + REG_R14, +# define REG_R14 REG_R14 + REG_R15, +# define REG_R15 REG_R15 + REG_RDI, +# define REG_RDI REG_RDI + REG_RSI, +# define REG_RSI REG_RSI + REG_RBP, +# define REG_RBP REG_RBP + REG_RBX, +# define REG_RBX REG_RBX + REG_RDX, +# define REG_RDX REG_RDX + REG_RAX, +# define REG_RAX REG_RAX + REG_RCX, +# define REG_RCX REG_RCX + REG_RSP, +# define REG_RSP REG_RSP + REG_RIP, +# define REG_RIP REG_RIP + REG_EFL, +# define REG_EFL REG_EFL + REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */ +# define REG_CSGSFS REG_CSGSFS + REG_ERR, +# define REG_ERR REG_ERR + REG_TRAPNO, +# define REG_TRAPNO REG_TRAPNO + REG_OLDMASK, +# define REG_OLDMASK REG_OLDMASK + REG_CR2 +# define REG_CR2 REG_CR2 +}; +#endif + +struct _libc_fpxreg +{ + unsigned short int __ctx(significand)[4]; + unsigned short int __ctx(exponent); + unsigned short int __glibc_reserved1[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t __ctx(element)[4]; +}; + +struct _libc_fpstate +{ + /* 64-bit FXSAVE format. */ + __uint16_t __ctx(cwd); + __uint16_t __ctx(swd); + __uint16_t __ctx(ftw); + __uint16_t __ctx(fop); + __uint64_t __ctx(rip); + __uint64_t __ctx(rdp); + __uint32_t __ctx(mxcsr); + __uint32_t __ctx(mxcr_mask); + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t __glibc_reserved1[24]; +}; + +/* Structure to describe FPU registers. */ +typedef struct _libc_fpstate *fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __ctx(gregs); + /* Note that fpregs is a pointer. */ + fpregset_t __ctx(fpregs); + __extension__ unsigned long long __reserved1 [8]; +} mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + __extension__ unsigned long long int __ssp[4]; + } ucontext_t; + +#else /* !__x86_64__ */ + +/* Type for general register. */ +typedef int greg_t; + +/* Number of general registers. */ +#define __NGREG 19 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_GNU +/* Number of each register is the `gregset_t' array. */ +enum +{ + REG_GS = 0, +# define REG_GS REG_GS + REG_FS, +# define REG_FS REG_FS + REG_ES, +# define REG_ES REG_ES + REG_DS, +# define REG_DS REG_DS + REG_EDI, +# define REG_EDI REG_EDI + REG_ESI, +# define REG_ESI REG_ESI + REG_EBP, +# define REG_EBP REG_EBP + REG_ESP, +# define REG_ESP REG_ESP + REG_EBX, +# define REG_EBX REG_EBX + REG_EDX, +# define REG_EDX REG_EDX + REG_ECX, +# define REG_ECX REG_ECX + REG_EAX, +# define REG_EAX REG_EAX + REG_TRAPNO, +# define REG_TRAPNO REG_TRAPNO + REG_ERR, +# define REG_ERR REG_ERR + REG_EIP, +# define REG_EIP REG_EIP + REG_CS, +# define REG_CS REG_CS + REG_EFL, +# define REG_EFL REG_EFL + REG_UESP, +# define REG_UESP REG_UESP + REG_SS +# define REG_SS REG_SS +}; +#endif + +/* Definitions taken from the kernel headers. */ +struct _libc_fpreg +{ + unsigned short int __ctx(significand)[4]; + unsigned short int __ctx(exponent); +}; + +struct _libc_fpstate +{ + unsigned long int __ctx(cw); + unsigned long int __ctx(sw); + unsigned long int __ctx(tag); + unsigned long int __ctx(ipoff); + unsigned long int __ctx(cssel); + unsigned long int __ctx(dataoff); + unsigned long int __ctx(datasel); + struct _libc_fpreg _st[8]; + unsigned long int __ctx(status); +}; + +/* Structure to describe FPU registers. */ +typedef struct _libc_fpstate *fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __ctx(gregs); + /* Due to Linux's history we have to use a pointer here. The SysV/i386 + ABI requires a struct with the values. */ + fpregset_t __ctx(fpregs); + unsigned long int __ctx(oldmask); + unsigned long int __ctx(cr2); + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + struct _libc_fpstate __fpregs_mem; + unsigned long int __ssp[4]; + } ucontext_t; + +#endif /* !__x86_64__ */ + +#undef __ctx + +#endif /* sys/ucontext.h */ \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/sys/user.h b/lib/libc/include/x86-linux-gnu/sys/user.h new file mode 100644 index 0000000000000000000000000000000000000000..0f64e565eb618846a993dde7c108a5be4aa545c6 --- /dev/null +++ b/lib/libc/include/x86-linux-gnu/sys/user.h @@ -0,0 +1,180 @@ +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + +/* The whole purpose of this file is for GDB and GDB only. Don't read + too much into it. Don't use it for anything other than GDB unless + you know what you are doing. */ + +#ifdef __x86_64__ + +struct user_fpregs_struct +{ + unsigned short int cwd; + unsigned short int swd; + unsigned short int ftw; + unsigned short int fop; + __extension__ unsigned long long int rip; + __extension__ unsigned long long int rdp; + unsigned int mxcsr; + unsigned int mxcr_mask; + unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ + unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ + unsigned int padding[24]; +}; + +struct user_regs_struct +{ + __extension__ unsigned long long int r15; + __extension__ unsigned long long int r14; + __extension__ unsigned long long int r13; + __extension__ unsigned long long int r12; + __extension__ unsigned long long int rbp; + __extension__ unsigned long long int rbx; + __extension__ unsigned long long int r11; + __extension__ unsigned long long int r10; + __extension__ unsigned long long int r9; + __extension__ unsigned long long int r8; + __extension__ unsigned long long int rax; + __extension__ unsigned long long int rcx; + __extension__ unsigned long long int rdx; + __extension__ unsigned long long int rsi; + __extension__ unsigned long long int rdi; + __extension__ unsigned long long int orig_rax; + __extension__ unsigned long long int rip; + __extension__ unsigned long long int cs; + __extension__ unsigned long long int eflags; + __extension__ unsigned long long int rsp; + __extension__ unsigned long long int ss; + __extension__ unsigned long long int fs_base; + __extension__ unsigned long long int gs_base; + __extension__ unsigned long long int ds; + __extension__ unsigned long long int es; + __extension__ unsigned long long int fs; + __extension__ unsigned long long int gs; +}; + +struct user +{ + struct user_regs_struct regs; + int u_fpvalid; + struct user_fpregs_struct i387; + __extension__ unsigned long long int u_tsize; + __extension__ unsigned long long int u_dsize; + __extension__ unsigned long long int u_ssize; + __extension__ unsigned long long int start_code; + __extension__ unsigned long long int start_stack; + __extension__ long long int signal; + int reserved; + __extension__ union + { + struct user_regs_struct* u_ar0; + __extension__ unsigned long long int __u_ar0_word; + }; + __extension__ union + { + struct user_fpregs_struct* u_fpstate; + __extension__ unsigned long long int __u_fpstate_word; + }; + __extension__ unsigned long long int magic; + char u_comm [32]; + __extension__ unsigned long long int u_debugreg [8]; +}; + +#else +/* These are the 32-bit x86 structures. */ +struct user_fpregs_struct +{ + long int cwd; + long int swd; + long int twd; + long int fip; + long int fcs; + long int foo; + long int fos; + long int st_space [20]; +}; + +struct user_fpxregs_struct +{ + unsigned short int cwd; + unsigned short int swd; + unsigned short int twd; + unsigned short int fop; + long int fip; + long int fcs; + long int foo; + long int fos; + long int mxcsr; + long int reserved; + long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ + long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ + long int padding[56]; +}; + +struct user_regs_struct +{ + long int ebx; + long int ecx; + long int edx; + long int esi; + long int edi; + long int ebp; + long int eax; + long int xds; + long int xes; + long int xfs; + long int xgs; + long int orig_eax; + long int eip; + long int xcs; + long int eflags; + long int esp; + long int xss; +}; + +struct user +{ + struct user_regs_struct regs; + int u_fpvalid; + struct user_fpregs_struct i387; + unsigned long int u_tsize; + unsigned long int u_dsize; + unsigned long int u_ssize; + unsigned long int start_code; + unsigned long int start_stack; + long int signal; + int reserved; + struct user_regs_struct* u_ar0; + struct user_fpregs_struct* u_fpstate; + unsigned long int magic; + char u_comm [32]; + int u_debugreg [8]; +}; +#endif /* __x86_64__ */ + +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) +#define NBPG PAGE_SIZE +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +#endif /* _SYS_USER_H */ \ No newline at end of file diff --git a/lib/ssp.zig b/lib/ssp.zig index f11698750d3a098646338d0e0804dc319abbe4e3..f75c4d1a55ba0f8d87680af971b223e8662142a4 100644 --- a/lib/ssp.zig +++ b/lib/ssp.zig @@ -35,7 +35,7 @@ export fn __chk_fail() callconv(.C) noreturn { @panic("buffer overflow detected"); } -// Emitted when targeting some architectures (eg. i386) +// Emitted when targeting some architectures (eg. x86) // XXX: This symbol should be hidden export fn __stack_chk_fail_local() callconv(.C) noreturn { __stack_chk_fail(); diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index a611ff38dece898c9d22ea886abf0dc3e51b3fc4..e2e17a29259e1e2cf323ad90451f6fe7906e12a9 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -753,7 +753,7 @@ const LinuxThreadImpl = struct { /// https://github.com/ifduyue/musl/search?q=__unmapself fn freeAndExit(self: *ThreadCompletion) noreturn { switch (target.cpu.arch) { - .i386 => asm volatile ( + .x86 => asm volatile ( \\ movl $91, %%eax \\ movl %[ptr], %%ebx \\ movl %[len], %%ecx @@ -959,10 +959,10 @@ const LinuxThreadImpl = struct { else => |e| return e, }; - // Prepare the TLS segment and prepare a user_desc struct when needed on i386 + // Prepare the TLS segment and prepare a user_desc struct when needed on x86 var tls_ptr = os.linux.tls.prepareTLS(mapped[tls_offset..]); - var user_desc: if (target.cpu.arch == .i386) os.linux.user_desc else void = undefined; - if (target.cpu.arch == .i386) { + var user_desc: if (target.cpu.arch == .x86) os.linux.user_desc else void = undefined; + if (target.cpu.arch == .x86) { defer tls_ptr = @ptrToInt(&user_desc); user_desc = .{ .entry_number = os.linux.tls.tls_image.gdt_entry_number, diff --git a/lib/std/atomic.zig b/lib/std/atomic.zig index ef1cce177484810abbfe7e8c403bf7b99b72d58f..d10c1224828db76e9cfc2328987511c2f1efebcd 100644 --- a/lib/std/atomic.zig +++ b/lib/std/atomic.zig @@ -44,7 +44,7 @@ pub inline fn spinLoopHint() void { // No-op instruction that can hint to save (or share with a hardware-thread) // pipelining/power resources // https://software.intel.com/content/www/us/en/develop/articles/benefitting-power-and-performance-sleep-loops.html - .i386, .x86_64 => asm volatile ("pause" ::: "memory"), + .x86, .x86_64 => asm volatile ("pause" ::: "memory"), // No-op instruction that serves as a hardware-thread resource yield hint. // https://stackoverflow.com/a/7588941 diff --git a/lib/std/build.zig b/lib/std/build.zig index 8c6af98eea31ce524e3635b5bb60787e41a08f56..ac85aff92a40223a564d88baa6fd9f29ffd71d33 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -2978,12 +2978,12 @@ pub const LibExeObjStep = struct { if (glibc_dir_arg) |dir| { // TODO look into making this a call to `linuxTriple`. This // needs the directory to be called "i686" rather than - // "i386" which is why we do it manually here. + // "x86" which is why we do it manually here. const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}"; const cpu_arch = self.target.getCpuArch(); const os_tag = self.target.getOsTag(); const abi = self.target.getAbi(); - const cpu_arch_name: []const u8 = if (cpu_arch == .i386) + const cpu_arch_name: []const u8 = if (cpu_arch == .x86) "i686" else @tagName(cpu_arch); diff --git a/lib/std/build/EmulatableRunStep.zig b/lib/std/build/EmulatableRunStep.zig index 23bdf5e59561c6e44ca1cad621409bd67f2d1774..52ce8edfac2a389973bff510523e1021361faf45 100644 --- a/lib/std/build/EmulatableRunStep.zig +++ b/lib/std/build/EmulatableRunStep.zig @@ -95,12 +95,12 @@ fn make(step: *Step) !void { if (glibc_dir_arg) |dir| { // TODO look into making this a call to `linuxTriple`. This // needs the directory to be called "i686" rather than - // "i386" which is why we do it manually here. + // "x86" which is why we do it manually here. const fmt_str = "{s}" ++ fs.path.sep_str ++ "{s}-{s}-{s}"; const cpu_arch = self.exe.target.getCpuArch(); const os_tag = self.exe.target.getOsTag(); const abi = self.exe.target.getAbi(); - const cpu_arch_name: []const u8 = if (cpu_arch == .i386) + const cpu_arch_name: []const u8 = if (cpu_arch == .x86) "i686" else @tagName(cpu_arch); diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig index 799040c38120cd40c777b3124a3a8c0ab8529083..9614a14522c509b62bb78eb826ce92424cb94db8 100644 --- a/lib/std/c/freebsd.zig +++ b/lib/std/c/freebsd.zig @@ -1444,7 +1444,7 @@ pub const E = enum(u16) { }; pub const MINSIGSTKSZ = switch (builtin.cpu.arch) { - .i386, .x86_64 => 2048, + .x86, .x86_64 => 2048, .arm, .aarch64 => 4096, else => @compileError("MINSIGSTKSZ not defined for this architecture"), }; diff --git a/lib/std/c/netbsd.zig b/lib/std/c/netbsd.zig index 18ed7027918ff417d7068c0949bc689e4fd8dbf1..98a6563140c49eb98f2d4a032ccff79d83d71119 100644 --- a/lib/std/c/netbsd.zig +++ b/lib/std/c/netbsd.zig @@ -80,7 +80,7 @@ pub const pthread_cond_t = extern struct { pub const pthread_rwlock_t = extern struct { magic: c_uint = 0x99990009, interlock: switch (builtin.cpu.arch) { - .aarch64, .sparc, .x86_64, .i386 => u8, + .aarch64, .sparc, .x86_64, .x86 => u8, .arm, .powerpc => c_int, else => unreachable, } = 0, @@ -97,7 +97,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) { .aarch64, .aarch64_be, .aarch64_32 => u8, .mips, .mipsel, .mips64, .mips64el => u32, .powerpc, .powerpc64, .powerpc64le => i32, - .i386, .x86_64 => u8, + .x86, .x86_64 => u8, .arm, .armeb, .thumb, .thumbeb => i32, .sparc, .sparcel, .sparc64 => u8, .riscv32, .riscv64 => u32, @@ -105,7 +105,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) { }; const padded_pthread_spin_t = switch (builtin.cpu.arch) { - .i386, .x86_64 => u32, + .x86, .x86_64 => u32, .sparc, .sparcel, .sparc64 => u32, else => pthread_spin_t, }; @@ -1067,7 +1067,7 @@ pub const ucontext_t = extern struct { mcontext: mcontext_t, __pad: [ switch (builtin.cpu.arch) { - .i386 => 4, + .x86 => 4, .mips, .mipsel, .mips64, .mips64el => 14, .arm, .armeb, .thumb, .thumbeb => 1, .sparc, .sparcel, .sparc64 => if (@sizeOf(usize) == 4) 43 else 8, diff --git a/lib/std/c/openbsd.zig b/lib/std/c/openbsd.zig index d78b679a1c2fc31f60ea94938ba08974b9e434b7..fbfae7b0c91ed9a5bf9ca55869589fdc0ca7c835 100644 --- a/lib/std/c/openbsd.zig +++ b/lib/std/c/openbsd.zig @@ -1247,7 +1247,7 @@ pub const E = enum(u16) { }; const _MAX_PAGE_SHIFT = switch (builtin.cpu.arch) { - .i386 => 12, + .x86 => 12, .sparc64 => 13, }; pub const MINSIGSTKSZ = 1 << _MAX_PAGE_SHIFT; diff --git a/lib/std/coff.zig b/lib/std/coff.zig index ad440e77572fc89cd99211f7eed655d2da4733ba..6b300276e9b277e3578a1bb6406ad287f2084671 100644 --- a/lib/std/coff.zig +++ b/lib/std/coff.zig @@ -1025,7 +1025,7 @@ pub const MachineType = enum(u16) { .powerpc => .POWERPC, .riscv32 => .RISCV32, .thumb => .Thumb, - .i386 => .I386, + .x86 => .I386, .aarch64 => .ARM64, .riscv64 => .RISCV64, .x86_64 => .X64, @@ -1040,7 +1040,7 @@ pub const MachineType = enum(u16) { .POWERPC => .powerpc, .RISCV32 => .riscv32, .Thumb => .thumb, - .I386 => .i386, + .I386 => .x86, .ARM64 => .aarch64, .RISCV64 => .riscv64, .X64 => .x86_64, diff --git a/lib/std/debug.zig b/lib/std/debug.zig index de7aa07b8b8f3fd8e6c997eda6972a45940e69dd..205be60b11d2706a86f1422cd76b2ffb11a870e4 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -182,7 +182,7 @@ pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid // an overflow. We do not need to signal `StackIterator` as it will correctly detect this // condition on the subsequent iteration and return `null` thus terminating the loop. - // same behaviour for i386-windows-msvc + // same behaviour for x86-windows-msvc const address = if (return_address == 0) return_address else return_address - 1; printSourceAtAddress(debug_info, stderr, address, tty_config) catch return; } @@ -568,7 +568,7 @@ pub fn writeCurrentStackTrace( // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid // an overflow. We do not need to signal `StackIterator` as it will correctly detect this // condition on the subsequent iteration and return `null` thus terminating the loop. - // same behaviour for i386-windows-msvc + // same behaviour for x86-windows-msvc const address = if (return_address == 0) return_address else return_address - 1; try printSourceAtAddress(debug_info, out_stream, address, tty_config); } @@ -1922,7 +1922,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any } switch (native_arch) { - .i386 => { + .x86 => { const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr)); const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]); const bp = @intCast(usize, ctx.mcontext.gregs[os.REG.EBP]); diff --git a/lib/std/elf.zig b/lib/std/elf.zig index 4a9b7a498fc476a209e841f4d4c554f95fec7a2b..74eb18186743cb390eada8aa072e7bf582252662 100644 --- a/lib/std/elf.zig +++ b/lib/std/elf.zig @@ -1502,7 +1502,7 @@ pub const EM = enum(u16) { .MIPS_RS3_LE => .mipsel, .PPC => .powerpc, .SPARC => .sparc, - .@"386" => .i386, + .@"386" => .x86, .XCORE => .xcore, .CSR_KALIMBA => .kalimba, .LANAI => .lanai, diff --git a/lib/std/macho.zig b/lib/std/macho.zig index 7511b482bd1edd3f92f40b9fc965cb7a21206cf0..11b737a2b718d1d304d57fee12a1542a764fbe74 100644 --- a/lib/std/macho.zig +++ b/lib/std/macho.zig @@ -1201,7 +1201,7 @@ pub const MH_DEAD_STRIPPABLE_DYLIB = 0x400000; /// Contains a section of type S_THREAD_LOCAL_VARIABLES pub const MH_HAS_TLV_DESCRIPTORS = 0x800000; -/// 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. +/// 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. pub const MH_NO_HEAP_EXECUTION = 0x1000000; /// The code was linked for use in an application extension. @@ -1444,7 +1444,7 @@ pub const S_ATTR_NO_DEAD_STRIP = 0x10000000; /// blocks are live if they reference live blocks pub const S_ATTR_LIVE_SUPPORT = 0x8000000; -/// used with i386 code stubs written on by dyld +/// used with x86 code stubs written on by dyld pub const S_ATTR_SELF_MODIFYING_CODE = 0x4000000; /// section contains some machine instructions diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index da9ea7432744163187492f35e0933b2b24c3a86d..f723024e87223135e53d3f3bb2c8547521a39fc6 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -33,7 +33,7 @@ const syscall_bits = switch (native_arch) { }; const arch_bits = switch (native_arch) { - .i386 => @import("linux/i386.zig"), + .x86 => @import("linux/x86.zig"), .x86_64 => @import("linux/x86_64.zig"), .aarch64 => @import("linux/arm64.zig"), .arm, .thumb => @import("linux/arm-eabi.zig"), @@ -94,7 +94,7 @@ pub const SECCOMP = @import("linux/seccomp.zig"); pub const syscalls = @import("linux/syscalls.zig"); pub const SYS = switch (@import("builtin").cpu.arch) { - .i386 => syscalls.X86, + .x86 => syscalls.X86, .x86_64 => syscalls.X64, .aarch64 => syscalls.Arm64, .arm, .thumb => syscalls.Arm, @@ -1198,42 +1198,42 @@ pub fn sigismember(set: *const sigset_t, sig: u6) bool { } pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.getsockname, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) }); } return syscall3(.getsockname, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len)); } pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.getpeername, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) }); } return syscall3(.getpeername, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len)); } pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.socket, &[3]usize{ domain, socket_type, protocol }); } return syscall3(.socket, domain, socket_type, protocol); } pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.setsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen) }); } return syscall5(.setsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen)); } pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.getsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen) }); } return syscall5(.getsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen)); } pub fn sendmsg(fd: i32, msg: *const std.x.os.Socket.Message, flags: c_int) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.sendmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) }); } 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 } pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.connect, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len }); } return syscall3(.connect, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len); } pub fn recvmsg(fd: i32, msg: *std.x.os.Socket.Message, flags: c_int) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.recvmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) }); } return syscall3(.recvmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags))); } pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.recvfrom, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen) }); } return syscall6(.recvfrom, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen)); } pub fn shutdown(fd: i32, how: i32) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.shutdown, &[2]usize{ @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)) }); } return syscall2(.shutdown, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how))); } pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.bind, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len) }); } return syscall3(.bind, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len)); } pub fn listen(fd: i32, backlog: u32) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.listen, &[2]usize{ @bitCast(usize, @as(isize, fd)), backlog }); } return syscall2(.listen, @bitCast(usize, @as(isize, fd)), backlog); } pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.sendto, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen) }); } 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 { } pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: *[2]i32) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd) }); } return syscall4(.socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd)); } pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.accept, &[4]usize{ fd, addr, len, 0 }); } return accept4(fd, addr, len, 0); } pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize { - if (native_arch == .i386) { + if (native_arch == .x86) { return socketcall(SC.accept4, &[4]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags }); } 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 { } pub const MINSIGSTKSZ = switch (native_arch) { - .i386, .x86_64, .arm, .mipsel => 2048, + .x86, .x86_64, .arm, .mipsel => 2048, .aarch64 => 5120, else => @compileError("MINSIGSTKSZ not defined for this architecture"), }; pub const SIGSTKSZ = switch (native_arch) { - .i386, .x86_64, .arm, .mipsel => 8192, + .x86, .x86_64, .arm, .mipsel => 8192, .aarch64 => 16384, else => @compileError("SIGSTKSZ not defined for this architecture"), }; @@ -5631,7 +5631,7 @@ pub const AUDIT = struct { const LE = 0x40000000; pub const current: AUDIT.ARCH = switch (native_arch) { - .i386 => .I386, + .x86 => .X86, .x86_64 => .X86_64, .aarch64 => .AARCH64, .arm, .thumb => .ARM, @@ -5650,7 +5650,7 @@ pub const AUDIT = struct { ARMEB = toAudit(.armeb), CSKY = toAudit(.csky), HEXAGON = @enumToInt(std.elf.EM.HEXAGON), - I386 = toAudit(.i386), + X86 = toAudit(.x86), M68K = toAudit(.m68k), MIPS = toAudit(.mips), MIPSEL = toAudit(.mips) | LE, diff --git a/lib/std/os/linux/i386.zig b/lib/std/os/linux/i386.zig deleted file mode 100644 index 93570025191aecfecc5989b4a094e008963af259..0000000000000000000000000000000000000000 --- a/lib/std/os/linux/i386.zig +++ /dev/null @@ -1,383 +0,0 @@ -const std = @import("../../std.zig"); -const maxInt = std.math.maxInt; -const linux = std.os.linux; -const SYS = linux.SYS; -const socklen_t = linux.socklen_t; -const iovec = std.os.iovec; -const iovec_const = std.os.iovec_const; -const uid_t = linux.uid_t; -const gid_t = linux.gid_t; -const pid_t = linux.pid_t; -const stack_t = linux.stack_t; -const sigset_t = linux.sigset_t; -const sockaddr = linux.sockaddr; -const timespec = linux.timespec; - -pub fn syscall0(number: SYS) usize { - return asm volatile ("int $0x80" - : [ret] "={eax}" (-> usize), - : [number] "{eax}" (@enumToInt(number)), - : "memory" - ); -} - -pub fn syscall1(number: SYS, arg1: usize) usize { - return asm volatile ("int $0x80" - : [ret] "={eax}" (-> usize), - : [number] "{eax}" (@enumToInt(number)), - [arg1] "{ebx}" (arg1), - : "memory" - ); -} - -pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { - return asm volatile ("int $0x80" - : [ret] "={eax}" (-> usize), - : [number] "{eax}" (@enumToInt(number)), - [arg1] "{ebx}" (arg1), - [arg2] "{ecx}" (arg2), - : "memory" - ); -} - -pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { - return asm volatile ("int $0x80" - : [ret] "={eax}" (-> usize), - : [number] "{eax}" (@enumToInt(number)), - [arg1] "{ebx}" (arg1), - [arg2] "{ecx}" (arg2), - [arg3] "{edx}" (arg3), - : "memory" - ); -} - -pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { - return asm volatile ("int $0x80" - : [ret] "={eax}" (-> usize), - : [number] "{eax}" (@enumToInt(number)), - [arg1] "{ebx}" (arg1), - [arg2] "{ecx}" (arg2), - [arg3] "{edx}" (arg3), - [arg4] "{esi}" (arg4), - : "memory" - ); -} - -pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { - return asm volatile ("int $0x80" - : [ret] "={eax}" (-> usize), - : [number] "{eax}" (@enumToInt(number)), - [arg1] "{ebx}" (arg1), - [arg2] "{ecx}" (arg2), - [arg3] "{edx}" (arg3), - [arg4] "{esi}" (arg4), - [arg5] "{edi}" (arg5), - : "memory" - ); -} - -pub fn syscall6( - number: SYS, - arg1: usize, - arg2: usize, - arg3: usize, - arg4: usize, - arg5: usize, - arg6: usize, -) usize { - // The 6th argument is passed via memory as we're out of registers if ebp is - // used as frame pointer. We push arg6 value on the stack before changing - // ebp or esp as the compiler may reference it as an offset relative to one - // of those two registers. - return asm volatile ( - \\ push %[arg6] - \\ push %%ebp - \\ mov 4(%%esp), %%ebp - \\ int $0x80 - \\ pop %%ebp - \\ add $4, %%esp - : [ret] "={eax}" (-> usize), - : [number] "{eax}" (@enumToInt(number)), - [arg1] "{ebx}" (arg1), - [arg2] "{ecx}" (arg2), - [arg3] "{edx}" (arg3), - [arg4] "{esi}" (arg4), - [arg5] "{edi}" (arg5), - [arg6] "rm" (arg6), - : "memory" - ); -} - -pub fn socketcall(call: usize, args: [*]usize) usize { - return asm volatile ("int $0x80" - : [ret] "={eax}" (-> usize), - : [number] "{eax}" (@enumToInt(SYS.socketcall)), - [arg1] "{ebx}" (call), - [arg2] "{ecx}" (@ptrToInt(args)), - : "memory" - ); -} - -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); - -/// This matches the libc clone function. -pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; - -pub fn restore() callconv(.Naked) void { - switch (@import("builtin").zig_backend) { - .stage2_c => return asm volatile ( - \\ movl %[number], %%eax - \\ int $0x80 - : - : [number] "i" (@enumToInt(SYS.sigreturn)), - : "memory" - ), - else => return asm volatile ("int $0x80" - : - : [number] "{eax}" (@enumToInt(SYS.sigreturn)), - : "memory" - ), - } -} - -pub fn restore_rt() callconv(.Naked) void { - switch (@import("builtin").zig_backend) { - .stage2_c => return asm volatile ( - \\ movl %[number], %%eax - \\ int $0x80 - : - : [number] "i" (@enumToInt(SYS.rt_sigreturn)), - : "memory" - ), - else => return asm volatile ("int $0x80" - : - : [number] "{eax}" (@enumToInt(SYS.rt_sigreturn)), - : "memory" - ), - } -} - -pub const O = struct { - pub const CREAT = 0o100; - pub const EXCL = 0o200; - pub const NOCTTY = 0o400; - pub const TRUNC = 0o1000; - pub const APPEND = 0o2000; - pub const NONBLOCK = 0o4000; - pub const DSYNC = 0o10000; - pub const SYNC = 0o4010000; - pub const RSYNC = 0o4010000; - pub const DIRECTORY = 0o200000; - pub const NOFOLLOW = 0o400000; - pub const CLOEXEC = 0o2000000; - - pub const ASYNC = 0o20000; - pub const DIRECT = 0o40000; - pub const LARGEFILE = 0o100000; - pub const NOATIME = 0o1000000; - pub const PATH = 0o10000000; - pub const TMPFILE = 0o20200000; - pub const NDELAY = NONBLOCK; -}; - -pub const F = struct { - pub const DUPFD = 0; - pub const GETFD = 1; - pub const SETFD = 2; - pub const GETFL = 3; - pub const SETFL = 4; - pub const SETOWN = 8; - pub const GETOWN = 9; - pub const SETSIG = 10; - pub const GETSIG = 11; - pub const GETLK = 12; - pub const SETLK = 13; - pub const SETLKW = 14; - pub const SETOWN_EX = 15; - pub const GETOWN_EX = 16; - pub const GETOWNER_UIDS = 17; - - pub const RDLCK = 0; - pub const WRLCK = 1; - pub const UNLCK = 2; -}; - -pub const LOCK = struct { - pub const SH = 1; - pub const EX = 2; - pub const NB = 4; - pub const UN = 8; -}; - -pub const MAP = struct { - pub const NORESERVE = 0x4000; - pub const GROWSDOWN = 0x0100; - pub const DENYWRITE = 0x0800; - pub const EXECUTABLE = 0x1000; - pub const LOCKED = 0x2000; - pub const @"32BIT" = 0x40; -}; - -pub const MMAP2_UNIT = 4096; - -pub const VDSO = struct { - pub const CGT_SYM = "__vdso_clock_gettime"; - pub const CGT_VER = "LINUX_2.6"; -}; - -pub const ARCH = struct {}; - -pub const Flock = extern struct { - type: i16, - whence: i16, - start: off_t, - len: off_t, - pid: pid_t, -}; - -pub const msghdr = extern struct { - name: ?*sockaddr, - namelen: socklen_t, - iov: [*]iovec, - iovlen: i32, - control: ?*anyopaque, - controllen: socklen_t, - flags: i32, -}; - -pub const msghdr_const = extern struct { - name: ?*const sockaddr, - namelen: socklen_t, - iov: [*]const iovec_const, - iovlen: i32, - control: ?*const anyopaque, - controllen: socklen_t, - flags: i32, -}; - -pub const blksize_t = i32; -pub const nlink_t = u32; -pub const time_t = isize; -pub const mode_t = u32; -pub const off_t = i64; -pub const ino_t = u64; -pub const dev_t = u64; -pub const blkcnt_t = i64; - -// The `stat` definition used by the Linux kernel. -pub const Stat = extern struct { - dev: dev_t, - __dev_padding: u32, - __ino_truncated: u32, - mode: mode_t, - nlink: nlink_t, - uid: uid_t, - gid: gid_t, - rdev: dev_t, - __rdev_padding: u32, - size: off_t, - blksize: blksize_t, - blocks: blkcnt_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - ino: ino_t, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -pub const timeval = extern struct { - tv_sec: i32, - tv_usec: i32, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -pub const mcontext_t = extern struct { - gregs: [19]usize, - fpregs: [*]u8, - oldmask: usize, - cr2: usize, -}; - -pub const REG = struct { - pub const GS = 0; - pub const FS = 1; - pub const ES = 2; - pub const DS = 3; - pub const EDI = 4; - pub const ESI = 5; - pub const EBP = 6; - pub const ESP = 7; - pub const EBX = 8; - pub const EDX = 9; - pub const ECX = 10; - pub const EAX = 11; - pub const TRAPNO = 12; - pub const ERR = 13; - pub const EIP = 14; - pub const CS = 15; - pub const EFL = 16; - pub const UESP = 17; - pub const SS = 18; -}; - -pub const ucontext_t = extern struct { - flags: usize, - link: ?*ucontext_t, - stack: stack_t, - mcontext: mcontext_t, - sigmask: sigset_t, - regspace: [64]u64, -}; - -pub const Elf_Symndx = u32; - -pub const user_desc = packed struct { - entry_number: u32, - base_addr: u32, - limit: u32, - seg_32bit: u1, - contents: u2, - read_exec_only: u1, - limit_in_pages: u1, - seg_not_present: u1, - useable: u1, -}; - -/// socketcall() call numbers -pub const SC = struct { - pub const socket = 1; - pub const bind = 2; - pub const connect = 3; - pub const listen = 4; - pub const accept = 5; - pub const getsockname = 6; - pub const getpeername = 7; - pub const socketpair = 8; - pub const send = 9; - pub const recv = 10; - pub const sendto = 11; - pub const recvfrom = 12; - pub const shutdown = 13; - pub const setsockopt = 14; - pub const getsockopt = 15; - pub const sendmsg = 16; - pub const recvmsg = 17; - pub const accept4 = 18; - pub const recvmmsg = 19; - pub const sendmmsg = 20; -}; diff --git a/lib/std/os/linux/start_pie.zig b/lib/std/os/linux/start_pie.zig index bf3e9c4c1eede031f99fda3377b14f8be5949148..aa1418f4a33ef62bd347e836eba9626dd0425840 100644 --- a/lib/std/os/linux/start_pie.zig +++ b/lib/std/os/linux/start_pie.zig @@ -11,7 +11,7 @@ const R_RISCV_RELATIVE = 3; const R_SPARC_RELATIVE = 22; const R_RELATIVE = switch (builtin.cpu.arch) { - .i386 => R_386_RELATIVE, + .x86 => R_386_RELATIVE, .x86_64 => R_AMD64_RELATIVE, .arm => R_ARM_RELATIVE, .aarch64 => R_AARCH64_RELATIVE, @@ -24,7 +24,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { // relocation that, at this point, is not yet applied. fn getDynamicSymbol() [*]elf.Dyn { return switch (builtin.cpu.arch) { - .i386 => asm volatile ( + .x86 => asm volatile ( \\ .weak _DYNAMIC \\ .hidden _DYNAMIC \\ call 1f diff --git a/lib/std/os/linux/tls.zig b/lib/std/os/linux/tls.zig index d91f7d7a9e83d5bb517ea5ad409fb68d2fe69799..d487530f55fd0c0b22f9745d6a27b6359b557fd4 100644 --- a/lib/std/os/linux/tls.zig +++ b/lib/std/os/linux/tls.zig @@ -30,7 +30,7 @@ const native_arch = @import("builtin").cpu.arch; // `-- The thread pointer register points here // // The structure of the TCB is not defined by the ABI so we reserve enough space -// for a single pointer as some architectures such as i386 and x86_64 need a +// for a single pointer as some architectures such as x86 and x86_64 need a // pointer to the TCB block itself at the address pointed by the tp. // // In this case the control structure and DTV are placed one after another right @@ -49,7 +49,7 @@ const TLSVariant = enum { const tls_variant = switch (native_arch) { .arm, .armeb, .thumb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => TLSVariant.VariantI, - .x86_64, .i386, .sparc64 => TLSVariant.VariantII, + .x86_64, .x86, .sparc64 => TLSVariant.VariantII, else => @compileError("undefined tls_variant for this architecture"), }; @@ -102,7 +102,7 @@ const TLSImage = struct { dtv_offset: usize, data_offset: usize, data_size: usize, - // Only used on the i386 architecture + // Only used on the x86 architecture gdt_entry_number: usize, }; @@ -110,7 +110,7 @@ pub var tls_image: TLSImage = undefined; pub fn setThreadPointer(addr: usize) void { switch (native_arch) { - .i386 => { + .x86 => { var user_desc = std.os.linux.user_desc{ .entry_number = tls_image.gdt_entry_number, .base_addr = addr, diff --git a/lib/std/os/linux/x86.zig b/lib/std/os/linux/x86.zig new file mode 100644 index 0000000000000000000000000000000000000000..93570025191aecfecc5989b4a094e008963af259 --- /dev/null +++ b/lib/std/os/linux/x86.zig @@ -0,0 +1,383 @@ +const std = @import("../../std.zig"); +const maxInt = std.math.maxInt; +const linux = std.os.linux; +const SYS = linux.SYS; +const socklen_t = linux.socklen_t; +const iovec = std.os.iovec; +const iovec_const = std.os.iovec_const; +const uid_t = linux.uid_t; +const gid_t = linux.gid_t; +const pid_t = linux.pid_t; +const stack_t = linux.stack_t; +const sigset_t = linux.sigset_t; +const sockaddr = linux.sockaddr; +const timespec = linux.timespec; + +pub fn syscall0(number: SYS) usize { + return asm volatile ("int $0x80" + : [ret] "={eax}" (-> usize), + : [number] "{eax}" (@enumToInt(number)), + : "memory" + ); +} + +pub fn syscall1(number: SYS, arg1: usize) usize { + return asm volatile ("int $0x80" + : [ret] "={eax}" (-> usize), + : [number] "{eax}" (@enumToInt(number)), + [arg1] "{ebx}" (arg1), + : "memory" + ); +} + +pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { + return asm volatile ("int $0x80" + : [ret] "={eax}" (-> usize), + : [number] "{eax}" (@enumToInt(number)), + [arg1] "{ebx}" (arg1), + [arg2] "{ecx}" (arg2), + : "memory" + ); +} + +pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { + return asm volatile ("int $0x80" + : [ret] "={eax}" (-> usize), + : [number] "{eax}" (@enumToInt(number)), + [arg1] "{ebx}" (arg1), + [arg2] "{ecx}" (arg2), + [arg3] "{edx}" (arg3), + : "memory" + ); +} + +pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { + return asm volatile ("int $0x80" + : [ret] "={eax}" (-> usize), + : [number] "{eax}" (@enumToInt(number)), + [arg1] "{ebx}" (arg1), + [arg2] "{ecx}" (arg2), + [arg3] "{edx}" (arg3), + [arg4] "{esi}" (arg4), + : "memory" + ); +} + +pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { + return asm volatile ("int $0x80" + : [ret] "={eax}" (-> usize), + : [number] "{eax}" (@enumToInt(number)), + [arg1] "{ebx}" (arg1), + [arg2] "{ecx}" (arg2), + [arg3] "{edx}" (arg3), + [arg4] "{esi}" (arg4), + [arg5] "{edi}" (arg5), + : "memory" + ); +} + +pub fn syscall6( + number: SYS, + arg1: usize, + arg2: usize, + arg3: usize, + arg4: usize, + arg5: usize, + arg6: usize, +) usize { + // The 6th argument is passed via memory as we're out of registers if ebp is + // used as frame pointer. We push arg6 value on the stack before changing + // ebp or esp as the compiler may reference it as an offset relative to one + // of those two registers. + return asm volatile ( + \\ push %[arg6] + \\ push %%ebp + \\ mov 4(%%esp), %%ebp + \\ int $0x80 + \\ pop %%ebp + \\ add $4, %%esp + : [ret] "={eax}" (-> usize), + : [number] "{eax}" (@enumToInt(number)), + [arg1] "{ebx}" (arg1), + [arg2] "{ecx}" (arg2), + [arg3] "{edx}" (arg3), + [arg4] "{esi}" (arg4), + [arg5] "{edi}" (arg5), + [arg6] "rm" (arg6), + : "memory" + ); +} + +pub fn socketcall(call: usize, args: [*]usize) usize { + return asm volatile ("int $0x80" + : [ret] "={eax}" (-> usize), + : [number] "{eax}" (@enumToInt(SYS.socketcall)), + [arg1] "{ebx}" (call), + [arg2] "{ecx}" (@ptrToInt(args)), + : "memory" + ); +} + +const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); + +/// This matches the libc clone function. +pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; + +pub fn restore() callconv(.Naked) void { + switch (@import("builtin").zig_backend) { + .stage2_c => return asm volatile ( + \\ movl %[number], %%eax + \\ int $0x80 + : + : [number] "i" (@enumToInt(SYS.sigreturn)), + : "memory" + ), + else => return asm volatile ("int $0x80" + : + : [number] "{eax}" (@enumToInt(SYS.sigreturn)), + : "memory" + ), + } +} + +pub fn restore_rt() callconv(.Naked) void { + switch (@import("builtin").zig_backend) { + .stage2_c => return asm volatile ( + \\ movl %[number], %%eax + \\ int $0x80 + : + : [number] "i" (@enumToInt(SYS.rt_sigreturn)), + : "memory" + ), + else => return asm volatile ("int $0x80" + : + : [number] "{eax}" (@enumToInt(SYS.rt_sigreturn)), + : "memory" + ), + } +} + +pub const O = struct { + pub const CREAT = 0o100; + pub const EXCL = 0o200; + pub const NOCTTY = 0o400; + pub const TRUNC = 0o1000; + pub const APPEND = 0o2000; + pub const NONBLOCK = 0o4000; + pub const DSYNC = 0o10000; + pub const SYNC = 0o4010000; + pub const RSYNC = 0o4010000; + pub const DIRECTORY = 0o200000; + pub const NOFOLLOW = 0o400000; + pub const CLOEXEC = 0o2000000; + + pub const ASYNC = 0o20000; + pub const DIRECT = 0o40000; + pub const LARGEFILE = 0o100000; + pub const NOATIME = 0o1000000; + pub const PATH = 0o10000000; + pub const TMPFILE = 0o20200000; + pub const NDELAY = NONBLOCK; +}; + +pub const F = struct { + pub const DUPFD = 0; + pub const GETFD = 1; + pub const SETFD = 2; + pub const GETFL = 3; + pub const SETFL = 4; + pub const SETOWN = 8; + pub const GETOWN = 9; + pub const SETSIG = 10; + pub const GETSIG = 11; + pub const GETLK = 12; + pub const SETLK = 13; + pub const SETLKW = 14; + pub const SETOWN_EX = 15; + pub const GETOWN_EX = 16; + pub const GETOWNER_UIDS = 17; + + pub const RDLCK = 0; + pub const WRLCK = 1; + pub const UNLCK = 2; +}; + +pub const LOCK = struct { + pub const SH = 1; + pub const EX = 2; + pub const NB = 4; + pub const UN = 8; +}; + +pub const MAP = struct { + pub const NORESERVE = 0x4000; + pub const GROWSDOWN = 0x0100; + pub const DENYWRITE = 0x0800; + pub const EXECUTABLE = 0x1000; + pub const LOCKED = 0x2000; + pub const @"32BIT" = 0x40; +}; + +pub const MMAP2_UNIT = 4096; + +pub const VDSO = struct { + pub const CGT_SYM = "__vdso_clock_gettime"; + pub const CGT_VER = "LINUX_2.6"; +}; + +pub const ARCH = struct {}; + +pub const Flock = extern struct { + type: i16, + whence: i16, + start: off_t, + len: off_t, + pid: pid_t, +}; + +pub const msghdr = extern struct { + name: ?*sockaddr, + namelen: socklen_t, + iov: [*]iovec, + iovlen: i32, + control: ?*anyopaque, + controllen: socklen_t, + flags: i32, +}; + +pub const msghdr_const = extern struct { + name: ?*const sockaddr, + namelen: socklen_t, + iov: [*]const iovec_const, + iovlen: i32, + control: ?*const anyopaque, + controllen: socklen_t, + flags: i32, +}; + +pub const blksize_t = i32; +pub const nlink_t = u32; +pub const time_t = isize; +pub const mode_t = u32; +pub const off_t = i64; +pub const ino_t = u64; +pub const dev_t = u64; +pub const blkcnt_t = i64; + +// The `stat` definition used by the Linux kernel. +pub const Stat = extern struct { + dev: dev_t, + __dev_padding: u32, + __ino_truncated: u32, + mode: mode_t, + nlink: nlink_t, + uid: uid_t, + gid: gid_t, + rdev: dev_t, + __rdev_padding: u32, + size: off_t, + blksize: blksize_t, + blocks: blkcnt_t, + atim: timespec, + mtim: timespec, + ctim: timespec, + ino: ino_t, + + pub fn atime(self: @This()) timespec { + return self.atim; + } + + pub fn mtime(self: @This()) timespec { + return self.mtim; + } + + pub fn ctime(self: @This()) timespec { + return self.ctim; + } +}; + +pub const timeval = extern struct { + tv_sec: i32, + tv_usec: i32, +}; + +pub const timezone = extern struct { + tz_minuteswest: i32, + tz_dsttime: i32, +}; + +pub const mcontext_t = extern struct { + gregs: [19]usize, + fpregs: [*]u8, + oldmask: usize, + cr2: usize, +}; + +pub const REG = struct { + pub const GS = 0; + pub const FS = 1; + pub const ES = 2; + pub const DS = 3; + pub const EDI = 4; + pub const ESI = 5; + pub const EBP = 6; + pub const ESP = 7; + pub const EBX = 8; + pub const EDX = 9; + pub const ECX = 10; + pub const EAX = 11; + pub const TRAPNO = 12; + pub const ERR = 13; + pub const EIP = 14; + pub const CS = 15; + pub const EFL = 16; + pub const UESP = 17; + pub const SS = 18; +}; + +pub const ucontext_t = extern struct { + flags: usize, + link: ?*ucontext_t, + stack: stack_t, + mcontext: mcontext_t, + sigmask: sigset_t, + regspace: [64]u64, +}; + +pub const Elf_Symndx = u32; + +pub const user_desc = packed struct { + entry_number: u32, + base_addr: u32, + limit: u32, + seg_32bit: u1, + contents: u2, + read_exec_only: u1, + limit_in_pages: u1, + seg_not_present: u1, + useable: u1, +}; + +/// socketcall() call numbers +pub const SC = struct { + pub const socket = 1; + pub const bind = 2; + pub const connect = 3; + pub const listen = 4; + pub const accept = 5; + pub const getsockname = 6; + pub const getpeername = 7; + pub const socketpair = 8; + pub const send = 9; + pub const recv = 10; + pub const sendto = 11; + pub const recvfrom = 12; + pub const shutdown = 13; + pub const setsockopt = 14; + pub const getsockopt = 15; + pub const sendmsg = 16; + pub const recvmsg = 17; + pub const accept4 = 18; + pub const recvmmsg = 19; + pub const sendmmsg = 20; +}; diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index a8497586f96999ec061dfbbf60cc88d394cb0fff..38c029f6127109a1b9348ad902ccec7fb741acdf 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -746,7 +746,7 @@ test "sigaction" { return error.SkipZigTest; // https://github.com/ziglang/zig/issues/7427 - if (native_os == .linux and builtin.target.cpu.arch == .i386) + if (native_os == .linux and builtin.target.cpu.arch == .x86) return error.SkipZigTest; const S = struct { diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 71dfc70d3773b241fba5d06518f2d8e8740c12bb..18c6244baf29d5086e76882147187d0c9e6cdb2c 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -1750,7 +1750,7 @@ pub fn UnlockFile( pub fn teb() *TEB { return switch (native_arch) { - .i386 => asm volatile ( + .x86 => asm volatile ( \\ movl %%fs:0x18, %[ptr] : [ptr] "=r" (-> *TEB), ), @@ -2053,7 +2053,7 @@ pub const STD_OUTPUT_HANDLE = maxInt(DWORD) - 11 + 1; /// The standard error device. Initially, this is the active console screen buffer, CONOUT$. pub const STD_ERROR_HANDLE = maxInt(DWORD) - 12 + 1; -pub const WINAPI: std.builtin.CallingConvention = if (native_arch == .i386) +pub const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .Stdcall else .C; @@ -3019,7 +3019,7 @@ pub const EXCEPTION_RECORD = extern struct { }; pub usingnamespace switch (native_arch) { - .i386 => struct { + .x86 => struct { pub const FLOATING_SAVE_AREA = extern struct { ControlWord: DWORD, StatusWord: DWORD, diff --git a/lib/std/start.zig b/lib/std/start.zig index 7ba24ad78cc4a9f67647918827cf1cbb46d3fe4d..8a0febf1a105de4dd5e73c9cf8c370b512c074d5 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -275,7 +275,7 @@ fn _start() callconv(.Naked) noreturn { \\ andq $-16, %%rsp \\ call _posixCallMainAndExit ), - .i386 => asm volatile ( + .x86 => asm volatile ( \\ xorl %%ebp, %%ebp \\ movl %%esp, argc_argv_ptr \\ andl $-16, %%esp @@ -307,7 +307,7 @@ fn _start() callconv(.Naked) noreturn { : [argc] "={rsp}" (-> [*]usize), ); }, - .i386 => { + .x86 => { argc_argv_ptr = asm volatile ( \\ xor %%ebp, %%ebp : [argc] "={esp}" (-> [*]usize), diff --git a/lib/std/start_windows_tls.zig b/lib/std/start_windows_tls.zig index df25a903a2761048a4863db22648769c4c017feb..b8d5ebc95407a4181feece0fb39f589e68e77c14 100644 --- a/lib/std/start_windows_tls.zig +++ b/lib/std/start_windows_tls.zig @@ -8,7 +8,7 @@ export var __xl_a: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLA") = export var __xl_z: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLZ") = null; comptime { - if (builtin.target.cpu.arch == .i386) { + if (builtin.target.cpu.arch == .x86) { // The __tls_array is the offset of the ThreadLocalStoragePointer field // in the TEB block whose base address held in the %fs segment. asm ( diff --git a/lib/std/target.zig b/lib/std/target.zig index 34bae7cda2e714803a57c464e0d986c3e6198916..691c5f2447bb8cd79f24a70030a8cc4358240a7f 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -850,7 +850,7 @@ pub const Target = struct { tcele, thumb, thumbeb, - i386, + x86, x86_64, xcore, nvptx, @@ -879,7 +879,7 @@ pub const Target = struct { pub fn isX86(arch: Arch) bool { return switch (arch) { - .i386, .x86_64 => true, + .x86, .x86_64 => true, else => false, }; } @@ -999,7 +999,7 @@ pub const Target = struct { .tcele => .NONE, .thumb => .ARM, .thumbeb => .ARM, - .i386 => .@"386", + .x86 => .@"386", .xcore => .XCORE, .nvptx => .NONE, .amdil => .NONE, @@ -1063,7 +1063,7 @@ pub const Target = struct { .tcele => .Unknown, .thumb => .Thumb, .thumbeb => .Thumb, - .i386 => .I386, + .x86 => .I386, .xcore => .Unknown, .nvptx => .Unknown, .amdil => .Unknown, @@ -1134,7 +1134,7 @@ pub const Target = struct { .r600, .riscv32, .riscv64, - .i386, + .x86, .x86_64, .wasm32, .wasm64, @@ -1179,7 +1179,7 @@ pub const Target = struct { const is_nvptx = arch == .nvptx or arch == .nvptx64; return switch (address_space) { .generic => true, - .fs, .gs, .ss => arch == .x86_64 or arch == .i386, + .fs, .gs, .ss => arch == .x86_64 or arch == .x86, .global, .constant, .local, .shared => arch == .amdgcn or is_nvptx, .param => is_nvptx, }; @@ -1211,7 +1211,7 @@ pub const Target = struct { .tcele, .thumb, .thumbeb, - .i386, + .x86, .xcore, .nvptx, .amdil, @@ -1267,7 +1267,7 @@ pub const Target = struct { .riscv32, .riscv64 => "riscv", .sparc, .sparc64, .sparcel => "sparc", .s390x => "s390x", - .i386, .x86_64 => "x86", + .x86, .x86_64 => "x86", .nvptx, .nvptx64 => "nvptx", .wasm32, .wasm64 => "wasm", .spirv32, .spirv64 => "spir-v", @@ -1291,7 +1291,7 @@ pub const Target = struct { .sparc, .sparc64, .sparcel => &sparc.all_features, .spirv32, .spirv64 => &spirv.all_features, .s390x => &s390x.all_features, - .i386, .x86_64 => &x86.all_features, + .x86, .x86_64 => &x86.all_features, .nvptx, .nvptx64 => &nvptx.all_features, .ve => &ve.all_features, .wasm32, .wasm64 => &wasm.all_features, @@ -1315,7 +1315,7 @@ pub const Target = struct { .riscv32, .riscv64 => comptime allCpusFromDecls(riscv.cpu), .sparc, .sparc64, .sparcel => comptime allCpusFromDecls(sparc.cpu), .s390x => comptime allCpusFromDecls(s390x.cpu), - .i386, .x86_64 => comptime allCpusFromDecls(x86.cpu), + .x86, .x86_64 => comptime allCpusFromDecls(x86.cpu), .nvptx, .nvptx64 => comptime allCpusFromDecls(nvptx.cpu), .ve => comptime allCpusFromDecls(ve.cpu), .wasm32, .wasm64 => comptime allCpusFromDecls(wasm.cpu), @@ -1377,7 +1377,7 @@ pub const Target = struct { .sparc, .sparcel => &sparc.cpu.generic, .sparc64 => &sparc.cpu.v9, // 64-bit SPARC needs v9 as the baseline .s390x => &s390x.cpu.generic, - .i386 => &x86.cpu.i386, + .x86 => &x86.cpu.x86, .x86_64 => &x86.cpu.x86_64, .nvptx, .nvptx64 => &nvptx.cpu.sm_20, .ve => &ve.cpu.generic, @@ -1392,7 +1392,7 @@ pub const Target = struct { .arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline, .riscv32 => &riscv.cpu.baseline_rv32, .riscv64 => &riscv.cpu.baseline_rv64, - .i386 => &x86.cpu.pentium4, + .x86 => &x86.cpu.pentium4, .nvptx, .nvptx64 => &nvptx.cpu.sm_20, .sparc, .sparcel => &sparc.cpu.v8, @@ -1622,7 +1622,7 @@ pub const Target = struct { .dragonfly => return copy(&result, "/libexec/ld-elf.so.2"), .solaris => return copy(&result, "/lib/64/ld.so.1"), .linux => switch (self.cpu.arch) { - .i386, + .x86, .sparc, .sparcel, => return copy(&result, "/lib/ld-linux.so.2"), @@ -1771,7 +1771,7 @@ pub const Target = struct { /// 5c arm little-endian ARM /// 6c amd64 AMD64 and compatibles (e.g., Intel EM64T) /// 7c arm64 ARM64 (ARMv8) - /// 8c 386 Intel i386, i486, Pentium, etc. + /// 8c 386 Intel x86, i486, Pentium, etc. /// kc sparc Sun SPARC /// qc power Power PC /// vc mips big-endian MIPS 3000 family @@ -1780,7 +1780,7 @@ pub const Target = struct { .arm => ".5", .x86_64 => ".6", .aarch64 => ".7", - .i386 => ".8", + .x86 => ".8", .sparc => ".k", .powerpc, .powerpcle => ".q", .mips, .mipsel => ".v", @@ -1815,7 +1815,7 @@ pub const Target = struct { .wasm64, => 8, - .i386 => return switch (target.os.tag) { + .x86 => return switch (target.os.tag) { .windows, .uefi => 8, else => 4, }, diff --git a/lib/std/target/x86.zig b/lib/std/target/x86.zig index a561c317bd13001cb082082199a6b75564c5878a..0d38e706637f77c23e22c7bd1063f2110133686e 100644 --- a/lib/std/target/x86.zig +++ b/lib/std/target/x86.zig @@ -2040,8 +2040,8 @@ pub const cpu = struct { .xsaveopt, }), }; - pub const @"i386" = CpuModel{ - .name = "i386", + pub const x86 = CpuModel{ + .name = "x86", .llvm_name = "i386", .features = featureSet(&[_]Feature{ .slow_unaligned_mem_16, diff --git a/lib/std/valgrind.zig b/lib/std/valgrind.zig index 7532e73e490df3803011b8560be62bb5da5b1642..471342ef17cfd03948149c1be11b6e4dcbb51f14 100644 --- a/lib/std/valgrind.zig +++ b/lib/std/valgrind.zig @@ -8,7 +8,7 @@ pub fn doClientRequest(default: usize, request: usize, a1: usize, a2: usize, a3: } switch (builtin.target.cpu.arch) { - .i386 => { + .x86 => { return asm volatile ( \\ roll $3, %%edi ; roll $13, %%edi \\ roll $29, %%edi ; roll $19, %%edi diff --git a/lib/std/zig/CrossTarget.zig b/lib/std/zig/CrossTarget.zig index 6c59a4a3a1c05172631196346849eaf7ff62b355..aad0cb42f252d04b858133ba6ec598aa043f1c1c 100644 --- a/lib/std/zig/CrossTarget.zig +++ b/lib/std/zig/CrossTarget.zig @@ -592,7 +592,7 @@ pub const VcpkgLinkage = std.builtin.LinkMode; /// Returned slice must be freed by the caller. pub fn vcpkgTriplet(self: CrossTarget, allocator: mem.Allocator, linkage: VcpkgLinkage) ![]u8 { const arch = switch (self.getCpuArch()) { - .i386 => "x86", + .x86 => "x86", .x86_64 => "x64", .arm, diff --git a/lib/std/zig/system/NativeTargetInfo.zig b/lib/std/zig/system/NativeTargetInfo.zig index c7b3f73f89626ead5524bc1f84fa0ddf5a03ca04..09b863cdf7fc27d10a719161472b5e4a22c99a9d 100644 --- a/lib/std/zig/system/NativeTargetInfo.zig +++ b/lib/std/zig/system/NativeTargetInfo.zig @@ -199,11 +199,11 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo { // For x86, we need to populate some CPU feature flags depending on architecture // and mode: // * 16bit_mode => if the abi is code16 - // * 32bit_mode => if the arch is i386 + // * 32bit_mode => if the arch is x86 // However, the "mode" flags can be used as overrides, so if the user explicitly // sets one of them, that takes precedence. switch (cpu_arch) { - .i386 => { + .x86 => { if (!std.Target.x86.featureSetHasAny(cross_target.cpu_features_add, .{ .@"16bit_mode", .@"32bit_mode", })) { @@ -969,7 +969,7 @@ fn detectNativeCpuAndFeatures(cpu_arch: Target.Cpu.Arch, os: Target.Os, cross_ta // although it is a runtime value, is guaranteed to be one of the architectures in the set // of the respective switch prong. switch (builtin.cpu.arch) { - .x86_64, .i386 => { + .x86_64, .x86 => { return @import("x86.zig").detectNativeCpuAndFeatures(cpu_arch, os, cross_target); }, else => {}, @@ -1019,7 +1019,7 @@ pub fn getExternalExecutor( if (host.target.cpu.arch == candidate.target.cpu.arch) break :cpu_ok true; - if (host.target.cpu.arch == .x86_64 and candidate.target.cpu.arch == .i386) + if (host.target.cpu.arch == .x86_64 and candidate.target.cpu.arch == .x86) break :cpu_ok true; if (host.target.cpu.arch == .aarch64 and candidate.target.cpu.arch == .arm) @@ -1068,7 +1068,7 @@ pub fn getExternalExecutor( .arm => Executor{ .qemu = "qemu-arm" }, .armeb => Executor{ .qemu = "qemu-armeb" }, .hexagon => Executor{ .qemu = "qemu-hexagon" }, - .i386 => Executor{ .qemu = "qemu-i386" }, + .x86 => Executor{ .qemu = "qemu-i386" }, .m68k => Executor{ .qemu = "qemu-m68k" }, .mips => Executor{ .qemu = "qemu-mips" }, .mipsel => Executor{ .qemu = "qemu-mipsel" }, diff --git a/lib/std/zig/system/x86.zig b/lib/std/zig/system/x86.zig index 66468ba6ff88e1f7b72db4c5d4e13bb1791975b5..50198fc654e19659cc6be03d0f15c7515f2b1b7b 100644 --- a/lib/std/zig/system/x86.zig +++ b/lib/std/zig/system/x86.zig @@ -80,7 +80,7 @@ fn detectIntelProcessor(cpu: *Target.Cpu, family: u32, model: u32, brand_id: u32 } switch (family) { 3 => { - cpu.model = &Target.x86.cpu.i386; + cpu.model = &Target.x86.cpu.x86; return; }, 4 => { diff --git a/src/Compilation.zig b/src/Compilation.zig index 958aac5e1bf365dbd2607623d429c1470c959b82..79035864505c247e151b9337e29d6c05bbb268f3 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4281,7 +4281,7 @@ pub fn addCCArgs( }, .ios, .tvos, .watchos => switch (target.cpu.arch) { // Pass the proper -m-version-min argument for darwin. - .i386, .x86_64 => { + .x86, .x86_64 => { const ver = target.os.version_range.semver.min; try argv.append(try std.fmt.allocPrint( arena, @@ -4969,7 +4969,7 @@ pub fn getZigBackend(comp: Compilation) std.builtin.CompilerBackend { .wasm32, .wasm64 => std.builtin.CompilerBackend.stage2_wasm, .arm, .armeb, .thumb, .thumbeb => .stage2_arm, .x86_64 => .stage2_x86_64, - .i386 => .stage2_x86, + .x86 => .stage2_x86, .aarch64, .aarch64_be, .aarch64_32 => .stage2_aarch64, .riscv64 => .stage2_riscv64, .sparc64 => .stage2_sparc64, diff --git a/src/Sema.zig b/src/Sema.zig index f3aa861b5c119a1918c0a52f07ecb6aa0b45c608..3a36cbf2f549c409acdd58521a3413807c7ec9cc 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -8415,20 +8415,20 @@ fn funcCommon( if (switch (cc_workaround) { .Unspecified, .C, .Naked, .Async, .Inline => null, .Interrupt => switch (arch) { - .i386, .x86_64, .avr, .msp430 => null, - else => @as([]const u8, "i386, x86_64, AVR, and MSP430"), + .x86, .x86_64, .avr, .msp430 => null, + else => @as([]const u8, "x86, x86_64, AVR, and MSP430"), }, .Signal => switch (arch) { .avr => null, else => @as([]const u8, "AVR"), }, .Stdcall, .Fastcall, .Thiscall => switch (arch) { - .i386 => null, - else => @as([]const u8, "i386"), + .x86 => null, + else => @as([]const u8, "x86"), }, .Vectorcall => switch (arch) { - .i386, .aarch64, .aarch64_be, .aarch64_32 => null, - else => @as([]const u8, "i386 and AArch64"), + .x86, .aarch64, .aarch64_be, .aarch64_32 => null, + else => @as([]const u8, "x86 and AArch64"), }, .APCS, .AAPCS, .AAPCSVFP => switch (arch) { .arm, .armeb, .aarch64, .aarch64_be, .aarch64_32, .thumb, .thumbeb => null, @@ -30813,7 +30813,7 @@ pub fn analyzeAddressSpace( const supported = switch (address_space) { .generic => true, - .gs, .fs, .ss => (arch == .i386 or arch == .x86_64) and ctx == .pointer, + .gs, .fs, .ss => (arch == .x86 or arch == .x86_64) and ctx == .pointer, // TODO: check that .shared and .local are left uninitialized .param => is_nv, .global, .shared, .local => is_gpu, diff --git a/src/codegen.zig b/src/codegen.zig index 6acea5a509d6923302b5564a8aacc8c4dd79588b..53a4f9a402b87d03fbf6c6799c50cf8177e2350b 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -110,7 +110,7 @@ pub fn generateFunction( //.tcele => return Function(.tcele).generate(bin_file, src_loc, func, air, liveness, code, debug_output), //.thumb => return Function(.thumb).generate(bin_file, src_loc, func, air, liveness, code, debug_output), //.thumbeb => return Function(.thumbeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.i386 => return Function(.i386).generate(bin_file, src_loc, func, air, liveness, code, debug_output), + //.x86 => return Function(.x86).generate(bin_file, src_loc, func, air, liveness, code, debug_output), .x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output), //.xcore => return Function(.xcore).generate(bin_file, src_loc, func, air, liveness, code, debug_output), //.nvptx => return Function(.nvptx).generate(bin_file, src_loc, func, air, liveness, code, debug_output), diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 8daffaefe0f71bfaa253e30d06c0e1e8d498a896..a37098f04bd914916f4379c9b226bc38603e8168 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -70,7 +70,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![:0]u8 { .tcele => "tcele", .thumb => "thumb", .thumbeb => "thumbeb", - .i386 => "i386", + .x86 => "i386", .x86_64 => "x86_64", .xcore => "xcore", .nvptx => "nvptx", @@ -282,7 +282,7 @@ pub fn targetArch(arch_tag: std.Target.Cpu.Arch) llvm.ArchType { .tcele => .tcele, .thumb => .thumb, .thumbeb => .thumbeb, - .i386 => .x86, + .x86 => .x86, .x86_64 => .x86_64, .xcore => .xcore, .nvptx => .nvptx, @@ -6195,7 +6195,7 @@ pub const FuncGen = struct { // here then we may risk tripping LLVM bugs since anything not used by Clang tends // to be buggy and regress often. switch (target.cpu.arch) { - .x86_64, .i386 => { + .x86_64, .x86 => { if (total_i != 0) try llvm_constraints.append(self.gpa, ','); try llvm_constraints.appendSlice(self.gpa, "~{dirflag},~{fpsr},~{flags}"); total_i += 3; @@ -9275,7 +9275,7 @@ pub const FuncGen = struct { switch (prefetch.cache) { .instruction => switch (target.cpu.arch) { .x86_64, - .i386, + .x86, .powerpc, .powerpcle, .powerpc64, @@ -9856,7 +9856,7 @@ fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void { llvm.LLVMInitializeWebAssemblyAsmPrinter(); llvm.LLVMInitializeWebAssemblyAsmParser(); }, - .i386, .x86_64 => { + .x86, .x86_64 => { llvm.LLVMInitializeX86Target(); llvm.LLVMInitializeX86TargetInfo(); llvm.LLVMInitializeX86TargetMC(); @@ -9968,7 +9968,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca .Stdcall => .X86_StdCall, .Fastcall => .X86_FastCall, .Vectorcall => return switch (target.cpu.arch) { - .i386, .x86_64 => .X86_VectorCall, + .x86, .x86_64 => .X86_VectorCall, .aarch64, .aarch64_be, .aarch64_32 => .AArch64_VectorCall, else => unreachable, }, @@ -9977,7 +9977,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca .AAPCS => .ARM_AAPCS, .AAPCSVFP => .ARM_AAPCS_VFP, .Interrupt => return switch (target.cpu.arch) { - .i386, .x86_64 => .X86_INTR, + .x86, .x86_64 => .X86_INTR, .avr => .AVR_INTR, .msp430 => .MSP430_INTR, else => unreachable, @@ -9999,7 +9999,7 @@ fn toLlvmCallConv(cc: std.builtin.CallingConvention, target: std.Target) llvm.Ca /// Convert a zig-address space to an llvm address space. fn toLlvmAddressSpace(address_space: std.builtin.AddressSpace, target: std.Target) c_uint { return switch (target.cpu.arch) { - .i386, .x86_64 => switch (address_space) { + .x86, .x86_64 => switch (address_space) { .generic => llvm.address_space.default, .gs => llvm.address_space.x86.gs, .fs => llvm.address_space.x86.fs, @@ -10714,7 +10714,7 @@ fn isScalar(ty: Type) bool { /// and false if we expect LLVM to crash if it counters an x86_fp80 type. fn backendSupportsF80(target: std.Target) bool { return switch (target.cpu.arch) { - .x86_64, .i386 => !std.Target.x86.featureSetHas(target.cpu.features, .soft_float), + .x86_64, .x86 => !std.Target.x86.featureSetHas(target.cpu.features, .soft_float), else => false, }; } diff --git a/src/crash_report.zig b/src/crash_report.zig index 04fbabca09fc823eb499a004d1913945e9a78d2a..cdb475ec6c3c2aebf0403c2b131916bf2b049743 100644 --- a/src/crash_report.zig +++ b/src/crash_report.zig @@ -205,7 +205,7 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any }; const stack_ctx: StackContext = switch (builtin.cpu.arch) { - .i386 => ctx: { + .x86 => ctx: { const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr)); const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]); const bp = @intCast(usize, ctx.mcontext.gregs[os.REG.EBP]); diff --git a/src/glibc.zig b/src/glibc.zig index ddbf3ac05018b3d9a4a3cbb6d4d11affdffb8566..87e713de34a4e5652d2c6e37b434a4c7b224e193 100644 --- a/src/glibc.zig +++ b/src/glibc.zig @@ -327,7 +327,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { }); try add_include_dirs(comp, arena, &args); - if (target.cpu.arch == .i386) { + if (target.cpu.arch == .x86) { // This prevents i386/sysdep.h from trying to do some // silly and unnecessary inline asm hack that uses weird // syntax that clang does not support. @@ -406,7 +406,7 @@ fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![ } } else if (arch == .x86_64) { try result.appendSlice("x86_64"); - } else if (arch == .i386) { + } else if (arch == .x86) { try result.appendSlice("i386"); } else if (is_aarch64) { try result.appendSlice("aarch64"); @@ -504,7 +504,7 @@ fn add_include_dirs_arch( opt_nptl: ?[]const u8, dir: []const u8, ) error{OutOfMemory}!void { - const is_x86 = arch == .i386 or arch == .x86_64; + const is_x86 = arch == .x86 or arch == .x86_64; const is_aarch64 = arch == .aarch64 or arch == .aarch64_be; const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le; const is_sparc = arch == .sparc or arch == .sparcel or arch == .sparc64; @@ -521,7 +521,7 @@ fn add_include_dirs_arch( try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64" })); } - } else if (arch == .i386) { + } else if (arch == .x86) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "i386", nptl })); diff --git a/src/libc_installation.zig b/src/libc_installation.zig index 58910ba12f4b4dc98a9790705bb8594ff61cf3c9..77d8571eaeb4288f29b9de8f6568da84878f7ee9 100644 --- a/src/libc_installation.zig +++ b/src/libc_installation.zig @@ -408,7 +408,7 @@ pub const LibCInstallation = struct { defer result_buf.deinit(); const arch_sub_dir = switch (builtin.target.cpu.arch) { - .i386 => "x86", + .x86 => "x86", .x86_64 => "x64", .arm, .armeb => "arm", .aarch64 => "arm64", @@ -472,7 +472,7 @@ pub const LibCInstallation = struct { defer result_buf.deinit(); const arch_sub_dir = switch (builtin.target.cpu.arch) { - .i386 => "x86", + .x86 => "x86", .x86_64 => "x64", .arm, .armeb => "arm", .aarch64 => "arm64", diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 8f29f4bd56f747ce96f3b859ba259e677ef0e558..ee5804b79a9b64f0c74089f2aa46a815cba939bb 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1294,7 +1294,7 @@ pub fn updateDeclExports( const exported_decl = module.declPtr(exp.exported_decl); if (exported_decl.getFunction() == null) continue; const winapi_cc = switch (self.base.options.target.cpu.arch) { - .i386 => std.builtin.CallingConvention.Stdcall, + .x86 => std.builtin.CallingConvention.Stdcall, else => std.builtin.CallingConvention.C, }; const decl_cc = exported_decl.ty.fnCallingConvention(); diff --git a/src/link/Coff/lld.zig b/src/link/Coff/lld.zig index feae0134e9c58af2b975a44848485535ff5da278..7047d4fdba7fca2dd92753c488c8196de29107a0 100644 --- a/src/link/Coff/lld.zig +++ b/src/link/Coff/lld.zig @@ -197,7 +197,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod try argv.append(try std.fmt.allocPrint(arena, "-BASE:{d}", .{image_base})); } - if (target.cpu.arch == .i386) { + if (target.cpu.arch == .x86) { try argv.append("-MACHINE:X86"); } else if (target.cpu.arch == .x86_64) { try argv.append("-MACHINE:X64"); @@ -380,7 +380,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod if (target.abi.isGnu()) { try argv.append("-lldmingw"); - if (target.cpu.arch == .i386) { + if (target.cpu.arch == .x86) { try argv.append("-ALTERNATENAME:__image_base__=___ImageBase"); } else { try argv.append("-ALTERNATENAME:__image_base__=__ImageBase"); @@ -388,7 +388,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod if (is_dyn_lib) { try argv.append(try comp.get_libc_crt_file(arena, "dllcrt2.obj")); - if (target.cpu.arch == .i386) { + if (target.cpu.arch == .x86) { try argv.append("-ALTERNATENAME:__DllMainCRTStartup@12=_DllMainCRTStartup@12"); } else { try argv.append("-ALTERNATENAME:_DllMainCRTStartup=DllMainCRTStartup"); diff --git a/src/link/Elf.zig b/src/link/Elf.zig index a7f49ab6d41ad21f04541e6eff85225fab3f342b..b6391b31c6c58ca7d192186cabbf5eaa1b61f8e3 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -3004,7 +3004,7 @@ fn sectHeaderTo32(shdr: elf.Elf64_Shdr) elf.Elf32_Shdr { fn getLDMOption(target: std.Target) ?[]const u8 { switch (target.cpu.arch) { - .i386 => return "elf_i386", + .x86 => return "elf_i386", .aarch64 => return "aarch64linux", .aarch64_be => return "aarch64_be_linux", .arm, .thumb => return "armelf_linux_eabi", diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig index 6c827437acc626fbdff5c1b8fd10dfdd627f140f..54eea6ee25865fc9079a119b95383d6115ad70c9 100644 --- a/src/link/Plan9.zig +++ b/src/link/Plan9.zig @@ -150,7 +150,7 @@ pub fn defaultBaseAddrs(arch: std.Target.Cpu.Arch) Bases { .text = 0x200028, .data = 0x400000, }, - .i386 => .{ + .x86 => .{ // header size => 32 => 0x20 .text = 0x200020, .data = 0x400000, diff --git a/src/link/Plan9/aout.zig b/src/link/Plan9/aout.zig index 09f39d89907af199580bca527845bdea06a56a83..b39cae5166c0db1f2d040033f314ee9bf511eed9 100644 --- a/src/link/Plan9/aout.zig +++ b/src/link/Plan9/aout.zig @@ -109,7 +109,7 @@ pub const R_MAGIC = _MAGIC(HDR_MAGIC, 28); // arm64 pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 { return switch (arch) { - .i386 => I_MAGIC, + .x86 => I_MAGIC, .sparc => K_MAGIC, // TODO should sparc64 and sparcel go here? .mips => V_MAGIC, .arm => E_MAGIC, @@ -124,7 +124,7 @@ pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 { /// gets the quantization of pc for the arch pub fn getPCQuant(arch: std.Target.Cpu.Arch) !u8 { return switch (arch) { - .i386, .x86_64 => 1, + .x86, .x86_64 => 1, .powerpc, .powerpc64, .mips, .sparc, .arm, .aarch64 => 4, else => error.ArchNotSupportedByPlan9, }; diff --git a/src/mingw.zig b/src/mingw.zig index 0d5d1fd0f75161ab615f00d2233060cea2606732..906d0a790dd4a1d3f78adb72a905fff4953aefa7 100644 --- a/src/mingw.zig +++ b/src/mingw.zig @@ -128,7 +128,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { .extra_flags = extra_flags, }; } - if (comp.getTarget().cpu.arch == .i386) { + if (comp.getTarget().cpu.arch == .x86) { for (msvcrt_i386_src) |dep| { (try c_source_files.addOne()).* = .{ .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ @@ -180,7 +180,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { }; } const target = comp.getTarget(); - if (target.cpu.arch == .i386 or target.cpu.arch == .x86_64) { + if (target.cpu.arch == .x86 or target.cpu.arch == .x86_64) { for (mingwex_x86_src) |dep| { (try c_source_files.addOne()).* = .{ .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 { }); const target_def_arg = switch (target.cpu.arch) { - .i386 => "-DDEF_I386", + .x86 => "-DDEF_I386", .x86_64 => "-DDEF_X64", .arm, .armeb, .thumb, .thumbeb, .aarch64_32 => "-DDEF_ARM32", .aarch64, .aarch64_be => "-DDEF_ARM64", @@ -434,7 +434,7 @@ fn findDef(comp: *Compilation, allocator: Allocator, lib_name: []const u8) ![]u8 const target = comp.getTarget(); const lib_path = switch (target.cpu.arch) { - .i386 => "lib32", + .x86 => "lib32", .x86_64 => "lib64", .arm, .armeb, .thumb, .thumbeb, .aarch64_32 => "libarm32", .aarch64, .aarch64_be => "libarm64", diff --git a/src/musl.zig b/src/musl.zig index 12ff530f8e8e3db43cc86c708850947a1ee2a4db..e4f24fe22033c2d1fbba08e2224c6ab53ade414c 100644 --- a/src/musl.zig +++ b/src/musl.zig @@ -262,7 +262,7 @@ pub fn archName(arch: std.Target.Cpu.Arch) [:0]const u8 { switch (arch) { .aarch64, .aarch64_be => return "aarch64", .arm, .armeb, .thumb, .thumbeb => return "arm", - .i386 => return "i386", + .x86 => return "i386", .mips, .mipsel => return "mips", .mips64el, .mips64 => return "mips64", .powerpc => return "powerpc", diff --git a/src/target.zig b/src/target.zig index 079d11516108c4215ea34bf566fa1a6bd3f48c24..23aff0f256fba90f62c71a009883d0a01f94fdb2 100644 --- a/src/target.zig +++ b/src/target.zig @@ -35,9 +35,9 @@ pub const available_libcs = [_]ArchOsAbi{ .{ .arch = .arm, .os = .windows, .abi = .gnu }, .{ .arch = .csky, .os = .linux, .abi = .gnueabi }, .{ .arch = .csky, .os = .linux, .abi = .gnueabihf }, - .{ .arch = .i386, .os = .linux, .abi = .gnu }, - .{ .arch = .i386, .os = .linux, .abi = .musl }, - .{ .arch = .i386, .os = .windows, .abi = .gnu }, + .{ .arch = .x86, .os = .linux, .abi = .gnu }, + .{ .arch = .x86, .os = .linux, .abi = .musl }, + .{ .arch = .x86, .os = .windows, .abi = .gnu }, .{ .arch = .m68k, .os = .linux, .abi = .gnu }, .{ .arch = .m68k, .os = .linux, .abi = .musl }, .{ .arch = .mips64el, .os = .linux, .abi = .gnuabi64 }, @@ -137,7 +137,7 @@ pub fn osArchName(target: std.Target) [:0]const u8 { .powerpc, .powerpcle, .powerpc64, .powerpc64le => "powerpc", .riscv32, .riscv64 => "riscv", .sparc, .sparcel, .sparc64 => "sparc", - .i386, .x86_64 => "x86", + .x86, .x86_64 => "x86", else => @tagName(target.cpu.arch), }, else => @tagName(target.cpu.arch), @@ -278,7 +278,7 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool { .tcele, .thumb, .thumbeb, - .i386, + .x86, .x86_64, .xcore, .nvptx, @@ -319,7 +319,7 @@ pub fn selfHostedBackendIsAsRobustAsLlvm(target: std.Target) bool { pub fn supportsStackProbing(target: std.Target) bool { return target.os.tag != .windows and target.os.tag != .uefi and - (target.cpu.arch == .i386 or target.cpu.arch == .x86_64); + (target.cpu.arch == .x86 or target.cpu.arch == .x86_64); } pub fn supportsStackProtector(target: std.Target) bool { @@ -431,7 +431,7 @@ pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.Mode { pub fn hasRedZone(target: std.Target) bool { return switch (target.cpu.arch) { .x86_64, - .i386, + .x86, .powerpc, .powerpc64, .powerpc64le, @@ -550,7 +550,7 @@ pub fn atomicPtrAlignment( .tcele, .thumb, .thumbeb, - .i386, + .x86, .xcore, .amdil, .hsail, @@ -655,7 +655,7 @@ pub fn addrSpaceCastIsValid( ) bool { const arch = target.cpu.arch; switch (arch) { - .x86_64, .i386 => return arch.supportsAddressSpace(from) and arch.supportsAddressSpace(to), + .x86_64, .x86 => return arch.supportsAddressSpace(from) and arch.supportsAddressSpace(to), .nvptx64, .nvptx, .amdgcn => { const to_generic = arch.supportsAddressSpace(from) and to == .generic; const from_generic = arch.supportsAddressSpace(to) and from == .generic; diff --git a/src/type.zig b/src/type.zig index a12733cbcb7e3d6a6086e5a2761c4057507be1ef..46d8b8bc201ba7881bda22d98de1d6631a513a2a 100644 --- a/src/type.zig +++ b/src/type.zig @@ -6650,7 +6650,7 @@ pub const CType = enum { .long, .ulong => return target.cpu.arch.ptrBitWidth(), .longlong, .ulonglong, .double => return 64, .longdouble => switch (target.cpu.arch) { - .i386 => switch (target.abi) { + .x86 => switch (target.abi) { .android => return 64, else => return 80, }, @@ -6738,7 +6738,7 @@ pub const CType = enum { .long, .ulong => return target.cpu.arch.ptrBitWidth(), .longlong, .ulonglong, .double => return 64, .longdouble => switch (target.cpu.arch) { - .i386 => switch (target.abi) { + .x86 => switch (target.abi) { .android => return 64, else => return 80, }, @@ -6792,7 +6792,7 @@ pub const CType = enum { }, .windows, .uefi => switch (target.cpu.arch) { - .i386 => switch (self) { + .x86 => switch (self) { .short, .ushort => return 16, .int, .uint, .float => return 32, .long, .ulong => return 32, @@ -6828,7 +6828,7 @@ pub const CType = enum { .short, .ushort => return 16, .int, .uint, .float => return 32, .long, .ulong => switch (target.cpu.arch) { - .i386, .arm, .aarch64_32 => return 32, + .x86, .arm, .aarch64_32 => return 32, .x86_64 => switch (target.abi) { .gnux32, .muslx32 => return 32, else => return 64, @@ -6837,7 +6837,7 @@ pub const CType = enum { }, .longlong, .ulonglong, .double => return 64, .longdouble => switch (target.cpu.arch) { - .i386 => switch (target.abi) { + .x86 => switch (target.abi) { .android => return 64, else => return 80, }, @@ -6896,7 +6896,7 @@ pub const CType = enum { .short, .ushort => return 2, else => return 1, }, - .i386 => switch (target.os.tag) { + .x86 => switch (target.os.tag) { .windows, .uefi => switch (self) { .longlong, .ulonglong, .double => return 8, .longdouble => switch (target.abi) { @@ -6937,7 +6937,7 @@ pub const CType = enum { .arc, .csky, - .i386, + .x86, .xcore, .dxil, .loongarch32, @@ -7034,7 +7034,7 @@ pub const CType = enum { .double => return 4, .longlong, .ulonglong => return 8, }, - .i386 => switch (target.os.tag) { + .x86 => switch (target.os.tag) { .windows, .uefi => switch (self) { .longdouble => switch (target.abi) { .gnu, .gnuilp32, .cygnus => return 4, @@ -7087,7 +7087,7 @@ pub const CType = enum { .bpfeb, .hexagon, .hsail64, - .i386, + .x86, .loongarch64, .m68k, .mips, diff --git a/src/windows_sdk.cpp b/src/windows_sdk.cpp index 25620805cdd12427e94545c91677b8a0d5a2fd32..6bc1ed7e01dbd0f8d3cf4fb422a4dbcea05b43ac 100644 --- a/src/windows_sdk.cpp +++ b/src/windows_sdk.cpp @@ -21,7 +21,7 @@ struct ZigWindowsSDKPrivate { enum NativeArch { NativeArchArm, - NativeArchi386, + NativeArchx86, NativeArchx86_64, NativeArchAarch64, }; @@ -29,7 +29,7 @@ enum NativeArch { #if defined(_M_ARM) || defined(__arm_) static const NativeArch native_arch = NativeArchArm; #elif defined(_M_IX86) || defined(__i386__) -static const NativeArch native_arch = NativeArchi386; +static const NativeArch native_arch = NativeArchx86; #elif defined(_M_X64) || defined(__x86_64__) static const NativeArch native_arch = NativeArchx86_64; #elif defined(_M_ARM64) || defined(__aarch64__) @@ -110,7 +110,7 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) { fclose(tools_file); out_append_ptr += sprintf(out_append_ptr, "VC\\Tools\\MSVC\\%s\\lib\\", tmp_path); switch (native_arch) { - case NativeArchi386: + case NativeArchx86: out_append_ptr += sprintf(out_append_ptr, "x86\\"); break; case NativeArchx86_64: @@ -158,7 +158,7 @@ com_done:; char *tmp_buf_append_ptr = tmp_buf + (cb_data - 1); tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "VC\\Lib\\"); switch (native_arch) { - case NativeArchi386: + case NativeArchx86: //x86 is in the root of the Lib folder break; case NativeArchx86_64: @@ -219,7 +219,7 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) { case NativeArchx86_64: option_name = "OptionId.DesktopCPPx64"; break; - case NativeArchi386: + case NativeArchx86: option_name = "OptionId.DesktopCPPx86"; break; default: diff --git a/test/behavior/align.zig b/test/behavior/align.zig index ca2aee52dd4063c107ad9fb554d8ad333e54e8b4..d4f9c362a194a5d7e326d20633170decd8fc6cf2 100644 --- a/test/behavior/align.zig +++ b/test/behavior/align.zig @@ -107,7 +107,7 @@ test "alignment and size of structs with 128-bit fields" { .u129_size = 24, }, - .i386 => switch (builtin.os.tag) { + .x86 => switch (builtin.os.tag) { .windows => .{ .a_align = 8, .a_size = 16, diff --git a/test/behavior/floatop.zig b/test/behavior/floatop.zig index bdfdaacf010c7b49e48f03f6a5f01b97de7ea71f..8b3ffd915eaa072ce5d0cba08e5f86a7b418f73d 100644 --- a/test/behavior/floatop.zig +++ b/test/behavior/floatop.zig @@ -5,7 +5,7 @@ const math = std.math; const pi = std.math.pi; const e = std.math.e; const has_f80_rt = switch (builtin.cpu.arch) { - .x86_64, .i386 => true, + .x86_64, .x86 => true, else => false, }; diff --git a/test/behavior/fn.zig b/test/behavior/fn.zig index 06127aa855aff90c5e260ba4a585b26f68429e0e..b7470a5141ac53033aef3628f2a4e42d007dda6a 100644 --- a/test/behavior/fn.zig +++ b/test/behavior/fn.zig @@ -150,9 +150,9 @@ test "extern struct with stdcallcc fn pointer" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = extern struct { - ptr: *const fn () callconv(if (builtin.target.cpu.arch == .i386) .Stdcall else .C) i32, + ptr: *const fn () callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .C) i32, - fn foo() callconv(if (builtin.target.cpu.arch == .i386) .Stdcall else .C) i32 { + fn foo() callconv(if (builtin.target.cpu.arch == .x86) .Stdcall else .C) i32 { return 1234; } }; diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index 66bffdacffbd081d62b5b59b51001b4eb5ac7ba7..a6cfd0f987b943113cc49b6f571341eb22a81bde 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -1109,7 +1109,7 @@ test "packed struct with undefined initializers" { var p: P = undefined; p = P{ .a = 2, .b = 4, .c = 6 }; // Make sure the compiler doesn't touch the unprefixed fields. - // Use expect since i386-linux doesn't like expectEqual + // Use expect since x86-linux doesn't like expectEqual try expect(p.a == 2); try expect(p.b == 4); try expect(p.c == 6); diff --git a/test/behavior/vector.zig b/test/behavior/vector.zig index 93299498f3215d868ca2f983a20896836fbdf3a7..20e2202b103887d4d3209d86fe6c6983bc8ec522 100644 --- a/test/behavior/vector.zig +++ b/test/behavior/vector.zig @@ -639,7 +639,7 @@ test "vector shift operators" { }; switch (builtin.target.cpu.arch) { - .i386, + .x86, .aarch64, .aarch64_be, .aarch64_32, diff --git a/test/c_abi/main.zig b/test/c_abi/main.zig index d9fb25f4b3b2b5996997607eca0f6e8717ca9107..479a8ca5f5a346a96bc5b47f8f7dff902a8baff3 100644 --- a/test/c_abi/main.zig +++ b/test/c_abi/main.zig @@ -2,7 +2,7 @@ const std = @import("std"); const builtin = @import("builtin"); const print = std.debug.print; const expect = std.testing.expect; -const has_i128 = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isARM() and +const has_i128 = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isMIPS() and !builtin.cpu.arch.isPPC(); extern fn run_c_tests() void; @@ -153,7 +153,7 @@ export fn zig_bool(x: bool) void { // https://github.com/ziglang/zig/issues/8465 // // For now, we have no way of referring to the _Complex C types from Zig, -// so our ABI is unavoidably broken on some platforms (such as i386) +// so our ABI is unavoidably broken on some platforms (such as x86) const ComplexFloat = extern struct { real: f32, imag: f32, @@ -170,7 +170,7 @@ extern fn c_cmultd_comp(a_r: f64, a_i: f64, b_r: f64, b_i: f64) ComplexDouble; extern fn c_cmultf(a: ComplexFloat, b: ComplexFloat) ComplexFloat; extern fn c_cmultd(a: ComplexDouble, b: ComplexDouble) ComplexDouble; -const complex_abi_compatible = builtin.cpu.arch != .i386 and !builtin.cpu.arch.isMIPS() and +const complex_abi_compatible = builtin.cpu.arch != .x86 and !builtin.cpu.arch.isMIPS() and !builtin.cpu.arch.isARM() and !builtin.cpu.arch.isPPC() and !builtin.cpu.arch.isRISCV(); test "C ABI complex float" { @@ -323,7 +323,7 @@ extern fn c_med_struct_mixed(MedStructMixed) void; extern fn c_ret_med_struct_mixed() MedStructMixed; test "C ABI medium struct of ints and floats" { - if (builtin.cpu.arch == .i386) return error.SkipZigTest; + if (builtin.cpu.arch == .x86) return error.SkipZigTest; if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; @@ -356,7 +356,7 @@ extern fn c_small_struct_ints(SmallStructInts) void; extern fn c_ret_small_struct_ints() SmallStructInts; test "C ABI small struct of ints" { - if (builtin.cpu.arch == .i386) return error.SkipZigTest; + if (builtin.cpu.arch == .x86) return error.SkipZigTest; if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; @@ -438,7 +438,7 @@ const SplitStructInt = extern struct { extern fn c_split_struct_ints(SplitStructInt) void; test "C ABI split struct of ints" { - if (builtin.cpu.arch == .i386) return error.SkipZigTest; + if (builtin.cpu.arch == .x86) return error.SkipZigTest; if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; @@ -466,7 +466,7 @@ extern fn c_split_struct_mixed(SplitStructMixed) void; extern fn c_ret_split_struct_mixed() SplitStructMixed; test "C ABI split struct of ints and floats" { - if (builtin.cpu.arch == .i386) return error.SkipZigTest; + if (builtin.cpu.arch == .x86) return error.SkipZigTest; if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; @@ -729,7 +729,7 @@ extern fn c_struct_with_array(StructWithArray) void; extern fn c_ret_struct_with_array() StructWithArray; test "Struct with array as padding." { - if (builtin.cpu.arch == .i386) return error.SkipZigTest; + if (builtin.cpu.arch == .x86) return error.SkipZigTest; if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; @@ -783,7 +783,7 @@ extern fn c_small_vec(SmallVec) void; extern fn c_ret_small_vec() SmallVec; test "small simd vector" { - if (builtin.cpu.arch == .i386) return error.SkipZigTest; + if (builtin.cpu.arch == .x86) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC64()) return error.SkipZigTest; c_small_vec(.{ 1, 2 }); @@ -820,7 +820,7 @@ extern fn c_ptr_size_float_struct(Vector2) void; extern fn c_ret_ptr_size_float_struct() Vector2; test "C ABI pointer sized float struct" { - if (builtin.cpu.arch == .i386) return error.SkipZigTest; + if (builtin.cpu.arch == .x86) return error.SkipZigTest; if (comptime builtin.cpu.arch.isMIPS()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isRISCV()) return error.SkipZigTest; if (comptime builtin.cpu.arch.isPPC()) return error.SkipZigTest; diff --git a/test/cases/compile_errors/callconv_interrupt_on_unsupported_platform.zig b/test/cases/compile_errors/callconv_interrupt_on_unsupported_platform.zig index 5f11fdcfa83dd79cf0aed0fa731e5f4eb2ee5367..8208e2ffa3321642f93f4af723270dba02f59588 100644 --- a/test/cases/compile_errors/callconv_interrupt_on_unsupported_platform.zig +++ b/test/cases/compile_errors/callconv_interrupt_on_unsupported_platform.zig @@ -4,4 +4,4 @@ export fn entry() callconv(.Interrupt) void {} // backend=stage2 // target=aarch64-linux-none // -// :1:29: error: callconv 'Interrupt' is only available on i386, x86_64, AVR, and MSP430, not aarch64 +// :1:29: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64 diff --git a/test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig b/test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig index d22fd13e8a473ae49e18572f9fbd2a3aa8b863c8..9813df24db7cfa32d1c509cc3800a3bc9846affd 100644 --- a/test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig +++ b/test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig @@ -18,6 +18,6 @@ export fn entry3() void { // backend=stage2 // target=x86_64-linux-none // -// :1:28: error: callconv 'Stdcall' is only available on i386, not x86_64 -// :2:28: error: callconv 'Fastcall' is only available on i386, not x86_64 -// :3:28: error: callconv 'Thiscall' is only available on i386, not x86_64 +// :1:28: error: callconv 'Stdcall' is only available on x86, not x86_64 +// :2:28: error: callconv 'Fastcall' is only available on x86, not x86_64 +// :3:28: error: callconv 'Thiscall' is only available on x86, not x86_64 diff --git a/test/cases/compile_errors/callconv_vectorcall_on_unsupported_platform.zig b/test/cases/compile_errors/callconv_vectorcall_on_unsupported_platform.zig index 9c231a6ea80db2640d3650ae592dfefa421749de..9c0d982b3f679aae7398db418d6084d5a18e7856 100644 --- a/test/cases/compile_errors/callconv_vectorcall_on_unsupported_platform.zig +++ b/test/cases/compile_errors/callconv_vectorcall_on_unsupported_platform.zig @@ -4,4 +4,4 @@ export fn entry() callconv(.Vectorcall) void {} // backend=stage2 // target=x86_64-linux-none // -// :1:29: error: callconv 'Vectorcall' is only available on i386 and AArch64, not x86_64 +// :1:29: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64 diff --git a/test/tests.zig b/test/tests.zig index 81be2c9d5cb55d12696ac0c33128ac89995b1b67..1d47fcddc5f76aa9ef1549170b914627cba82fa1 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -163,14 +163,14 @@ const test_targets = blk: { .{ .target = .{ - .cpu_arch = .i386, + .cpu_arch = .x86, .os_tag = .linux, .abi = .none, }, }, .{ .target = .{ - .cpu_arch = .i386, + .cpu_arch = .x86, .os_tag = .linux, .abi = .musl, }, @@ -178,7 +178,7 @@ const test_targets = blk: { }, .{ .target = .{ - .cpu_arch = .i386, + .cpu_arch = .x86, .os_tag = .linux, .abi = .gnu, }, @@ -387,7 +387,7 @@ const test_targets = blk: { .{ .target = .{ - .cpu_arch = .i386, + .cpu_arch = .x86, .os_tag = .windows, .abi = .msvc, }, @@ -403,7 +403,7 @@ const test_targets = blk: { .{ .target = .{ - .cpu_arch = .i386, + .cpu_arch = .x86, .os_tag = .windows, .abi = .gnu, }, @@ -1279,7 +1279,7 @@ const c_abi_targets = [_]CrossTarget{ .abi = .musl, }, .{ - .cpu_arch = .i386, + .cpu_arch = .x86, .os_tag = .linux, .abi = .musl, }, diff --git a/test/translate_c.zig b/test/translate_c.zig index 9f35f5ebc9f52d91ed71bacec28fd550cbdc91b8..c1be960eddba00c5fb6db72f1e04ac160b23cc59 100644 --- a/test/translate_c.zig +++ b/test/translate_c.zig @@ -1775,7 +1775,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { } cases.addWithTarget("Calling convention", .{ - .cpu_arch = .i386, + .cpu_arch = .x86, .os_tag = .linux, .abi = .none, }, diff --git a/tools/gen_stubs.zig b/tools/gen_stubs.zig index b7c1ae16470caf58b3a7792debefb2f98e60d504..2b217312240bfec53ff28dade70409a5accbea24 100644 --- a/tools/gen_stubs.zig +++ b/tools/gen_stubs.zig @@ -2,7 +2,7 @@ //! ./gen_stubs /path/to/musl/build-all >libc.S //! //! The directory 'build-all' is expected to contain these subdirectories: -//! arm i386 mips mips64 powerpc powerpc64 riscv64 x86_64 +//! arm x86 mips mips64 powerpc powerpc64 riscv64 x86_64 //! //! ...each with 'lib/libc.so' inside of them. //! @@ -30,7 +30,7 @@ const native_endian = @import("builtin").target.cpu.arch.endian(); const arches: [7]std.Target.Cpu.Arch = blk: { var result: [7]std.Target.Cpu.Arch = undefined; - for (.{ .riscv64, .mips, .i386, .x86_64, .powerpc, .powerpc64, .aarch64 }) |arch| { + for (.{ .riscv64, .mips, .x86, .x86_64, .powerpc, .powerpc64, .aarch64 }) |arch| { result[archIndex(arch)] = arch; } break :blk result; @@ -56,7 +56,7 @@ const MultiSym = struct { fn is32Only(ms: MultiSym) bool { return ms.present[archIndex(.riscv64)] == false and ms.present[archIndex(.mips)] == true and - ms.present[archIndex(.i386)] == true and + ms.present[archIndex(.x86)] == true and ms.present[archIndex(.x86_64)] == false and ms.present[archIndex(.powerpc)] == true and ms.present[archIndex(.powerpc64)] == false and @@ -97,7 +97,7 @@ const MultiSym = struct { const map = .{ .{ .riscv64, 8 }, .{ .mips, 4 }, - .{ .i386, 4 }, + .{ .x86, 4 }, .{ .x86_64, 8 }, .{ .powerpc, 4 }, .{ .powerpc64, 8 }, @@ -118,7 +118,7 @@ const MultiSym = struct { const map = .{ .{ .riscv64, 16 }, .{ .mips, 8 }, - .{ .i386, 8 }, + .{ .x86, 8 }, .{ .x86_64, 16 }, .{ .powerpc, 8 }, .{ .powerpc64, 16 }, @@ -139,7 +139,7 @@ const MultiSym = struct { const map = .{ .{ .riscv64, 2 }, .{ .mips, 1 }, - .{ .i386, 1 }, + .{ .x86, 1 }, .{ .x86_64, 2 }, .{ .powerpc, 1 }, .{ .powerpc64, 2 }, @@ -555,7 +555,7 @@ fn archIndex(arch: std.Target.Cpu.Arch) u8 { // zig fmt: off .riscv64 => 0, .mips => 1, - .i386 => 2, + .x86 => 2, .x86_64 => 3, .powerpc => 4, .powerpc64 => 5, diff --git a/tools/process_headers.zig b/tools/process_headers.zig index 04baeee68d4c311e2dad859fb74e1ec7acad4cef..a6550a2573b3ab34e2d8dc93c7bf83cedbb7e814 100644 --- a/tools/process_headers.zig +++ b/tools/process_headers.zig @@ -96,7 +96,7 @@ const glibc_targets = [_]LibCTarget{ }, LibCTarget{ .name = "i686-linux-gnu", - .arch = MultiArch{ .specific = Arch.i386 }, + .arch = MultiArch{ .specific = Arch.x86 }, .abi = MultiAbi{ .specific = Abi.gnu }, }, LibCTarget{ @@ -208,8 +208,8 @@ const musl_targets = [_]LibCTarget{ .abi = MultiAbi.musl, }, LibCTarget{ - .name = "i386", - .arch = MultiArch{ .specific = .i386 }, + .name = "x86", + .arch = MultiArch{ .specific = .x86 }, .abi = MultiAbi.musl, }, LibCTarget{