Patchwork Replace PREPARE_VERSION macro with inline function

login
register
mail settings
Submitter Tobias Klauser
Date May 24, 2019, 3:39 p.m.
Message ID <20190524153941.10128-1-tklauser@distanz.ch>
Download mbox | patch
Permalink /patch/32851/
State New
Headers show

Comments

Tobias Klauser - May 24, 2019, 3:39 p.m.
Suggested by Adhemerval Zanella

2019-05-24  Tobias Klauser  <tklauser@distanz.ch>

	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
	(prepare_version_base): New helper inline function.
	(prepare_version): New macro replacing PREPARE_VERSION.
	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
---
 sysdeps/unix/sysv/linux/dl-vdso.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
Carlos O'Donell - May 25, 2019, 12:56 a.m.
On 5/24/19 10:39 AM, Tobias Klauser wrote:
> Suggested by Adhemerval Zanella
> 
> 2019-05-24  Tobias Klauser  <tklauser@distanz.ch>
> 
> 	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
> 	(prepare_version_base): New helper inline function.
> 	(prepare_version): New macro replacing PREPARE_VERSION.
> 	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.

Tobias,

What is your copyright status with the FSF for glibc?
Tobias Klauser - May 27, 2019, 7:06 a.m.
Hi Carlos

On 2019-05-25 at 02:56:28 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
> On 5/24/19 10:39 AM, Tobias Klauser wrote:
> > Suggested by Adhemerval Zanella
> > 
> > 2019-05-24  Tobias Klauser  <tklauser@distanz.ch>
> > 
> > 	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
> > 	(prepare_version_base): New helper inline function.
> > 	(prepare_version): New macro replacing PREPARE_VERSION.
> > 	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
> 
> Tobias,
> 
> What is your copyright status with the FSF for glibc?

I have not yet completed an FSF copyright assignment but would be
willing to do so. What would be the next steps? The contribution
checklist [1] mentions I would need a glibc developer or project steward
to direct me towards filing an assignment request.

[1] https://sourceware.org/glibc/wiki/Contribution%20checklist#FSF_copyright_Assignment

Best regards
Tobias
Carlos O'Donell - June 4, 2019, 2:57 a.m.
On 5/27/19 3:06 AM, Tobias Klauser wrote:
> Hi Carlos
> 
> On 2019-05-25 at 02:56:28 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
>> On 5/24/19 10:39 AM, Tobias Klauser wrote:
>>> Suggested by Adhemerval Zanella
>>>
>>> 2019-05-24  Tobias Klauser  <tklauser@distanz.ch>
>>>
>>> 	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
>>> 	(prepare_version_base): New helper inline function.
>>> 	(prepare_version): New macro replacing PREPARE_VERSION.
>>> 	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
>>
>> Tobias,
>>
>> What is your copyright status with the FSF for glibc?
> 
> I have not yet completed an FSF copyright assignment but would be
> willing to do so. What would be the next steps? The contribution
> checklist [1] mentions I would need a glibc developer or project steward
> to direct me towards filing an assignment request.
> 
> [1] https://sourceware.org/glibc/wiki/Contribution%20checklist#FSF_copyright_Assignment

I would suggest a future assignment:
http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future

It is the simplest process that allows us to accept
current and future patches from you.
Tobias Klauser - June 4, 2019, 7:28 a.m.
On 2019-06-04 at 04:57:08 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
> On 5/27/19 3:06 AM, Tobias Klauser wrote:
> > Hi Carlos
> > 
> > On 2019-05-25 at 02:56:28 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
> > > On 5/24/19 10:39 AM, Tobias Klauser wrote:
> > > > Suggested by Adhemerval Zanella
> > > > 
> > > > 2019-05-24  Tobias Klauser  <tklauser@distanz.ch>
> > > > 
> > > > 	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
> > > > 	(prepare_version_base): New helper inline function.
> > > > 	(prepare_version): New macro replacing PREPARE_VERSION.
> > > > 	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
> > > 
> > > Tobias,
> > > 
> > > What is your copyright status with the FSF for glibc?
> > 
> > I have not yet completed an FSF copyright assignment but would be
> > willing to do so. What would be the next steps? The contribution
> > checklist [1] mentions I would need a glibc developer or project steward
> > to direct me towards filing an assignment request.
> > 
> > [1] https://sourceware.org/glibc/wiki/Contribution%20checklist#FSF_copyright_Assignment
> 
> I would suggest a future assignment:
> http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future
> 
> It is the simplest process that allows us to accept
> current and future patches from you.

