summaryrefslogtreecommitdiffhomepage
path: root/src/arbits/slbt_armap_bsd_64.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-06 20:43:10 +0000
committermidipix <writeonce@midipix.org>2024-02-07 03:50:47 +0000
commit4223c83c4bb6ea3aeee68f1810ca86a8fb785f86 (patch)
treedcc2c7bcd01a840d6ba75bd3c63f842e2f4c4d58 /src/arbits/slbt_armap_bsd_64.c
parent8a77f66005f77d9f8173c1e646ff521517d9c452 (diff)
downloadslibtool-4223c83c4bb6ea3aeee68f1810ca86a8fb785f86.tar.bz2
slibtool-4223c83c4bb6ea3aeee68f1810ca86a8fb785f86.tar.xz
slbt_get_archive_meta(): bsd symrefs vector: fix ar_name_offset logic.
Diffstat (limited to 'src/arbits/slbt_armap_bsd_64.c')
-rw-r--r--src/arbits/slbt_armap_bsd_64.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/arbits/slbt_armap_bsd_64.c b/src/arbits/slbt_armap_bsd_64.c
index b7b7d6d..6dcc737 100644
--- a/src/arbits/slbt_armap_bsd_64.c
+++ b/src/arbits/slbt_armap_bsd_64.c
@@ -127,7 +127,21 @@ int slbt_ar_parse_primary_armap_bsd_64(
mark = armap->ar_first_name_offset;
symrefs = m->armaps.armap_symrefs_64;
- for (idx=0,uch=*++mark; idx<nsyms; idx++,uch=*++mark) {
+ for (idx=0; 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_name_offset = (uref_hi << 32) + uref_lo;
+
+ 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];
@@ -137,7 +151,6 @@ int slbt_ar_parse_primary_armap_bsd_64(
}
symrefs[idx].ar_member_offset = (uref_hi << 32) + uref_lo;
- mark++;
}
armap->ar_string_table = m->symstrv;