elf/tst-libc_dlvsym: Add a TEST_COMPAT around some symbol tests

Message ID 20200826153723.1649036-1-alistair.francis@wdc.com
State Committed
Headers
Series elf/tst-libc_dlvsym: Add a TEST_COMPAT around some symbol tests |

Commit Message

Alistair Francis Aug. 26, 2020, 3:37 p.m. UTC
  The _sys_errlist and _sys_siglist symbols are deprecated since 2.32.
This patch adds a TEST_COMPAT check around the tests. This fixes test
failures on new architecutres (such as RV32) that don't have this
symbol defined.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 elf/tst-libc_dlvsym.h | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Adhemerval Zanella Aug. 26, 2020, 4:19 p.m. UTC | #1
On 26/08/2020 12:37, Alistair Francis via Libc-alpha wrote:
> The _sys_errlist and _sys_siglist symbols are deprecated since 2.32.
> This patch adds a TEST_COMPAT check around the tests. This fixes test
> failures on new architecutres (such as RV32) that don't have this

s/architecutres/architectures

> symbol defined.
> 
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

We don't use DCO, but rather Copyright assignment.

LGTM with the comment adjustment below, thanks.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  elf/tst-libc_dlvsym.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/elf/tst-libc_dlvsym.h b/elf/tst-libc_dlvsym.h
> index 6b132dd7c3..4601e8869c 100644
> --- a/elf/tst-libc_dlvsym.h
> +++ b/elf/tst-libc_dlvsym.h
> @@ -117,8 +117,12 @@ compare_vsyms (void)
>       obtain an explicit handle for libc.so.  */
>    void *libc_handle = xdlopen (LIBC_SO, RTLD_LAZY | RTLD_NOLOAD);
>  
> +  /* sys_errlist and sys_siglist were deprecated in glibc 2.32 and aren't
> +     avaliable on newly linked binaries.  */

This comment does not really apply here, since it is not using the static link
to generate a new binary.  I think a better description would be:

  /* sys_errlist and sys_siglist were deprecated in glibc 2.32 and they are
     not available on architectures with base ABI newer than 2.32.  */

> +#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_32)
>    compare_vsyms_1 (libc_handle, "_sys_errlist");
>    compare_vsyms_1 (libc_handle, "_sys_siglist");
> +#endif
>    compare_vsyms_1 (libc_handle, "quick_exit");
>  
>    xdlclose (libc_handle);
>
  
Alistair Francis Aug. 26, 2020, 4:23 p.m. UTC | #2
On Wed, Aug 26, 2020 at 9:20 AM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
>
>
> On 26/08/2020 12:37, Alistair Francis via Libc-alpha wrote:
> > The _sys_errlist and _sys_siglist symbols are deprecated since 2.32.
> > This patch adds a TEST_COMPAT check around the tests. This fixes test
> > failures on new architecutres (such as RV32) that don't have this
>
> s/architecutres/architectures

Fixed.

>
> > symbol defined.
> >
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>
> We don't use DCO, but rather Copyright assignment.

Argh, I know that. Sorry it's just a hard habit to break.

>
> LGTM with the comment adjustment below, thanks.
>
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> > ---
> >  elf/tst-libc_dlvsym.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/elf/tst-libc_dlvsym.h b/elf/tst-libc_dlvsym.h
> > index 6b132dd7c3..4601e8869c 100644
> > --- a/elf/tst-libc_dlvsym.h
> > +++ b/elf/tst-libc_dlvsym.h
> > @@ -117,8 +117,12 @@ compare_vsyms (void)
> >       obtain an explicit handle for libc.so.  */
> >    void *libc_handle = xdlopen (LIBC_SO, RTLD_LAZY | RTLD_NOLOAD);
> >
> > +  /* sys_errlist and sys_siglist were deprecated in glibc 2.32 and aren't
> > +     avaliable on newly linked binaries.  */
>
> This comment does not really apply here, since it is not using the static link
> to generate a new binary.  I think a better description would be:
>
>   /* sys_errlist and sys_siglist were deprecated in glibc 2.32 and they are
>      not available on architectures with base ABI newer than 2.32.  */

Fixed.

Alistair

>
> > +#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_32)
> >    compare_vsyms_1 (libc_handle, "_sys_errlist");
> >    compare_vsyms_1 (libc_handle, "_sys_siglist");
> > +#endif
> >    compare_vsyms_1 (libc_handle, "quick_exit");
> >
> >    xdlclose (libc_handle);
> >
  

Patch

diff --git a/elf/tst-libc_dlvsym.h b/elf/tst-libc_dlvsym.h
index 6b132dd7c3..4601e8869c 100644
--- a/elf/tst-libc_dlvsym.h
+++ b/elf/tst-libc_dlvsym.h
@@ -117,8 +117,12 @@  compare_vsyms (void)
      obtain an explicit handle for libc.so.  */
   void *libc_handle = xdlopen (LIBC_SO, RTLD_LAZY | RTLD_NOLOAD);
 
+  /* sys_errlist and sys_siglist were deprecated in glibc 2.32 and aren't
+     avaliable on newly linked binaries.  */
+#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_32)
   compare_vsyms_1 (libc_handle, "_sys_errlist");
   compare_vsyms_1 (libc_handle, "_sys_siglist");
+#endif
   compare_vsyms_1 (libc_handle, "quick_exit");
 
   xdlclose (libc_handle);