# Module: keep frame pointer in ReleaseSmall on x86 · gitcafe/zig

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

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

Visibility: public

Requested revision: 0ff0bdb4a71d8fd055272abfdadea2f23f99574a

Requested commit: 0ff0bdb4a71d8fd055272abfdadea2f23f99574a

Commit: 0ff0bdb4a71d8fd055272abfdadea2f23f99574a

Tree: 264695e89691b93355dd795ce9fc060521966e23

Author: wooster0

Committer: Alex Rønne Petersen

## Message

````
Module: keep frame pointer in ReleaseSmall on x86

On x86 and x86_64 keeping the frame pointer usually reduces binary size, even for simple programs:

```
~$ cat x.zig
pub fn main() void {
    @import("std").debug.print("hello", .{});
}
~$ zig build-exe x.zig -target x86_64-linux -OReleaseSmall -fno-omit-frame-pointer && wc -c x
5168 x
~$ zig build-exe x.zig -target x86_64-linux -OReleaseSmall -fomit-frame-pointer && wc -c x
5216 x
```
```
~$ cat x.zig
pub fn main() void {
    @import("std").debug.print("hello", .{});
}
~$ zig build-exe x.zig -target x86-linux -OReleaseSmall -fno-omit-frame-pointer && wc -c x
3400 x
~$ zig build-exe x.zig -target x86-linux -OReleaseSmall -fomit-frame-pointer && wc -c x
3556 x
```

A bigger benchmark is the Zig compiler:

With no changes to anything on master branch:
```
$ zig build -Dno-lib -Dno-langref --zig-lib-dir lib -Doptimize=ReleaseSmall
$ wc -c zig-out/bin/zig
10698792 zig-out/bin/zig
```
Adding `.omit_frame_pointer = false` in `addCompilerStep` in `build.zig`:
```
$ zig build -Dno-lib -Dno-langref --zig-lib-dir lib -Doptimize=ReleaseSmall
$ wc -c zig-out/bin/zig
10155744 zig-out/bin/zig
```

````

## Parents

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

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