mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
16 lines
457 B
Zig
16 lines
457 B
Zig
const std = @import("std");
|
|
const elf = std.elf;
|
|
|
|
threadlocal var foo: u8 = 42;
|
|
|
|
test "Check ELF header" {
|
|
// PIE executables are marked as ET_DYN, regular exes as ET_EXEC.
|
|
const header = @as(*elf.Ehdr, @ptrFromInt(std.process.getBaseAddress()));
|
|
try std.testing.expectEqual(elf.ET.DYN, header.e_type);
|
|
}
|
|
|
|
test "TLS is initialized" {
|
|
// Ensure the TLS is initialized by the startup code.
|
|
try std.testing.expectEqual(@as(u8, 42), foo);
|
|
}
|