aboutsummaryrefslogtreecommitdiff
path: root/src/objcopy.zig
AgeCommit message (Collapse)Author
2023-08-15objcopy: fix typoXavier Bouchoux
fixes aecc15391a4c37a4504d29cb7e3179990b180773 the usual last 'harmless' cosmetic ajustement before commit strikes again...
2023-08-12objcpy: preserve the mode when striping an elf file.Xavier Bouchoux
+ clean some @as()
2023-06-24all: migrate code to new cast builtin syntaxmlugg
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
2023-06-22objcopy.zig allow outputting zero length sections (#16121)d18g
Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2023-06-20Update objcopy.zigd18g
Fix `--only-section=` handling
2023-06-19Merge pull request #16046 from BratishkaErik/issue-6128Andrew Kelley
Renaming `@xtoy` to `@YfromX`
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19objcopy: add support for `--compress-debug-sections`Xavier Bouchoux
2023-06-19objcopy: support some more elf file variantsXavier Bouchoux
"SHT_NOBITS" sections can be easily moved around in the file, they can be anywhere since there is no data... and remove logic about the categorization of symbol tables: I don't understand or remember why it was needed, and, in my tests, it works fine without... It previouly failed to strip an exe linked with `mold`
2023-06-17mem: rename align*Generic to mem.align*Motiejus Jakštys
Anecdote 1: The generic version is way more popular than the non-generic one in Zig codebase: git grep -w alignForward | wc -l 56 git grep -w alignForwardGeneric | wc -l 149 git grep -w alignBackward | wc -l 6 git grep -w alignBackwardGeneric | wc -l 15 Anecdote 2: In my project (turbonss) that does much arithmetic and alignment I exclusively use the Generic functions. Anecdote 3: we used only the Generic versions in the Macho Man's linker workshop.
2023-05-23std.sort: add pdqsort and heapsortAli Chraghi
2023-04-28compiler: use `@memcpy` instead of `std.mem.copy`Andrew Kelley
2023-04-28update codebase to use `@memset` and `@memcpy`Andrew Kelley
2023-03-20objcopy: cleanups and extract helper functions to reduce bloatXavier Bouchoux
parts of the code are independant of Elf32/Elf64 variant, so avoid generating the code twice by putting them outside of the generic struct.
2023-03-20objcopy: add support for stripping 32bits ELF filesXavier Bouchoux
2023-03-20objcopy: use defined data for padding ELF sectionsXavier Bouchoux
Seems the right thing to do, but not strictly necessary.
2023-03-20objcopy: add support for `--add-gnu-debuglink` and `--only-keep-debug`Xavier Bouchoux
as documented at https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html It is now equivalent to do ``` zig objcopy --only-keep-debug bar foo.debug zig objcopy -g bar foo.tmp zig objcopy --add-gnu-debuglink=foo.debug foo.tmp foo rm foo.tmp ``` or ``` zig objcopy --only-keep-debug bar foo foo.debug zig objcopy -g --add-gnu-debuglink=foo.debug bar foo ``` or ``` zig objcopy -g --extract-to=foo.debug bar foo ```
2023-03-20objcopy: fix compilation on 32-bit systemsXavier Bouchoux
2023-03-20objcopy: add some support for --strip-debug and --strip-allXavier Bouchoux
Support for the use case: `zig objcopy --strip-all program stripped --extract-to stripped.dbg` to separate the debug & symbols sections out to a companion file, with a corresponding a .gnu_debuglink. note: this is "a minimal effort implementation" It doesn't support all possibile elf files: there may be some sections type that need fixups, the program header may need fix up, ... It was written for a specific use case (strip debug info to a sperate file, for linux 64-bits executables built with `zig` or `zig c++` ) It doesn't support 32-bit files, or file with non-native endianess.
2023-03-15make the build runner and test runner talk to each otherAndrew Kelley
std.Build.addTest creates a CompileStep as before, however, this kind of step no longer actually runs the unit tests. Instead it only compiles it, and one must additionally create a RunStep from the CompileStep in order to actually run the tests. RunStep gains integration with the default test runner, which now supports the standard --listen=- argument in order to communicate over stdin and stdout. It also reports test statistics; how many passed, failed, and leaked, as well as directly associating the relevant stderr with the particular test name that failed. This separation of CompileStep and RunStep means that `CompileStep.Kind.test_exe` is no longer needed, and therefore has been removed in this commit. * build runner: show unit test statistics in build summary * added Step.writeManifest since many steps want to treat it as a warning and emit the same message if it fails. * RunStep: fixed error message that prints the failed command printing the original argv and not the adjusted argv in case an interpreter was used. * RunStep: fixed not passing the command line arguments to the interpreter. * move src/Server.zig to std.zig.Server so that the default test runner can use it. * the simpler test runner function which is used by work-in-progress backends now no longer prints to stderr, which is necessary in order for the build runner to not print the stderr as a warning message.
2023-03-15zig objcopy: support the compiler protocolAndrew Kelley
This commit extracts out server code into src/Server.zig and uses it both in the main CLI as well as `zig objcopy`. std.Build.ObjCopyStep now adds `--listen=-` to the CLI for `zig objcopy` and observes the protocol for progress and other kinds of integrations. This fixes the last two test failures of this branch when I run `zig build test` locally.
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-01-11zig objcopy: Fix corrupted hex outputEckhart Köppen
Do not return stack local data for hex record payload data.
2022-12-13add `zig objcopy` subcommandAndrew Kelley
This commit moves the logic from `std.build.InstallRawStep` into `zig objcopy`. The options here are limited, but we can add features as needed. closes #9261 New issues can be opened for specific objcopy flag support.