From 582991a5a818179881f7923c7e6cff10de50dfcf Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 16 Mar 2020 09:54:11 +0100 Subject: [PATCH] build: Expose function-sections switch --- lib/std/build.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/std/build.zig b/lib/std/build.zig index 8fb5eaeeb0..e5d83f22b9 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -1157,8 +1157,14 @@ pub const LibExeObjStep = struct { valgrind_support: ?bool = null, + /// Create a .eh_frame_hdr section and a PT_GNU_EH_FRAME segment in the ELF + /// file. link_eh_frame_hdr: bool = false, + /// Place every function in its own section so that unused ones may be + /// safely garbage-collected during the linking phase. + link_function_sections: bool = false, + /// Uses system Wine installation to run cross compiled Windows build artifacts. enable_wine: bool = false, @@ -1884,7 +1890,9 @@ pub const LibExeObjStep = struct { if (self.link_eh_frame_hdr) { try zig_args.append("--eh-frame-hdr"); } - + if (self.link_function_sections) { + try zig_args.append("-ffunction-sections"); + } if (self.single_threaded) { try zig_args.append("--single-threaded"); }