aboutsummaryrefslogtreecommitdiff
path: root/lib/std/elf.zig
AgeCommit message (Collapse)Author
2020-09-15std: Fix typo in ELF section header iteratorLemonBoy
The code accidentally used the phdr offset instead of the shdr one while iterating over the section headers. Fixes #6338
2020-08-22Targets: add SPU Mark II architectureNoam Preil
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-08-19Merge pull request #5745 from lun-4/ebadf-errorAndrew Kelley
map EBADF to error values for read and write
2020-08-01elf: Iterate over headers w/o need for allocatorJay Petacat
2020-07-28std.elf: Fix read functions for 32-bit targetsJay Petacat
The buffer index was declared as `u64`, which overflows `usize` on a 32-bit target. The following example program failed to compile for 32-bit targets: ```zig const std = @import("std"); pub fn main() !void { const alloc = std.testing.allocator; const file = std.io.getStdIn(); _ = try std.elf.readAllHeaders(alloc, file); } ``` ``` lib/zig/std/elf.zig:543:36: error: expected type 'usize', found 'u64' const len = file.pread(buf[i .. buf.len - i], offset + i) catch |err| switch (err) { ^ lib/zig/std/elf.zig:543:36: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values const len = file.pread(buf[i .. buf.len - i], offset + i) catch |err| switch (err) { ^ lib/zig/std/elf.zig:543:35: note: referenced here const len = file.pread(buf[i .. buf.len - i], offset + i) catch |err| switch (err) { ^ lib/zig/std/elf.zig:348:5: note: referenced here try preadNoEof(file, &hdr_buf, 0); ^ lib/zig/std/elf.zig:392:19: note: referenced here .header = try readHeader(file), ```
2020-07-11run zig fmt on std lib and self hostedVexu
2020-07-02Merge branch 'master' into ebadf-errorluna
2020-06-30Map ENOTCAPABLE into error.AccessDenied instead of error.NotCapableJakub Konka
This is direct result of review comments left by andrewrk and daurnimator. It makes sense to map `ENOTCAPABLE` into a more generic `error.AccessDenied`.
2020-06-29Fix compilation errorsJakub Konka
2020-06-28std.os: make EBADF return error for read and writeLuna
2020-06-09Support Reader for InStreamJonathan Marler
2020-05-06std: handle ConnectionTimedOut in switchVexu
regression from #5266 closes #5270
2020-03-11fix regressions in elf parsing codeAndrew Kelley
2020-03-11add std.io.StreamSource and fixes to emitRawAndrew Kelley
2020-03-11fix compilation errors for emitRawAndrew Kelley
2020-03-10rework some old ELF parsing code and start to fix emitRawAndrew Kelley
2020-03-10(breaking) rework stream abstractionsAndrew Kelley
The main goal here is to make the function pointers comptime, so that we don't have to do the crazy stuff with async function frames. Since InStream, OutStream, and SeekableStream are already generic across error sets, it's not really worse to make them generic across the vtable as well. See #764 for the open issue acknowledging that using generics for these abstractions is a design flaw. See #130 for the efforts to make these abstractions non-generic. This commit also changes the OutStream API so that `write` returns number of bytes written, and `writeAll` is the one that loops until the whole buffer is written.
2020-03-01short std.builtin enum literals in std libxackus
2020-02-28complete the native target detection based on /usr/bin/envAndrew Kelley
2020-02-28introduce operating system version ranges as part of the targetAndrew Kelley
* 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
2020-02-03Add InstallRawStep to Zig build system that does a similar job to ↵Michaël Larouche
llvm-objcopy. To use it, do 'exe.installRaw("kernel.bin");' where exe is a LibExeObjStep Part of #2826
2019-12-21Initial support for static PIE executablesLemonBoy
2019-11-27remove type coercion from array values to referencesAndrew Kelley
* Implements #3768. This is a sweeping breaking change that requires many (trivial) edits to Zig source code. Array values no longer coerced to slices; however one may use `&` to obtain a reference to an array value, which may then be coerced to a slice. * Adds `IrInstruction::dump`, for debugging purposes. It's useful to call to inspect the instruction when debugging Zig IR. * Fixes bugs with result location semantics. See the new behavior test cases, and compile error test cases. * Fixes bugs with `@typeInfo` not properly resolving const values. * Behavior tests are passing but std lib tests are not yet. There is more work to do before merging this branch.
2019-11-26std.elf: breaking improvements to the APIAndrew Kelley
and also integration with std.Target.Arch
2019-11-08update the codebase to use `@as`Andrew Kelley
2019-10-13Add ELF architecture constant for RISC-VLemonBoy
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221