[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 Mar 21 13:04:30 PDT 2018


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:177
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
----------------
jakubjelinek wrote:
> vitalybuka wrote:
> > Do we need to check for this?
> > Maybe just always go for dlvsym(RTLD_NEXT, "glob", "GLIBC_2.27") ?
> It is not strictly needed, just an optimization.  At least in GCC, if somebody configures the compiler against some version of binutils, glibc etc., we assume that at runtime that version or newer of it is available, so it is an optimization; if somebody configures against glibc 2.27+, it avoids the dlvsym calls on startup of every sanitized app.
```
#if defined(__i386__) && (!defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 27))
#define CHECK_GET_TLS_STATIC_INFO_VERSION 1
#else
#define CHECK_GET_TLS_STATIC_INFO_VERSION 0
#endif

...

if (CHECK_GET_TLS_STATIC_INFO_VERSION && !dlvsym(RTLD_NEXT, "glob", "GLIBC_2.27")) {

```


Repository:
  rL LLVM

https://reviews.llvm.org/D44623





More information about the llvm-commits mailing list