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

This commit is contained in:
Alex Rønne Petersen 2024-11-05 14:47:36 +01:00
parent 7fef0b4a23
commit 796d4845ff
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View File

@ -6264,6 +6264,7 @@ fn buildOutputFromZig(
pub const CrtFileOptions = struct {
function_sections: ?bool = null,
data_sections: ?bool = null,
omit_frame_pointer: ?bool = null,
pic: ?bool = null,
no_builtin: ?bool = null,
};
@ -6322,7 +6323,8 @@ pub fn build_crt_file(
.sanitize_c = false,
.sanitize_thread = false,
.red_zone = comp.root_mod.red_zone,
.omit_frame_pointer = comp.root_mod.omit_frame_pointer,
// Some libcs (e.g. musl) are opinionated about -fomit-frame-pointer.
.omit_frame_pointer = options.omit_frame_pointer orelse comp.root_mod.omit_frame_pointer,
.valgrind = false,
.unwind_tables = false,
// Some CRT objects (e.g. musl's rcrt1.o and Scrt1.o) are opinionated about PIC.

View File

@ -41,6 +41,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
return comp.build_crt_file("crti", .Obj, .@"musl crti.o", prog_node, &files, .{
.function_sections = true,
.data_sections = true,
.omit_frame_pointer = true,
.no_builtin = true,
});
},
@ -57,6 +58,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
return comp.build_crt_file("crtn", .Obj, .@"musl crtn.o", prog_node, &files, .{
.function_sections = true,
.data_sections = true,
.omit_frame_pointer = true,
.no_builtin = true,
});
},
@ -76,6 +78,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files, .{
.function_sections = true,
.data_sections = true,
.omit_frame_pointer = true,
.no_builtin = true,
});
},
@ -95,6 +98,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files, .{
.function_sections = true,
.data_sections = true,
.omit_frame_pointer = true,
.pic = true,
.no_builtin = true,
});
@ -115,6 +119,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files, .{
.function_sections = true,
.data_sections = true,
.omit_frame_pointer = true,
.pic = true,
.no_builtin = true,
});
@ -213,6 +218,7 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items, .{
.function_sections = true,
.data_sections = true,
.omit_frame_pointer = true,
.no_builtin = true,
});
},
@ -457,7 +463,6 @@ fn addCcArgs(
o_arg,
"-fomit-frame-pointer",
"-fno-unwind-tables",
"-fno-asynchronous-unwind-tables",