This is a merge of three commits from my working tree:
commit 363f3194b2f0f229bdd8a2295319252acfb033f8
Author: Ed Maste <emaste@freebsd.org>
Date: Mon Apr 22 09:39:26 2019 -0400
ar: test for writing 64-bit format only if symbol count is nonzero
This is a minor simplification; if we do not have any symbols a 32-bit
(empty) symbol table is sufficient.
Sponsored by: The FreeBSD Foundationcommit 01214a87fa0b029b26d19bb018c43e2f6c480b9e
Author: Ed Maste <emaste@freebsd.org>
Date: Mon Apr 22 09:44:12 2019 -0400
ar: use array notation to access s_so
This is somewhat more readable than pointer arithmetic.
Sponsored by: The FreeBSD Foundationcommit 17c24416b6bd478c947918c8cc94f19255c651e2 (HEAD -> wipbsd.20190326)
Author: Ed Maste <emaste@freebsd.org>
Date: Mon Apr 22 09:53:12 2019 -0400
ar: shuffle symbol offsets during conversion for 32-bit ar archives
During processing we maintain symbol offsets in the 64-bit s_so array,
and when writing the archive convert to 32-bit if no offsets are greater
than 4GB. However, this was inefficient as we looped over the array
twice: first, converting to big endian and second, writing each 32-bit
value one at a time. Instead, when writing a 32-bit archive shuffle
convert symbol data to big endian and shuffle to the beginning of the
array at the same time.
Sponsored by: The FreeBSD Foundation