| 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,8 +8084,8 @@ fn buildOutputFromZig( |
| 8084 | } | 8084 | } |
| 8085 | 8085 | ||
| 8086 | pub const CrtFileOptions = struct { | 8086 | pub const CrtFileOptions = struct { |
| 8087 | function_sections: ?bool = null, | 8087 | function_sections: bool = true, |
| 8088 | data_sections: ?bool = null, | 8088 | data_sections: bool = true, |
| 8089 | omit_frame_pointer: ?bool = null, | 8089 | omit_frame_pointer: ?bool = null, |
| 8090 | unwind_tables: ?std.builtin.UnwindTables = null, | 8090 | unwind_tables: ?std.builtin.UnwindTables = null, |
| 8091 | pic: ?bool = null, | 8091 | pic: ?bool = null, |
| ... | @@ -8188,8 +8188,8 @@ pub fn build_crt_file( | ... | @@ -8188,8 +8188,8 @@ pub fn build_crt_file( |
| 8188 | .root_name = root_name, | 8188 | .root_name = root_name, |
| 8189 | .libc_installation = comp.libc_installation, | 8189 | .libc_installation = comp.libc_installation, |
| 8190 | .emit_bin = .yes_cache, | 8190 | .emit_bin = .yes_cache, |
| 8191 | .function_sections = options.function_sections orelse false, | 8191 | .function_sections = options.function_sections, |
| 8192 | .data_sections = options.data_sections orelse false, | 8192 | .data_sections = options.data_sections, |
| 8193 | .c_source_files = c_source_files, | 8193 | .c_source_files = c_source_files, |
| 8194 | .verbose_cc = comp.verbose_cc, | 8194 | .verbose_cc = comp.verbose_cc, |
| 8195 | .verbose_link = comp.verbose_link, | 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,6 +265,8 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 265 | .root_name = root_name, | 265 | .root_name = root_name, |
| 266 | .libc_installation = comp.libc_installation, | 266 | .libc_installation = comp.libc_installation, |
| 267 | .emit_bin = .yes_cache, | 267 | .emit_bin = .yes_cache, |
| 268 | .function_sections = true, | ||
| 269 | .data_sections = true, | ||
| 268 | .c_source_files = c_source_files.items, | 270 | .c_source_files = c_source_files.items, |
| 269 | .verbose_cc = comp.verbose_cc, | 271 | .verbose_cc = comp.verbose_cc, |
| 270 | .verbose_link = comp.verbose_link, | 272 | .verbose_link = comp.verbose_link, |
| ... | @@ -459,6 +461,8 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr | ... | @@ -459,6 +461,8 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 459 | .root_name = root_name, | 461 | .root_name = root_name, |
| 460 | .libc_installation = comp.libc_installation, | 462 | .libc_installation = comp.libc_installation, |
| 461 | .emit_bin = .yes_cache, | 463 | .emit_bin = .yes_cache, |
| 464 | .function_sections = true, | ||
| 465 | .data_sections = true, | ||
| 462 | .c_source_files = c_source_files.items, | 466 | .c_source_files = c_source_files.items, |
| 463 | .verbose_cc = comp.verbose_cc, | 467 | .verbose_cc = comp.verbose_cc, |
| 464 | .verbose_link = comp.verbose_link, | 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,6 +288,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 288 | .root_name = root_name, | 288 | .root_name = root_name, |
| 289 | .libc_installation = comp.libc_installation, | 289 | .libc_installation = comp.libc_installation, |
| 290 | .emit_bin = .yes_cache, | 290 | .emit_bin = .yes_cache, |
| 291 | .function_sections = true, | ||
| 292 | .data_sections = true, | ||
| 291 | .c_source_files = c_source_files.items, | 293 | .c_source_files = c_source_files.items, |
| 292 | .verbose_cc = comp.verbose_cc, | 294 | .verbose_cc = comp.verbose_cc, |
| 293 | .verbose_link = comp.verbose_link, | 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,7 +155,8 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 155 | .main_mod = null, | 155 | .main_mod = null, |
| 156 | .libc_installation = comp.libc_installation, | 156 | .libc_installation = comp.libc_installation, |
| 157 | .emit_bin = .yes_cache, | 157 | .emit_bin = .yes_cache, |
| 158 | .function_sections = comp.function_sections, | 158 | .function_sections = true, |
| 159 | .data_sections = true, | ||
| 159 | .c_source_files = &c_source_files, | 160 | .c_source_files = &c_source_files, |
| 160 | .verbose_cc = comp.verbose_cc, | 161 | .verbose_cc = comp.verbose_cc, |
| 161 | .verbose_link = comp.verbose_link, | 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,6 +56,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 56 | }, | 56 | }, |
| 57 | }; | 57 | }; |
| 58 | return comp.build_crt_file("crt2", .Obj, .@"mingw-w64 crt2.o", prog_node, &files, .{ | 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 | .unwind_tables = unwind_tables, | 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,8 +43,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 43 | }, | 43 | }, |
| 44 | }; | 44 | }; |
| 45 | return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files, .{ | 45 | return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files, .{ |
| 46 | .function_sections = true, | ||
| 47 | .data_sections = true, | ||
| 48 | .omit_frame_pointer = true, | 46 | .omit_frame_pointer = true, |
| 49 | .no_builtin = true, | 47 | .no_builtin = true, |
| 50 | }); | 48 | }); |
| ... | @@ -63,8 +61,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro | ... | @@ -63,8 +61,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 63 | }, | 61 | }, |
| 64 | }; | 62 | }; |
| 65 | return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files, .{ | 63 | return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files, .{ |
| 66 | .function_sections = true, | ||
| 67 | .data_sections = true, | ||
| 68 | .omit_frame_pointer = true, | 64 | .omit_frame_pointer = true, |
| 69 | .pic = true, | 65 | .pic = true, |
| 70 | .no_builtin = true, | 66 | .no_builtin = true, |
| ... | @@ -84,8 +80,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro | ... | @@ -84,8 +80,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 84 | }, | 80 | }, |
| 85 | }; | 81 | }; |
| 86 | return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files, .{ | 82 | return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files, .{ |
| 87 | .function_sections = true, | ||
| 88 | .data_sections = true, | ||
| 89 | .omit_frame_pointer = true, | 83 | .omit_frame_pointer = true, |
| 90 | .pic = true, | 84 | .pic = true, |
| 91 | .no_builtin = true, | 85 | .no_builtin = true, |
| ... | @@ -172,8 +166,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro | ... | @@ -172,8 +166,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 172 | }; | 166 | }; |
| 173 | } | 167 | } |
| 174 | return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items, .{ | 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 | .omit_frame_pointer = true, | 169 | .omit_frame_pointer = true, |
| 178 | .no_builtin = true, | 170 | .no_builtin = true, |
| 179 | }); | 171 | }); |