diff options
author | midipix <writeonce@midipix.org> | 2024-01-28 07:06:50 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-01-28 07:25:29 +0000 |
commit | 29c5878fdd773245c8ec78f48053e5110362b445 (patch) | |
tree | dc649852953c4fe263674e6e878b1c56515d6346 /src/arbits | |
parent | 70b20fba28a8180f74c15fb78e78e8cbb365d13f (diff) | |
download | slibtool-29c5878fdd773245c8ec78f48053e5110362b445.tar.bz2 slibtool-29c5878fdd773245c8ec78f48053e5110362b445.tar.xz |
slbt_ar_parse_primary_armap_bsd_64(): symrefs vector: record member offsets.
Diffstat (limited to 'src/arbits')
-rw-r--r-- | src/arbits/slbt_archive_meta.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/arbits/slbt_archive_meta.c b/src/arbits/slbt_archive_meta.c index 622bf7d..f70ee43 100644 --- a/src/arbits/slbt_archive_meta.c +++ b/src/arbits/slbt_archive_meta.c @@ -381,6 +381,10 @@ static int slbt_ar_parse_primary_armap_bsd_64( struct ar_raw_armap_bsd_64 * armap; struct ar_meta_member_info * memberp; struct ar_meta_armap_common_64 *armapref; + struct ar_meta_armap_ref_64 * symrefs; + uint64_t idx; + uint64_t uref_hi; + uint64_t uref_lo; uint32_t attr; uint64_t u64_lo; uint64_t u64_hi; @@ -481,10 +485,30 @@ static int slbt_ar_parse_primary_armap_bsd_64( if (!(m->symstrv = calloc(nsyms + 1,sizeof(const char *)))) return SLBT_SYSTEM_ERROR(dctx,0); + if (!(m->armaps.armap_symrefs_64 = calloc(nsyms + 1,sizeof(*symrefs)))) + return SLBT_SYSTEM_ERROR(dctx,0); + + mark = armap->ar_first_name_offset; + symrefs = m->armaps.armap_symrefs_64; + + for (idx=0,uch=*++mark; idx<nsyms; idx++,uch=*++mark) { + if (attr == AR_ARMAP_ATTR_BE_64) { + uref_hi = (uch[0] << 24) + (uch[1] << 16) + (uch[2] << 8) + uch[3]; + uref_lo = (uch[4] << 24) + (uch[5] << 16) + (uch[6] << 8) + uch[7]; + } else { + uref_lo = (uch[3] << 24) + (uch[2] << 16) + (uch[1] << 8) + uch[0]; + uref_hi = (uch[7] << 24) + (uch[6] << 16) + (uch[5] << 8) + uch[4]; + } + + symrefs[idx].ar_member_offset = (uref_hi << 32) + uref_lo; + mark++; + } + armap->ar_string_table = m->symstrv; armapref = &m->armaps.armap_common_64; armapref->ar_member = memberp; + armapref->ar_symrefs = symrefs; armapref->ar_armap_bsd = armap; armapref->ar_armap_attr = AR_ARMAP_ATTR_BSD | attr; armapref->ar_num_of_symbols = nsyms; |