aboutsummaryrefslogtreecommitdiff
path: root/lib/std/elf.zig
AgeCommit message (Collapse)Author
2022-08-27Sema: add error for non-comptime param in comptime funcantlilja
Adds error for taking a non comptime parameter in a function returning a comptime-only type but not when that type is dependent on a parameter. Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-08-24stage2: explicitly tagged enums no longer have one possible valueAndrew Kelley
Previously, Zig had inconsistent semantics for an enum like this: `enum(u8){zero = 0}` Although in theory this can only hold one possible value, the tag `zero`, Zig no longer will treat the type this way. It will do loads and stores, as if the type has runtime bits. Closes #12619 Tests passed locally: * test-behavior * test-cases
2022-08-22stage2+stage1: remove type parameter from bit builtinsVeikka Tuominen
Closes #12529 Closes #12511 Closes #6835
2022-05-13target: Rename sparcv9 -> sparc64Koakuma
Rename all references of sparcv9 to sparc64, to make Zig align more with other projects. Also, added new function to convert glibc arch name to Zig arch name, since it refers to the architecture as sparcv9. This is based on the suggestion by @kubkon in PR 11847. (https://github.com/ziglang/zig/pull/11487#pullrequestreview-963761757)
2022-05-02Avoid some unnecessary underscores in constant namesr00ster91
2022-04-28Merge pull request #10717 from gh-fork-dump/seccomp-bitsVeikka Tuominen
Add Seccomp bits for linux
2022-04-04Pull elf magic string out to re-used constantTom Read Cutting
2022-03-15std: Add elf.EM, coff.MachineType to Target.CPU.Arch conversionsTom Maenan Read Cutting
target.Arch already supports finding the correct encoding for either target, so being able to do the inverse has use cases for when parsing files of an unknown target (i.e. for zar).
2022-01-29Add bits for the Linux Auditing SystemStephen Gregoratto
Also adds the _CSKY and _FRV ELF machines that are defined in `<linux/elf-em.h>`
2022-01-28Rename mem.bswapAllFields to byteSwapAllFieldsJohn Schmidt
To match the renaming of `@bswap` to `@byteSwap` in https://github.com/ziglang/zig/commit/1fdb24827fb51351d5e31103069619668fae31c4.
2021-12-21Fix dead linkominitay
2021-12-08improve musl dynamic stubs file libc.sAndrew Kelley
tools/gen_stubs.zig now cuts out the middle man and operates directly on the libc.so ELF file. it outputs accurate .size directives for objects. std.elf gains an STV enum.
2021-09-19elf: add amd64 relocation typesJakub Konka
I believe these are Linux specific so they will need to be os-gated in `elf.zig` at some point, but I reckon it should be fine to have them as-is right now since the ELF linker work will mainly be done on x86-64 Linux at first.
2021-09-17elf: add a couple missing special section indexes SHN_Jakub Konka
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-06-25Add fat/universal dylib support to zig ldTom Maenan Read Cutting
With this change zig ld can link with dynamic libraries contained within a fat/universal file that had multiple seperate binaries embedded within it for multi-arch support (in macOS). Whilst zig can still only create single-architecture executables - the ability to link with fat libraries is useful for cases where they are the easiest (or only) option to link against.
2021-06-08Changed return values of SectionHeaderIterator().next() to bswapAllFields() ↵ArtixFox
(#9014)
2021-05-20Run `zig fmt` on src/ and lib/std/Isaac Freund
This replaces callconv(.Inline) with the more idiomatic inline keyword.
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-05-06stage2: fix compile errors in test harnessAndrew Kelley
2021-04-22std: fix compile errors caught by stage2 AstGenAndrew Kelley
* `comptime const` is redundant * don't use `extern enum`; specify a tag type. `extern enum` is only when you need tags to alias. But aliasing tags is a smell. I will be making a proposal shortly to remove `extern enum` from the language. * there is no such thing as `packed enum`. * instead of `catch |_|`, omit the capture entirely. * unused function definition with missing parameter name * using `try` outside of a function or test
2021-03-11elf: make EM non-exhaustiveAsherah Connor
2021-03-10expose machine field in ELF headerAsherah Connor
2021-03-07stage2 Elf linker: fill in bswapAllFieldsjacob gw
I moved it to std.elf since it could be used there and added test
2021-03-04Merge pull request #7763 from kivikakk/zig-elf-parseAndrew Kelley
std.elf: expose parsing decoupled from std.fs.File
2021-02-10Convert inline fn to callconv(.Inline) everywhereTadeo Kondrak
2021-01-15use interfacesAsherah Connor
2021-01-14fix SectionHeaderIterator implAsherah Connor
2021-01-14expose phdr, shdr parsingAsherah Connor
2021-01-14std.elf: actually pass the pointerAsherah Connor
2021-01-14std.elf: call it Header.parseAsherah Connor
2021-01-14std.elf: make Header pubAsherah Connor
2021-01-14std.elf: expose parsing decoupled from std.fs.FileAsherah Connor
2020-12-31Year++Frank Denis
2020-11-22Merge branch 'piepiepie' of https://github.com/LemonBoy/zig into pieAndrew Kelley
Conflicts: lib/std/dynamic_library.zig (fixed in this commit) src/all_types.hpp src/codegen.cpp src/link.cpp src/main.cpp Will manually apply the diffs to these deleted files to the new zig code in a followup commit.
2020-10-25openbsd: make dl_phdr_info cross archesSébastien Marie
introduce Addr and Half definition to std.elf, and use them for dl_phdr_info
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