| author | |
| committer | |
| log | a996a75e06193d377c3071042ece1c3af5cfdc6c |
| tree | 389c9eb5b65a4cd639e9d3ca6c0ac0eed6b927c6 |
| parent | 312b231da9a90e477c56801fb2056324edc50ea1 |
| signature |
We already did this for some of them; this just makes us consistent. Doing this
gives the linker more flexibility to rearrange code/data, but more importantly,
allows --gc-sections to get rid of all the unused code, which is a real concern
for these libraries in particular.6 files changed, 13 insertions(+), 13 deletions(-)
src/Compilation.zig+4-4| ... | ... | @@ -8084,8 +8084,8 @@ fn buildOutputFromZig( |
| 8084 | 8084 | } |
| 8085 | 8085 | |
| 8086 | 8086 | pub const CrtFileOptions = struct { |
| 8087 | function_sections: ?bool = null, | |
| 8088 | data_sections: ?bool = null, | |
| 8087 | function_sections: bool = true, | |
| 8088 | data_sections: bool = true, | |
| 8089 | 8089 | omit_frame_pointer: ?bool = null, |
| 8090 | 8090 | unwind_tables: ?std.builtin.UnwindTables = null, |
| 8091 | 8091 | pic: ?bool = null, |
| ... | ... | @@ -8188,8 +8188,8 @@ pub fn build_crt_file( |
| 8188 | 8188 | .root_name = root_name, |
| 8189 | 8189 | .libc_installation = comp.libc_installation, |
| 8190 | 8190 | .emit_bin = .yes_cache, |
| 8191 | .function_sections = options.function_sections orelse false, | |
| 8192 | .data_sections = options.data_sections orelse false, | |
| 8191 | .function_sections = options.function_sections, | |
| 8192 | .data_sections = options.data_sections, | |
| 8193 | 8193 | .c_source_files = c_source_files, |
| 8194 | 8194 | .verbose_cc = comp.verbose_cc, |
| 8195 | 8195 | .verbose_link = comp.verbose_link, |
src/libs/libcxx.zig+4| ... | ... | @@ -265,6 +265,8 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 265 | 265 | .root_name = root_name, |
| 266 | 266 | .libc_installation = comp.libc_installation, |
| 267 | 267 | .emit_bin = .yes_cache, |
| 268 | .function_sections = true, | |
| 269 | .data_sections = true, | |
| 268 | 270 | .c_source_files = c_source_files.items, |
| 269 | 271 | .verbose_cc = comp.verbose_cc, |
| 270 | 272 | .verbose_link = comp.verbose_link, |
| ... | ... | @@ -459,6 +461,8 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 459 | 461 | .root_name = root_name, |
| 460 | 462 | .libc_installation = comp.libc_installation, |
| 461 | 463 | .emit_bin = .yes_cache, |
| 464 | .function_sections = true, | |
| 465 | .data_sections = true, | |
| 462 | 466 | .c_source_files = c_source_files.items, |
| 463 | 467 | .verbose_cc = comp.verbose_cc, |
| 464 | 468 | .verbose_link = comp.verbose_link, |
src/libs/libtsan.zig+2| ... | ... | @@ -288,6 +288,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 288 | 288 | .root_name = root_name, |
| 289 | 289 | .libc_installation = comp.libc_installation, |
| 290 | 290 | .emit_bin = .yes_cache, |
| 291 | .function_sections = true, | |
| 292 | .data_sections = true, | |
| 291 | 293 | .c_source_files = c_source_files.items, |
| 292 | 294 | .verbose_cc = comp.verbose_cc, |
| 293 | 295 | .verbose_link = comp.verbose_link, |
src/libs/libunwind.zig+2-1| ... | ... | @@ -155,7 +155,8 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 155 | 155 | .main_mod = null, |
| 156 | 156 | .libc_installation = comp.libc_installation, |
| 157 | 157 | .emit_bin = .yes_cache, |
| 158 | .function_sections = comp.function_sections, | |
| 158 | .function_sections = true, | |
| 159 | .data_sections = true, | |
| 159 | 160 | .c_source_files = &c_source_files, |
| 160 | 161 | .verbose_cc = comp.verbose_cc, |
| 161 | 162 | .verbose_link = comp.verbose_link, |
src/libs/mingw.zig+1| ... | ... | @@ -56,6 +56,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 56 | 56 | }, |
| 57 | 57 | }; |
| 58 | 58 | return comp.build_crt_file("crt2", .Obj, .@"mingw-w64 crt2.o", prog_node, &files, .{ |
| 59 | .function_sections = false, // https://codeberg.org/ziglang/zig/issues/30702 | |
| 59 | 60 | .unwind_tables = unwind_tables, |
| 60 | 61 | }); |
| 61 | 62 | }, |
src/libs/musl.zig-8| ... | ... | @@ -43,8 +43,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 43 | 43 | }, |
| 44 | 44 | }; |
| 45 | 45 | return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files, .{ |
| 46 | .function_sections = true, | |
| 47 | .data_sections = true, | |
| 48 | 46 | .omit_frame_pointer = true, |
| 49 | 47 | .no_builtin = true, |
| 50 | 48 | }); |
| ... | ... | @@ -63,8 +61,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 63 | 61 | }, |
| 64 | 62 | }; |
| 65 | 63 | return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files, .{ |
| 66 | .function_sections = true, | |
| 67 | .data_sections = true, | |
| 68 | 64 | .omit_frame_pointer = true, |
| 69 | 65 | .pic = true, |
| 70 | 66 | .no_builtin = true, |
| ... | ... | @@ -84,8 +80,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 84 | 80 | }, |
| 85 | 81 | }; |
| 86 | 82 | return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files, .{ |
| 87 | .function_sections = true, | |
| 88 | .data_sections = true, | |
| 89 | 83 | .omit_frame_pointer = true, |
| 90 | 84 | .pic = true, |
| 91 | 85 | .no_builtin = true, |
| ... | ... | @@ -172,8 +166,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 172 | 166 | }; |
| 173 | 167 | } |
| 174 | 168 | return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items, .{ |
| 175 | .function_sections = true, | |
| 176 | .data_sections = true, | |
| 177 | 169 | .omit_frame_pointer = true, |
| 178 | 170 | .no_builtin = true, |
| 179 | 171 | }); |