80 if (sym->n_scnum < 1 || sym->n_scnum > obj->
hdr.f_nscns) {
83 addr->paddr = obj->
scn_hdrs[sym->n_scnum - 1].s_scnptr + sym->n_value;
96 if (obj->
hdr.f_opthdr) {
103 for (
i = 0;
i < obj->
hdr.f_nsyms;
i++) {
104 if ((!strcmp(obj->
symbols[
i].n_name,
"_start") ||
105 !strcmp(obj->
symbols[
i].n_name,
"start")) &&
110 for (
i = 0;
i < obj->
hdr.f_nsyms;
i++) {
111 if ((!strcmp(obj->
symbols[
i].n_name,
"_main") ||
112 !strcmp(obj->
symbols[
i].n_name,
"main")) &&
121 for (
i = 0;
i < obj->
hdr.f_nscns;
i++) {
152 if (ret !=
sizeof(
struct coff_hdr)) {
157 if (ret !=
sizeof(
ut16)) {
166 if (!obj->
hdr.f_opthdr) {
171 if (ret !=
sizeof(
struct coff_opt_hdr)) {
179 ut64 offset =
sizeof(
struct coff_hdr) + (obj->hdr.f_opthdr ? sizeof(struct coff_opt_hdr) : 0);
183 size = obj->
hdr.f_nscns *
sizeof(
struct coff_scn_hdr);
202 if (obj->
hdr.f_nsyms >= 0xffff || !obj->
hdr.f_nsyms) {
205 size = obj->
hdr.f_nsyms *
sizeof(
struct coff_symbol);
231 for (
i = 0;
i < obj->
hdr.f_nscns;
i++) {
243 obj->
sym_ht = ht_up_new0();
244 obj->
imp_ht = ht_up_new0();
RZ_API struct rz_bin_coff_obj * rz_bin_coff_new_buf(RzBuffer *buf, bool verbose)
static bool rz_bin_coff_init_scn_hdr(struct rz_bin_coff_obj *obj)
static bool rz_bin_coff_init_symtable(struct rz_bin_coff_obj *obj)
static int rz_bin_coff_init(struct rz_bin_coff_obj *obj, RzBuffer *buf, bool verbose)
static bool rz_bin_coff_init_hdr(struct rz_bin_coff_obj *obj)
RZ_API void rz_bin_coff_free(struct rz_bin_coff_obj *obj)
RZ_API ut64 rz_coff_perms_from_section_flags(ut32 flags)
RZ_API RzBinAddr * rz_coff_get_entry(struct rz_bin_coff_obj *obj)
static int rz_coff_rebase_sym(struct rz_bin_coff_obj *obj, RzBinAddr *addr, struct coff_symbol *sym)
RZ_API bool rz_coff_supported_arch(const ut8 *buf)
RZ_API char * rz_coff_symbol_name(struct rz_bin_coff_obj *obj, void *ptr)
static bool rz_bin_coff_init_opt_hdr(struct rz_bin_coff_obj *obj)
static bool rz_bin_coff_init_scn_va(struct rz_bin_coff_obj *obj)
#define COFF_IS_LITTLE_ENDIAN
#define COFF_IS_BIG_ENDIAN
#define COFF_FILE_MACHINE_SH3DSP
#define COFF_FILE_MACHINE_SH4
#define COFF_FILE_MACHINE_AMD29KBE
#define COFF_FILE_MACHINE_ARM64
#define COFF_FILE_MACHINE_AMD64
#define COFF_SCN_MEM_EXECUTE
#define COFF_FILE_MACHINE_ARM
#define COFF_FILE_TI_COFF
#define COFF_FILE_MACHINE_MIPSFPU
#define COFF_FILE_MACHINE_SH3
#define COFF_SCN_MEM_READ
#define COFF_FILE_MACHINE_MIPS16
#define COFF_FILE_MACHINE_MIPSFPU16
#define COFF_FILE_MACHINE_I386
#define COFF_FILE_MACHINE_SH5
#define COFF_FILE_MACHINE_AMD29KLE
#define COFF_FILE_MACHINE_THUMB
#define COFF_FILE_MACHINE_R4000
#define COFF_SCN_MEM_WRITE
#define COFF_FILE_MACHINE_H8300
#define COFF_FILE_MACHINE_ARMNT
RZ_API void Ht_() free(HtName_(Ht) *ht)
void * calloc(size_t number, size_t size)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define rz_buf_read_le16_at(b, addr, result)
RZ_API st64 rz_buf_fread(RZ_NONNULL RzBuffer *b, RZ_NONNULL ut8 *buf, RZ_NONNULL const char *fmt, int n)
...
RZ_API RzBuffer * rz_buf_ref(RzBuffer *b)
Increment the reference count of the buffer.
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
RZ_API st64 rz_buf_fread_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL ut8 *buf, RZ_NONNULL const char *fmt, int n)
...
RZ_API void rz_buf_free(RzBuffer *b)
Free all internal data hold by the buffer and the buffer.
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
static ut16 rz_read_le16(const void *src)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
static struct sockaddr static addrlen static backlog const void static flags void flags
RzBuffer * buf_patched
overlay over the original file with relocs patched
struct coff_symbol * symbols
struct coff_scn_hdr * scn_hdrs
HtUU * imp_index
locally-generated indices for imports, in particular for deterministically assigning reloc targets
struct coff_opt_hdr opt_hdr
if(dbg->bits==RZ_SYS_BITS_64)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()