This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Properly mark all internal function definitions.


Since we banned old style function definitions GCC is able to diagnose
function definitions that don't match the function declaration:

  elf32_getehdr.c:78: error: conflicting types for ‘__elf64_getehdr_wrlock’
  libelfP.h:498: note: previous declaration of ‘__elf64_getehdr_wrlock’

This happens on i386 because there internal functions are marked with:

  # define internal_function __attribute__ ((regparm (3), stdcall))

Make sure all internal function declarations and definitions are marked
with internal_function.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libasm/ChangeLog           |  7 +++++++
 libasm/asm_align.c         |  1 +
 libasm/asm_end.c           |  1 +
 libasm/asm_error.c         |  1 +
 libdw/ChangeLog            |  7 +++++++
 libdw/dwarf_error.c        |  1 +
 libdw/dwarf_formref.c      |  1 +
 libdw/libdw_findcu.c       |  1 +
 libdw/libdw_visit_scopes.c |  1 +
 libelf/ChangeLog           | 14 ++++++++++++++
 libelf/elf32_getehdr.c     |  1 +
 libelf/elf32_getshdr.c     |  2 ++
 libelf/elf_error.c         |  1 +
 libelf/elf_getphdrnum.c    |  2 ++
 libelf/elf_getshdrnum.c    |  1 +
 libelf/elf_readall.c       |  1 +
 libelf/gelf_getehdr.c      |  1 +
 17 files changed, 44 insertions(+)

diff --git a/libasm/ChangeLog b/libasm/ChangeLog
index 0eb84c6..7433cb7 100644
--- a/libasm/ChangeLog
+++ b/libasm/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-23  Mark Wielaard  <mjw@redhat.com>
+
+	* asm_align.c (__libasm_ensure_section_space): Mark as
+	internal_function.
+	* asm_end.c (__libasm_finictx): Likewise.
+	* asm_error.c (__libasm_seterrno): Likewise.
+
 2015-09-22  Mark Wielaard  <mjw@redhat.com>
 
 	* asm_*.c: Remove old-style function definitions.
diff --git a/libasm/asm_align.c b/libasm/asm_align.c
index b7708f5..6631c4d 100644
--- a/libasm/asm_align.c
+++ b/libasm/asm_align.c
@@ -132,6 +132,7 @@ asm_align (AsmScn_t *asmscn, GElf_Word value)
 /* Ensure there are at least LEN bytes available in the output buffer
    for ASMSCN.  */
 int
