public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Steve Ellcey <sellcey@cavium.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: libc-alpha@sourceware.org, Szabolcs Nagy <szabolcs.nagy@arm.com>,
	nd <nd@arm.com>
Subject: Re: Obsolete matherr, _LIB_VERSION, libieee.a
Date: Thu, 24 Aug 2017 17:20:00 -0000	[thread overview]
Message-ID: <1503595246.28672.90.camel@cavium.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1708241230090.1920@digraph.polyomino.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

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


[-- Attachment #2: glibc-test.patch --]
[-- Type: text/x-patch, Size: 2068 bytes --]

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>

  reply	other threads:[~2017-08-24 17:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-17 21:30 Joseph Myers
2017-08-21 20:16 ` Adhemerval Zanella
2017-08-21 21:45   ` Joseph Myers
2017-08-21 20:32 ` Gabriel F. T. Gomes
2017-08-21 21:17   ` Joseph Myers
2017-08-23 20:21 ` Steve Ellcey
2017-08-24  9:27   ` Szabolcs Nagy
2017-08-24 12:32   ` Joseph Myers
2017-08-24 17:20     ` Steve Ellcey [this message]
2017-08-24 17:25       ` Joseph Myers
2017-08-24 17:44         ` Steve Ellcey
2017-08-24 18:08           ` Joseph Myers
2017-08-24 18:55       ` Florian Weimer
2017-08-24 21:06         ` Steve Ellcey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503595246.28672.90.camel@cavium.com \
    --to=sellcey@cavium.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).