Skip to content

Commit e5bc842

Browse files
authored
[NFC][sanitizer] Remove #elif to simplify ThreadDescriptorSizeFallback (#108911)
1 parent da46244 commit e5bc842

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,19 +281,27 @@ static uptr ThreadDescriptorSizeFallback() {
281281
return FIRST_32_SECOND_64(1344, 2496);
282282
}
283283
return 0;
284-
# elif defined(__s390__) || defined(__sparc__)
284+
# endif
285+
286+
# if defined(__s390__) || defined(__sparc__)
285287
// The size of a prefix of TCB including pthread::{specific_1stblock,specific}
286288
// suffices. Just return offsetof(struct pthread, specific_used), which hasn't
287289
// changed since 2007-05. Technically this applies to i386/x86_64 as well but
288290
// we call _dl_get_tls_static_info and need the precise size of struct
289291
// pthread.
290292
return FIRST_32_SECOND_64(524, 1552);
291-
# elif defined(__mips__)
293+
# endif
294+
295+
# if defined(__mips__)
292296
// TODO(sagarthakur): add more values as per different glibc versions.
293297
return FIRST_32_SECOND_64(1152, 1776);
294-
# elif SANITIZER_LOONGARCH64
298+
# endif
299+
300+
# if SANITIZER_LOONGARCH64
295301
return 1856; // from glibc 2.36
296-
# elif SANITIZER_RISCV64
302+
# endif
303+
304+
# if SANITIZER_RISCV64
297305
int major;
298306
int minor;
299307
int patch;
@@ -307,10 +315,14 @@ static uptr ThreadDescriptorSizeFallback() {
307315
return 1936; // tested against glibc 2.32
308316
}
309317
return 0;
310-
# elif defined(__aarch64__)
318+
# endif
319+
320+
# if defined(__aarch64__)
311321
// The sizeof (struct pthread) is the same from GLIBC 2.17 to 2.22.
312322
return 1776;
313-
# elif defined(__powerpc64__)
323+
# endif
324+
325+
# if defined(__powerpc64__)
314326
return 1776; // from glibc.ppc64le 2.20-8.fc21
315327
# endif
316328
}

0 commit comments

Comments
 (0)