authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-07-13 23:20:51+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-07-15 18:49:47+02:00
log9ca69c51e76525e1e753588375036ea711f72df0
tree8ffc99b93a6a3287abc7d61fde5db094c8924253
parente3575cdad44e63f598b557ba3142675197875906

zld: error out if LTO is requested targeting Darwin


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

src/Compilation.zig+3-1
...@@ -929,7 +929,9 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {...@@ -929,7 +929,9 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
929 if (!use_lld and !options.target.isDarwin())929 if (!use_lld and !options.target.isDarwin())
930 return error.LtoUnavailableWithoutLld;930 return error.LtoUnavailableWithoutLld;
931 break :blk explicit;931 break :blk explicit;
932 } else if (!use_lld and !options.target.isDarwin()) {932 } else if (!use_lld) {
933 // TODO zig ld LTO support
934 // See https://github.com/ziglang/zig/issues/8680
933 break :blk false;935 break :blk false;
934 } else if (options.c_source_files.len == 0) {936 } else if (options.c_source_files.len == 0) {
935 break :blk false;937 break :blk false;
src/main.zig+7-1
...@@ -1648,7 +1648,13 @@ fn buildOutputType(...@@ -1648,7 +1648,13 @@ fn buildOutputType(
16481648
1649 if (use_lld) |opt| {1649 if (use_lld) |opt| {
1650 if (opt and cross_target.isDarwin()) {1650 if (opt and cross_target.isDarwin()) {
1651 fatal("-fLLD requested with Mach-O object format. Only the self-hosted linker is supported for this target.", .{});1651 fatal("LLD requested with Mach-O object format. Only the self-hosted linker is supported for this target.", .{});
1652 }
1653 }
1654
1655 if (want_lto) |opt| {
1656 if (opt and cross_target.isDarwin()) {
1657 fatal("LTO is not yet supported with the Mach-O object format. More details: https://github.com/ziglang/zig/issues/8680", .{});
1652 }1658 }
1653 }1659 }
16541660