diff options
| author | Luuk de Gram <luuk@degram.dev> | 2022-06-23 16:20:20 +0200 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2022-06-24 08:12:17 +0200 |
| commit | 7c87f9c828282aa12fb2d77c9c6a2318d83b8dff (patch) | |
| tree | d1168ba85eca9ea505d901faecd97847b5bea76c /src/link.zig | |
| parent | 3868864695b41c2c94f585b9644d3ed3bda39708 (diff) | |
| download | zig-7c87f9c828282aa12fb2d77c9c6a2318d83b8dff.tar.gz zig-7c87f9c828282aa12fb2d77c9c6a2318d83b8dff.zip | |
link:clarification & enable MachO getGlobalSymbol
This adds clarification to the getGlobalSymbol doc comments,
as well as renames the `addExternFn` function for MachO to `getGlobalSymbol`.
This function will now be called from 'src/link.zig' as well.
Finally, this also enables compiling zig's libc using LLVM even though
the `fno-LLVM` flag is given.
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/link.zig b/src/link.zig index 8bad44aa21..c78fb8c2c5 100644 --- a/src/link.zig +++ b/src/link.zig @@ -439,14 +439,15 @@ pub const File = struct { } /// Called from within CodeGen to retrieve the symbol index of a global symbol. - /// If no symbol exists yet with this name, a new one will be created instead. + /// If no symbol exists yet with this name, a new undefined global symbol will + /// be created. This symbol may get resolved once all relocatables are (re-)linked. pub fn getGlobalSymbol(base: *File, name: []const u8) UpdateDeclError!u32 { log.debug("getGlobalSymbol '{s}'", .{name}); switch (base.tag) { // zig fmt: off .coff => unreachable, .elf => unreachable, - .macho => unreachable, + .macho => return @fieldParentPtr(MachO, "base", base).getGlobalSymbol(name), .plan9 => unreachable, .spirv => unreachable, .c => unreachable, |
