diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-10-04 15:16:52 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-10-04 11:21:56 -0700 |
| commit | 8b4e3b6aee61a26e7229ea30728e6c5e31c7cd0b (patch) | |
| tree | c78414c59ad23d9dd24b8989cced5589203370a2 /lib/std/Build/Step | |
| parent | a306bfcd8eec166906ce2839bc7ff86ba6335376 (diff) | |
| download | zig-8b4e3b6aee61a26e7229ea30728e6c5e31c7cd0b.tar.gz zig-8b4e3b6aee61a26e7229ea30728e6c5e31c7cd0b.zip | |
comp: add support for -fdata-sections
Diffstat (limited to 'lib/std/Build/Step')
| -rw-r--r-- | lib/std/Build/Step/Compile.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index 5ffc6c33ac..07eb3ded01 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -123,6 +123,10 @@ link_emit_relocs: bool = false, /// safely garbage-collected during the linking phase. link_function_sections: bool = false, +/// Place every data in its own section so that unused ones may be +/// safely garbage-collected during the linking phase. +link_data_sections: bool = false, + /// Remove functions and data that are unreachable by the entry point or /// exported symbols. link_gc_sections: ?bool = null, @@ -1647,6 +1651,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { if (self.link_function_sections) { try zig_args.append("-ffunction-sections"); } + if (self.link_data_sections) { + try zig_args.append("-fdata-sections"); + } if (self.link_gc_sections) |x| { try zig_args.append(if (x) "--gc-sections" else "--no-gc-sections"); } |
