authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-31 22:56:39-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-31 22:56:39-07:00
logcbb806da6e0b8f2f4d0d12ca57618c291acfa0c0
tree39ae80638ae38654145dd75d5e241301fdba626b
parent8c0f4e6f54eefc56f69bf8def333ff8cf67c0783

stage2: -fbuild-id causes default linker to be LLD

until zig's self-hosted linker gains this functionality.

1 files changed, 4 insertions(+), 2 deletions(-)

src/Compilation.zig+4-2
......@@ -975,6 +975,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
975975 const unwind_tables = options.want_unwind_tables orelse
976976 (link_libunwind or target_util.needUnwindTables(options.target));
977977 const link_eh_frame_hdr = options.link_eh_frame_hdr or unwind_tables;
978 const build_id = options.build_id orelse false;
978979
979980 // Make a decision on whether to use LLD or our own linker.
980981 const use_lld = options.use_lld orelse blk: {
......@@ -1005,7 +1006,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
10051006 options.output_mode == .Lib or
10061007 options.image_base_override != null or
10071008 options.linker_script != null or options.version_script != null or
1008 options.emit_implib != null)
1009 options.emit_implib != null or
1010 build_id)
10091011 {
10101012 break :blk true;
10111013 }
......@@ -1640,7 +1642,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
16401642 .skip_linker_dependencies = options.skip_linker_dependencies,
16411643 .parent_compilation_link_libc = options.parent_compilation_link_libc,
16421644 .each_lib_rpath = options.each_lib_rpath orelse options.is_native_os,
1643 .build_id = options.build_id orelse false,
1645 .build_id = build_id,
16441646 .cache_mode = cache_mode,
16451647 .disable_lld_caching = options.disable_lld_caching or cache_mode == .whole,
16461648 .subsystem = options.subsystem,