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-04 19:41:20 +09:00
parent 2dc8ac0bdd
commit e7f3e94f30
2 changed files with 13 additions and 5 deletions

View File

@ -6,6 +6,14 @@ InputSection::InputSection(Context &ctx, ObjectFile &file, const MachSection &hd
: file(file), hdr(hdr) {
contents = file.mf->get_contents().substr(hdr.offset, hdr.size);
subsections.push_back({*this, 0, (u32)contents.size()});
rels.reserve(hdr.nreloc);
MachRel *rel = (MachRel *)(file.mf->data + hdr.reloff);
for (i64 i = 0; i < hdr.nreloc; i++) {
MachRel r = rel[i];
rels.push_back({r.offset, r.type});
}
}
} // namespace mold::macho

View File

@ -39,11 +39,11 @@ std::ostream &operator<<(std::ostream &out, const ObjectFile &file);
//
struct Relocation {
u32 offset;
u32 type;
Symbol *sym;
Subsection *subsec;
u64 addend;
u32 offset = 0;
u32 type = 0;
Symbol *sym = nullptr;
Subsection *subsec = nullptr;
u64 addend = 0;
};
class InputSection {