diff options
author | midipix <writeonce@midipix.org> | 2017-02-09 19:43:45 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-02-11 19:07:51 -0500 |
commit | 9c013b63fef168f49246fd69ab0c0ce024a20941 (patch) | |
tree | 13ca8a0aab41cb48d7b1e8ef6870e81609da04f5 /src/object/mdso_objgen_symfn.c | |
parent | 5d3a9331a3ced5aa0898839f651c9ec004c9f6f4 (diff) | |
download | mdso-9c013b63fef168f49246fd69ab0c0ce024a20941.tar.bz2 mdso-9c013b63fef168f49246fd69ab0c0ce024a20941.tar.xz |
archive generation: added mdso_argen_common().
Diffstat (limited to 'src/object/mdso_objgen_symfn.c')
-rw-r--r-- | src/object/mdso_objgen_symfn.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/object/mdso_objgen_symfn.c b/src/object/mdso_objgen_symfn.c index 3bdd98f..47f9280 100644 --- a/src/object/mdso_objgen_symfn.c +++ b/src/object/mdso_objgen_symfn.c @@ -53,6 +53,7 @@ int mdso_objgen_symfn( struct pe_raw_coff_symbol * symrec; const unsigned char * code; unsigned char * mark; + unsigned char * mapsym; struct pe_raw_aux_rec_section * aux; size_t buflen; uint32_t symlen; @@ -69,6 +70,7 @@ int mdso_objgen_symfn( uint32_t cstoff; uint32_t codoff; uint32_t datoff; + uint32_t uscore; if ((buflen = strlen(sym)) > 1024*1024) return MDSO_CUSTOM_ERROR(dctx,MDSO_ERR_INVALID_DATA); @@ -76,12 +78,15 @@ int mdso_objgen_symfn( symlen = (uint32_t)buflen; cstlen = (3 * symlen) + 32; objlen = sizeof(*symfn) + cstlen; + uscore = !(dctx->cctx->drvflags & MDSO_DRIVER_QUAD_PTR); if (vobj && vobj->addr && (vobj->size < objlen)) return MDSO_BUFFER_ERROR(dctx); if (vobj && !vobj->addr) { vobj->size = objlen; + vobj->mapstrsnum = 1; + vobj->mapstrslen = 1 + uscore + symlen; return 0; } @@ -179,6 +184,7 @@ int mdso_objgen_symfn( symrec += 2; /* coff symbol: sym */ + mapsym = mark; symrec[0].cs_storage_class[0] = PE_IMAGE_SYM_CLASS_EXTERNAL; symrec[0].cs_num_of_aux_symbols[0] = 1; @@ -199,6 +205,10 @@ int mdso_objgen_symfn( mark += 1 + symlen; symrec += 2; + /* archive symbol map */ + if (vobj && vobj->mapstrs) + memcpy(vobj->mapstrs,mapsym,mark-mapsym); + /* coff symbol: __imp_sym */ symrec[0].cs_storage_class[0] = PE_IMAGE_SYM_CLASS_EXTERNAL; symrec[0].cs_num_of_aux_symbols[0] = 0; |