# objcopy: add some support for \-\-strip-debug and \-\-strip-all · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/3a700d60baf419d837c0e71518e388337cb1bb33)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 3a700d60baf419d837c0e71518e388337cb1bb33

Requested commit: 3a700d60baf419d837c0e71518e388337cb1bb33

Commit: 3a700d60baf419d837c0e71518e388337cb1bb33

Tree: 3887c75d01774972150302c6fb7b8cfdc06d1524

Author: Xavier Bouchoux

Committer: Xavier Bouchoux

## Message

```
objcopy: add some support for --strip-debug and --strip-all

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.

```

## Parents

- [30427ff794514d51cb5066b9e50113da998e0fd0](https://git.cafe/gitcafe/zig/commit/30427ff794514d51cb5066b9e50113da998e0fd0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/3a700d60baf419d837c0e71518e388337cb1bb33?format=markdown)
