diff options
author | midipix <writeonce@midipix.org> | 2024-01-28 05:45:03 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-01-28 07:25:29 +0000 |
commit | 74eea3080ec9236119808ac698ce179b4714f4f2 (patch) | |
tree | 9c4405dda40676a9e92c190b0b0ebdeec6e37462 | |
parent | 7fe83d363d5fd2d27b5c44b95c3a50c493ce7876 (diff) | |
download | slibtool-74eea3080ec9236119808ac698ce179b4714f4f2.tar.bz2 slibtool-74eea3080ec9236119808ac698ce179b4714f4f2.tar.xz |
slbt_ar_parse_primary_armap_sysv_32(): symrefs vector: record member offsets.
-rw-r--r-- | src/arbits/slbt_archive_meta.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/arbits/slbt_archive_meta.c b/src/arbits/slbt_archive_meta.c index 9f6595c..8482858 100644 --- a/src/arbits/slbt_archive_meta.c +++ b/src/arbits/slbt_archive_meta.c @@ -487,6 +487,9 @@ static int slbt_ar_parse_primary_armap_sysv_32( struct ar_raw_armap_sysv_32 * armap; struct ar_meta_member_info * memberp; struct ar_meta_armap_common_32 *armapref; + struct ar_meta_armap_ref_32 * symrefs; + uint32_t idx; + uint32_t uref; uint32_t nsyms; uint32_t nstrs; const char * ch; @@ -550,10 +553,22 @@ static int slbt_ar_parse_primary_armap_sysv_32( if (!(m->symstrv = calloc(nsyms + 1,sizeof(const char *)))) return SLBT_SYSTEM_ERROR(dctx,0); + if (!(m->armaps.armap_symrefs_32 = calloc(nsyms + 1,sizeof(*symrefs)))) + return SLBT_SYSTEM_ERROR(dctx,0); + + mark = armap->ar_first_ref_offset; + symrefs = m->armaps.armap_symrefs_32; + + for (idx=0,uch=*mark; idx<nsyms; idx++,uch=*++mark) { + uref = (uch[0] << 24) + (uch[1] << 16) + (uch[2] << 8) + uch[3]; + symrefs[idx].ar_member_offset = uref; + } + armap->ar_string_table = m->symstrv; armapref = &m->armaps.armap_common_32; armapref->ar_member = memberp; + armapref->ar_symrefs = symrefs; armapref->ar_armap_sysv = armap; armapref->ar_armap_attr = AR_ARMAP_ATTR_SYSV | AR_ARMAP_ATTR_BE_32; armapref->ar_num_of_symbols = nsyms; |