bfd: parse Object Attributes v2's section in input object files
This patch adds to BFD the capability of parsing the Object Attributes v2
(OAv2) stored into the section defined by the backend (i.e. .ARM.attributes
for AArch64).
An OAv2 section is organized with the following syntactic structure:
<format-version: uint8>
[ <subsection-length: uint32>
<subsection-name: NTBS>
<optionality: uint8>
<encoding: uint8>
<attribute>*
]*
Once parsing is completed, OAv2 are stored in a list of subsections in
elf_obj_tdata.
Regarding ULEB128 parsing, the implementation of _bfd_safe_read_leb128
has known shortcomings. In particular, it may accept malformed ULEB128
values if the 8th bit is set while meeting the end condition "data < end".
The error handling could be improved, but this function is old and used
in more than 50 places. The same issue applies to _bfd_read_unsigned_leb128
and _bfd_read_signed_leb128, which likewise do not report errors in
this case. Since this is long-standing behavior and fixing it would
require broader changes outside the scope of this patch series, the
issue is acknowledged but not addressed here, and is considered
acceptable as this patch does not worsen the situation.