[v2] Make elf.h header self contained.

Message ID 20201027141741.27391-1-ericonr@disroot.org
State Committed
Commit 9538f6b95a3be228edc078ce58258f0574142e0c
Headers
Series [v2] Make elf.h header self contained. |

Commit Message

Érico Nogueira Oct. 27, 2020, 2:17 p.m. UTC
  From: Érico Rolim <ericonr@disroot.org>

The elf/elf.h header is shared, verbatim, by the elfutils project.
However, elfutils can be used on systems with libcs other than glibc,
making the presence of __BEGIN_DECLS, __END_DECLS and <features.h> in
the file something that downstream distros may have to add patches for.

Furthermore, this file doesn't declare anything with language linkage,
so `extern "C" {}` blocks aren't necessary; it also doesn't have any
conditional definitions based on feature test macros, making inclusion
of features.h unnecessary.

---

Per https://sourceware.org/pipermail/elfutils-devel/2020q4/002994.html ,
the elfutils project would prefer to keep maintenance to a minimum,
which can be achieved by making this single header more portable.

 elf/elf.h | 6 ------
 1 file changed, 6 deletions(-)
  

Comments

Florian Weimer Oct. 28, 2020, 11:16 a.m. UTC | #1
* Érico Nogueira via Libc-alpha:

> From: Érico Rolim <ericonr@disroot.org>
>
> The elf/elf.h header is shared, verbatim, by the elfutils project.
> However, elfutils can be used on systems with libcs other than glibc,
> making the presence of __BEGIN_DECLS, __END_DECLS and <features.h> in
> the file something that downstream distros may have to add patches for.
>
> Furthermore, this file doesn't declare anything with language linkage,
> so `extern "C" {}` blocks aren't necessary; it also doesn't have any
> conditional definitions based on feature test macros, making inclusion
> of features.h unnecessary.

I've pushed this for you after checking that the glibcs stage of
build-many-glibcs.py still passes.

Thanks,
Florian
  
Érico Nogueira Oct. 28, 2020, 5:05 p.m. UTC | #2
On Wed Oct 28, 2020 at 9:16 AM -03, Florian Weimer wrote:
> * Érico Nogueira via Libc-alpha:
>
> > From: Érico Rolim <ericonr@disroot.org>
> >
> > The elf/elf.h header is shared, verbatim, by the elfutils project.
> > However, elfutils can be used on systems with libcs other than glibc,
> > making the presence of __BEGIN_DECLS, __END_DECLS and <features.h> in
> > the file something that downstream distros may have to add patches for.
> >
> > Furthermore, this file doesn't declare anything with language linkage,
> > so `extern "C" {}` blocks aren't necessary; it also doesn't have any
> > conditional definitions based on feature test macros, making inclusion
> > of features.h unnecessary.
>
> I've pushed this for you after checking that the glibcs stage of
> build-many-glibcs.py still passes.
>
> Thanks,
> Florian
> --
> Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
> Commercial register: Amtsgericht Muenchen, HRB 153243,
> Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael
> O'Neill

Thank you!
Érico
  

Patch

diff --git a/elf/elf.h b/elf/elf.h
index ff9f1dadd5..6439c1a4d5 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -19,10 +19,6 @@ 
 #ifndef _ELF_H
 #define	_ELF_H 1
 
-#include <features.h>
-
-__BEGIN_DECLS
-
 /* Standard ELF types.  */
 
 #include <stdint.h>
@@ -4105,6 +4101,4 @@  enum
 #define R_ARC_TLS_LE_S9		0x4a
 #define R_ARC_TLS_LE_32		0x4b
 
-__END_DECLS
-
 #endif	/* elf.h */