aboutsummaryrefslogtreecommitdiff
path: root/lib/std/elf.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-25 01:52:27 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-02-28 14:51:53 -0500
commit4616af0ca459358ffa09ba27f9daa8527a38fd35 (patch)
tree2705847ded931e30dc924bd44acf24847743855c /lib/std/elf.zig
parentfba39ff331a84f1a32d076ccbb8b87cd02ea7121 (diff)
downloadzig-4616af0ca459358ffa09ba27f9daa8527a38fd35.tar.gz
zig-4616af0ca459358ffa09ba27f9daa8527a38fd35.zip
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`. `std.build.Target` wraps `std.Target` so that it can be annotated as "the native target" or an explicitly specified target. * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a struct which has the tag as well as version range information. * `std.elf` gains some more ELF header constants. * `std.Target.parse` gains the ability to parse operating system version ranges as well as glibc version. * Added `std.Target.isGnuLibC()`. * self-hosted dynamic linker detection and glibc version detection. This also adds the improved logic using `/usr/bin/env` rather than invoking the system C compiler to find the dynamic linker when zig is statically linked. Related: #2084 Note: this `/usr/bin/env` code is work-in-progress. * `-target-glibc` CLI option is removed in favor of the new `-target` syntax. Example: `-target x86_64-linux-gnu.2.27` closes #1907
Diffstat (limited to 'lib/std/elf.zig')
-rw-r--r--lib/std/elf.zig25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/std/elf.zig b/lib/std/elf.zig
index 9e4c1ac5f6..007a01bb90 100644
--- a/lib/std/elf.zig
+++ b/lib/std/elf.zig
@@ -349,16 +349,6 @@ pub const Elf = struct {
program_headers: []ProgramHeader,
allocator: *mem.Allocator,
- /// Call close when done.
- pub fn openPath(allocator: *mem.Allocator, path: []const u8) !Elf {
- @compileError("TODO implement");
- }
-
- /// Call close when done.
- pub fn openFile(allocator: *mem.Allocator, file: File) !Elf {
- @compileError("TODO implement");
- }
-
pub fn openStream(
allocator: *mem.Allocator,
seekable_stream: *io.SeekableStream(anyerror, anyerror),
@@ -554,6 +544,21 @@ pub const Elf = struct {
};
pub const EI_NIDENT = 16;
+
+pub const EI_CLASS = 4;
+pub const ELFCLASSNONE = 0;
+pub const ELFCLASS32 = 1;
+pub const ELFCLASS64 = 2;
+pub const ELFCLASSNUM = 3;
+
+pub const EI_DATA = 5;
+pub const ELFDATANONE = 0;
+pub const ELFDATA2LSB = 1;
+pub const ELFDATA2MSB = 2;
+pub const ELFDATANUM = 3;
+
+pub const EI_VERSION = 6;
+
pub const Elf32_Half = u16;
pub const Elf64_Half = u16;
pub const Elf32_Word = u32;