Sent the request to assign@gnu.org

Thank you
Tobias Klauser - June 20, 2019, 8:31 a.m.
Hi Carlos

On 2019-06-04 at 04:57:08 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
> On 5/27/19 3:06 AM, Tobias Klauser wrote:
> > Hi Carlos
> > 
> > On 2019-05-25 at 02:56:28 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
> > > On 5/24/19 10:39 AM, Tobias Klauser wrote:
> > > > Suggested by Adhemerval Zanella
> > > > 
> > > > 2019-05-24  Tobias Klauser  <tklauser@distanz.ch>
> > > > 
> > > > 	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
> > > > 	(prepare_version_base): New helper inline function.
> > > > 	(prepare_version): New macro replacing PREPARE_VERSION.
> > > > 	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
> > > 
> > > Tobias,
> > > 
> > > What is your copyright status with the FSF for glibc?
> > 
> > I have not yet completed an FSF copyright assignment but would be
> > willing to do so. What would be the next steps? The contribution
> > checklist [1] mentions I would need a glibc developer or project steward
> > to direct me towards filing an assignment request.
> > 
> > [1] https://sourceware.org/glibc/wiki/Contribution%20checklist#FSF_copyright_Assignment
> 
> I would suggest a future assignment:
> http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future
> 
> It is the simplest process that allows us to accept
> current and future patches from you.

I now completed the paperwork with the FSF wrt. the copyright
assignment. Is there anything you need from me (e.g. the signed copy of
the assignment)?

Thanks
Tobias
Carlos O'Donell - June 20, 2019, 2:18 p.m.
On 6/20/19 4:31 AM, Tobias Klauser wrote:
> Hi Carlos
> 
> On 2019-06-04 at 04:57:08 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
>> On 5/27/19 3:06 AM, Tobias Klauser wrote:
>>> Hi Carlos
>>>
>>> On 2019-05-25 at 02:56:28 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
>>>> On 5/24/19 10:39 AM, Tobias Klauser wrote:
>>>>> Suggested by Adhemerval Zanella
>>>>>
>>>>> 2019-05-24  Tobias Klauser  <tklauser@distanz.ch>
>>>>>
>>>>> 	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
>>>>> 	(prepare_version_base): New helper inline function.
>>>>> 	(prepare_version): New macro replacing PREPARE_VERSION.
>>>>> 	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
>>>>
>>>> Tobias,
>>>>
>>>> What is your copyright status with the FSF for glibc?
>>>
>>> I have not yet completed an FSF copyright assignment but would be
>>> willing to do so. What would be the next steps? The contribution
>>> checklist [1] mentions I would need a glibc developer or project steward
>>> to direct me towards filing an assignment request.
>>>
>>> [1] https://sourceware.org/glibc/wiki/Contribution%20checklist#FSF_copyright_Assignment
>>
>> I would suggest a future assignment:
>> http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future
>>
>> It is the simplest process that allows us to accept
>> current and future patches from you.
> 
> I now completed the paperwork with the FSF wrt. the copyright
> assignment. Is there anything you need from me (e.g. the signed copy of
> the assignment)?

I have verified with the master copyright list that you have an assignment
in place! Thank you!
Carlos O'Donell - June 20, 2019, 2:20 p.m.
On 5/24/19 11:39 AM, Tobias Klauser wrote:
> Suggested by Adhemerval Zanella

