1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-21 09:57:18 +03:00

[Mach-O] wip

This commit is contained in:
Rui Ueyama 2021-10-23 22:16:24 +09:00
parent 1f5bc4b3ee
commit 857aef3244
3 changed files with 9 additions and 10 deletions

View File

@ -87,12 +87,12 @@ static void create_synthetic_chunks(Context &ctx) {
}
static void fill_symtab(Context &ctx) {
ctx.symtab.add(ctx, intern(ctx, "__dyld_private"), N_SECT, false, 8, 0x0);
ctx.symtab.add(ctx, intern(ctx, "__mh_execute_header"), N_SECT, true, 1, 0x10);
ctx.symtab.add(ctx, intern(ctx, "_hello"), N_SECT, true, 1, 0x0);
ctx.symtab.add(ctx, intern(ctx, "_main"), N_SECT, true, 1, 0x0);
ctx.symtab.add(ctx, intern(ctx, "_printf"), N_UNDF, true, 0, 0x100);
ctx.symtab.add(ctx, intern(ctx, "dyld_stub_binder"), N_UNDF, true, 0, 0x100);
ctx.symtab.add(ctx, intern(ctx, "__dyld_private"), false, 8, 0x0);
ctx.symtab.add(ctx, intern(ctx, "__mh_execute_header"), true, 1, 0x10);
ctx.symtab.add(ctx, intern(ctx, "_hello"), true, 1, 0x0);
ctx.symtab.add(ctx, intern(ctx, "_main"), true, 1, 0x0);
ctx.symtab.add(ctx, intern(ctx, "_printf"), true, 0, 0x100);
ctx.symtab.add(ctx, intern(ctx, "dyld_stub_binder"), true, 0, 0x100);
}
static void export_symbols(Context &ctx) {

View File

@ -346,7 +346,7 @@ public:
hdr.p2align = __builtin_ctz(8);
}
void add(Context &ctx, Symbol *sym, i64 type, bool is_external,
void add(Context &ctx, Symbol *sym, bool is_external,
i64 sect_idx, i64 lib_idx);
void copy_buf(Context &ctx) override;

View File

@ -579,8 +579,7 @@ void OutputFunctionStartsSection::copy_buf(Context &ctx) {
write_vector(ctx.buf + hdr.offset, contents);
}
void OutputSymtabSection::add(Context &ctx, Symbol *sym,
i64 type, bool is_external,
void OutputSymtabSection::add(Context &ctx, Symbol *sym, bool is_external,
i64 sect_idx, i64 desc) {
MachSym &msym = mach_syms.emplace_back();
hdr.size += sizeof(msym);
@ -588,7 +587,7 @@ void OutputSymtabSection::add(Context &ctx, Symbol *sym,
memset(&msym, 0, sizeof(msym));
msym.stroff = ctx.strtab.add_string(sym->name);
msym.type = type;
msym.type = (sym->file->is_dylib ? N_UNDF : N_SECT);
msym.ext = is_external;
msym.sect = sect_idx;
msym.desc = desc;