mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 12:27:41 +00:00
macho: unify Atom concept between drivers
This commit is contained in:
parent
85f2df5050
commit
da9e7e498a
@ -588,7 +588,6 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO/Relocation.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO/Trie.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO/UnwindInfo.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO/ZldAtom.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO/dyld_info/bind.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO/dyld_info/Rebase.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/MachO/dead_strip.zig"
|
||||
|
||||
@ -1597,8 +1597,11 @@ pub fn createAtom(self: *MachO) !Atom.Index {
|
||||
try self.atom_by_index_table.putNoClobber(gpa, sym_index, atom_index);
|
||||
atom.* = .{
|
||||
.sym_index = sym_index,
|
||||
.inner_sym_index = 0,
|
||||
.inner_nsyms_trailing = 0,
|
||||
.file = 0,
|
||||
.size = 0,
|
||||
.alignment = 0,
|
||||
.prev_index = null,
|
||||
.next_index = null,
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@ const sort = std.sort;
|
||||
const trace = @import("../../tracy.zig").trace;
|
||||
|
||||
const Allocator = mem.Allocator;
|
||||
const Atom = @import("ZldAtom.zig");
|
||||
const Atom = @import("Atom.zig");
|
||||
const AtomIndex = @import("zld.zig").AtomIndex;
|
||||
const DwarfInfo = @import("DwarfInfo.zig");
|
||||
const LoadCommandIterator = macho.LoadCommandIterator;
|
||||
|
||||
@ -12,7 +12,7 @@ const mem = std.mem;
|
||||
const trace = @import("../../tracy.zig").trace;
|
||||
|
||||
const Allocator = mem.Allocator;
|
||||
const Atom = @import("ZldAtom.zig");
|
||||
const Atom = @import("Atom.zig");
|
||||
const AtomIndex = @import("zld.zig").AtomIndex;
|
||||
const EhFrameRecord = eh_frame.EhFrameRecord;
|
||||
const MachO = @import("../MachO.zig");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@ const mem = std.mem;
|
||||
|
||||
const Allocator = mem.Allocator;
|
||||
const AtomIndex = @import("zld.zig").AtomIndex;
|
||||
const Atom = @import("ZldAtom.zig");
|
||||
const Atom = @import("Atom.zig");
|
||||
const MachO = @import("../MachO.zig");
|
||||
const SymbolWithLoc = MachO.SymbolWithLoc;
|
||||
const SymbolResolver = MachO.SymbolResolver;
|
||||
|
||||
@ -8,7 +8,7 @@ const log = std.log.scoped(.eh_frame);
|
||||
|
||||
const Allocator = mem.Allocator;
|
||||
const AtomIndex = @import("zld.zig").AtomIndex;
|
||||
const Atom = @import("ZldAtom.zig");
|
||||
const Atom = @import("Atom.zig");
|
||||
const MachO = @import("../MachO.zig");
|
||||
const Relocation = @import("Relocation.zig");
|
||||
const SymbolWithLoc = MachO.SymbolWithLoc;
|
||||
|
||||
@ -15,7 +15,7 @@ const mem = std.mem;
|
||||
const aarch64 = @import("../../arch/aarch64/bits.zig");
|
||||
|
||||
const Allocator = mem.Allocator;
|
||||
const Atom = @import("ZldAtom.zig");
|
||||
const Atom = @import("Atom.zig");
|
||||
const AtomIndex = @import("zld.zig").AtomIndex;
|
||||
const MachO = @import("../MachO.zig");
|
||||
const Relocation = @import("Relocation.zig");
|
||||
|
||||
@ -21,7 +21,7 @@ const trace = @import("../../tracy.zig").trace;
|
||||
|
||||
const Allocator = mem.Allocator;
|
||||
const Archive = @import("Archive.zig");
|
||||
const Atom = @import("ZldAtom.zig");
|
||||
const Atom = @import("Atom.zig");
|
||||
const Cache = std.Build.Cache;
|
||||
const CodeSignature = @import("CodeSignature.zig");
|
||||
const Compilation = @import("../../Compilation.zig");
|
||||
@ -247,7 +247,16 @@ pub const Zld = struct {
|
||||
const gpa = self.gpa;
|
||||
const index = @as(AtomIndex, @intCast(self.atoms.items.len));
|
||||
const atom = try self.atoms.addOne(gpa);
|
||||
atom.* = Atom.empty;
|
||||
atom.* = .{
|
||||
.sym_index = 0,
|
||||
.inner_sym_index = 0,
|
||||
.inner_nsyms_trailing = 0,
|
||||
.file = 0,
|
||||
.size = 0,
|
||||
.alignment = 0,
|
||||
.prev_index = null,
|
||||
.next_index = null,
|
||||
};
|
||||
atom.sym_index = sym_index;
|
||||
atom.size = size;
|
||||
atom.alignment = alignment;
|
||||
@ -3169,6 +3178,14 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr
|
||||
};
|
||||
defer zld.deinit();
|
||||
|
||||
// Index 0 is always a null symbol.
|
||||
try zld.locals.append(gpa, .{
|
||||
.n_strx = 0,
|
||||
.n_type = 0,
|
||||
.n_sect = 0,
|
||||
.n_desc = 0,
|
||||
.n_value = 0,
|
||||
});
|
||||
try zld.strtab.buffer.append(gpa, 0);
|
||||
|
||||
// Positional arguments to the linker such as object files and static archives.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user