diff options
author | midipix <writeonce@midipix.org> | 2017-02-11 21:29:09 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-02-11 21:44:19 -0500 |
commit | 68360c8b966ffd92989c3a26a2be8919e6b8a091 (patch) | |
tree | ad17188041c3a2076dc700c7645993ff0f8218a2 | |
parent | dc40b9d14adf423c5cfc8380be1567f97da23b05 (diff) | |
download | mdso-68360c8b966ffd92989c3a26a2be8919e6b8a091.tar.bz2 mdso-68360c8b966ffd92989c3a26a2be8919e6b8a091.tar.xz |
mdso_argen_common(): objlen: account for index:num_of_syms, simplify logic.
-rw-r--r-- | src/archive/mdso_argen_common.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/archive/mdso_argen_common.c b/src/archive/mdso_argen_common.c index 95282e3..fdd138c 100644 --- a/src/archive/mdso_argen_common.c +++ b/src/archive/mdso_argen_common.c @@ -86,11 +86,11 @@ int mdso_argen_common( else if (!(aobj = calloc(1,nobj*sizeof(*aobj)))) return MDSO_SYSTEM_ERROR(dctx); - /* archive signature, archive header */ + /* objlen: archive signature, index header */ objlen = 8; objlen += sizeof(struct pe_raw_archive_common_hdr); - /* archive meta */ + /* objlen: member headers */ ret = mdso_objgen_dsometa(dctx,0,aobj); aobj->size += 1; @@ -98,8 +98,6 @@ int mdso_argen_common( aobj->size ^= 1; objlen += aobj->size; - objlen += aobj->mapstrslen; - objlen += sizeof(uint32_t) * aobj->mapstrsnum; objlen += sizeof(struct pe_raw_archive_common_hdr); mapstrslen = aobj->mapstrslen; @@ -113,8 +111,6 @@ int mdso_argen_common( pobj->size ^= 1; objlen += pobj->size; - objlen += pobj->mapstrslen; - objlen += sizeof(uint32_t) * pobj->mapstrsnum; objlen += sizeof(struct pe_raw_archive_common_hdr); mapstrslen += pobj->mapstrslen; @@ -128,8 +124,6 @@ int mdso_argen_common( pobj->size ^= 1; objlen += pobj->size; - objlen += pobj->mapstrslen; - objlen += sizeof(uint32_t) * pobj->mapstrsnum; objlen += sizeof(struct pe_raw_archive_common_hdr); mapstrslen += pobj->mapstrslen; @@ -143,11 +137,15 @@ int mdso_argen_common( if (ret) return ret; - /* archive alignment */ + /* index: string block alignment */ mapstrslen += 1; mapstrslen |= 1; mapstrslen ^= 1; + /* objlen: index size, padding */ + objlen += sizeof(uint32_t) * (1 + mapstrsnum); + objlen += mapstrslen; + objlen += 15; objlen |= 15; objlen ^= 15; |