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:
parent
2dc8ac0bdd
commit
e7f3e94f30
@ -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
|
||||
|
10
macho/mold.h
10
macho/mold.h
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user