diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-10-08 16:08:05 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-10-10 22:47:47 -0700 |
| commit | 2e31077fe0e021858cf2f92f85e5fcfd12c41501 (patch) | |
| tree | 5f1e04aebfe2e0f440cd3d8426c645d1a723b97b /lib/std | |
| parent | b2bc6073c8ada065906da9e3b5a4a2e7db04c21d (diff) | |
| download | zig-2e31077fe0e021858cf2f92f85e5fcfd12c41501.tar.gz zig-2e31077fe0e021858cf2f92f85e5fcfd12c41501.zip | |
Coff: implement threadlocal variables
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/coff.zig | 91 | ||||
| -rw-r--r-- | lib/std/debug.zig | 20 | ||||
| -rw-r--r-- | lib/std/math/isnan.zig | 2 |
3 files changed, 42 insertions, 71 deletions
diff --git a/lib/std/coff.zig b/lib/std/coff.zig index db2f7df73e..1706af24ab 100644 --- a/lib/std/coff.zig +++ b/lib/std/coff.zig @@ -249,55 +249,6 @@ pub const OptionalHeader = extern struct { pub const IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16; -pub const DirectoryEntry = enum(u16) { - /// Export Directory - EXPORT = 0, - - /// Import Directory - IMPORT = 1, - - /// Resource Directory - RESOURCE = 2, - - /// Exception Directory - EXCEPTION = 3, - - /// Security Directory - SECURITY = 4, - - /// Base Relocation Table - BASERELOC = 5, - - /// Debug Directory - DEBUG = 6, - - /// Architecture Specific Data - ARCHITECTURE = 7, - - /// RVA of GP - GLOBALPTR = 8, - - /// TLS Directory - TLS = 9, - - /// Load Configuration Directory - LOAD_CONFIG = 10, - - /// Bound Import Directory in headers - BOUND_IMPORT = 11, - - /// Import Address Table - IAT = 12, - - /// Delay Load Import Descriptors - DELAY_IMPORT = 13, - - /// COM Runtime descriptor - COM_DESCRIPTOR = 14, - - _, -}; - pub const ImageDataDirectory = extern struct { virtual_address: u32, size: u32, @@ -1054,9 +1005,9 @@ pub const Coff = struct { assert(self.is_image); const data_dirs = self.getDataDirectories(); - if (@intFromEnum(DirectoryEntry.DEBUG) >= data_dirs.len) return null; + if (@intFromEnum(IMAGE.DIRECTORY_ENTRY.DEBUG) >= data_dirs.len) return null; - const debug_dir = data_dirs[@intFromEnum(DirectoryEntry.DEBUG)]; + const debug_dir = data_dirs[@intFromEnum(IMAGE.DIRECTORY_ENTRY.DEBUG)]; var reader: std.Io.Reader = .fixed(self.data); if (self.is_loaded) { @@ -1400,6 +1351,44 @@ pub const Relocation = extern struct { }; pub const IMAGE = struct { + pub const DIRECTORY_ENTRY = enum(u32) { + /// Export Directory + EXPORT = 0, + /// Import Directory + IMPORT = 1, + /// Resource Directory + RESOURCE = 2, + /// Exception Directory + EXCEPTION = 3, + /// Security Directory + SECURITY = 4, + /// Base Relocation Table + BASERELOC = 5, + /// Debug Directory + DEBUG = 6, + /// Architecture Specific Data + ARCHITECTURE = 7, + /// RVA of GP + GLOBALPTR = 8, + /// TLS Directory + TLS = 9, + /// Load Configuration Directory + LOAD_CONFIG = 10, + /// Bound Import Directory in headers + BOUND_IMPORT = 11, + /// Import Address Table + IAT = 12, + /// Delay Load Import Descriptors + DELAY_IMPORT = 13, + /// COM Runtime descriptor + COM_DESCRIPTOR = 14, + /// must be zero + RESERVED = 15, + _, + + pub const len = @typeInfo(IMAGE.DIRECTORY_ENTRY).@"enum".fields.len; + }; + pub const FILE = struct { /// Machine Types /// The Machine field has one of the following values, which specify the CPU type. diff --git a/lib/std/debug.zig b/lib/std/debug.zig index a1753f1e77..7ac6c45903 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -468,10 +468,6 @@ const use_trap_panic = switch (builtin.zig_backend) { .stage2_wasm, .stage2_x86, => true, - .stage2_x86_64 => switch (builtin.target.ofmt) { - .elf, .macho => false, - else => true, - }, else => false, }; @@ -484,22 +480,6 @@ pub fn defaultPanic( if (use_trap_panic) @trap(); - switch (builtin.zig_backend) { - .stage2_aarch64, - .stage2_arm, - .stage2_powerpc, - .stage2_riscv64, - .stage2_spirv, - .stage2_wasm, - .stage2_x86, - => @trap(), - .stage2_x86_64 => switch (builtin.target.ofmt) { - .elf, .macho => {}, - else => @trap(), - }, - else => {}, - } - switch (builtin.os.tag) { .freestanding, .other => { @trap(); diff --git a/lib/std/math/isnan.zig b/lib/std/math/isnan.zig index 7cd8c2e734..b3de93597a 100644 --- a/lib/std/math/isnan.zig +++ b/lib/std/math/isnan.zig @@ -28,6 +28,8 @@ test isNan { } test isSignalNan { + if (builtin.zig_backend == .stage2_x86_64 and builtin.object_format == .coff and builtin.abi != .gnu) return error.SkipZigTest; + inline for ([_]type{ f16, f32, f64, f80, f128, c_longdouble }) |T| { // TODO: Signalling NaN values get converted to quiet NaN values in // some cases where they shouldn't such that this can fail. |
