Static archives (.a) generated by GNU toolchains use newline (\n) as separator in the "long names" header, instead of \000 (used in MS' toolchain). This header is used whenever object names take more than 16 bytes. The absence of \000's triggered a quadratic behaviour when reading object names.
To fix this, we postprocess the "long name" string table to replace \n (and/or the optional trailing /) by \000. Similar logic is present in binutils:
Static archives (
.a
) generated by GNU toolchains use newline (\n
) as separator in the "long names" header, instead of\000
(used in MS' toolchain). This header is used whenever object names take more than 16 bytes. The absence of\000
's triggered a quadratic behaviour when reading object names.To fix this, we postprocess the "long name" string table to replace
\n
(and/or the optional trailing/
) by\000
. Similar logic is present inbinutils
:https://github.com/bminor/binutils-gdb/blob/672008e6dcacddd76a5551aec9a30cd31c102d72/bfd/archive.c#L1323-L1324
(
ARFMAG[1]
is\n
above.)Fixes #101