From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH v2 15/16] dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2
Date: Wed, 2 Jun 2021 15:09:55 -0300 [thread overview]
Message-ID: <1d006256-eb79-0841-d078-0f3cf80af654@linaro.org> (raw)
In-Reply-To: <66fdbeb88347a0f07f1185e3294bbc78ded0d370.1622469909.git.fweimer@redhat.com>
On 31/05/2021 11:12, Florian Weimer via Libc-alpha wrote:
> The test appears to use _dlfcn_hook@@GLIBC_PRIVATE as a way to
> test dlvsym without having to know the appropriate symbol version.
> With <first-versions.h>, we can use a public symbol and the symbol
> version at which it was defined first.
Right, I think by including the <first-versions.h> there is no need
to make it an internal test.
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> dlfcn/modstatic2.c | 10 +++++++++-
> dlfcn/tststatic2.c | 10 +++++++++-
> 2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/dlfcn/modstatic2.c b/dlfcn/modstatic2.c
> index 9b5aae8b9f..02d561a7b0 100644
> --- a/dlfcn/modstatic2.c
> +++ b/dlfcn/modstatic2.c
> @@ -4,6 +4,7 @@
> #include <stdlib.h>
> #include <string.h>
> #include <gnu/lib-names.h>
> +#include <first-versions.h>
>
> int test (FILE *out, int a);
>
> @@ -117,11 +118,18 @@ test (FILE *out, int a)
> exit (1);
> }
>
> - if (dlvsym (handle2, "_dlfcn_hook", "GLIBC_PRIVATE") == NULL)
> + /* _exit is very unlikely to receive a second symbol version. */
> + void *exit_ptr = dlvsym (handle2, "_exit", FIRST_VERSION_libc__exit_STRING);
> + if (exit_ptr == NULL)
> {
> fprintf (out, "dlvsym: %s\n", dlerror ());
> exit (1);
> }
> + if (exit_ptr != dlsym (handle2, "_exit"))
> + {
> + fprintf (out, "dlvsym for _exit does not match dlsym\n");
> + exit (1);
> + }
>
> void *(*dlsymfn) (void *, const char *);
> dlsymfn = dlsym (handle2, "dlsym");
Ok.
> diff --git a/dlfcn/tststatic2.c b/dlfcn/tststatic2.c
> index f8cd5a964b..5d8a7831b2 100644
> --- a/dlfcn/tststatic2.c
> +++ b/dlfcn/tststatic2.c
> @@ -4,6 +4,7 @@
> #include <stdlib.h>
> #include <string.h>
> #include <gnu/lib-names.h>
> +#include <first-versions.h>
>
> static int
> do_test (void)
> @@ -115,11 +116,18 @@ do_test (void)
> exit (1);
> }
>
> - if (dlvsym (handle2, "_dlfcn_hook", "GLIBC_PRIVATE") == NULL)
> + /* _exit is very unlikely to receive a second symbol version. */
> + void *exit_ptr = dlvsym (handle2, "_exit", FIRST_VERSION_libc__exit_STRING);
> + if (exit_ptr == NULL)
> {
> printf ("dlvsym: %s\n", dlerror ());
> exit (1);
> }
> + if (exit_ptr != dlsym (handle2, "_exit"))
> + {
> + printf ("dlvsym for _exit does not match dlsym\n");
> + exit (1);
> + }
>
> void *(*dlsymfn) (void *, const char *);
> dlsymfn = dlsym (handle2, "dlsym");
>
Ok.
next prev parent reply other threads:[~2021-06-02 18:09 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 14:10 [PATCH v3 00/16] Move libdl into libc Florian Weimer
2021-05-31 14:11 ` [PATCH v2 01/16] stdio-common: Remove _IO_vfwscanf Florian Weimer
2021-05-31 19:42 ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 02/16] Add missing symbols to Version files Florian Weimer
2021-06-01 19:12 ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 03/16] scripts/versions.awk: Add local: * to all version nodes Florian Weimer
2021-06-01 19:23 ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH v2 04/16] Add libc ABI extension kludge for baseline-violating libdl symbols Florian Weimer
2021-06-01 19:31 ` Adhemerval Zanella
2021-06-01 19:34 ` Florian Weimer
2021-06-01 19:38 ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 05/16] dlfcn: Move dlerror into libc Florian Weimer
2021-06-01 19:36 ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 06/16] dlfcn: Move dlclose " Florian Weimer
2021-06-02 12:58 ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 07/16] dlfcn: Move dladdr " Florian Weimer
2021-06-02 14:02 ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 08/16] dlfcn: Move dlsym " Florian Weimer
2021-06-02 14:12 ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 09/16] dlfcn: Move dlmopen " Florian Weimer
2021-06-02 14:19 ` Adhemerval Zanella
2021-06-02 14:37 ` Florian Weimer
2021-06-02 14:43 ` Adhemerval Zanella
2021-06-02 17:49 ` Florian Weimer
2021-06-02 18:00 ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 10/16] dlfcn: Move dladdr1 " Florian Weimer
2021-06-02 14:29 ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 11/16] dlfcn: Move dlinfo " Florian Weimer
2021-06-02 14:31 ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 12/16] dlfcn: Move dlvsym " Florian Weimer
2021-06-02 14:34 ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 13/16] dlfcn: Move dlopen " Florian Weimer
2021-06-02 14:54 ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 14/16] dlfcn: Cleanups after -ldl is no longer required Florian Weimer
2021-06-02 18:08 ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH v2 15/16] dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2 Florian Weimer
2021-06-02 18:09 ` Adhemerval Zanella [this message]
2021-05-31 14:12 ` [PATCH 16/16] dlfcn: Rework static dlopen hooks Florian Weimer
2021-06-02 19:18 ` Adhemerval Zanella
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=1d006256-eb79-0841-d078-0f3cf80af654@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/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).