This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Obsolete matherr, _LIB_VERSION, libieee.a


On Thu, 2017-08-24 at 12:32 +0000, Joseph Myers wrote:
> 
> > Earlier discussion about tst-mallocstate:
> > https://sourceware.org/ml/libc-alpha/2016-12/msg00527.html
> I think Florian's suggestion from that discussion is a good idea: generate 
> a makefile equivalent of abi-versions.h, so that you can write 
> conditionals in makefiles that are equivalent to SHLIB_COMPAT conditions 
> in C code.

It is not clear to me that I need a separate abi-versions.h file, the
tests are already including shlib-compat.h and that includes the
existing abi-versions.h.  Here is a patch that I have created and
tested, if the approach seems reasonable I can submit it in a seperate
thread with a ChangeLog file.  Basically, I created a TEST_COMPAT macro
that is almost identical to SHLIB_COMPAT and then I used that to ifdef
the test.  I put the macro in shlib-compat.h, maybe it should be in a
different or new header file but I liked having it there so that it was
near SHLIB_COMPAT which it is based on.  Testing on aarch64 looked good
for both ILP32 and LP64 with ILP32 doing the dummy do_test and LP64
running the original do_test.

Steve Ellcey
sellcey@cavium.com

diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index 41eb362..d872afc 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -97,4 +97,14 @@
   compat_symbol (libc, name, aliasname, version);
 # endif
 
+/* The TEST_COMPAT macro acts just like the SHLIB_COMPAT macro except
+   that it does not check IS_IN.  It is used by tests that are testing
+   functionality that is only available in specific GLIBC versions.  */
+
+# define TEST_COMPAT(lib, introduced, obsoleted)			      \
+  _TEST_COMPAT (lib, introduced, obsoleted)
+# define _TEST_COMPAT(lib, introduced, obsoleted)			      \
+   (!(ABI_##lib##_##obsoleted - 0)					      \
+       || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
+
 #endif	/* shlib-compat.h */
diff --git a/math/test-matherr-2.c b/math/test-matherr-2.c
index c2fc5e6..667e9be 100644
--- a/math/test-matherr-2.c
+++ b/math/test-matherr-2.c
@@ -22,8 +22,11 @@
 
 #include <math-svid-compat.h>
 #include <shlib-compat.h>
-#undef matherr
-#undef _LIB_VERSION
+
+#if TEST_COMPAT (libm, GLIBC_2_0, GLIBC_2_27)
+
+# undef matherr
+# undef _LIB_VERSION
 compat_symbol_reference (libm, matherr, matherr, GLIBC_2_0);
 compat_symbol_reference (libm, _LIB_VERSION, _LIB_VERSION, GLIBC_2_0);
 
@@ -45,5 +48,12 @@ do_test (void)
   acos (2.0);
   return fail;
 }
+#else
+static int
+do_test (void)
+{
+  return 0;
+}
+#endif
 
 #include <support/test-driver.c>
diff --git a/math/test-matherr.c b/math/test-matherr.c
index 34856f1..927433c 100644
--- a/math/test-matherr.c
+++ b/math/test-matherr.c
@@ -22,8 +22,11 @@
 
 #include <math-svid-compat.h>
 #include <shlib-compat.h>
-#undef matherr
-#undef _LIB_VERSION
+
+#if TEST_COMPAT (libm, GLIBC_2_0, GLIBC_2_27)
+
+# undef matherr
+# undef _LIB_VERSION
 compat_symbol_reference (libm, matherr, matherr, GLIBC_2_0);
 compat_symbol_reference (libm, _LIB_VERSION, _LIB_VERSION, GLIBC_2_0);
 
@@ -44,5 +47,12 @@ do_test (void)
   acos (2.0);
   return fail;
 }
+#else
+static int
+do_test (void)
+{
+  return 0;
+}
+#endif
 
 #include <support/test-driver.c>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]