diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-10-14 22:24:46 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-10-23 16:27:38 -0700 |
| commit | 5b016e290a5ba335b295afeae104af6b3396a425 (patch) | |
| tree | 370ce44e11911967fefd986c42c53c12c22f320b /src/Compilation.zig | |
| parent | a4cc344aa0947f5b0d0e1a872e6d003b8e580976 (diff) | |
| download | zig-5b016e290a5ba335b295afeae104af6b3396a425.tar.gz zig-5b016e290a5ba335b295afeae104af6b3396a425.zip | |
move ld script processing to the frontend
along with the relevant logic, making the libraries within subject to
the same search criteria as all the other libraries.
this unfortunately means doing file system access on all .so files when
targeting ELF to determine if they are linker scripts, however, I have a
plan to address this.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 2776d2960a..d4b187915c 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1003,10 +1003,11 @@ pub const LinkObject = struct { path: Path, must_link: bool = false, needed: bool = false, - // When the library is passed via a positional argument, it will be - // added as a full path. If it's `-l<lib>`, then just the basename. - // - // Consistent with `withLOption` variable name in lld ELF driver. + weak: bool = false, + /// When the library is passed via a positional argument, it will be + /// added as a full path. If it's `-l<lib>`, then just the basename. + /// + /// Consistent with `withLOption` variable name in lld ELF driver. loption: bool = false, pub fn isObject(lo: LinkObject) bool { @@ -1061,6 +1062,9 @@ pub const CreateOptions = struct { /// this flag would be set to disable this machinery to avoid false positives. disable_lld_caching: bool = false, cache_mode: CacheMode = .incremental, + /// This field is intended to be removed. + /// The ELF implementation no longer uses this data, however the MachO and COFF + /// implementations still do. lib_dirs: []const []const u8 = &[0][]const u8{}, rpath_list: []const []const u8 = &[0][]const u8{}, symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty, @@ -2563,6 +2567,7 @@ fn addNonIncrementalStuffToCacheManifest( _ = try man.addFilePath(obj.path, null); man.hash.add(obj.must_link); man.hash.add(obj.needed); + man.hash.add(obj.weak); man.hash.add(obj.loption); } @@ -3219,18 +3224,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { })); } - for (comp.link_diags.msgs.items) |link_err| { - try bundle.addRootErrorMessage(.{ - .msg = try bundle.addString(link_err.msg), - .notes_len = @intCast(link_err.notes.len), - }); - const notes_start = try bundle.reserveNotes(@intCast(link_err.notes.len)); - for (link_err.notes, 0..) |note, i| { - bundle.extra.items[notes_start + i] = @intFromEnum(try bundle.addErrorMessage(.{ - .msg = try bundle.addString(note.msg), - })); - } - } + try comp.link_diags.addMessagesToBundle(&bundle); if (comp.zcu) |zcu| { if (bundle.root_list.items.len == 0 and zcu.compile_log_sources.count() != 0) { |
