[lldb/ELF] Fix IDs of synthetic eh_frame symbols
authorPavel Labath <pavel@labath.sk>
Sat, 17 Apr 2021 16:31:17 +0000 (18:31 +0200)
committerPavel Labath <pavel@labath.sk>
Wed, 21 Apr 2021 09:24:43 +0000 (11:24 +0200)
commitcd64273f5ed39ec697ff1e20a1fe25ebd3502629
treef2fbacc91d111691fb15a8c04f45412bbd8ce603
parent85740ee108f18e49c1ec64820c721bc76e16d8c9
[lldb/ELF] Fix IDs of synthetic eh_frame symbols

The code used the total number of symbols to create a symbol ID for the
synthetic symbols. This is not correct because the IDs of real symbols
can be higher than their total number, as we do not add all symbols (and
in particular, we never add symbol zero, which is not a real symbol).

This meant we could have symbols with duplicate IDs, which caused
problems if some relocations were referring to the duplicated IDs. This
was the cause of the failure of the test D97786.

This patch fixes the code to use the ID of the highest (last) symbol
instead.
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml [new file with mode: 0644]