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

[Mach-O] wip

This commit is contained in:
Rui Ueyama 2021-09-14 19:45:51 +09:00
parent a504ef9ba7
commit 955f35e977
2 changed files with 13 additions and 15 deletions

View File

@ -205,19 +205,11 @@ static constexpr u32 DICE_KIND_JUMP_TABLE16 = 3;
static constexpr u32 DICE_KIND_JUMP_TABLE32 = 4;
static constexpr u32 DICE_KIND_ABS_JUMP_TABLE32 = 5;
static constexpr u32 N_STAB = 0xe0;
static constexpr u32 N_PEXT = 0x10;
static constexpr u32 N_TYPE = 0x0e;
static constexpr u32 N_EXT = 0x01;
static constexpr u32 N_UNDF = 0x0;
static constexpr u32 N_ABS = 0x2;
static constexpr u32 N_SECT = 0xe;
static constexpr u32 N_PBUD = 0xc;
static constexpr u32 N_INDR = 0xa;
static constexpr u32 NO_SECT = 0;
static constexpr u32 MAX_SECT = 255;
static constexpr u32 N_UNDF = 0;
static constexpr u32 N_ABS = 1;
static constexpr u32 N_INDR = 5;
static constexpr u32 N_PBUD = 6;
static constexpr u32 N_SECT = 7;
static constexpr u32 REFERENCE_TYPE = 0xf;
static constexpr u32 REFERENCE_FLAG_UNDEFINED_NON_LAZY = 0;
@ -380,7 +372,10 @@ struct DataInCodeEntry {
// This struct is named `n_list` in BSD and macOS.
struct MachoSym {
u32 stroff;
u8 type;
u8 ext : 1;
u8 type : 3;
u8 pext : 1;
u8 stub : 3;
u8 sect;
u16 desc;
u64 value;

View File

@ -87,7 +87,10 @@ int main(int argc, char **argv) {
for (i64 j = 0; j < cmd.nsyms; j++) {
std::cout << " symbol:"
<< "\n name: " << (char *)(buf + cmd.stroff + syms[j].stroff)
<< "\n type: 0x" << (u32)syms[j].type
<< "\n stub: " << (u32)syms[j].stub
<< "\n pext: " << (u32)syms[j].pext
<< "\n type: " << (u32)syms[j].type
<< "\n ext: " << (u32)syms[j].ext
<< "\n sect: 0x" << (u32)syms[j].sect
<< "\n desc: 0x" << (u32)syms[j].desc
<< "\n value: 0x" << syms[j].value