This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: off by one in bfd/syms.c or bfd/elfcode.h?
>>>>> "hjl" == hjl <H> writes:
>> Note that we base it on the count plus 1, since we will null
>> terminate the vector allocated based on this size. However, the
>> ELF symbol table - always has a dummy entry as symbol #0, so it
>> ends up even.
hjl> Why (symcount - 1 + 1)?
That's the way it was and according to the comment above it's to make it
clear that we subtract 1 for the empty symbol #0 and then add one for
the terminating null pointer. Except there is no symbol #0 when symbol
table is empty, which caused the problem that started me on this path.