]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ar: shuffle symbol offsets during conversion for 32-bit ar archives
authoremaste <emaste@FreeBSD.org>
Mon, 22 Apr 2019 19:55:47 +0000 (19:55 +0000)
committeremaste <emaste@FreeBSD.org>
Mon, 22 Apr 2019 19:55:47 +0000 (19:55 +0000)
commitffca4becd77c4b0957860407672a674c4493d931
tree45a5d893b3ce8cd08da6d4e39c9c70e2d8345485
parent8019d4dcb572e6c8ffcfa851e8cde0f7d6664a1b
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 somewhat inefficient as we looped over the
array twice: first, converting to big endian and second, writing each
32-bit value one at a time (and incorrectly so on big-endian platforms).

Instead, when writing a 32-bit archive shuffle convert symbol data to
big endian (as required by the ar format) and shuffle to the beginning
of the allocation at the same time.

Also correct emission of the symbol count on big endian platforms.

Further changes are planned, but this should fix powerpc64.

Reported by: jhibbits, mlinimon
Reviewed by: jhibbits, Gerald Aryeetey (earlier)
Tested by: jhibbits
MFC after: 10 days
MFC with: r346079
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20007
usr.bin/ar/write.c