diff options
Diffstat (limited to 'src/object')
-rw-r--r-- | src/object/mdso_objgen_dsometa.c | 6 | ||||
-rw-r--r-- | src/object/mdso_objgen_symentry.c | 10 | ||||
-rw-r--r-- | src/object/mdso_objgen_symfn.c | 10 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/object/mdso_objgen_dsometa.c b/src/object/mdso_objgen_dsometa.c index 61df843..dfe8a33 100644 --- a/src/object/mdso_objgen_dsometa.c +++ b/src/object/mdso_objgen_dsometa.c @@ -70,6 +70,8 @@ int mdso_objgen_dsometa( if (vobj && !vobj->addr) { vobj->size = objlen; + vobj->mapstrsnum = 1; + vobj->mapstrslen = 10 + liblen; return 0; } @@ -217,6 +219,10 @@ int mdso_objgen_dsometa( memcpy(&mark[0],".dsometa_",9); memcpy(&mark[9],dctx->cctx->libname,liblen); + /* archive symbol map */ + if (vobj && vobj->mapstrs) + memcpy(vobj->mapstrs,mark,9+liblen); + /* .libname */ mark = dsometa->hdr.cfh_machine; memcpy(&mark[stroff],dctx->cctx->libname,liblen); diff --git a/src/object/mdso_objgen_symentry.c b/src/object/mdso_objgen_symentry.c index 3a3503f..47167c7 100644 --- a/src/object/mdso_objgen_symentry.c +++ b/src/object/mdso_objgen_symentry.c @@ -38,6 +38,7 @@ int mdso_objgen_symentry( struct mdso_symentry_object * syment; struct pe_raw_coff_symbol * symrec; unsigned char * mark; + unsigned char * mapsym; struct pe_raw_aux_rec_section * aux; size_t buflen; size_t liblen; @@ -57,6 +58,7 @@ int mdso_objgen_symentry( uint32_t cstoff; uint32_t datoff; uint32_t stroff; + uint32_t uscore; if ((buflen = strlen(sym)) > 1024*1024) return MDSO_CUSTOM_ERROR(dctx,MDSO_ERR_INVALID_DATA); @@ -67,12 +69,15 @@ int mdso_objgen_symentry( symlen = (uint32_t)buflen; cstlen = (uint32_t)liblen + (3 * symlen) + 64; objlen = sizeof(*syment) + 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 = 7 + uscore + symlen; return 0; } @@ -210,6 +215,7 @@ int mdso_objgen_symentry( symrec += 1; /* coff symbol: __imp_sym */ + mapsym = mark; symrec[0].cs_storage_class[0] = PE_IMAGE_SYM_CLASS_EXTERNAL; symrec[0].cs_num_of_aux_symbols[0] = 0; @@ -231,6 +237,10 @@ int mdso_objgen_symentry( mark += 7 + symlen; symrec += 1; + /* archive symbol map */ + if (vobj && vobj->mapstrs) + memcpy(vobj->mapstrs,mapsym,mark-mapsym); + /* coff symbol: .dsometa_libname */ symrec[0].cs_storage_class[0] = PE_IMAGE_SYM_CLASS_EXTERNAL; symrec[0].cs_num_of_aux_symbols[0] = 0; 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; |