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

[Mach-O] Support LC_DYLD_EXPORTS_TRIE

This commit is contained in:
Rui Ueyama 2021-11-16 12:51:56 +09:00
parent cd404f72cd
commit 94889d7a02
2 changed files with 10 additions and 3 deletions

View File

@ -122,6 +122,8 @@ static constexpr u32 LC_VERSION_MIN_TVOS = 0x2F;
static constexpr u32 LC_VERSION_MIN_WATCHOS = 0x30;
static constexpr u32 LC_NOTE = 0x31;
static constexpr u32 LC_BUILD_VERSION = 0x32;
static constexpr u32 LC_DYLD_EXPORTS_TRIE = (0x33 | LC_REQ_DYLD);
static constexpr u32 LC_DYLD_CHAINED_FIXUPS = (0x34 | LC_REQ_DYLD);
static constexpr u32 SG_HIGHVM = 0x1;
static constexpr u32 SG_FVMLIB = 0x2;

View File

@ -474,8 +474,8 @@ DylibFile *DylibFile::create(Context &ctx, MappedFile<Context> *mf) {
return dylib;
};
void DylibFile::read_trie(Context &ctx, u8 *start, i64 offset,
const std::string &prefix) {
void DylibFile::read_trie(Context &ctx, u8 *start, i64 offset = 0,
const std::string &prefix = "") {
u8 *buf = start + offset;
if (*buf) {
@ -513,7 +513,12 @@ void DylibFile::parse_dylib(Context &ctx) {
case LC_DYLD_INFO_ONLY: {
DyldInfoCommand &cmd = *(DyldInfoCommand *)p;
if (cmd.export_off)
read_trie(ctx, mf->data + cmd.export_off, 0, "");
read_trie(ctx, mf->data + cmd.export_off);
break;
}
case LC_DYLD_EXPORTS_TRIE: {
LinkEditDataCommand &cmd = *(LinkEditDataCommand *)p;
read_trie(ctx, mf->data + cmd.dataoff);
break;
}
}