From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by sourceware.org (Postfix) with ESMTPS id CBEDE388A83A for ; Wed, 2 Jun 2021 18:09:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CBEDE388A83A Received: by mail-qt1-x834.google.com with SMTP id a15so2543563qta.0 for ; Wed, 02 Jun 2021 11:09:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iWWz5izK6LTYxcuOs9gPFxkaCCLK52jXLGD7MdljfcM=; b=fTmWZD3OgJ7NGlOZqNArH7Ti7RxKJ8GtxkxjyA5DTkvgu/efYMb1IFIlHvhr6QLwJi cjt3RPq5gFjqxjAWa90J6uNXtOyrrIB9JkCX47yD9Cwu/BqYdc0AEx6/YTmYwaK9V2Ml Q/X6U8Aq22cfPcUdNacshRbXDD7C/f+iaZ6ImH+42rIRPLZ/qGtyEmnj2G+5jH4PSWVa LqGZSyWDihWb4/EXKJgkxDXkPzqW8wCO3PqE2zoJFXnp8n4HtnOxAtreEzwwOXC1IKsE YfjsPdqTcUD9Y3NuI/VTd2H2MCK/x1dtBTX6EKiyffO32dwFn1t0VD4xyZsHrq4tvQuS 9p8A== X-Gm-Message-State: AOAM532Rs43UdAlsE1xgXbP1W5KnZ3P5ZclUGLFm3cVVi68YGqsDwfj9 X8fduWwDKYpBkGV9YLoOLoOsv5bu+LhZbg== X-Google-Smtp-Source: ABdhPJyXXleHrElqpoNuY5IR4K6EJXMTR2SS0l0g+hObMLVdkqCYTi8XW8CMTymmXo2k3j9z63kaEA== X-Received: by 2002:ac8:4b74:: with SMTP id g20mr25967142qts.196.1622657397335; Wed, 02 Jun 2021 11:09:57 -0700 (PDT) Received: from [192.168.1.4] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id w11sm258832qta.59.2021.06.02.11.09.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 11:09:57 -0700 (PDT) Subject: Re: [PATCH v2 15/16] dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2 To: Florian Weimer , libc-alpha@sourceware.org References: <66fdbeb88347a0f07f1185e3294bbc78ded0d370.1622469909.git.fweimer@redhat.com> From: Adhemerval Zanella Message-ID: <1d006256-eb79-0841-d078-0f3cf80af654@linaro.org> Date: Wed, 2 Jun 2021 15:09:55 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <66fdbeb88347a0f07f1185e3294bbc78ded0d370.1622469909.git.fweimer@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 18:09:59 -0000 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 , we can use a public symbol and the symbol > version at which it was defined first. Right, I think by including the there is no need to make it an internal test. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > 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 > #include > #include > +#include > > 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 > #include > #include > +#include > > 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.