authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-05 14:47:36+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-05 22:41:09+01:00
log796d4845ff6747611c0061f8fe5c3c1c5b967226
tree3e15bd1068c7531faab19a2de8280856c93bf68c
parent7fef0b4a23ae616ebfec978d6af8e9f716a63555
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

musl: Pass -fomit-frame-pointer via CrtFileOptions.


2 files changed, 9 insertions(+), 2 deletions(-)

src/Compilation.zig+3-1
......@@ -6264,6 +6264,7 @@ fn buildOutputFromZig(
62646264pub const CrtFileOptions = struct {
62656265 function_sections: ?bool = null,
62666266 data_sections: ?bool = null,
6267 omit_frame_pointer: ?bool = null,
62676268 pic: ?bool = null,
62686269 no_builtin: ?bool = null,
62696270};
......@@ -6322,7 +6323,8 @@ pub fn build_crt_file(
63226323 .sanitize_c = false,
63236324 .sanitize_thread = false,
63246325 .red_zone = comp.root_mod.red_zone,
6325 .omit_frame_pointer = comp.root_mod.omit_frame_pointer,
6326 // Some libcs (e.g. musl) are opinionated about -fomit-frame-pointer.
6327 .omit_frame_pointer = options.omit_frame_pointer orelse comp.root_mod.omit_frame_pointer,
63266328 .valgrind = false,
63276329 .unwind_tables = false,
63286330 // Some CRT objects (e.g. musl's rcrt1.o and Scrt1.o) are opinionated about PIC.
src/musl.zig+6-1
......@@ -41,6 +41,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
4141 return comp.build_crt_file("crti", .Obj, .@"musl crti.o", prog_node, &files, .{
4242 .function_sections = true,
4343 .data_sections = true,
44 .omit_frame_pointer = true,
4445 .no_builtin = true,
4546 });
4647 },
......@@ -57,6 +58,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
5758 return comp.build_crt_file("crtn", .Obj, .@"musl crtn.o", prog_node, &files, .{
5859 .function_sections = true,
5960 .data_sections = true,
61 .omit_frame_pointer = true,
6062 .no_builtin = true,
6163 });
6264 },
......@@ -76,6 +78,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
7678 return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files, .{
7779 .function_sections = true,
7880 .data_sections = true,
81 .omit_frame_pointer = true,
7982 .no_builtin = true,
8083 });
8184 },
......@@ -95,6 +98,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
9598 return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files, .{
9699 .function_sections = true,
97100 .data_sections = true,
101 .omit_frame_pointer = true,
98102 .pic = true,
99103 .no_builtin = true,
100104 });
......@@ -115,6 +119,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
115119 return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files, .{
116120 .function_sections = true,
117121 .data_sections = true,
122 .omit_frame_pointer = true,
118123 .pic = true,
119124 .no_builtin = true,
120125 });
......@@ -213,6 +218,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
213218 return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items, .{
214219 .function_sections = true,
215220 .data_sections = true,
221 .omit_frame_pointer = true,
216222 .no_builtin = true,
217223 });
218224 },
......@@ -457,7 +463,6 @@ fn addCcArgs(
457463
458464 o_arg,
459465
460 "-fomit-frame-pointer",
461466 "-fno-unwind-tables",
462467 "-fno-asynchronous-unwind-tables",
463468