35 Commits

Author SHA1 Message Date
Jakub Konka 540d8cd809 coff: add import table definitions 2022-08-31 19:30:51 +02:00
Jakub Konka d3eaabd285 coff: add base relocation related types 2022-08-30 23:07:28 +02:00
Jakub Konka aa5568beb6 coff: move Symtab and Strtab out of coff.Coff
This should ease interfacing with different std.coff functionalities.
2022-08-30 15:51:49 +02:00
Jakub Konka 7ef0c9d298 Merge pull request #12677 from ziglang/coff-linker
coff: initial rewrite of the COFF/PE linker
2022-08-30 14:29:41 +02:00
Jakub Konka ed481e3837 coff: write headers to file 2022-08-30 10:42:21 +02:00
Jakub Konka 90b3599c68 coff: reorganize the linker 2022-08-30 10:42:21 +02:00
William Sengir 91b9f295d3 coff: publicize and flesh out more image constants 2022-08-28 06:20:18 -07:00
William Sengir 3860e664c5 coff: fix reading COFF header offset 2022-08-28 03:10:39 -07:00
Jakub Konka 02e6960966 coff: do not pull in std.log into coff.zig definitions 2022-08-26 16:14:44 +02:00
max d8e22fcb20 fix coff.zig with const qualifier convert problem 2022-08-24 22:49:47 +02:00
Jakub Konka c84e5ee878 coff: improve default COFF/PE object parser
We now do not allocate memory for headers and other metadata unless
requested by the caller. Instead, we read-in the entire contents
of the image into memory and operate on pointers and casts wherever
possible. I have a left a TODO to hook up Windows' memory-mapped API
here in-place of standard `readToEndAlloc` which should be more memory
proof on memory constrained hosts.

This commit also supplements our `std.coff` with a lot missing basic
extern structs required to make our COFF linker.
2022-08-23 08:55:04 +02:00
Jakub Konka 10b95d89f8 coff: change improperly used packed struct into extern struct 2022-08-19 16:45:16 -07:00
Erik Hugne f7bc8900bf std.coff: parse out codebase and entrypoint from optionalheader 2022-04-28 18:31:20 +03:00
Jakub Konka 28ca203b71 debug: fix resource (de)allocation for Elf and Coff targets
With this change, it is now possible to safely call
`var di = std.debug.openSelfDebugInfo(gpa)`. Calling then
`di.deinit()` on the object will correctly free all allocated
resources.

Ensure we store the result of `mmap` with correct alignment.
2022-04-21 11:48:15 +02:00
Tom Maenan Read Cutting 9bb19a090e std: Add elf.EM, coff.MachineType to Target.CPU.Arch conversions
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-03-15 13:48:42 -04:00
Lee Cannon 85de022c56 allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
Ryan Liptak a343758141 Update ensureTotalCapacity to ensureTotalCapacityPrecise where it makes sense
These calls are all late-initialization of ArrayList's that were initialized outside the current scope. This allows us to still get the potential memory-saving benefits of the 'precision' of initCapacity.
2021-11-01 00:57:33 -07:00
Andrew Kelley 6115cf2240 migrate from std.Target.current to @import("builtin").target
closes #9388
closes #9321
2021-10-04 23:48:55 -07:00
Ryan Liptak 59f5053bed Update all ensureCapacity calls to the relevant non-deprecated version 2021-09-19 13:52:56 +02:00
Andrew Kelley d29871977f remove redundant license headers from zig standard library
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-08-24 12:25:09 -07:00
Matt Chudleigh a6c2e44ae7 Add support for reading DWARF debug information from COFF files 2021-06-18 16:19:20 -07:00
Matt Chudleigh 2dcdaa7668 Support long section names in COFF files 2021-06-18 16:19:20 -07:00
Andrew Kelley 429cd2b5dd std: change @import("builtin") to std.builtin 2021-04-15 19:06:39 -07:00
Andrew Kelley 5f35dc0c0d zig fmt the std lib 2021-02-24 21:29:23 -07:00
Jay Petacat a9b505fa77 Reduce use of deprecated IO types
Related: #4917
2021-01-07 23:48:58 -08:00
Frank Denis 6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
Josh Holland c25b157dda remove deprecated uses of ArrayList.span 2020-11-07 11:15:44 +00:00
Alexandros Naskos e9b137f23a Completed basic PE linker for stage2
Added std.coff.MachineType
Added image characteristic and section flag valued to std.coff
Added std.Target.Cpu.Arch.toCoffMachine
Fixed stage2 --watch flag on windows
2020-09-04 05:15:03 +03:00
Andrew Kelley 4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
xackus 7a28c644aa new ArrayList API: fix everything else 2020-04-02 16:12:08 +02:00
Andrew Kelley 9e7ae06249 std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Andrew Kelley 2bff0dda79 fix regressions found by test suite 2020-03-10 20:22:30 -04:00
Andrew Kelley d87b13f2f7 fix windows std lib regressions 2019-11-29 21:55:27 -05:00
Vexu 4e6c1b676b add cast to not hit #2561 2019-11-21 23:21:51 -05:00
Andrew Kelley ed36dbbd9c mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00