+internal_function
 __libasm_ensure_section_space (AsmScn_t *asmscn, size_t len)
 {
   /* The blocks with the section content are kept in a circular
diff --git a/libasm/asm_end.c b/libasm/asm_end.c
index d629fcd..d21a70a 100644
--- a/libasm/asm_end.c
+++ b/libasm/asm_end.c
@@ -554,6 +554,7 @@ free_section (AsmScn_t *scnp)
 
 
 void
+internal_function
 __libasm_finictx (AsmCtx_t *ctx)
 {
   /* Iterate through section table and free individual entries.  */
diff --git a/libasm/asm_error.c b/libasm/asm_error.c
index 5443049..cc3e660 100644
--- a/libasm/asm_error.c
+++ b/libasm/asm_error.c
@@ -52,6 +52,7 @@ asm_errno (void)
 
 
 void
+internal_function
 __libasm_seterrno (int value)
 {
   global_error = value;
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index cb5ec9c..5a026d8 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-23  Mark Wielaard  <mjw@redhat.com>
+
+	* dwarf_error.c (__libdw_seterrno): Mark as internal_function.
+	* dwarf_formref.c (__libdw_formref): Likewise.
+	* libdw_findcu.c (__libdw_findcu): Likewise.
+	* libdw_visit_scopes.c (__libdw_visit_scopes): Likewise.
+
 2015-09-22  Mark Wielaard  <mjw@redhat.com>
 
 	* *.c: Remove old-style function definitions.
diff --git a/libdw/dwarf_error.c b/libdw/dwarf_error.c
index c431bd3..66fdc81 100644
--- a/libdw/dwarf_error.c
+++ b/libdw/dwarf_error.c
@@ -100,6 +100,7 @@ static const char *errmsgs[] =
 
 
 void
+internal_function
 __libdw_seterrno (int value)
 {
   global_error = (value >= 0 && value < (int) nerrmsgs
diff --git a/libdw/dwarf_formref.c b/libdw/dwarf_formref.c
index c5fb19b..2240a25 100644
--- a/libdw/dwarf_formref.c
+++ b/libdw/dwarf_formref.c
@@ -35,6 +35,7 @@
 #include "libdwP.h"
 
 int
+internal_function
 __libdw_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
 {
   const unsigned char *datap = attr->valp;
diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c
index 5c03843..082307b 100644
--- a/libdw/libdw_findcu.c
+++ b/libdw/libdw_findcu.c
@@ -133,6 +133,7 @@ __libdw_intern_next_unit (Dwarf *dbg, bool debug_types)
 }
 
 struct Dwarf_CU *
+internal_function
 __libdw_findcu (Dwarf *dbg, Dwarf_Off start, bool debug_types)
 {
   void **tree = debug_types ? &dbg->tu_tree : &dbg->cu_tree;
diff --git a/libdw/libdw_visit_scopes.c b/libdw/libdw_visit_scopes.c
index c882e4a..5e5c26f 100644
--- a/libdw/libdw_visit_scopes.c
+++ b/libdw/libdw_visit_scopes.c
@@ -65,6 +65,7 @@ may_have_scopes (Dwarf_Die *die)
 }
 
 int
+internal_function
 __libdw_visit_scopes (unsigned int depth, struct Dwarf_Die_Chain *root,
 		      struct Dwarf_Die_Chain *imports,
 		      int (*previsit) (unsigned int,
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 193d126..1916877 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,17 @@
+2015-09-23  Mark Wielaard  <mjw@redhat.com>
+
+	* elf32_getehdr.c (getehdr_wrlock): Mark as internal_function.
+	* elf32_getshdr.c (getshdr_rdlock): Likewise.
+	(getshdr_wrlock): Likewise.
+	* elf_error.c (__libelf_seterrno): Likewise.
+	* elf_getphdrnum.c (__elf_getphdrnum_rdlock): Likewise.
+	(__elf_getphdrnum_chk_rdlock): Likewise.
+	* elf_getshdrnum.c (__elf_getphdrnum_rdlock): Likewise.
+	(__elf_getphdrnum_chk_rdlock): Likewise.
+	* elf_getshdrnum.c (__elf_getshdrnum_rdlock): Likewise.
+	* elf_readall.c (__libelf_readall): Likewise.
+	* gelf_getehdr.c (__gelf_getehdr_rdlock): Likewise.
+
 2015-09-22  Mark Wielaard  <mjw@redhat.com>
 
 	* *.c: Remove old-style function definitions.
diff --git a/libelf/elf32_getehdr.c b/libelf/elf32_getehdr.c
index 2b9ad1f..89e3c40 100644
--- a/libelf/elf32_getehdr.c
+++ b/libelf/elf32_getehdr.c
@@ -75,6 +75,7 @@ getehdr_impl (Elf *elf, int wrlock)
 }
 
 ElfW2(LIBELFBITS,Ehdr) *
+internal_function
 __elfw2(LIBELFBITS,getehdr_wrlock) (Elf *elf)
 {
   return getehdr_impl (elf, 1);
diff --git a/libelf/elf32_getshdr.c b/libelf/elf32_getshdr.c
index a5fdb54..3a6375c 100644
--- a/libelf/elf32_getshdr.c
+++ b/libelf/elf32_getshdr.c
@@ -243,6 +243,7 @@ scn_valid (Elf_Scn *scn)
 }
 
 ElfW2(LIBELFBITS,Shdr) *
+internal_function
 __elfw2(LIBELFBITS,getshdr_rdlock) (Elf_Scn *scn)
 {
   ElfW2(LIBELFBITS,Shdr) *result;
@@ -264,6 +265,7 @@ __elfw2(LIBELFBITS,getshdr_rdlock) (Elf_Scn *scn)
 }
 
 ElfW2(LIBELFBITS,Shdr) *
+internal_function
 __elfw2(LIBELFBITS,getshdr_wrlock) (Elf_Scn *scn)
 {
   ElfW2(LIBELFBITS,Shdr) *result;
diff --git a/libelf/elf_error.c b/libelf/elf_error.c
index d6e5183..d6bdaab 100644
--- a/libelf/elf_error.c
+++ b/libelf/elf_error.c
@@ -283,6 +283,7 @@ static const uint_fast16_t msgidx[ELF_E_NUM] =
 
 
 void
+internal_function
 __libelf_seterrno (int value)
 {
   global_error = value >= 0 && value < nmsgidx ? value : ELF_E_UNKNOWN_ERROR;
diff --git a/libelf/elf_getphdrnum.c b/libelf/elf_getphdrnum.c
index fe70345..061183b 100644
--- a/libelf/elf_getphdrnum.c
+++ b/libelf/elf_getphdrnum.c
@@ -38,6 +38,7 @@
 
 
 int
+internal_function
 __elf_getphdrnum_rdlock (Elf *elf, size_t *dst)
 {
  if (unlikely (elf->state.elf64.ehdr == NULL))
@@ -78,6 +79,7 @@ __elf_getphdrnum_rdlock (Elf *elf, size_t *dst)
 }
 
 int
+internal_function
 __elf_getphdrnum_chk_rdlock (Elf *elf, size_t *dst)
 {
   int result = __elf_getphdrnum_rdlock (elf, dst);
diff --git a/libelf/elf_getshdrnum.c b/libelf/elf_getshdrnum.c
index 4875c19..18e5d14 100644
--- a/libelf/elf_getshdrnum.c
+++ b/libelf/elf_getshdrnum.c
@@ -39,6 +39,7 @@
 
 
 int
+internal_function
 __elf_getshdrnum_rdlock (Elf *elf, size_t *dst)
 {
   int result = 0;
diff --git a/libelf/elf_readall.c b/libelf/elf_readall.c
index 52a0b4e..384d251 100644
--- a/libelf/elf_readall.c
+++ b/libelf/elf_readall.c
@@ -66,6 +66,7 @@ set_address (Elf *elf, size_t offset)
 
 
 char *
+internal_function
 __libelf_readall (Elf *elf)
 {
   /* Get the file.  */
diff --git a/libelf/gelf_getehdr.c b/libelf/gelf_getehdr.c
index cace0ef..abeb70c 100644
--- a/libelf/gelf_getehdr.c
+++ b/libelf/gelf_getehdr.c
@@ -40,6 +40,7 @@
 
 
 GElf_Ehdr *
+internal_function
 __gelf_getehdr_rdlock (Elf *elf, GElf_Ehdr *dest)
 {
   GElf_Ehdr *result = NULL;
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]