Fix symbol versions with shared libs
commitfdeeb62e28f7b79fd2222d14da454aab72af2f00
authorMichael Matz <matz@suse.de>
Mon, 20 Jan 2020 04:31:09 +0000 (20 05:31 +0100)
committerMichael Matz <matz@suse.de>
Mon, 20 Jan 2020 04:31:09 +0000 (20 05:31 +0100)
tree2b61ef6865bd6e6b9d13383716d94701737ae618
parentd79e1dee8cfc9ddc68810be5af0d68670362094a
Fix symbol versions with shared libs

ELF files that refer to shared libs containing sym-versions, but
don't refer to any dynamic symbols with symbol versions (should happen
only with very simple shared libs) would generate an empty .gnu.version_r
section.  Some dynamic linker contain bugs in that they don't check
the section size or DT_VERNEEDNUM (which are both zero for such files
we generate) before accessing the first entry, and then bail out with
a message like

./a.exe: error while loading shared libraries: ./a1.so: unsupported
 version 25960 of Verneed record

(where the "version number" actually comes from neighboring bytes
from different sections).

So, there's not much choice, we simply must not generate such section.
tccelf.c