aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-10-04 15:16:52 +0200
committerAndrew Kelley <andrew@ziglang.org>2023-10-04 11:21:56 -0700
commit8b4e3b6aee61a26e7229ea30728e6c5e31c7cd0b (patch)
treec78414c59ad23d9dd24b8989cced5589203370a2 /src/main.zig
parenta306bfcd8eec166906ce2839bc7ff86ba6335376 (diff)
downloadzig-8b4e3b6aee61a26e7229ea30728e6c5e31c7cd0b.tar.gz
zig-8b4e3b6aee61a26e7229ea30728e6c5e31c7cd0b.zip
comp: add support for -fdata-sections
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index 30911b57ba..f7f3da1b99 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -453,6 +453,8 @@ const usage_build_generic =
\\ -fno-builtin Disable implicit builtin knowledge of functions
\\ -ffunction-sections Places each function in a separate section
\\ -fno-function-sections All functions go into same section
+ \\ -fdata-sections Places each data in a separate section
+ \\ -fno-data-sections All data go into same section
\\ -fstrip Omit debug symbols
\\ -fno-strip Keep debug symbols
\\ -fformatted-panics Enable formatted safety panics
@@ -793,6 +795,7 @@ fn buildOutputType(
var strip: ?bool = null;
var formatted_panics: ?bool = null;
var function_sections = false;
+ var data_sections = false;
var no_builtin = false;
var listen: Listen = .none;
var debug_compile_errors = false;
@@ -1459,6 +1462,10 @@ fn buildOutputType(
function_sections = true;
} else if (mem.eql(u8, arg, "-fno-function-sections")) {
function_sections = false;
+ } else if (mem.eql(u8, arg, "-fdata-sections")) {
+ data_sections = true;
+ } else if (mem.eql(u8, arg, "-fno-data-sections")) {
+ data_sections = false;
} else if (mem.eql(u8, arg, "-fbuiltin")) {
no_builtin = false;
} else if (mem.eql(u8, arg, "-fno-builtin")) {
@@ -1780,6 +1787,8 @@ fn buildOutputType(
.no_omit_frame_pointer => omit_frame_pointer = false,
.function_sections => function_sections = true,
.no_function_sections => function_sections = false,
+ .data_sections => data_sections = true,
+ .no_data_sections => data_sections = false,
.builtin => no_builtin = false,
.no_builtin => no_builtin = true,
.color_diagnostics => color = .on,
@@ -3475,6 +3484,7 @@ fn buildOutputType(
.formatted_panics = formatted_panics,
.single_threaded = single_threaded,
.function_sections = function_sections,
+ .data_sections = data_sections,
.no_builtin = no_builtin,
.self_exe_path = self_exe_path,
.thread_pool = &thread_pool,
@@ -5589,6 +5599,8 @@ pub const ClangArgIterator = struct {
no_omit_frame_pointer,
function_sections,
no_function_sections,
+ data_sections,
+ no_data_sections,
builtin,
no_builtin,
color_diagnostics,