[PATCH] D135018: [compiler-rt] [test] Fix sem_init_glibc.cpp test for glibc 2.36 on i386

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 1 13:20:36 PDT 2022


mgorny created this revision.
mgorny added reviewers: eugenis, vitalybuka, rovka.
Herald added subscribers: Enna1, dberris.
Herald added a project: All.
mgorny requested review of this revision.

Update sem_init_glibc.cpp to apply the "newer" GET_SEM_VALUE(v) logic
to i386 if glibc is 2.36 or newer.  With this glibc version, the old
macro returns "84" instead of "42".


https://reviews.llvm.org/D135018

Files:
  compiler-rt/test/sanitizer_common/TestCases/Linux/sem_init_glibc.cpp


Index: compiler-rt/test/sanitizer_common/TestCases/Linux/sem_init_glibc.cpp
===================================================================
--- compiler-rt/test/sanitizer_common/TestCases/Linux/sem_init_glibc.cpp
+++ compiler-rt/test/sanitizer_common/TestCases/Linux/sem_init_glibc.cpp
@@ -30,7 +30,8 @@
 // Therefore, it is not enough to rely on the __GLIBC_PREREQ macro - we should
 // instead check the platform as well to make sure we only expect the new
 // behavior on platforms where the older symbols do not exist.
-#if defined(__arm__) && __GLIBC_PREREQ(2, 21)
+#if (defined(__arm__) && __GLIBC_PREREQ(2, 21)) ||                             \
+    (defined(__i386__) && __GLIBC_PREREQ(2, 36))
 #define GET_SEM_VALUE(V) ((V) >> 1)
 #else
 #define GET_SEM_VALUE(V) (V)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135018.464512.patch
Type: text/x-patch
Size: 780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221001/bba63f19/attachment.bin>


More information about the cfe-commits mailing list