Adhemerval,

Since you made this suggestion I'll let you review :-)

Tobias has copyright status with FSF, so we can install this patch.

Thank you Tobias!

> 2019-05-24  Tobias Klauser  <tklauser@distanz.ch>
> 
> 	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
> 	(prepare_version_base): New helper inline function.
> 	(prepare_version): New macro replacing PREPARE_VERSION.
> 	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
> ---
>  sysdeps/unix/sysv/linux/dl-vdso.h | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/dl-vdso.h b/sysdeps/unix/sysv/linux/dl-vdso.h
> index 9e61ca742363..c418c697a3a4 100644
> --- a/sysdeps/unix/sysv/linux/dl-vdso.h
> +++ b/sysdeps/unix/sysv/linux/dl-vdso.h
> @@ -24,19 +24,19 @@
>  #include <dl-hash.h>
>  
>  /* Create version number record for lookup.  */
> -#define PREPARE_VERSION(var, vname, vhash) \
> -  struct r_found_version var;						      \
> -  var.name = vname;							      \
> -  var.hidden = 1;							      \
> -  var.hash = vhash;							      \
> -  assert (var.hash == _dl_elf_hash (var.name));				      \
> -  /* We don't have a specific file where the symbol can be found.  */	      \
> -  var.filename = NULL
> +static inline struct r_found_version
> +prepare_version_base (const char *name, ElfW(Word) hash)
> +{
> +  assert (hash == _dl_elf_hash (name));
> +  return (struct r_found_version) { name, hash, 1, NULL };
> +}
> +#define prepare_version(vname) \
> +  prepare_version_base (VDSO_NAME_##vname, VDSO_HASH_##vname)
>  
>  /* Use this for the known version sets defined below, where we
>     record their precomputed hash values only once, in this file.  */
>  #define PREPARE_VERSION_KNOWN(var, vname) \
> -  PREPARE_VERSION (var, VDSO_NAME_##vname, VDSO_HASH_##vname)
> +  struct r_found_version var = prepare_version (vname);
>  
>  #define VDSO_NAME_LINUX_2_6	"LINUX_2.6"
>  #define VDSO_HASH_LINUX_2_6	61765110
>
Tobias Klauser - June 28, 2019, 9:03 a.m.
Hi Adhemerval

On 2019-06-20 at 16:20:21 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
> On 5/24/19 11:39 AM, Tobias Klauser wrote:
> > Suggested by Adhemerval Zanella
> 
> Adhemerval,
> 
> Since you made this suggestion I'll let you review :-)
> 
> Tobias has copyright status with FSF, so we can install this patch.

Are there any changes needed to this patch? The other one
("Add missing VDSO_{NAME,HASH}_* macros and use them for
PREPARE_VERSION_KNOWN", commit 85c748f9ff3db4a7796472f90d4d80e9987b7922)
was added to the tree, but this one not yet.

Thanks and best regards
Tobias

> Thank you Tobias!
> 
> > 2019-05-24  Tobias Klauser  <tklauser@distanz.ch>
> > 
> > 	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
> > 	(prepare_version_base): New helper inline function.
> > 	(prepare_version): New macro replacing PREPARE_VERSION.
> > 	(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.
> > ---
> >  sysdeps/unix/sysv/linux/dl-vdso.h | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/sysdeps/unix/sysv/linux/dl-vdso.h b/sysdeps/unix/sysv/linux/dl-vdso.h
> > index 9e61ca742363..c418c697a3a4 100644
> > --- a/sysdeps/unix/sysv/linux/dl-vdso.h
> > +++ b/sysdeps/unix/sysv/linux/dl-vdso.h
> > @@ -24,19 +24,19 @@
> >  #include <dl-hash.h>
> >  
> >  /* Create version number record for lookup.  */
> > -#define PREPARE_VERSION(var, vname, vhash) \
> > -  struct r_found_version var;						      \
> > -  var.name = vname;							      \
> > -  var.hidden = 1;							      \
> > -  var.hash = vhash;							      \
> > -  assert (var.hash == _dl_elf_hash (var.name));				      \
> > -  /* We don't have a specific file where the symbol can be found.  */	      \
> > -  var.filename = NULL
> > +static inline struct r_found_version
> > +prepare_version_base (const char *name, ElfW(Word) hash)
> > +{
> > +  assert (hash == _dl_elf_hash (name));
> > +  return (struct r_found_version) { name, hash, 1, NULL };
> > +}
> > +#define prepare_version(vname) \
> > +  prepare_version_base (VDSO_NAME_##vname, VDSO_HASH_##vname)
> >  
> >  /* Use this for the known version sets defined below, where we
> >     record their precomputed hash values only once, in this file.  */
> >  #define PREPARE_VERSION_KNOWN(var, vname) \
> > -  PREPARE_VERSION (var, VDSO_NAME_##vname, VDSO_HASH_##vname)
> > +  struct r_found_version var = prepare_version (vname);
> >  
> >  #define VDSO_NAME_LINUX_2_6	"LINUX_2.6"
> >  #define VDSO_HASH_LINUX_2_6	61765110
> > 
> 
> 
> -- 
> Cheers,
> Carlos.
>
Adhemerval Zanella Netto - June 28, 2019, 11:48 a.m.
On 28/06/2019 06:03, Tobias Klauser wrote:
> Hi Adhemerval
> 
> On 2019-06-20 at 16:20:21 +0200, Carlos O'Donell <carlos@redhat.com> wrote:
>> On 5/24/19 11:39 AM, Tobias Klauser wrote:
>>> Suggested by Adhemerval Zanella
>>
>> Adhemerval,
>>
>> Since you made this suggestion I'll let you review :-)
>>
>> Tobias has copyright status with FSF, so we can install this patch.
> 
> Are there any changes needed to this patch? The other one
> ("Add missing VDSO_{NAME,HASH}_* macros and use them for
> PREPARE_VERSION_KNOWN", commit 85c748f9ff3db4a7796472f90d4d80e9987b7922)
> was added to the tree, but this one not yet.
> 
> Thanks and best regards
> Tobias

LGTM, I have pushed it upstream for you.

Patch

diff --git a/sysdeps/unix/sysv/linux/dl-vdso.h b/sysdeps/unix/sysv/linux/dl-vdso.h
index 9e61ca742363..c418c697a3a4 100644
--- a/sysdeps/unix/sysv/linux/dl-vdso.h
+++ b/sysdeps/unix/sysv/linux/dl-vdso.h
@@ -24,19 +24,19 @@ 
 #include <dl-hash.h>
 
 /* Create version number record for lookup.  */
-#define PREPARE_VERSION(var, vname, vhash) \
-  struct r_found_version var;						      \
-  var.name = vname;							      \
-  var.hidden = 1;							      \
-  var.hash = vhash;							      \
-  assert (var.hash == _dl_elf_hash (var.name));				      \
-  /* We don't have a specific file where the symbol can be found.  */	      \
-  var.filename = NULL
+static inline struct r_found_version
+prepare_version_base (const char *name, ElfW(Word) hash)
+{
+  assert (hash == _dl_elf_hash (name));
+  return (struct r_found_version) { name, hash, 1, NULL };
+}
+#define prepare_version(vname) \
+  prepare_version_base (VDSO_NAME_##vname, VDSO_HASH_##vname)
 
 /* Use this for the known version sets defined below, where we
    record their precomputed hash values only once, in this file.  */
 #define PREPARE_VERSION_KNOWN(var, vname) \
-  PREPARE_VERSION (var, VDSO_NAME_##vname, VDSO_HASH_##vname)
+  struct r_found_version var = prepare_version (vname);
 
 #define VDSO_NAME_LINUX_2_6	"LINUX_2.6"
 #define VDSO_HASH_LINUX_2_6	61765110