fix symbol search loop in debuglink mode
Some distribs like ubuntu'18 creatively name files with debug symbols.
(same name without .debug suffix) And give no build-id
way.
$ dpkg -L libc6-dbg | grep -v gconv
/usr/lib/debug/.build-id/68/f36706eb2e6eee4046c4fdca2a19540b2f6113.debug
/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.27.so
$ dpkg -L libc6
/lib/x86_64-linux-gnu/libc-2.27.so
/lib/x86_64-linux-gnu/libc.so.6
$ objdump -s -j .gnu_debuglink -j .note.gnu.build-id \
/lib/x86_64-linux-gnu/libc-2.27.so
Contents of section .gnu_debuglink:
0000 6c696263 2d322e32 372e736f 00000000 libc-2.27.so....
0010 5ac51387 Z...
Contents of section .note.gnu.build-id:
0270 04000000 14000000 03000000 474e5500 ............GNU.
0280 ce450eb0 1a5e5acc 7ce7b8c2 633b02cc .E...^Z.|...c;..
0290 1093339e ..3.
So elf_find_debugfile_by_debuglink(libc)
loops back to
/lib/x86_64-linux-gnu/libc-2.27.so
and can't lookup symbols for libc
and
another standard libs. This patch breaks this loop and allows to lookup
for symbols at other places.