@@ -110,15 +110,15 @@ SANITIZER_WEAK_ATTRIBUTE
110
110
const void *__sanitizer_get_allocated_begin (const void *p);
111
111
}
112
112
113
- static bool GetDTLSRange (uptr & tls_beg, uptr &tls_size ) {
113
+ static uptr GetDTLSRange (uptr tls_beg) {
114
114
const void *start = __sanitizer_get_allocated_begin ((void *)tls_beg);
115
115
if (!start)
116
- return false ;
117
- tls_beg = (uptr)start ;
118
- tls_size = __sanitizer_get_allocated_size (start);
116
+ return 0 ;
117
+ CHECK_EQ (start, ( void *)tls_beg) ;
118
+ uptr tls_size = __sanitizer_get_allocated_size (start);
119
119
VReport (2 , " __tls_get_addr: glibc DTLS suspected; tls={%p,0x%zx}\n " ,
120
120
(void *)tls_beg, tls_size);
121
- return true ;
121
+ return tls_size ;
122
122
}
123
123
124
124
DTLS::DTV *DTLS_on_tls_get_addr (void *arg_void, void *res,
@@ -142,10 +142,12 @@ DTLS::DTV *DTLS_on_tls_get_addr(void *arg_void, void *res,
142
142
// creation.
143
143
VReport (2 , " __tls_get_addr: static tls: %p\n " , (void *)tls_beg);
144
144
tls_size = 0 ;
145
- } else if (!GetDTLSRange (tls_beg, tls_size)) {
146
- VReport (2 , " __tls_get_addr: Can't guess glibc version\n " );
147
- // This may happen inside the DTOR of main thread, so just ignore it.
148
- tls_size = 0 ;
145
+ } else {
146
+ tls_size = GetDTLSRange (tls_beg);
147
+ if (tls_size) {
148
+ VReport (2 , " __tls_get_addr: Can't guess glibc version\n " );
149
+ // This may happen inside the DTOR of main thread, so just ignore it.
150
+ }
149
151
}
150
152
dtv->beg = tls_beg;
151
153
dtv->size = tls_size;
0 commit comments