[PATCH] D44623: Fix asan on i?86-linux (32-bit) against glibc 2.27 and later

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 9 12:34:29 PDT 2018


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:174
+
+#if CHECK_GET_TLS_STATIC_INFO_VERSION
 # define DL_INTERNAL_FUNCTION __attribute__((regparm(3), stdcall))
----------------
jakubjelinek wrote:
> vitalybuka wrote:
> > Do we need this if we do runtime check anyway?
> > We can't get into GetTlsStaticInfoRegparmCall with CHECK_GET_TLS_STATIC_INFO_VERSION == 0
> If you mean the __GLIBC_PREREQ, that is an optimization to avoid doing the runtime check if we know the check is unnecessary.
> If the CallGetTls<GetTlsStaticInfoCall>(get_tls_static_info_ptr, ...); call is not ifdefed out through preprocessor, then yes, it is needed.
> 
This initialization once per process not thread, so I don't see reasons to complicate code for such minor improvement.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:238
   uptr len = confstr(_CS_GNU_LIBC_VERSION, buf, sizeof(buf));
   if (len < sizeof(buf) && internal_strncmp(buf, "glibc 2.", 8) == 0) {
     char *end;
----------------
jakubjelinek wrote:
> vitalybuka wrote:
> > Is this the same as __GLIBC_PREREQ()
> confstr is a runtime check, __GLIBC_PREREQ is a compile time check.
Right,
than this is should be similar to dlvsym(RTLD_NEXT, "glob", "GLIBC_2.27"))?


Repository:
  rL LLVM

https://reviews.llvm.org/D44623





More information about the llvm-commits mailing list