The calling convention for _dl_get_tls_static_info symbol has changed on
32-bit systems since glibc 2.27. Make sure to support older and newer
32-bit glibc versions with the same runtime library.
Reuse the version check from InitTlsSize. Use gnu_get_libc_version
rather than confstr(_CS_GNU_LIBC_VERSION) because the latter is
intercepted by msan. This symbol existed since February 1998.
This patch does not try to address other issues with glibc 2.25.
Tested with 32/64-bit glibc 2.26/2.27 on Arch Linux.
Fixes https://github.com/google/sanitizers/issues/954
This is an alternative patch to D44623 by Jakub, addressing some review comments from there (reduce ifdef magic, coding style) and using a different approach for version detection. If desired, GetGlibVersion runtime could be guarded under a __GLIBC_PREREQ check, but there is potentially much more code that could be hidden that way so I did not do this.
Test: all check-sanitizers tests pass on Linux with glibc 2.27 except SanitizerCommon-asan-i386-Linux (unrelated) and SanitizerCommon-lsan-x86_64-Linux (not sure, probably also unrelated).
I'd split this into two patches: