]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC ar: implement support for /SYM64/ 64-bit archives
authoremaste <emaste@FreeBSD.org>
Mon, 29 Apr 2019 18:37:39 +0000 (18:37 +0000)
committeremaste <emaste@FreeBSD.org>
Mon, 29 Apr 2019 18:37:39 +0000 (18:37 +0000)
commit4c616367b89d4a0708f2a776f10d6a8ba66c7a23
tree17867d88b706494f6ac7248f12171a3c2bf78551
parentffe34adc3f7819208a051c808d24d3655174d5b5
MFC ar: implement support for /SYM64/ 64-bit archives

r346079: ar: implement support for /SYM64/ 64-bit archives

Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: imp (earlier)

r346568: 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 the empty
symbol table can be in 32-bit format.

r346569: ar: use array notation to access s_so

This is somewhat more readable than pointer arithmetic.  Also remove an
unnecessary cast while here.

r346582: 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

PR: 234454
Sponsored by: The FreeBSD Foundation
usr.bin/ar/ar.h
usr.bin/ar/read.c
usr.bin/ar/write.c