Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions patterns/elf.hexpat
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,15 @@ struct Elf32_Syminfo {
SYMINFO_FLG si_flags;
};

struct Elf32_Dyn {
DT d_tag;
Elf32_Word d_val;
} [[format("format_elf32_dyn")]];

fn format_elf32_dyn(auto dyn) {
return dyn.d_tag;
};

s64 stringTableIndex;

struct String {
Expand Down Expand Up @@ -680,6 +689,8 @@ struct Elf32_Shdr {
Elf32_Rela relaTable[sh_size / sh_entsize] @ sh_offset;
} else if (sh_type == SHT::INIT_ARRAY || sh_type == SHT::FINI_ARRAY) {
u32 pointer[while($ < (sh_offset + sh_size))] @ sh_offset;
} else if (sh_type == SHT::DYNAMIC) {
Elf32_Dyn dynamic_entries[sh_size / sh_entsize] @ sh_offset;
} else {
u8 data[sh_size] @ sh_offset [[sealed]];
}
Expand Down Expand Up @@ -716,6 +727,16 @@ struct Elf64_Syminfo {
u16 si_boundto;
SYMINFO_FLG si_flags;
};

struct Elf64_Dyn {
DT d_tag;
padding[4];
Elf64_Xword d_val;
} [[format("format_elf64_dyn")]];

fn format_elf64_dyn(auto dyn) {
return dyn.d_tag;
};

struct Elf64_Shdr {
u32 sh_name;
Expand Down Expand Up @@ -743,6 +764,8 @@ struct Elf64_Shdr {
Elf64_Rela relaTable[sh_size / sh_entsize] @ sh_offset;
} else if (sh_type == SHT::INIT_ARRAY || sh_type == SHT::FINI_ARRAY) {
u32 pointer[while($ < (sh_offset + sh_size))] @ sh_offset;
} else if (sh_type == SHT::DYNAMIC) {
Elf64_Dyn dynamic_entries[sh_size / sh_entsize] @ sh_offset;
} else {
u8 data[sh_size] @ sh_offset [[sealed]];
}
Expand Down