In the initial Solaris ASan port, GetTls was left unimplemented. This patch corrects that. There are a couple of caveats, unfortunately:
While current Solaris 11.4 supports the dlpi_tls_modid field of struct dl_phdr_info, this was only added in SRU 10 and isn't present in either Solaris 11.3 or Illumos. Instead, this uses a method used in GCC's D runtime library libphobos dlpi_tls_modid workaround which works even on Solaris 10.
However, the direct call to __tls_get_address triggers a Solaris ld bug on amd64, which needs to be worked around the same way as in libphobos: ld workaround.
Together, they allow the sanitizer_common TLS tests to PASS on both sparc and x86.
I've also verified that the patch doesn't break the Illumos build; however compiler-rt test results continue to be horrible there.
Can the configure-time variable LINKER_SUPPORTS_Z_RELAX_TRANSTLS be replaced by a version check on the triple suffix?
You can see some tests where x86_64-unknown-freebsd11 or x86_64-unknown-freebsd12 is used. The idea is that the driver continuously bumps the default version.