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)


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)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to