[PATCH] Do without union of variable length arrays.
by Chih-Hung Hsieh
Prepare to compile without gnu99 extension.
A union like
{ T32 a32[n]; T64 a64[n]; } u;
is expanded to
void *data = malloc (...);
T32 *a32 = data;
T64 *a64 = data;
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
libdwfl/dwfl_module_getdwarf.c | 46 +++++++++++---------
libdwfl/dwfl_segment_report_module.c | 60 +++++++++++++-------------
libdwfl/elf-from-memory.c | 41 +++++++++---------
libdwfl/link_map.c | 81 +++++++++++++-----------------------
libelf/elf_getarsym.c | 12 ++----
src/readelf.c | 30 +++++++------
src/unstrip.c | 22 ++++++----
7 files changed, 138 insertions(+), 154 deletions(-)
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index dba9d66..5f1b9b1 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -370,14 +370,17 @@ find_prelink_address_sync (Dwfl_Module *mod, struct dwfl_file *file)
{
typedef union
{
- Elf32_Phdr p32[phnum];
- Elf64_Phdr p64[phnum];
- } phdr;
- phdr *phdrs = malloc (sizeof (phdr));
+ Elf32_Phdr p32;
+ Elf64_Phdr p64;
+ } phdr_u;
+ /* phnum elements of phdr_u */
+ void *phdrs = malloc (phnum * sizeof (phdr_u));
+ Elf32_Phdr *p32 = phdrs;
+ Elf64_Phdr *p64 = phdrs;
if (unlikely (phdrs == NULL))
return DWFL_E_NOMEM;
dst.d_buf = phdrs;
- dst.d_size = sizeof (phdr);
+ dst.d_size = phnum * sizeof (phdr_u);
if (unlikely (gelf_xlatetom (mod->main.elf, &dst, &src,
ehdr.e32.e_ident[EI_DATA]) == NULL))
{
@@ -387,18 +390,18 @@ find_prelink_address_sync (Dwfl_Module *mod, struct dwfl_file *file)
if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32)
{
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs->p32[i].p_type == PT_INTERP)
+ if (p32[i].p_type == PT_INTERP)
{
- undo_interp = phdrs->p32[i].p_vaddr;
+ undo_interp = p32[i].p_vaddr;
break;
}
}
else
{
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs->p64[i].p_type == PT_INTERP)
+ if (p64[i].p_type == PT_INTERP)
{
- undo_interp = phdrs->p64[i].p_vaddr;
+ undo_interp = p64[i].p_vaddr;
break;
}
}
@@ -414,14 +417,17 @@ find_prelink_address_sync (Dwfl_Module *mod, struct dwfl_file *file)
typedef union
{
- Elf32_Shdr s32[shnum - 1];
- Elf64_Shdr s64[shnum - 1];
- } shdr;
- shdr *shdrs = malloc (sizeof (shdr));
+ Elf32_Shdr s32;
+ Elf64_Shdr s64;
+ } shdr_u;
+ /* (shnum - 1) elements of shdr_u */
+ void *shdrs = malloc ((shnum - 1) * sizeof (shdr_u));
+ Elf32_Shdr *s32 = shdrs;
+ Elf64_Shdr *s64 = shdrs;
if (unlikely (shdrs == NULL))
return DWFL_E_NOMEM;
dst.d_buf = shdrs;
- dst.d_size = sizeof (shdr);
+ dst.d_size = (shnum - 1) * sizeof (shdr_u);
if (unlikely (gelf_xlatetom (mod->main.elf, &dst, &src,
ehdr.e32.e_ident[EI_DATA]) == NULL))
{
@@ -484,14 +490,14 @@ find_prelink_address_sync (Dwfl_Module *mod, struct dwfl_file *file)
highest = 0;
if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32)
for (size_t i = 0; i < shnum - 1; ++i)
- consider_shdr (undo_interp, shdrs->s32[i].sh_type,
- shdrs->s32[i].sh_flags, shdrs->s32[i].sh_addr,
- shdrs->s32[i].sh_size);
+ consider_shdr (undo_interp, s32[i].sh_type,
+ s32[i].sh_flags, s32[i].sh_addr,
+ s32[i].sh_size);
else
for (size_t i = 0; i < shnum - 1; ++i)
- consider_shdr (undo_interp, shdrs->s64[i].sh_type,
- shdrs->s64[i].sh_flags, shdrs->s64[i].sh_addr,
- shdrs->s64[i].sh_size);
+ consider_shdr (undo_interp, s64[i].sh_type,
+ s64[i].sh_flags, s64[i].sh_addr,
+ s64[i].sh_size);
if (highest > file->vaddr)
file->address_sync = highest;
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index a0f07ad..b5c45f3 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -406,17 +406,18 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
typedef union
{
- Elf32_Phdr p32[phnum];
- Elf64_Phdr p64[phnum];
- } phdrsn;
+ Elf32_Phdr p32;
+ Elf64_Phdr p64;
+ } phdr_u;
- phdrsp = malloc (sizeof (phdrsn));
+ phdrsp = malloc (phnum * sizeof (phdr_u));
+ Elf32_Phdr *p32 = phdrsp;
+ Elf64_Phdr *p64 = phdrsp;
if (unlikely (phdrsp == NULL))
return finish ();
- phdrsn *phdrs = (phdrsn *) phdrsp;
- xlateto.d_buf = phdrs;
- xlateto.d_size = sizeof (phdrsn);
+ xlateto.d_buf = phdrsp;
+ xlateto.d_size = phnum * sizeof (phdr_u);
/* Track the bounds of the file visible in memory. */
GElf_Off file_trimmed_end = 0; /* Proper p_vaddr + p_filesz end. */
@@ -579,10 +580,10 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
found_bias = false; /* Trigger error check. */
else
for (uint_fast16_t i = 0; i < phnum; ++i)
- consider_phdr (phdrs->p32[i].p_type,
- phdrs->p32[i].p_vaddr, phdrs->p32[i].p_memsz,
- phdrs->p32[i].p_offset, phdrs->p32[i].p_filesz,
- phdrs->p32[i].p_align);
+ consider_phdr (p32[i].p_type,
+ p32[i].p_vaddr, p32[i].p_memsz,
+ p32[i].p_offset, p32[i].p_filesz,
+ p32[i].p_align);
}
else
{
@@ -590,10 +591,10 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
found_bias = false; /* Trigger error check. */
else
for (uint_fast16_t i = 0; i < phnum; ++i)
- consider_phdr (phdrs->p64[i].p_type,
- phdrs->p64[i].p_vaddr, phdrs->p64[i].p_memsz,
- phdrs->p64[i].p_offset, phdrs->p64[i].p_filesz,
- phdrs->p64[i].p_align);
+ consider_phdr (p64[i].p_type,
+ p64[i].p_vaddr, p64[i].p_memsz,
+ p64[i].p_offset, p64[i].p_filesz,
+ p64[i].p_align);
}
finish_portion (&ph_buffer, &ph_buffer_size);
@@ -749,44 +750,39 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
const size_t dyn_entsize = (ei_class == ELFCLASS32
? sizeof (Elf32_Dyn) : sizeof (Elf64_Dyn));
- void *dyns = NULL;
void *dyn_data = NULL;
size_t dyn_data_size = 0;
if (dyn_filesz != 0 && dyn_filesz % dyn_entsize == 0
&& ! read_portion (&dyn_data, &dyn_data_size, dyn_vaddr, dyn_filesz))
{
- typedef union
- {
- Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)];
- Elf64_Dyn d64[dyn_filesz / sizeof (Elf64_Dyn)];
- } dynn;
- dyns = malloc (sizeof (dynn));
+ void *dyns = malloc (dyn_filesz);
+ Elf32_Dyn *d32 = dyns;
+ Elf64_Dyn *d64 = dyns;
if (unlikely (dyns == NULL))
return finish ();
- dynn *dyn = (dynn *) dyns;
xlatefrom.d_type = xlateto.d_type = ELF_T_DYN;
xlatefrom.d_buf = (void *) dyn_data;
xlatefrom.d_size = dyn_filesz;
- xlateto.d_buf = dyn;
- xlateto.d_size = sizeof (dynn);
+ xlateto.d_buf = dyns;
+ xlateto.d_size = dyn_filesz;
if (ei_class == ELFCLASS32)
{
if (elf32_xlatetom (&xlateto, &xlatefrom, ei_data) != NULL)
for (size_t i = 0; i < dyn_filesz / sizeof (Elf32_Dyn); ++i)
- if (consider_dyn (dyn->d32[i].d_tag, dyn->d32[i].d_un.d_val))
+ if (consider_dyn (d32[i].d_tag, d32[i].d_un.d_val))
break;
}
else
{
if (elf64_xlatetom (&xlateto, &xlatefrom, ei_data) != NULL)
for (size_t i = 0; i < dyn_filesz / sizeof (Elf64_Dyn); ++i)
- if (consider_dyn (dyn->d64[i].d_tag, dyn->d64[i].d_un.d_val))
+ if (consider_dyn (d64[i].d_tag, d64[i].d_un.d_val))
break;
}
+ free (dyns);
}
- free (dyns);
finish_portion (&dyn_data, &dyn_data_size);
/* We'll use the name passed in or a stupid default if not DT_SONAME. */
@@ -901,12 +897,12 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
if (ei_class == ELFCLASS32)
for (uint_fast16_t i = 0; i < phnum; ++i)
- read_phdr (phdrs->p32[i].p_type, phdrs->p32[i].p_vaddr,
- phdrs->p32[i].p_offset, phdrs->p32[i].p_filesz);
+ read_phdr (p32[i].p_type, p32[i].p_vaddr,
+ p32[i].p_offset, p32[i].p_filesz);
else
for (uint_fast16_t i = 0; i < phnum; ++i)
- read_phdr (phdrs->p64[i].p_type, phdrs->p64[i].p_vaddr,
- phdrs->p64[i].p_offset, phdrs->p64[i].p_filesz);
+ read_phdr (p64[i].p_type, p64[i].p_vaddr,
+ p64[i].p_offset, p64[i].p_filesz);
}
else
{
diff --git a/libdwfl/elf-from-memory.c b/libdwfl/elf-from-memory.c
index ed8f6e9..ee37cfd 100644
--- a/libdwfl/elf-from-memory.c
+++ b/libdwfl/elf-from-memory.c
@@ -193,20 +193,21 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
typedef union
{
- Elf32_Phdr p32[phnum];
- Elf64_Phdr p64[phnum];
- } phdrsn;
+ Elf32_Phdr p32;
+ Elf64_Phdr p64;
+ } phdr_u;
- phdrsp = malloc (sizeof (phdrsn));
+ phdrsp = malloc (phnum * sizeof (phdr_u));
+ Elf32_Phdr *p32 = phdrsp;
+ Elf64_Phdr *p64 = phdrsp;
if (unlikely (phdrsp == NULL))
{
free (buffer);
goto no_memory;
}
- phdrsn *phdrs = (phdrsn *) phdrsp;
- xlateto.d_buf = phdrs;
- xlateto.d_size = sizeof (phdrsn);
+ xlateto.d_buf = phdrsp;
+ xlateto.d_size = phnum * sizeof (phdr_u);
/* Scan for PT_LOAD segments to find the total size of the file image. */
size_t contents_size = 0;
@@ -249,9 +250,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
ehdr.e32.e_ident[EI_DATA]) == NULL)
goto libelf_error;
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs->p32[i].p_type == PT_LOAD)
- if (handle_segment (phdrs->p32[i].p_vaddr, phdrs->p32[i].p_offset,
- phdrs->p32[i].p_filesz, phdrs->p32[i].p_memsz))
+ if (p32[i].p_type == PT_LOAD)
+ if (handle_segment (p32[i].p_vaddr, p32[i].p_offset,
+ p32[i].p_filesz, p32[i].p_memsz))
goto bad_elf;
break;
@@ -260,9 +261,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
ehdr.e64.e_ident[EI_DATA]) == NULL)
goto libelf_error;
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs->p64[i].p_type == PT_LOAD)
- if (handle_segment (phdrs->p64[i].p_vaddr, phdrs->p64[i].p_offset,
- phdrs->p64[i].p_filesz, phdrs->p64[i].p_memsz))
+ if (p64[i].p_type == PT_LOAD)
+ if (handle_segment (p64[i].p_vaddr, p64[i].p_offset,
+ p64[i].p_filesz, p64[i].p_memsz))
goto bad_elf;
break;
@@ -315,9 +316,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
case ELFCLASS32:
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs->p32[i].p_type == PT_LOAD)
- if (handle_segment (phdrs->p32[i].p_vaddr, phdrs->p32[i].p_offset,
- phdrs->p32[i].p_filesz))
+ if (p32[i].p_type == PT_LOAD)
+ if (handle_segment (p32[i].p_vaddr, p32[i].p_offset,
+ p32[i].p_filesz))
goto read_error;
/* If the segments visible in memory didn't include the section
@@ -342,9 +343,9 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
case ELFCLASS64:
for (uint_fast16_t i = 0; i < phnum; ++i)
- if (phdrs->p64[i].p_type == PT_LOAD)
- if (handle_segment (phdrs->p64[i].p_vaddr, phdrs->p64[i].p_offset,
- phdrs->p64[i].p_filesz))
+ if (p64[i].p_type == PT_LOAD)
+ if (handle_segment (p64[i].p_vaddr, p64[i].p_offset,
+ p64[i].p_filesz))
goto read_error;
/* If the segments visible in memory didn't include the section
@@ -373,7 +374,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
}
free (phdrsp);
- phdrs = phdrsp = NULL;
+ phdrsp = NULL;
/* Now we have the image. Open libelf on it. */
diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c
index 030c600..a756e43 100644
--- a/libdwfl/link_map.c
+++ b/libdwfl/link_map.c
@@ -48,20 +48,16 @@ static bool
auxv_format_probe (const void *auxv, size_t size,
uint_fast8_t *elfclass, uint_fast8_t *elfdata)
{
- const union
- {
- char buf[size];
- Elf32_auxv_t a32[size / sizeof (Elf32_auxv_t)];
- Elf64_auxv_t a64[size / sizeof (Elf64_auxv_t)];
- } *u = auxv;
+ const Elf32_auxv_t *a32 = auxv;
+ const Elf64_auxv_t *a64 = auxv;
inline bool check64 (size_t i)
{
/* The AUXV pointer might not even be naturally aligned for 64-bit
data, because note payloads in a core file are not aligned. */
- uint64_t type = read_8ubyte_unaligned_noncvt (&u->a64[i].a_type);
- uint64_t val = read_8ubyte_unaligned_noncvt (&u->a64[i].a_un.a_val);
+ uint64_t type = read_8ubyte_unaligned_noncvt (&a64[i].a_type);
+ uint64_t val = read_8ubyte_unaligned_noncvt (&a64[i].a_un.a_val);
if (type == BE64 (PROBE_TYPE)
&& val == BE64 (PROBE_VAL64))
@@ -85,8 +81,8 @@ auxv_format_probe (const void *auxv, size_t size,
/* The AUXV pointer might not even be naturally aligned for 32-bit
data, because note payloads in a core file are not aligned. */
- uint32_t type = read_4ubyte_unaligned_noncvt (&u->a32[i].a_type);
- uint32_t val = read_4ubyte_unaligned_noncvt (&u->a32[i].a_un.a_val);
+ uint32_t type = read_4ubyte_unaligned_noncvt (&a32[i].a_type);
+ uint32_t val = read_4ubyte_unaligned_noncvt (&a32[i].a_un.a_val);
if (type == BE32 (PROBE_TYPE)
&& val == BE32 (PROBE_VAL32))
@@ -280,29 +276,26 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
return true;
}
- const union
- {
- Elf32_Addr a32[n];
- Elf64_Addr a64[n];
- } *in = vaddr - read_vaddr + buffer;
+ Elf32_Addr *a32 = vaddr - read_vaddr + buffer;
+ Elf64_Addr *a64 = (void *) a32;
if (elfclass == ELFCLASS32)
{
if (elfdata == ELFDATA2MSB)
for (size_t i = 0; i < n; ++i)
- addrs[i] = BE32 (read_4ubyte_unaligned_noncvt (&in->a32[i]));
+ addrs[i] = BE32 (read_4ubyte_unaligned_noncvt (&a32[i]));
else
for (size_t i = 0; i < n; ++i)
- addrs[i] = LE32 (read_4ubyte_unaligned_noncvt (&in->a32[i]));
+ addrs[i] = LE32 (read_4ubyte_unaligned_noncvt (&a32[i]));
}
else
{
if (elfdata == ELFDATA2MSB)
for (size_t i = 0; i < n; ++i)
- addrs[i] = BE64 (read_8ubyte_unaligned_noncvt (&in->a64[i]));
+ addrs[i] = BE64 (read_8ubyte_unaligned_noncvt (&a64[i]));
else
for (size_t i = 0; i < n; ++i)
- addrs[i] = LE64 (read_8ubyte_unaligned_noncvt (&in->a64[i]));
+ addrs[i] = LE64 (read_8ubyte_unaligned_noncvt (&a64[i]));
}
return false;
@@ -861,13 +854,9 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
}
if (in_ok)
{
- typedef union
- {
- Elf32_Phdr p32;
- Elf64_Phdr p64;
- char data[phnum * phent];
- } data_buf;
- data_buf *buf = malloc (sizeof (data_buf));
+ void *buf = malloc (phnum * phent);
+ Elf32_Phdr *p32 = buf;
+ Elf64_Phdr *p64 = buf;
if (unlikely (buf == NULL))
{
__libdwfl_seterrno (DWFL_E_NOMEM);
@@ -886,25 +875,20 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
(&out, &in, elfdata) != NULL))
{
/* We are looking for PT_DYNAMIC. */
- const union
- {
- Elf32_Phdr p32[phnum];
- Elf64_Phdr p64[phnum];
- } *u = (void *) buf;
if (elfclass == ELFCLASS32)
{
for (size_t i = 0; i < phnum; ++i)
- if (consider_phdr (u->p32[i].p_type,
- u->p32[i].p_vaddr,
- u->p32[i].p_filesz))
+ if (consider_phdr (p32[i].p_type,
+ p32[i].p_vaddr,
+ p32[i].p_filesz))
break;
}
else
{
for (size_t i = 0; i < phnum; ++i)
- if (consider_phdr (u->p64[i].p_type,
- u->p64[i].p_vaddr,
- u->p64[i].p_filesz))
+ if (consider_phdr (p64[i].p_type,
+ p64[i].p_vaddr,
+ p64[i].p_filesz))
break;
}
}
@@ -955,13 +939,9 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
if ((*memory_callback) (dwfl, dyn_segndx, &in.d_buf, &in.d_size,
dyn_vaddr, dyn_filesz, memory_callback_arg))
{
- typedef union
- {
- Elf32_Dyn d32;
- Elf64_Dyn d64;
- char data[dyn_filesz];
- } data_buf;
- data_buf *buf = malloc (sizeof (data_buf));
+ void *buf = malloc (dyn_filesz);
+ Elf32_Dyn *d32 = buf;
+ Elf64_Dyn *d64 = buf;
if (unlikely (buf == NULL))
{
__libdwfl_seterrno (DWFL_E_NOMEM);
@@ -980,18 +960,13 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
(&out, &in, elfdata) != NULL))
{
/* We are looking for DT_DEBUG. */
- const union
- {
- Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)];
- Elf64_Dyn d64[dyn_filesz / sizeof (Elf64_Dyn)];
- } *u = (void *) buf;
if (elfclass == ELFCLASS32)
{
size_t n = dyn_filesz / sizeof (Elf32_Dyn);
for (size_t i = 0; i < n; ++i)
- if (u->d32[i].d_tag == DT_DEBUG)
+ if (d32[i].d_tag == DT_DEBUG)
{
- r_debug_vaddr = u->d32[i].d_un.d_val;
+ r_debug_vaddr = d32[i].d_un.d_val;
break;
}
}
@@ -999,9 +974,9 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
{
size_t n = dyn_filesz / sizeof (Elf64_Dyn);
for (size_t i = 0; i < n; ++i)
- if (u->d64[i].d_tag == DT_DEBUG)
+ if (d64[i].d_tag == DT_DEBUG)
{
- r_debug_vaddr = u->d64[i].d_un.d_val;
+ r_debug_vaddr = d64[i].d_un.d_val;
break;
}
}
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
index 8324244..6f7bfab 100644
--- a/libelf/elf_getarsym.c
+++ b/libelf/elf_getarsym.c
@@ -203,11 +203,7 @@ elf_getarsym (elf, ptr)
elf->state.ar.ar_sym = (Elf_Arsym *) malloc (ar_sym_len);
if (elf->state.ar.ar_sym != NULL)
{
- union
- {
- uint32_t u32[n];
- uint64_t u64[n];
- } *file_data;
+ void *file_data; /* unit32_t[n] or uint64_t[n] */
char *str_data;
size_t sz = n * w;
@@ -274,7 +270,7 @@ elf_getarsym (elf, ptr)
arsym[cnt].as_name = str_data;
if (index64_p)
{
- uint64_t tmp = file_data->u64[cnt];
+ uint64_t tmp = ((uint64_t *) file_data)[cnt];
if (__BYTE_ORDER == __LITTLE_ENDIAN)
tmp = bswap_64 (tmp);
@@ -296,9 +292,9 @@ elf_getarsym (elf, ptr)
}
}
else if (__BYTE_ORDER == __LITTLE_ENDIAN)
- arsym[cnt].as_off = bswap_32 (file_data->u32[cnt]);
+ arsym[cnt].as_off = bswap_32 (((uint32_t *) file_data)[cnt]);
else
- arsym[cnt].as_off = file_data->u32[cnt];
+ arsym[cnt].as_off = ((uint32_t *) file_data)[cnt];
arsym[cnt].as_hash = _dl_elf_hash (str_data);
str_data = rawmemchr (str_data, '\0') + 1;
diff --git a/src/readelf.c b/src/readelf.c
index 8e64400..6011ad7 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -4943,7 +4943,7 @@ print_cfa_program (const unsigned char *readp, const unsigned char *const endp,
unsigned int version, unsigned int ptr_size,
Dwfl_Module *dwflmod, Ebl *ebl, Dwarf *dbg)
{
- char regnamebuf[REGNAMESZ];
+ char *regnamebuf = alloca (REGNAMESZ);
const char *regname (unsigned int regno)
{
register_info (ebl, regno, NULL, regnamebuf, NULL, NULL);
@@ -8378,11 +8378,16 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc,
DO_TYPE (XWORD, Xword, "0x%.16" PRIx64, "%" PRId64); \
DO_TYPE (SXWORD, Sxword, "%" PRId64, "%" PRId64)
-#define DO_TYPE(NAME, Name, hex, dec) GElf_##Name Name[count]
- union { TYPES; } value;
+#define DO_TYPE(NAME, Name, hex, dec) GElf_##Name Name
+ typedef union { TYPES; } value_t;
+ void *data = alloca (count * sizeof (value_t));
+#undef DO_TYPE
+
+#define DO_TYPE(NAME, Name, hex, dec) \
+ GElf_##Name *value_##Name __attribute__((unused)) = data
+ TYPES;
#undef DO_TYPE
- void *data = &value;
size_t size = gelf_fsize (core, item->type, count, EV_CURRENT);
size_t convsize = size;
if (repeated_size != NULL)
@@ -8413,7 +8418,7 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc,
#define DO_TYPE(NAME, Name, hex, dec) \
case ELF_T_##NAME: \
colno = print_core_item (colno, ',', WRAP_COLUMN, \
- 0, item->name, dec, value.Name[0]); \
+ 0, item->name, dec, value_##Name[0]); \
break
TYPES;
#undef DO_TYPE
@@ -8429,7 +8434,7 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc,
#define DO_TYPE(NAME, Name, hex, dec) \
case ELF_T_##NAME: \
colno = print_core_item (colno, ',', WRAP_COLUMN, \
- 0, item->name, hex, value.Name[0]); \
+ 0, item->name, hex, value_##Name[0]); \
break
TYPES;
#undef DO_TYPE
@@ -8519,8 +8524,8 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc,
{
#define DO_TYPE(NAME, Name, hex, dec) \
case ELF_T_##NAME: \
- sec = value.Name[0]; \
- usec = value.Name[1]; \
+ sec = value_##Name[0]; \
+ usec = value_##Name[1]; \
break
TYPES;
#undef DO_TYPE
@@ -8550,12 +8555,12 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc,
case 'c':
assert (count == 1);
colno = print_core_item (colno, ',', WRAP_COLUMN, 0, item->name,
- "%c", value.Byte[0]);
+ "%c", value_Byte[0]);
break;
case 's':
colno = print_core_item (colno, ',', WRAP_COLUMN, 0, item->name,
- "%.*s", (int) count, value.Byte);
+ "%.*s", (int) count, value_Byte);
break;
case '\n':
@@ -8899,8 +8904,9 @@ handle_core_registers (Ebl *ebl, Elf *core, const void *desc,
assert (maxnreg > 0);
}
- struct register_info regs[maxnreg];
- memset (regs, 0, sizeof regs);
+ const int sizeof_regs = sizeof (struct register_info) * maxnreg;
+ struct register_info *regs = alloca (sizeof_regs);
+ memset (regs, 0, sizeof_regs);
/* Sort to collect the sets together. */
int maxreg = 0;
diff --git a/src/unstrip.c b/src/unstrip.c
index 82bcdd8..7507eef 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -1013,13 +1013,16 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab,
error (EXIT_FAILURE, 0, _("invalid contents in '%s' section"),
".gnu.prelink_undo");
- union
+ typedef union
{
- Elf32_Shdr s32[shnum - 1];
- Elf64_Shdr s64[shnum - 1];
- } shdr;
- dst.d_buf = &shdr;
- dst.d_size = sizeof shdr;
+ Elf32_Shdr s32;
+ Elf64_Shdr s64;
+ } shdr_u;
+ void *shdr = alloca ((shnum - 1) * sizeof (shdr_u));
+ Elf32_Shdr *s32 = shdr;
+ Elf64_Shdr *s64 = shdr;
+ dst.d_buf = shdr;
+ dst.d_size = (shnum - 1) * sizeof (shdr_u);
ELF_CHECK (gelf_xlatetom (main, &dst, &src,
main_ehdr->e_ident[EI_DATA]) != NULL,
_("cannot read '.gnu.prelink_undo' section: %s"));
@@ -1030,7 +1033,7 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab,
struct section *sec = &undo_sections[undo_nalloc];
if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32)
{
-#define COPY(field) sec->shdr.field = shdr.s32[i].field
+#define COPY(field) sec->shdr.field = s32[i].field
COPY (sh_name);
COPY (sh_type);
COPY (sh_flags);
@@ -1044,7 +1047,7 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab,
#undef COPY
}
else
- sec->shdr = shdr.s64[i];
+ sec->shdr = s64[i];
if (sec->shdr.sh_flags & SHF_ALLOC)
{
sec->shdr.sh_addr += bias;
@@ -1260,7 +1263,8 @@ copy_elided_sections (Elf *unstripped, Elf *stripped,
more sections in stripped file than debug file -- arguments reversed?"));
/* Cache the stripped file's section details. */
- struct section sections[stripped_shnum - 1];
+ struct section *sections =
+ alloca (sizeof (struct section) * (stripped_shnum - 1));
Elf_Scn *scn = NULL;
while ((scn = elf_nextscn (stripped, scn)) != NULL)
{
--
2.5.0.457.gab17608
8 years, 1 month
Bugzilla component missing and another (minor) fuzzing-related bug report
by Hanno Böck
Hi,
The elfutils webpage says:
"To report bugs: please open a bugzilla report against the elfutils
component."
However it seems the redhat bugzilla doesn't have an elfutils
component. Therefore I'm reporting it here, hope that's okay.
The attached file will cause a huge malloc allocation with elfutils' nm
tool. This will crash if you try to run it with address sanitizer.
The reason is likely that nm will try to allocate space for something
based on the header value - no matter if that value makes any sense. A
sanity check that checks in such cases if the file itself is smaller
than the supposedly allocated memory could avoid that.
Address Sanitizer trace:
==29915==ERROR: AddressSanitizer failed to allocate 0xb18002000
(47647301632) bytes of LargeMmapAllocator: 12
==19508==AddressSanitizer CHECK
failed: /var/tmp/portage/sys-devel/gcc-4.9.2/work/gcc-4.9.2/libsanitizer/sanitizer_common/sanitizer_posix.cc:66
"(("unable to mmap" && 0)) != (0)" (0x0, 0x0) #0 0x7f1a5001df90
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x5cf90) #1
0x7f1a500221f3 in __sanitizer::CheckFailed(char const*, int, char
const*, unsigned long long, unsigned long long)
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x611f3) #2
0x7f1a50027041
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x66041) #3
0x7f1a4ffddad8
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x1cad8) #4
0x7f1a5001868f in malloc
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x5768f) #5
0x41a421 in xmalloc /f/elfutils/elfutils-0.163/lib/xmalloc.c:52 #6
0x4089a4 in show_symbols /f/elfutils/elfutils-0.163/src/nm.c:1212 #7
0x40ce47 in handle_elf /f/elfutils/elfutils-0.163/src/nm.c:1484 #8
0x4033a6 in process_file /f/elfutils/elfutils-0.163/src/nm.c:387 #9
0x4033a6 in main /f/elfutils/elfutils-0.163/src/nm.c:248 #10
0x7f1a4f2cef9f in __libc_start_main (/lib64/libc.so.6+0x1ff9f) #11
0x40438e (/old-ram/elfutils/nm+0x40438e)
--
Hanno Böck
http://hboeck.de/
mail/jabber: hanno(a)hboeck.de
GPG: BBB51E42
8 years, 1 month
[PATCH] Replace libdwelf nested functions with macros.
by Chih-Hung Hsieh
To be compiled without gnu99 extension.
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
libdwelf/ChangeLog | 5 +++++
libdwelf/dwelf_elf_gnu_build_id.c | 42 +++++++++++++++++++++------------------
2 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/libdwelf/ChangeLog b/libdwelf/ChangeLog
index 342cb9c..1300182 100644
--- a/libdwelf/ChangeLog
+++ b/libdwelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-14 Chih-Hung Hsieh <chh(a)google.com>
+
+ * dwelf_elf_gnu_build_id.c (find_elf_build_id): Replace nested function
+ with macro.
+
2014-11-14 Mark Wielaard <mjw(a)redhat.com>
* dwelf_elf_gnu_debuglink.c (dwelf_elf_gnu_debuglink): Check d_buf
diff --git a/libdwelf/dwelf_elf_gnu_build_id.c b/libdwelf/dwelf_elf_gnu_build_id.c
index 1ed501d..cb20bca 100644
--- a/libdwelf/dwelf_elf_gnu_build_id.c
+++ b/libdwelf/dwelf_elf_gnu_build_id.c
@@ -42,25 +42,29 @@ find_elf_build_id (Dwfl_Module *mod, int e_type, Elf *elf,
const void **build_id_bits, GElf_Addr *build_id_elfaddr,
int *build_id_len)
{
- int check_notes (Elf_Data *data, GElf_Addr data_elfaddr)
- {
- size_t pos = 0;
- GElf_Nhdr nhdr;
- size_t name_pos;
- size_t desc_pos;
- while ((pos = gelf_getnote (data, pos, &nhdr, &name_pos, &desc_pos)) > 0)
- if (nhdr.n_type == NT_GNU_BUILD_ID
- && nhdr.n_namesz == sizeof "GNU" && !memcmp (data->d_buf + name_pos,
- "GNU", sizeof "GNU"))
- {
- *build_id_bits = data->d_buf + desc_pos;
- *build_id_elfaddr = (data_elfaddr == NO_VADDR
- ? 0 : data_elfaddr + desc_pos);
- *build_id_len = nhdr.n_descsz;
- return 1;
- }
- return 0;
- }
+#define check_notes(_data, _data_elfaddr) \
+ ( { \
+ Elf_Data *data = _data; \
+ GElf_Addr data_elfaddr = _data_elfaddr; \
+ int check_result = 0; \
+ size_t pos = 0; \
+ GElf_Nhdr nhdr; \
+ size_t name_pos; \
+ size_t desc_pos; \
+ while ((pos = gelf_getnote (data, pos, &nhdr, &name_pos, &desc_pos)) > 0) \
+ if (nhdr.n_type == NT_GNU_BUILD_ID \
+ && nhdr.n_namesz == sizeof "GNU" && !memcmp (data->d_buf + name_pos, \
+ "GNU", sizeof "GNU")) \
+ { \
+ *build_id_bits = data->d_buf + desc_pos; \
+ *build_id_elfaddr = (data_elfaddr == NO_VADDR \
+ ? 0 : data_elfaddr + desc_pos); \
+ *build_id_len = nhdr.n_descsz; \
+ check_result = 1; \
+ break; \
+ } \
+ check_result; \
+ } )
size_t shstrndx = SHN_UNDEF;
int result = 0;
--
2.6.0.rc0.131.gf624c3d
8 years, 1 month
[PATCH] Move recursive nested function to file scope.
by Chih-Hung Hsieh
Prepare to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
src/ChangeLog | 5 ++++
src/ld.c | 94 ++++++++++++++++++++++++++++++-----------------------------
2 files changed, 53 insertions(+), 46 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 238c416..981aaeb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-15 Chih-Hung Hsieh <chh(a)google.com>
+
+ * ld.c (determine_output_format): Move recurisve nested
+ function "try" to file scope.
+
2015-09-09 Chih-Hung Hsieh <chh(a)google.com>
* readelf.c (print_debug_exception_table): Initialize variable before
diff --git a/src/ld.c b/src/ld.c
index 6e96ae2..b9a4f64 100644
--- a/src/ld.c
+++ b/src/ld.c
@@ -1049,6 +1049,53 @@ parse_B_option_2 (const char *arg)
}
+static inline int
+try (int fd, Elf *elf)
+{
+ int result = 0;
+
+ if (elf == NULL)
+ return 0;
+
+ if (elf_kind (elf) == ELF_K_ELF)
+ {
+ /* We have an ELF file. We now can find out
+ what the output format should be. */
+ XElf_Ehdr_vardef(ehdr);
+
+ /* Get the ELF header of the object. */
+ xelf_getehdr (elf, ehdr);
+ if (ehdr != NULL)
+ ld_state.ebl =
+ ebl_openbackend_machine (ehdr->e_machine);
+
+ result = 1;
+ }
+ else if (elf_kind (elf) == ELF_K_AR)
+ {
+ /* Try the archive members. This could
+ potentially lead to wrong results if the
+ archive contains files for more than one
+ architecture. But this is the user's
+ problem. */
+ Elf *subelf;
+ Elf_Cmd cmd = ELF_C_READ_MMAP;
+
+ while ((subelf = elf_begin (fd, cmd, elf)) != NULL)
+ {
+ cmd = elf_next (subelf);
+
+ if (try (fd, subelf) != 0)
+ break;
+ }
+ }
+
+ elf_end (elf);
+
+ return result;
+}
+
+
static void
determine_output_format (void)
{
@@ -1078,52 +1125,7 @@ determine_output_format (void)
int fd = open (runp->name, O_RDONLY);
if (fd != -1)
{
- int try (Elf *elf)
- {
- int result = 0;
-
- if (elf == NULL)
- return 0;
-
- if (elf_kind (elf) == ELF_K_ELF)
- {
- /* We have an ELF file. We now can find out
- what the output format should be. */
- XElf_Ehdr_vardef(ehdr);
-
- /* Get the ELF header of the object. */
- xelf_getehdr (elf, ehdr);
- if (ehdr != NULL)
- ld_state.ebl =
- ebl_openbackend_machine (ehdr->e_machine);
-
- result = 1;
- }
- else if (elf_kind (elf) == ELF_K_AR)
- {
- /* Try the archive members. This could
- potentially lead to wrong results if the
- archive contains files for more than one
- architecture. But this is the user's
- problem. */
- Elf *subelf;
- Elf_Cmd cmd = ELF_C_READ_MMAP;
-
- while ((subelf = elf_begin (fd, cmd, elf)) != NULL)
- {
- cmd = elf_next (subelf);
-
- if (try (subelf) != 0)
- break;
- }
- }
-
- elf_end (elf);
-
- return result;
- }
-
- if (try (elf_begin (fd, ELF_C_READ_MMAP, NULL)) != 0)
+ if (try (fd, elf_begin (fd, ELF_C_READ_MMAP, NULL)) != 0)
/* Found a file. */
break;
}
--
2.6.0.rc0.131.gf624c3d
8 years, 1 month
[PATCH] libelf: Always update e_version and e_shentsize in elf_update.
by Mark Wielaard
When e_version is EV_NONE we should set it to EV_CURRENT like we do for
the EI_VERSION and like we set EI_DATA to the correct byte order when set
to ELFDATANONE. Likewise we should always set e_shentsize like we do for
e_phentsize, not just when ELF_F_LAYOUT isn't set.
Add a new elfshphehdr testcase to check the above.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libelf/ChangeLog | 5 ++
libelf/elf32_updatenull.c | 13 ++--
tests/ChangeLog | 7 ++
tests/Makefile.am | 7 +-
tests/elfshphehdr.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 207 insertions(+), 7 deletions(-)
create mode 100644 tests/elfshphehdr.c
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 1916877..0609b37 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-29 Mark Wielaard <mjw(a)redhat.com>
+
+ * elf32_updatenull.c (default_ehdr): Set e_version when EV_NONE.
+ (updatenull_wrlock): Always set e_shentsize.
+
2015-09-23 Mark Wielaard <mjw(a)redhat.com>
* elf32_getehdr.c (getehdr_wrlock): Mark as internal_function.
diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
index c59ffcb..d3754d3 100644
--- a/libelf/elf32_updatenull.c
+++ b/libelf/elf32_updatenull.c
@@ -84,8 +84,12 @@ ELFW(default_ehdr,LIBELFBITS) (Elf *elf, ElfW2(LIBELFBITS,Ehdr) *ehdr,
update_if_changed (ehdr->e_ident[EI_VERSION], EV_CURRENT,
elf->state.ELFW(elf,LIBELFBITS).ehdr_flags);
- if (unlikely (ehdr->e_version == EV_NONE)
- || unlikely (ehdr->e_version >= EV_NUM))
+ if (unlikely (ehdr->e_version == EV_NONE))
+ {
+ ehdr->e_version = EV_CURRENT;
+ elf->state.ELFW(elf,LIBELFBITS).ehdr_flags |= ELF_F_DIRTY;
+ }
+ else if (unlikely (ehdr->e_version >= EV_NUM))
{
__libelf_seterrno (ELF_E_UNKNOWN_VERSION);
return 1;
@@ -394,6 +398,8 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
while ((list = list->next) != NULL);
/* Store section information. */
+ update_if_changed (ehdr->e_shentsize,
+ elf_typesize (LIBELFBITS, ELF_T_SHDR, 1), ehdr_flags);
if (elf->flags & ELF_F_LAYOUT)
{
/* The user is supposed to fill out e_shoff. Use it and
@@ -414,9 +420,6 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
size = (size + SHDR_ALIGN - 1) & ~(SHDR_ALIGN - 1);
update_if_changed (ehdr->e_shoff, (GElf_Word) size, elf->flags);
- update_if_changed (ehdr->e_shentsize,
- elf_typesize (LIBELFBITS, ELF_T_SHDR, 1),
- ehdr_flags);
/* Account for the section header size. */
size += elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum);
diff --git a/tests/ChangeLog b/tests/ChangeLog
index b8ac61d..0f8925e 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-29 Mark Wielaard <mjw(a)redhat.com>
+
+ * elfshphehdr.c: New test.
+ * Makefile.am (check_PROGRAMS): Add elfshphehdr.
+ (TESTS): Likewise.
+ (elfshphehdr_LDADD): New variable.
+
2015-09-08 Mark Wielaard <mjw(a)redhat.com>
* dwfl-proc-attach.c: New test.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ca2c2d7..eaa904c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -51,7 +51,8 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
dwfl-report-elf-align varlocs backtrace backtrace-child \
backtrace-data backtrace-dwarf debuglink debugaltlink \
buildid deleted deleted-lib.so aggregate_size vdsosyms \
- getsrc_die strptr newdata elfstrtab dwfl-proc-attach
+ getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
+ elfshphehdr
asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
asm-tst6 asm-tst7 asm-tst8 asm-tst9
@@ -118,7 +119,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-stack-demangled-test.sh \
run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
run-linkmap-cut.sh run-aggregate-size.sh vdsosyms run-readelf-A.sh \
- run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach
+ run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach \
+ elfshphehdr
if !BIARCH
export ELFUTILS_DISABLE_BIARCH = 1
@@ -448,6 +450,7 @@ newdata_LDADD = $(libelf)
elfstrtab_LDADD = $(libelf)
dwfl_proc_attach_LDADD = $(libdw)
dwfl_proc_attach_LDFLAGS = -pthread
+elfshphehdr_LDADD =$(libelf)
if GCOV
check: check-am coverage
diff --git a/tests/elfshphehdr.c b/tests/elfshphehdr.c
new file mode 100644
index 0000000..5f6b96c
--- /dev/null
+++ b/tests/elfshphehdr.c
@@ -0,0 +1,182 @@
+/* Test program for adding section and program headers and ehdr updates.
+ Copyright (C) 2015 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+#include <assert.h>
+#include ELFUTILS_HEADER(elf)
+#include <gelf.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <stdbool.h>
+
+void
+check (const char *msg, bool check)
+{
+ if (! check)
+ {
+ fprintf (stderr, "%s FAILED\n", msg);
+ exit (-1);
+ }
+ else
+ fprintf (stderr, "%s OK\n", msg);
+}
+
+void
+check_elf (const char *msg, bool check)
+{
+ if (! check)
+ {
+ fprintf (stderr, "%s: %s\n", msg, elf_errmsg (-1));
+ exit (-1);
+ }
+ else
+ fprintf (stderr, "%s OK\n", msg);
+}
+
+void
+test (Elf *elf, int class, bool layout)
+{
+ fprintf (stderr, "testing ELF class: %d, layout: %d\n", class, layout);
+
+ check_elf ("gelf_newehdr", gelf_newehdr (elf, class) != 0);
+ check_elf ("gelf_getclass", gelf_getclass (elf) == class);
+
+ check_elf ("elf_flagelf", elf_flagelf (elf, layout ? ELF_C_SET : ELF_C_CLR,
+ ELF_F_LAYOUT) != 0);
+
+ GElf_Ehdr ehdr;
+ check_elf ("gelf_getehdr", gelf_getehdr (elf, &ehdr) != NULL);
+ check ("e_shnum == 0", ehdr.e_shnum == 0);
+ check ("e_phnum == 0", ehdr.e_phnum == 0);
+ check ("e_shoff == 0", ehdr.e_shoff == 0);
+ check ("e_phoff == 0", ehdr.e_phoff == 0);
+
+ size_t shnum;
+ check_elf ("elf_getshdrnum", elf_getshdrnum (elf, &shnum) == 0);
+ check ("shnum == 0", shnum == 0);
+
+ size_t phnum;
+ check_elf ("elf_getphdrnum", elf_getphdrnum (elf, &phnum) == 0);
+ check ("phnum == 0", phnum == 0);
+
+ /* Lets fill in some info we are always responsible for. */
+ ehdr.e_ident[EI_DATA] = ELFDATANONE; /* Ask for native encoding. */
+ ehdr.e_type = ET_EXEC;
+ ehdr.e_machine = EM_386;
+ ehdr.e_version = EV_NONE; /* Ask for current version. */
+ check_elf ("gelf_update_ehdr", gelf_update_ehdr (elf, &ehdr) != 0);
+
+ check_elf ("elf_update", elf_update (elf, ELF_C_NULL) > 0);
+
+ check_elf ("gelf_getehdr", gelf_getehdr (elf, &ehdr) != NULL);
+ check ("EI_DATA", ehdr.e_ident[EI_DATA] != ELFDATANONE);
+ check ("e_version", ehdr.e_version == EV_CURRENT);
+
+ /* The sh/ph values shouldn't have changed. */
+ check ("e_shnum == 0", ehdr.e_shnum == 0);
+ check ("e_phnum == 0", ehdr.e_phnum == 0);
+ check ("e_shoff == 0", ehdr.e_shoff == 0);
+ check ("e_phoff == 0", ehdr.e_phoff == 0);
+
+ check_elf ("elf_getshdrnum", elf_getshdrnum (elf, &shnum) == 0);
+ check ("shnum == 0", shnum == 0);
+
+ check_elf ("elf_getphdrnum", elf_getphdrnum (elf, &phnum) == 0);
+ check ("phnum == 0", phnum == 0);
+
+ /* Lets add a header. */
+ check_elf ("elf_newscn", elf_newscn (elf) != NULL);
+ check_elf ("gelf_newphdr", gelf_newphdr (elf, 1) != 0);
+
+ /* If we are responsible for the layout ourselves we should also
+ tell where to put them. */
+ if (layout)
+ {
+ check_elf ("gelf_getehdr", gelf_getehdr (elf, &ehdr) != NULL);
+ /* phdrs go right after the ehdr. */
+ ehdr.e_phoff = ehdr.e_ehsize;
+ /* shdrs go right after the phdrs. */
+ ehdr.e_shoff = ehdr.e_phoff + ehdr.e_phnum * ehdr.e_phentsize;
+ check_elf ("gelf_update_ehdr", gelf_update_ehdr (elf, &ehdr) != 0);
+ }
+
+ check_elf ("elf_update", elf_update (elf, ELF_C_NULL) > 0);
+
+ check_elf ("elf_getshdrnum", elf_getshdrnum (elf, &shnum) == 0);
+ check ("shnum == 1", shnum == 2); /* section zero is also created. */
+
+ check_elf ("elf_getphdrnum", elf_getphdrnum (elf, &phnum) != 0);
+ check ("phnum == 1", phnum == 1);
+
+ check_elf ("gelf_getehdr", gelf_getehdr (elf, &ehdr) != NULL);
+
+ check ("EI_DATA", ehdr.e_ident[EI_DATA] != ELFDATANONE);
+ check ("e_version", ehdr.e_version == EV_CURRENT);
+
+ check ("e_shnum == 2", ehdr.e_shnum == 2);
+ check ("e_phnum == 1", ehdr.e_phnum == 1);
+ check ("e_shoff != 0", ehdr.e_shoff != 0);
+ check ("e_phoff != 0", ehdr.e_phoff != 0);
+
+ size_t shentsize = (class == ELFCLASS32
+ ? sizeof (Elf32_Shdr) : sizeof (Elf64_Shdr));
+ check ("e_shentsize", ehdr.e_shentsize == shentsize);
+ size_t phentsize = (class == ELFCLASS32
+ ? sizeof (Elf32_Phdr) : sizeof (Elf64_Phdr));
+ check ("e_phentsize", ehdr.e_phentsize == phentsize);
+}
+
+int
+main (int argc __attribute__ ((unused)), char **argv __attribute ((unused)))
+{
+ elf_version (EV_CURRENT);
+
+ int fd = fd = open("/dev/zero", O_WRONLY);
+ check ("open", fd >= 0);
+
+ Elf *elf;
+
+ elf = elf_begin (fd, ELF_C_WRITE, NULL);
+ check_elf ("elf_begin", elf != NULL);
+ test (elf, ELFCLASS32, false);
+ elf_end (elf);
+
+ elf = elf_begin (fd, ELF_C_WRITE, NULL);
+ check_elf ("elf_begin", elf != NULL);
+ test (elf, ELFCLASS32, true);
+ elf_end (elf);
+
+ elf = elf_begin (fd, ELF_C_WRITE, NULL);
+ check_elf ("elf_begin", elf != NULL);
+ test (elf, ELFCLASS64, false);
+ elf_end (elf);
+
+ elf = elf_begin (fd, ELF_C_WRITE, NULL);
+ check_elf ("elf_begin", elf != NULL);
+ test (elf, ELFCLASS64, true);
+ elf_end (elf);
+
+ close (fd);
+ return 0;
+}
--
2.4.3
8 years, 1 month
[PATCH] Move 4 libdwfl nested functions.
by Chih-Hung Hsieh
Now they should compile with clang.
Used local variables are passed to new file scope functions
as constant parameters, or pointers, or embedded in a
'state' structure.
One simple function "report" is changed to a macro.
It triggers a gcc false positive -Werror=maybe-uninitialized,
so the local variables are explicitly initialized.
Signed-off-by: Chih-Hung Hsieh <chh(a)google.com>
---
libdwfl/ChangeLog | 16 ++++
libdwfl/linux-kernel-modules.c | 120 +++++++++++++++------------
libdwfl/relocate.c | 184 ++++++++++++++++++++++-------------------
3 files changed, 182 insertions(+), 138 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0ab386f..b9f42a1 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,19 @@
+2015-09-18 Chih-Hung Hsieh <chh(a)google.com>
+
+ * relocate.c (relocate_section): Move nested function "relocate"
+ to file scope, pass all used local variables as constants.
+ Move nested "check_badreltype" to file scope, pass addresses of
+ updated used local variables.
+ * linux-kernel-modules.c (intuit_kernel_bounds): Move nested function
+ "read_address" to file scope, pass all updated local variables in
+ a state structure.
+ * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Move nested
+ function "subst_name" to file scope, pass all used local variables
+ as constants.
+ * linux-kernel-modules.c (dwfl_linux_kernel_report_kernel): Replace
+ simple nested function "report" with a macro. Work around gcc static
+ analysis error -Werror=maybe-uninitialized.
+
2015-09-09 Chih-Hung Hsieh <chh(a)google.com>
Mark Wielaard <mjw(a)redhat.com>
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 236e2cd..dafe893 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -440,46 +440,55 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
INTDEF (dwfl_linux_kernel_report_offline)
+/* State of read_address used by intuit_kernel_bounds. */
+struct read_address_state {
+ FILE *f;
+ char *line;
+ size_t linesz;
+ size_t n;
+ char *p;
+ const char *type;
+};
+
+static inline bool
+read_address (struct read_address_state *state, Dwarf_Addr *addr)
+{
+ if ((state->n = getline (&state->line, &state->linesz, state->f)) < 1 ||
+ state->line[state->n - 2] == ']')
+ return false;
+ *addr = strtoull (state->line, &state->p, 16);
+ state->p += strspn (state->p, " \t");
+ state->type = strsep (&state->p, " \t\n");
+ if (state->type == NULL)
+ return false;
+ return state->p != NULL && state->p != state->line;
+}
+
+
/* Grovel around to guess the bounds of the runtime kernel image. */
static int
intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes)
{
- FILE *f = fopen (KSYMSFILE, "r");
- if (f == NULL)
+ struct read_address_state state = { NULL, NULL, 0, 0, NULL, NULL };
+
+ state.f = fopen (KSYMSFILE, "r");
+ if (state.f == NULL)
return errno;
- (void) __fsetlocking (f, FSETLOCKING_BYCALLER);
+ (void) __fsetlocking (state.f, FSETLOCKING_BYCALLER);
*notes = 0;
- char *line = NULL;
- size_t linesz = 0;
- size_t n;
- char *p = NULL;
- const char *type;
-
- inline bool read_address (Dwarf_Addr *addr)
- {
- if ((n = getline (&line, &linesz, f)) < 1 || line[n - 2] == ']')
- return false;
- *addr = strtoull (line, &p, 16);
- p += strspn (p, " \t");
- type = strsep (&p, " \t\n");
- if (type == NULL)
- return false;
- return p != NULL && p != line;
- }
-
int result;
do
- result = read_address (start) ? 0 : -1;
- while (result == 0 && strchr ("TtRr", *type) == NULL);
+ result = read_address (&state, start) ? 0 : -1;
+ while (result == 0 && strchr ("TtRr", *state.type) == NULL);
if (result == 0)
{
*end = *start;
- while (read_address (end))
- if (*notes == 0 && !strcmp (p, "__start_notes\n"))
+ while (read_address (&state, end))
+ if (*notes == 0 && !strcmp (state.p, "__start_notes\n"))
*notes = *end;
Dwarf_Addr round_kernel = sysconf (_SC_PAGE_SIZE);
@@ -489,12 +498,12 @@ intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes)
if (*start >= *end || *end - *start < round_kernel)
result = -1;
}
- free (line);
+ free (state.line);
if (result == -1)
- result = ferror_unlocked (f) ? errno : ENOEXEC;
+ result = ferror_unlocked (state.f) ? errno : ENOEXEC;
- fclose (f);
+ fclose (state.f);
return result;
}
@@ -619,12 +628,11 @@ check_module_notes (Dwfl_Module *mod)
int
dwfl_linux_kernel_report_kernel (Dwfl *dwfl)
{
- Dwarf_Addr start;
- Dwarf_Addr end;
- inline Dwfl_Module *report (void)
- {
- return INTUSE(dwfl_report_module) (dwfl, KERNEL_MODNAME, start, end);
- }
+ Dwarf_Addr start = 0;
+ Dwarf_Addr end = 0;
+
+ #define report() \
+ (INTUSE(dwfl_report_module) (dwfl, KERNEL_MODNAME, start, end))
/* This is a bit of a kludge. If we already reported the kernel,
don't bother figuring it out again--it never changes. */
@@ -657,6 +665,29 @@ dwfl_linux_kernel_report_kernel (Dwfl *dwfl)
INTDEF (dwfl_linux_kernel_report_kernel)
+static inline bool
+subst_name (char from, char to,
+ const char * const module_name,
+ char * const alternate_name,
+ const size_t namelen)
+{
+ const char *n = memchr (module_name, from, namelen);
+ if (n == NULL)
+ return false;
+ char *a = mempcpy (alternate_name, module_name, n - module_name);
+ *a++ = to;
+ ++n;
+ const char *p;
+ while ((p = memchr (n, from, namelen - (n - module_name))) != NULL)
+ {
+ a = mempcpy (a, n, p - n);
+ *a++ = to;
+ n = p + 1;
+ }
+ memcpy (a, n, namelen - (n - module_name) + 1);
+ return true;
+}
+
/* Dwfl_Callbacks.find_elf for the running Linux kernel and its modules. */
int
@@ -713,25 +744,8 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod,
free (modulesdir[0]);
return ENOMEM;
}
- inline bool subst_name (char from, char to)
- {
- const char *n = memchr (module_name, from, namelen);
- if (n == NULL)
- return false;
- char *a = mempcpy (alternate_name, module_name, n - module_name);
- *a++ = to;
- ++n;
- const char *p;
- while ((p = memchr (n, from, namelen - (n - module_name))) != NULL)
- {
- a = mempcpy (a, n, p - n);
- *a++ = to;
- n = p + 1;
- }
- memcpy (a, n, namelen - (n - module_name) + 1);
- return true;
- }
- if (!subst_name ('-', '_') && !subst_name ('_', '-'))
+ if (!subst_name ('-', '_', module_name, alternate_name, namelen) &&
+ !subst_name ('_', '-', module_name, alternate_name, namelen))
alternate_name[0] = '\0';
FTSENT *f;
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index e102e1e..2dc6737 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -277,77 +277,18 @@ resolve_symbol (Dwfl_Module *referer, struct reloc_symtab_cache *symtab,
return DWFL_E_RELUNDEF;
}
+/* Apply one relocation. Returns true for any invalid data. */
static Dwfl_Error
-relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
- size_t shstrndx, struct reloc_symtab_cache *reloc_symtab,
- Elf_Scn *scn, GElf_Shdr *shdr,
- Elf_Scn *tscn, bool debugscn, bool partial)
+relocate (Dwfl_Module * const mod,
+ Elf * const relocated,
+ struct reloc_symtab_cache * const reloc_symtab,
+ Elf_Data * const tdata,
+ const GElf_Ehdr * const ehdr,
+ GElf_Addr offset,
+ const GElf_Sxword *addend,
+ int rtype,
+ int symndx)
{
- /* First, fetch the name of the section these relocations apply to. */
- GElf_Shdr tshdr_mem;
- GElf_Shdr *tshdr = gelf_getshdr (tscn, &tshdr_mem);
- const char *tname = elf_strptr (relocated, shstrndx, tshdr->sh_name);
- if (tname == NULL)
- return DWFL_E_LIBELF;
-
- if (unlikely (tshdr->sh_type == SHT_NOBITS) || unlikely (tshdr->sh_size == 0))
- /* No contents to relocate. */
- return DWFL_E_NOERROR;
-
- if (debugscn && ! ebl_debugscn_p (mod->ebl, tname))
- /* This relocation section is not for a debugging section.
- Nothing to do here. */
- return DWFL_E_NOERROR;
-
- /* Fetch the section data that needs the relocations applied. */
- Elf_Data *tdata = elf_rawdata (tscn, NULL);
- if (tdata == NULL)
- return DWFL_E_LIBELF;
-
- /* If either the section that needs the relocation applied, or the
- section that the relocations come from overlap one of the ehdrs,
- shdrs or phdrs data then we refuse to do the relocations. It
- isn't illegal for ELF section data to overlap the header data,
- but updating the (relocation) data might corrupt the in-memory
- libelf headers causing strange corruptions or errors. */
- size_t ehsize = gelf_fsize (relocated, ELF_T_EHDR, 1, EV_CURRENT);
- if (unlikely (shdr->sh_offset < ehsize
- || tshdr->sh_offset < ehsize))
- return DWFL_E_BADELF;
-
- GElf_Off shdrs_start = ehdr->e_shoff;
- size_t shnums;
- if (elf_getshdrnum (relocated, &shnums) < 0)
- return DWFL_E_LIBELF;
- /* Overflows will have been checked by elf_getshdrnum/get|rawdata. */
- size_t shentsize = gelf_fsize (relocated, ELF_T_SHDR, 1, EV_CURRENT);
- GElf_Off shdrs_end = shdrs_start + shnums * shentsize;
- if (unlikely ((shdrs_start < shdr->sh_offset + shdr->sh_size
- && shdr->sh_offset < shdrs_end)
- || (shdrs_start < tshdr->sh_offset + tshdr->sh_size
- && tshdr->sh_offset < shdrs_end)))
- return DWFL_E_BADELF;
-
- GElf_Off phdrs_start = ehdr->e_phoff;
- size_t phnums;
- if (elf_getphdrnum (relocated, &phnums) < 0)
- return DWFL_E_LIBELF;
- if (phdrs_start != 0 && phnums != 0)
- {
- /* Overflows will have been checked by elf_getphdrnum/get|rawdata. */
- size_t phentsize = gelf_fsize (relocated, ELF_T_PHDR, 1, EV_CURRENT);
- GElf_Off phdrs_end = phdrs_start + phnums * phentsize;
- if (unlikely ((phdrs_start < shdr->sh_offset + shdr->sh_size
- && shdr->sh_offset < phdrs_end)
- || (phdrs_start < tshdr->sh_offset + tshdr->sh_size
- && tshdr->sh_offset < phdrs_end)))
- return DWFL_E_BADELF;
- }
-
- /* Apply one relocation. Returns true for any invalid data. */
- Dwfl_Error relocate (GElf_Addr offset, const GElf_Sxword *addend,
- int rtype, int symndx)
- {
/* First see if this is a reloc we can handle.
If we are skipping it, don't bother resolving the symbol. */
@@ -482,7 +423,89 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
/* We have applied this relocation! */
return DWFL_E_NOERROR;
- }
+}
+
+static inline void
+check_badreltype (bool *first_badreltype,
+ Dwfl_Module *mod,
+ Dwfl_Error *result)
+{
+ if (*first_badreltype)
+ {
+ *first_badreltype = false;
+ if (ebl_get_elfmachine (mod->ebl) == EM_NONE)
+ /* This might be because ebl_openbackend failed to find
+ any libebl_CPU.so library. Diagnose that clearly. */
+ *result = DWFL_E_UNKNOWN_MACHINE;
+ }
+}
+
+static Dwfl_Error
+relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
+ size_t shstrndx, struct reloc_symtab_cache *reloc_symtab,
+ Elf_Scn *scn, GElf_Shdr *shdr,
+ Elf_Scn *tscn, bool debugscn, bool partial)
+{
+ /* First, fetch the name of the section these relocations apply to. */
+ GElf_Shdr tshdr_mem;
+ GElf_Shdr *tshdr = gelf_getshdr (tscn, &tshdr_mem);
+ const char *tname = elf_strptr (relocated, shstrndx, tshdr->sh_name);
+ if (tname == NULL)
+ return DWFL_E_LIBELF;
+
+ if (unlikely (tshdr->sh_type == SHT_NOBITS) || unlikely (tshdr->sh_size == 0))
+ /* No contents to relocate. */
+ return DWFL_E_NOERROR;
+
+ if (debugscn && ! ebl_debugscn_p (mod->ebl, tname))
+ /* This relocation section is not for a debugging section.
+ Nothing to do here. */
+ return DWFL_E_NOERROR;
+
+ /* Fetch the section data that needs the relocations applied. */
+ Elf_Data *tdata = elf_rawdata (tscn, NULL);
+ if (tdata == NULL)
+ return DWFL_E_LIBELF;
+
+ /* If either the section that needs the relocation applied, or the
+ section that the relocations come from overlap one of the ehdrs,
+ shdrs or phdrs data then we refuse to do the relocations. It
+ isn't illegal for ELF section data to overlap the header data,
+ but updating the (relocation) data might corrupt the in-memory
+ libelf headers causing strange corruptions or errors. */
+ size_t ehsize = gelf_fsize (relocated, ELF_T_EHDR, 1, EV_CURRENT);
+ if (unlikely (shdr->sh_offset < ehsize
+ || tshdr->sh_offset < ehsize))
+ return DWFL_E_BADELF;
+
+ GElf_Off shdrs_start = ehdr->e_shoff;
+ size_t shnums;
+ if (elf_getshdrnum (relocated, &shnums) < 0)
+ return DWFL_E_LIBELF;
+ /* Overflows will have been checked by elf_getshdrnum/get|rawdata. */
+ size_t shentsize = gelf_fsize (relocated, ELF_T_SHDR, 1, EV_CURRENT);
+ GElf_Off shdrs_end = shdrs_start + shnums * shentsize;
+ if (unlikely ((shdrs_start < shdr->sh_offset + shdr->sh_size
+ && shdr->sh_offset < shdrs_end)
+ || (shdrs_start < tshdr->sh_offset + tshdr->sh_size
+ && tshdr->sh_offset < shdrs_end)))
+ return DWFL_E_BADELF;
+
+ GElf_Off phdrs_start = ehdr->e_phoff;
+ size_t phnums;
+ if (elf_getphdrnum (relocated, &phnums) < 0)
+ return DWFL_E_LIBELF;
+ if (phdrs_start != 0 && phnums != 0)
+ {
+ /* Overflows will have been checked by elf_getphdrnum/get|rawdata. */
+ size_t phentsize = gelf_fsize (relocated, ELF_T_PHDR, 1, EV_CURRENT);
+ GElf_Off phdrs_end = phdrs_start + phnums * phentsize;
+ if (unlikely ((phdrs_start < shdr->sh_offset + shdr->sh_size
+ && shdr->sh_offset < phdrs_end)
+ || (phdrs_start < tshdr->sh_offset + tshdr->sh_size
+ && tshdr->sh_offset < phdrs_end)))
+ return DWFL_E_BADELF;
+ }
/* Fetch the relocation section and apply each reloc in it. */
Elf_Data *reldata = elf_getdata (scn, NULL);
@@ -491,17 +514,6 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
Dwfl_Error result = DWFL_E_NOERROR;
bool first_badreltype = true;
- inline void check_badreltype (void)
- {
- if (first_badreltype)
- {
- first_badreltype = false;
- if (ebl_get_elfmachine (mod->ebl) == EM_NONE)
- /* This might be because ebl_openbackend failed to find
- any libebl_CPU.so library. Diagnose that clearly. */
- result = DWFL_E_UNKNOWN_MACHINE;
- }
- }
size_t sh_entsize
= gelf_fsize (relocated, shdr->sh_type == SHT_REL ? ELF_T_REL : ELF_T_RELA,
@@ -514,10 +526,11 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
GElf_Rel rel_mem, *r = gelf_getrel (reldata, relidx, &rel_mem);
if (r == NULL)
return DWFL_E_LIBELF;
- result = relocate (r->r_offset, NULL,
+ result = relocate (mod, relocated, reloc_symtab, tdata, ehdr,
+ r->r_offset, NULL,
GELF_R_TYPE (r->r_info),
GELF_R_SYM (r->r_info));
- check_badreltype ();
+ check_badreltype (&first_badreltype, mod, &result);
if (partial)
switch (result)
{
@@ -543,10 +556,11 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
&rela_mem);
if (r == NULL)
return DWFL_E_LIBELF;
- result = relocate (r->r_offset, &r->r_addend,
+ result = relocate (mod, relocated, reloc_symtab, tdata, ehdr,
+ r->r_offset, &r->r_addend,
GELF_R_TYPE (r->r_info),
GELF_R_SYM (r->r_info));
- check_badreltype ();
+ check_badreltype (&first_badreltype, mod, &result);
if (partial)
switch (result)
{
--
2.6.0.rc0.131.gf624c3d
8 years, 1 month
[PATCH] Properly mark all internal function definitions.
by Mark Wielaard
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(a)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(a)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(a)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(a)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(a)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(a)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(a)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
8 years, 2 months
[PATCH] Remove old-style function definitions.
by Mark Wielaard
We already require -std=gnu99 and old-style function definitions might
hide some compiler warnings.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
backends/ChangeLog | 6 +++++
backends/arm_attrs.c | 10 +++-----
backends/linux-core-note.c | 12 +++------
backends/ppc_attrs.c | 10 +++-----
config/ChangeLog | 4 +++
config/eu.am | 2 +-
lib/ChangeLog | 9 +++++++
lib/dynamicsizehash.c | 31 +++++-----------------
lib/md5.c | 32 ++++++-----------------
lib/sha1.c | 23 +++++------------
lib/xmalloc.c | 12 +++------
lib/xstrdup.c | 5 ++--
lib/xstrndup.c | 6 ++---
libasm/ChangeLog | 4 +++
libasm/asm_abort.c | 3 +--
libasm/asm_addsleb128.c | 4 +--
libasm/asm_addstrz.c | 5 +---
libasm/asm_adduleb128.c | 4 +--
libasm/asm_align.c | 8 ++----
libasm/asm_end.c | 6 ++---
libasm/asm_error.c | 6 ++---
libasm/asm_fill.c | 5 +---
libasm/asm_getelf.c | 3 +--
libasm/asm_newabssym.c | 9 ++-----
libasm/asm_newcomsym.c | 7 ++---
libasm/asm_newscn.c | 7 ++---
libasm/asm_newscn_ingrp.c | 8 ++----
libasm/asm_newscngrp.c | 7 ++---
libasm/asm_newsubscn.c | 4 +--
libasm/asm_newsym.c | 8 ++----
libasm/asm_scngrp_newsignature.c | 4 +--
libdw/ChangeLog | 4 +++
libdw/dwarf_abbrevhaschildren.c | 3 +--
libdw/dwarf_addrdie.c | 5 +---
libdw/dwarf_aggregate_size.c | 4 +--
libdw/dwarf_arrayorder.c | 3 +--
libdw/dwarf_attr.c | 5 +---
libdw/dwarf_begin.c | 4 +--
libdw/dwarf_begin_elf.c | 5 +---
libdw/dwarf_bitoffset.c | 3 +--
libdw/dwarf_bitsize.c | 3 +--
libdw/dwarf_bytesize.c | 3 +--
libdw/dwarf_cfi_addrframe.c | 5 +---
libdw/dwarf_cfi_end.c | 3 +--
libdw/dwarf_child.c | 4 +--
libdw/dwarf_cu_die.c | 14 +++-------
libdw/dwarf_cu_getdwarf.c | 3 +--
libdw/dwarf_cuoffset.c | 3 +--
libdw/dwarf_diecu.c | 7 ++---
libdw/dwarf_diename.c | 3 +--
libdw/dwarf_dieoffset.c | 3 +--
libdw/dwarf_end.c | 3 +--
libdw/dwarf_entry_breakpoints.c | 4 +--
libdw/dwarf_entrypc.c | 4 +--
libdw/dwarf_error.c | 6 ++---
libdw/dwarf_formaddr.c | 4 +--
libdw/dwarf_formblock.c | 4 +--
libdw/dwarf_formflag.c | 4 +--
libdw/dwarf_formref.c | 8 ++----
libdw/dwarf_formref_die.c | 4 +--
libdw/dwarf_formsdata.c | 4 +--
libdw/dwarf_formstring.c | 3 +--
libdw/dwarf_formudata.c | 4 +--
libdw/dwarf_frame_cfa.c | 5 +---
libdw/dwarf_frame_info.c | 7 ++---
libdw/dwarf_frame_register.c | 8 ++----
libdw/dwarf_getabbrev.c | 13 +++-------
libdw/dwarf_getabbrevattr.c | 8 ++----
libdw/dwarf_getabbrevcode.c | 3 +--
libdw/dwarf_getabbrevtag.c | 3 +--
libdw/dwarf_getarange_addr.c | 4 +--
libdw/dwarf_getaranges.c | 5 +---
libdw/dwarf_getattrcnt.c | 4 +--
libdw/dwarf_getcfi.c | 3 +--
libdw/dwarf_getcfi_elf.c | 3 +--
libdw/dwarf_getelf.c | 3 +--
libdw/dwarf_getlocation.c | 40 ++++++++---------------------
libdw/dwarf_getlocation_attr.c | 5 +---
libdw/dwarf_getlocation_die.c | 6 ++---
libdw/dwarf_getlocation_implicit_pointer.c | 6 ++---
libdw/dwarf_getmacros.c | 7 ++---
libdw/dwarf_getpubnames.c | 8 +++---
libdw/dwarf_getsrcdirs.c | 5 +---
libdw/dwarf_getstring.c | 5 +---
libdw/dwarf_hasattr.c | 4 +--
libdw/dwarf_haschildren.c | 3 +--
libdw/dwarf_hasform.c | 4 +--
libdw/dwarf_highpc.c | 4 +--
libdw/dwarf_lowpc.c | 4 +--
libdw/dwarf_nextcu.c | 29 ++++++---------------
libdw/dwarf_offdie.c | 10 ++------
libdw/dwarf_peel_type.c | 4 +--
libdw/dwarf_siblingof.c | 4 +--
libdw/dwarf_srclang.c | 3 +--
libdw/dwarf_tag.c | 3 +--
libdw/dwarf_whatattr.c | 3 +--
libdw/dwarf_whatform.c | 3 +--
libdw/libdw_visit_scopes.c | 20 ++++++++-------
libdwfl/ChangeLog | 10 ++++++++
libdwfl/core-file.c | 4 +--
libdwfl/dwfl_error.c | 3 +--
libdwfl/dwfl_module_dwarf_cfi.c | 4 +--
libdwfl/dwfl_module_eh_cfi.c | 4 +--
libdwfl/dwfl_module_register_names.c | 11 ++++----
libdwfl/dwfl_module_return_value_location.c | 6 ++---
libdwfl/dwfl_version.c | 3 +--
libebl/ChangeLog | 4 +++
libebl/ebl_check_special_section.c | 7 ++---
libebl/ebl_check_special_symbol.c | 8 ++----
libebl/ebl_syscall_abi.c | 7 +----
libebl/eblabicfi.c | 4 +--
libebl/eblauxvinfo.c | 7 ++---
libebl/eblbackendname.c | 3 +--
libebl/eblbsspltp.c | 3 +--
libebl/eblcheckobjattr.c | 10 +++-----
libebl/eblcopyrelocp.c | 4 +--
libebl/eblcorenote.c | 14 +++-------
libebl/eblcorenotetypename.c | 6 +----
libebl/ebldebugscnp.c | 4 +--
libebl/ebldynamictagcheck.c | 4 +--
libebl/ebldynamictagname.c | 6 +----
libebl/eblelfclass.c | 3 +--
libebl/eblelfdata.c | 3 +--
libebl/eblelfmachine.c | 3 +--
libebl/eblgotpcreloccheck.c | 4 +--
libebl/eblmachineflagcheck.c | 4 +--
libebl/eblmachineflagname.c | 6 +----
libebl/eblmachinesectionflagcheck.c | 4 +--
libebl/eblnonerelocp.c | 4 +--
libebl/eblobjecttypename.c | 6 +----
libebl/eblobjnote.c | 8 ++----
libebl/eblobjnotetypename.c | 8 ++----
libebl/eblopenbackend.c | 8 ++----
libebl/eblosabiname.c | 6 +----
libebl/eblreginfo.c | 12 +++------
libebl/eblrelativerelocp.c | 4 +--
libebl/eblrelocsimpletype.c | 4 +--
libebl/eblreloctypecheck.c | 4 +--
libebl/eblreloctypename.c | 6 +----
libebl/eblrelocvaliduse.c | 4 +--
libebl/eblretval.c | 6 ++---
libebl/eblsectionname.c | 10 ++------
libebl/eblsectiontypename.c | 6 +----
libebl/eblsegmenttypename.c | 6 +----
libebl/eblshflagscombine.c | 5 +---
libebl/eblsymbolbindingname.c | 6 +----
libebl/eblsymboltypename.c | 6 +----
libebl/eblsysvhashentrysize.c | 3 +--
libelf/ChangeLog | 4 +++
libelf/elf32_checksum.c | 5 ++--
libelf/elf32_fsize.c | 7 ++---
libelf/elf32_getehdr.c | 12 +++------
libelf/elf32_getphdr.c | 8 +++---
libelf/elf32_getshdr.c | 11 +++-----
libelf/elf32_newehdr.c | 5 ++--
libelf/elf32_newphdr.c | 6 ++---
libelf/elf32_offscn.c | 6 ++---
libelf/elf32_xlatetof.c | 8 +++---
libelf/elf32_xlatetom.c | 8 +++---
libelf/elf_begin.c | 10 +++-----
libelf/elf_cntl.c | 6 ++---
libelf/elf_end.c | 5 ++--
libelf/elf_error.c | 8 +++---
libelf/elf_fill.c | 5 ++--
libelf/elf_flagdata.c | 7 ++---
libelf/elf_flagehdr.c | 7 ++---
libelf/elf_flagelf.c | 7 ++---
libelf/elf_flagphdr.c | 7 ++---
libelf/elf_flagscn.c | 7 ++---
libelf/elf_flagshdr.c | 7 ++---
libelf/elf_getarhdr.c | 5 ++--
libelf/elf_getaroff.c | 5 ++--
libelf/elf_getarsym.c | 4 +--
libelf/elf_getbase.c | 5 ++--
libelf/elf_getdata.c | 8 ++----
libelf/elf_getdata_rawchunk.c | 8 ++----
libelf/elf_getident.c | 6 ++---
libelf/elf_getphdrnum.c | 14 +++-------
libelf/elf_getscn.c | 6 ++---
libelf/elf_getshdrnum.c | 10 +++-----
libelf/elf_getshdrstrndx.c | 6 ++---
libelf/elf_gnu_hash.c | 5 ++--
libelf/elf_hash.c | 5 ++--
libelf/elf_kind.c | 5 ++--
libelf/elf_memory.c | 6 ++---
libelf/elf_ndxscn.c | 5 ++--
libelf/elf_newscn.c | 5 ++--
libelf/elf_next.c | 5 ++--
libelf/elf_nextscn.c | 6 ++---
libelf/elf_rand.c | 6 ++---
libelf/elf_rawdata.c | 6 ++---
libelf/elf_rawfile.c | 6 ++---
libelf/elf_readall.c | 5 ++--
libelf/elf_strptr.c | 5 +---
libelf/elf_update.c | 4 +--
libelf/elf_version.c | 5 ++--
libelf/gelf_checksum.c | 5 ++--
libelf/gelf_fsize.c | 8 ++----
libelf/gelf_getauxv.c | 7 ++---
libelf/gelf_getclass.c | 5 ++--
libelf/gelf_getdyn.c | 7 ++---
libelf/gelf_getehdr.c | 10 +++-----
libelf/gelf_getlib.c | 7 ++---
libelf/gelf_getmove.c | 7 ++---
libelf/gelf_getnote.c | 10 +++-----
libelf/gelf_getphdr.c | 7 ++---
libelf/gelf_getrel.c | 7 ++---
libelf/gelf_getrela.c | 7 ++---
libelf/gelf_getshdr.c | 6 ++---
libelf/gelf_getsym.c | 7 ++---
libelf/gelf_getsyminfo.c | 7 ++---
libelf/gelf_getsymshndx.c | 10 +++-----
libelf/gelf_getverdaux.c | 7 ++---
libelf/gelf_getverdef.c | 7 ++---
libelf/gelf_getvernaux.c | 7 ++---
libelf/gelf_getverneed.c | 7 ++---
libelf/gelf_getversym.c | 7 ++---
libelf/gelf_newehdr.c | 6 ++---
libelf/gelf_newphdr.c | 6 ++---
libelf/gelf_offscn.c | 6 ++---
libelf/gelf_update_auxv.c | 7 ++---
libelf/gelf_update_dyn.c | 7 ++---
libelf/gelf_update_lib.c | 7 ++---
libelf/gelf_update_move.c | 7 ++---
libelf/gelf_update_sym.c | 7 ++---
libelf/gelf_update_syminfo.c | 7 ++---
libelf/gelf_update_symshndx.c | 10 +++-----
libelf/gelf_update_verdaux.c | 7 ++---
libelf/gelf_update_verdef.c | 7 ++---
libelf/gelf_update_vernaux.c | 7 ++---
libelf/gelf_update_verneed.c | 7 ++---
libelf/gelf_update_versym.c | 7 ++---
libelf/gelf_xlatetof.c | 9 +++----
libelf/gelf_xlatetom.c | 9 +++----
src/ChangeLog | 4 +++
src/strip.c | 2 +-
236 files changed, 480 insertions(+), 1050 deletions(-)
diff --git a/backends/ChangeLog b/backends/ChangeLog
index 2059d86..0434e20 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-22 Chih-Hung Hsieh <chh(a)google.com>
+
+ * arm_attrs.c: Remove old-style function definitions.
+ * linux-core-note.c: Likewise.
+ * ppc_attrs.c: Likewise.
+
2015-09-04 Chih-Hung Hsieh <chh(a)google.com>
* aarch64_init.c (aarch64_init): Replace K&R function definition
diff --git a/backends/arm_attrs.c b/backends/arm_attrs.c
index c858715..6842b77 100644
--- a/backends/arm_attrs.c
+++ b/backends/arm_attrs.c
@@ -44,13 +44,9 @@
} while (0)
bool
-arm_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name)
- Ebl *ebl __attribute__ ((unused));
- const char *vendor;
- int tag;
- uint64_t value __attribute__ ((unused));
- const char **tag_name;
- const char **value_name;
+arm_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
+ const char *vendor, int tag, uint64_t value,
+ const char **tag_name, const char **value_name)
{
if (!strcmp (vendor, "aeabi"))
switch (tag)
diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c
index db82e85..ff2b226 100644
--- a/backends/linux-core-note.c
+++ b/backends/linux-core-note.c
@@ -204,14 +204,10 @@ static const Ebl_Core_Item vmcoreinfo_items[] =
#undef FIELD
int
-EBLHOOK(core_note) (nhdr, name, regs_offset, nregloc, reglocs, nitems, items)
- const GElf_Nhdr *nhdr;
- const char *name;
- GElf_Word *regs_offset;
- size_t *nregloc;
- const Ebl_Register_Location **reglocs;
- size_t *nitems;
- const Ebl_Core_Item **items;
+EBLHOOK(core_note) (const GElf_Nhdr *nhdr, const char *name,
+ GElf_Word *regs_offset, size_t *nregloc,
+ const Ebl_Register_Location **reglocs,
+ size_t *nitems, const Ebl_Core_Item **items)
{
switch (nhdr->n_namesz)
{
diff --git a/backends/ppc_attrs.c b/backends/ppc_attrs.c
index ebeafe5..612c576 100644
--- a/backends/ppc_attrs.c
+++ b/backends/ppc_attrs.c
@@ -37,13 +37,9 @@
#include "libebl_CPU.h"
bool
-ppc_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name)
- Ebl *ebl __attribute__ ((unused));
- const char *vendor;
- int tag;
- uint64_t value;
- const char **tag_name;
- const char **value_name;
+ppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
+ const char *vendor, int tag, uint64_t value,
+ const char **tag_name, const char **value_name)
{
if (!strcmp (vendor, "gnu"))
switch (tag)
diff --git a/config/ChangeLog b/config/ChangeLog
index 31eeca7..e24263c 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-22 Mark Wielaard <mjw(a)redhat.com>
+
+ * eu.am (AM_CFLAGS): Add -Wold-style-definition.
+
2015-08-04 Mark Wielaard <mjw(a)redhat.com>
* 10-default-yama-scope.conf: New file.
diff --git a/config/eu.am b/config/eu.am
index 70d32de..7d0c10d 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -38,7 +38,7 @@ STACK_USAGE_WARNING=-Wstack-usage=262144
else
STACK_USAGE_WARNING=
endif
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 -Wold-style-definition \
$(if $($(*F)_no_Werror),,-Werror) \
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
$(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
diff --git a/lib/ChangeLog b/lib/ChangeLog
index d04bf17..d1bdc7b 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,12 @@
+2015-09-22 Mark Wielaard <mjw(a)redhat.com>
+
+ * dynamicsizehash.c: Remove old-style function definitions.
+ * md5.c: Likewise.
+ * sha1.c: Likewise.
+ * xmalloc.c: Likewise.
+ * xstrdup.c: Likewise.
+ * xstrndup.c: Likewise.
+
2015-05-31 Mark Wielaard <mjw(a)redhat.com>
* eu-config.h (ALLOW_UNALIGNED): Define when ! CHECK_UNDEFINED.
diff --git a/lib/dynamicsizehash.c b/lib/dynamicsizehash.c
index 1fdff1b..f9406eb 100644
--- a/lib/dynamicsizehash.c
+++ b/lib/dynamicsizehash.c
@@ -44,10 +44,7 @@
static size_t
-lookup (htab, hval, val)
- NAME *htab;
- HASHTYPE hval;
- TYPE val __attribute__ ((unused));
+lookup (NAME *htab, HASHTYPE hval, TYPE val __attribute__ ((unused)))
{
/* First hash function: simply take the modul but prevent zero. Small values
can skip the division, which helps performance when this is common. */
@@ -176,9 +173,7 @@ int
#define INIT(name) _INIT (name)
#define _INIT(name) \
name##_init
-INIT(NAME) (htab, init_size)
- NAME *htab;
- size_t init_size;
+INIT(NAME) (NAME *htab, size_t init_size)
{
/* We need the size to be a prime. */
init_size = next_prime (init_size);
@@ -201,8 +196,7 @@ int
#define FREE(name) _FREE (name)
#define _FREE(name) \
name##_free
-FREE(NAME) (htab)
- NAME *htab;
+FREE(NAME) (NAME *htab)
{
free (htab->table);
return 0;
@@ -213,10 +207,7 @@ int
#define INSERT(name) _INSERT (name)
#define _INSERT(name) \
name##_insert
-INSERT(NAME) (htab, hval, data)
- NAME *htab;
- HASHTYPE hval;
- TYPE data;
+INSERT(NAME) (NAME *htab, HASHTYPE hval, TYPE data)
{
size_t idx;
@@ -240,10 +231,7 @@ int
#define INSERT(name) _INSERT (name)
#define _INSERT(name) \
name##_overwrite
-INSERT(NAME) (htab, hval, data)
- NAME *htab;
- HASHTYPE hval;
- TYPE data;
+INSERT(NAME) (NAME *htab, HASHTYPE hval, TYPE data)
{
size_t idx;
@@ -263,10 +251,7 @@ TYPE
#define FIND(name) _FIND (name)
#define _FIND(name) \
name##_find
-FIND(NAME) (htab, hval, val)
- NAME *htab;
- HASHTYPE hval;
- TYPE val;
+FIND(NAME) (NAME *htab, HASHTYPE hval, TYPE val)
{
size_t idx;
@@ -287,9 +272,7 @@ FIND(NAME) (htab, hval, val)
# define _ITERATEFCT(name) \
name##_iterate
TYPE
-ITERATEFCT(NAME) (htab, ptr)
- NAME *htab;
- void **ptr;
+ITERATEFCT(NAME) (NAME *htab, void **ptr)
{
void *p = *ptr;
diff --git a/lib/md5.c b/lib/md5.c
index 1c27549..40f3044 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,6 +1,6 @@
/* Functions to compute MD5 message digest of files or memory blocks.
according to the definition of MD5 in RFC 1321 from April 1992.
- Copyright (C) 1995-2011 Red Hat, Inc.
+ Copyright (C) 1995-2011, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1995.
@@ -49,8 +49,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
void
-md5_init_ctx (ctx)
- struct md5_ctx *ctx;
+md5_init_ctx (struct md5_ctx *ctx)
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
@@ -67,9 +66,7 @@ md5_init_ctx (ctx)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
-md5_read_ctx (ctx, resbuf)
- const struct md5_ctx *ctx;
- void *resbuf;
+md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
{
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -95,9 +92,7 @@ le64_copy (char *dest, uint64_t x)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
-md5_finish_ctx (ctx, resbuf)
- struct md5_ctx *ctx;
- void *resbuf;
+md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
{
/* Take yet unprocessed bytes into account. */
md5_uint32 bytes = ctx->buflen;
@@ -129,9 +124,7 @@ md5_finish_ctx (ctx, resbuf)
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int
-md5_stream (stream, resblock)
- FILE *stream;
- void *resblock;
+md5_stream (FILE *stream, void *resblock)
{
/* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096
@@ -189,10 +182,7 @@ md5_stream (stream, resblock)
output yields to the wanted ASCII representation of the message
digest. */
void *
-md5_buffer (buffer, len, resblock)
- const char *buffer;
- size_t len;
- void *resblock;
+md5_buffer (const char *buffer, size_t len, void *resblock)
{
struct md5_ctx ctx;
@@ -209,10 +199,7 @@ md5_buffer (buffer, len, resblock)
void
-md5_process_bytes (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct md5_ctx *ctx;
+md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
@@ -296,10 +283,7 @@ md5_process_bytes (buffer, len, ctx)
It is assumed that LEN % 64 == 0. */
void
-md5_process_block (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct md5_ctx *ctx;
+md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
{
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;
diff --git a/lib/sha1.c b/lib/sha1.c
index 0e84562..6a9b61f 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -1,6 +1,6 @@
/* Functions to compute SHA1 message digest of files or memory blocks.
according to the definition of SHA1 in FIPS 180-1 from April 1997.
- Copyright (C) 2008-2011 Red Hat, Inc.
+ Copyright (C) 2008-2011, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2008.
@@ -48,8 +48,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation. */
void
-sha1_init_ctx (ctx)
- struct sha1_ctx *ctx;
+sha1_init_ctx (struct sha1_ctx *ctx)
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
@@ -67,9 +66,7 @@ sha1_init_ctx (ctx)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
-sha1_read_ctx (ctx, resbuf)
- const struct sha1_ctx *ctx;
- void *resbuf;
+sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
{
((sha1_uint32 *) resbuf)[0] = SWAP (ctx->A);
((sha1_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -93,9 +90,7 @@ be64_copy (char *dest, uint64_t x)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
-sha1_finish_ctx (ctx, resbuf)
- struct sha1_ctx *ctx;
- void *resbuf;
+sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
{
/* Take yet unprocessed bytes into account. */
sha1_uint32 bytes = ctx->buflen;
@@ -123,10 +118,7 @@ sha1_finish_ctx (ctx, resbuf)
void
-sha1_process_bytes (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct sha1_ctx *ctx;
+sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
@@ -220,10 +212,7 @@ sha1_process_bytes (buffer, len, ctx)
It is assumed that LEN % 64 == 0. */
void
-sha1_process_block (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct sha1_ctx *ctx;
+sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
{
sha1_uint32 computed_words[16];
#define W(i) computed_words[(i) % 16]
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index 27ccab9..0cde384 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -1,5 +1,5 @@
/* Convenience functions for allocation.
- Copyright (C) 2006 Red Hat, Inc.
+ Copyright (C) 2006, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -44,8 +44,7 @@
/* Allocate N bytes of memory dynamically, with error checking. */
void *
-xmalloc (n)
- size_t n;
+xmalloc (size_t n)
{
void *p;
@@ -58,8 +57,7 @@ xmalloc (n)
/* Allocate memory for N elements of S bytes, with error checking. */
void *
-xcalloc (n, s)
- size_t n, s;
+xcalloc (size_t n, size_t s)
{
void *p;
@@ -73,9 +71,7 @@ xcalloc (n, s)
/* Change the size of an allocated block of memory P to N bytes,
with error checking. */
void *
-xrealloc (p, n)
- void *p;
- size_t n;
+xrealloc (void *p, size_t n)
{
p = realloc (p, n);
if (p == NULL)
diff --git a/lib/xstrdup.c b/lib/xstrdup.c
index d9d6010..aa10352 100644
--- a/lib/xstrdup.c
+++ b/lib/xstrdup.c
@@ -1,5 +1,5 @@
/* Convenience function for string allocation.
- Copyright (C) 2006 Red Hat, Inc.
+ Copyright (C) 2006, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -36,8 +36,7 @@
/* Return a newly allocated copy of STRING. */
char *
-xstrdup (string)
- const char *string;
+xstrdup (const char *string)
{
return strcpy (xmalloc (strlen (string) + 1), string);
}
diff --git a/lib/xstrndup.c b/lib/xstrndup.c
index 52304e6..92b79c1 100644
--- a/lib/xstrndup.c
+++ b/lib/xstrndup.c
@@ -1,5 +1,5 @@
/* Convenience function for string allocation.
- Copyright (C) 2006 Red Hat, Inc.
+ Copyright (C) 2006, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -36,9 +36,7 @@
/* Return a newly allocated copy of STRING. */
char *
-xstrndup (string, n)
- const char *string;
- size_t n;
+xstrndup (const char *string, size_t n)
{
char *res;
size_t len = strnlen (string, n);
diff --git a/libasm/ChangeLog b/libasm/ChangeLog
index 91338d0..0eb84c6 100644
--- a/libasm/ChangeLog
+++ b/libasm/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-22 Mark Wielaard <mjw(a)redhat.com>
+
+ * asm_*.c: Remove old-style function definitions.
+
2015-09-04 Chih-Hung Hsieh <chh(a)google.com>
* asm_addint8.c (FCT): Replace K&R function definition
diff --git a/libasm/asm_abort.c b/libasm/asm_abort.c
index ef55ee9..12743dc 100644
--- a/libasm/asm_abort.c
+++ b/libasm/asm_abort.c
@@ -39,8 +39,7 @@
int
-asm_abort (ctx)
- AsmCtx_t *ctx;
+asm_abort (AsmCtx_t *ctx)
{
if (ctx == NULL)
/* Something went wrong earlier. */
diff --git a/libasm/asm_addsleb128.c b/libasm/asm_addsleb128.c
index 3692789..dc62c95 100644
--- a/libasm/asm_addsleb128.c
+++ b/libasm/asm_addsleb128.c
@@ -38,9 +38,7 @@
int
-asm_addsleb128 (asmscn, num)
- AsmScn_t *asmscn;
- int32_t num;
+asm_addsleb128 (AsmScn_t *asmscn, int32_t num)
{
if (asmscn == NULL)
return -1;
diff --git a/libasm/asm_addstrz.c b/libasm/asm_addstrz.c
index 87663f3..26e06bb 100644
--- a/libasm/asm_addstrz.c
+++ b/libasm/asm_addstrz.c
@@ -40,10 +40,7 @@
/* Add zero terminated string STR of size LEN to (sub)section ASMSCN. */
int
-asm_addstrz (asmscn, str, len)
- AsmScn_t *asmscn;
- const char *str;
- size_t len;
+asm_addstrz (AsmScn_t *asmscn, const char *str, size_t len)
{
if (asmscn == NULL)
return -1;
diff --git a/libasm/asm_adduleb128.c b/libasm/asm_adduleb128.c
index a3a8573..96438cc 100644
--- a/libasm/asm_adduleb128.c
+++ b/libasm/asm_adduleb128.c
@@ -38,9 +38,7 @@
int
-asm_adduleb128 (asmscn, num)
- AsmScn_t *asmscn;
- uint32_t num;
+asm_adduleb128 (AsmScn_t *asmscn, uint32_t num)
{
if (asmscn == NULL)
return -1;
diff --git a/libasm/asm_align.c b/libasm/asm_align.c
index 2025b02..b7708f5 100644
--- a/libasm/asm_align.c
+++ b/libasm/asm_align.c
@@ -40,9 +40,7 @@
int
-asm_align (asmscn, value)
- AsmScn_t *asmscn;
- GElf_Word value;
+asm_align (AsmScn_t *asmscn, GElf_Word value)
{
if (asmscn == NULL)
/* An earlier error. */
@@ -134,9 +132,7 @@ asm_align (asmscn, value)
/* Ensure there are at least LEN bytes available in the output buffer
for ASMSCN. */
int
-__libasm_ensure_section_space (asmscn, len)
- AsmScn_t *asmscn;
- size_t len;
+__libasm_ensure_section_space (AsmScn_t *asmscn, size_t len)
{
/* The blocks with the section content are kept in a circular
single-linked list. */
diff --git a/libasm/asm_end.c b/libasm/asm_end.c
index f4145a7..d629fcd 100644
--- a/libasm/asm_end.c
+++ b/libasm/asm_end.c
@@ -498,8 +498,7 @@ binary_end (AsmCtx_t *ctx)
int
-asm_end (ctx)
- AsmCtx_t *ctx;
+asm_end (AsmCtx_t *ctx)
{
int result;
@@ -555,8 +554,7 @@ free_section (AsmScn_t *scnp)
void
-__libasm_finictx (ctx)
- AsmCtx_t *ctx;
+__libasm_finictx (AsmCtx_t *ctx)
{
/* Iterate through section table and free individual entries. */
AsmScn_t *scn = ctx->section_list;
diff --git a/libasm/asm_error.c b/libasm/asm_error.c
index 300a798..5443049 100644
--- a/libasm/asm_error.c
+++ b/libasm/asm_error.c
@@ -52,8 +52,7 @@ asm_errno (void)
void
-__libasm_seterrno (value)
- int value;
+__libasm_seterrno (int value)
{
global_error = value;
}
@@ -75,8 +74,7 @@ static const char *msgs[ASM_E_NUM] =
};
const char *
-asm_errmsg (error)
- int error;
+asm_errmsg (int error)
{
int last_error = global_error;
diff --git a/libasm/asm_fill.c b/libasm/asm_fill.c
index 6b92bc3..62d9d73 100644
--- a/libasm/asm_fill.c
+++ b/libasm/asm_fill.c
@@ -39,10 +39,7 @@
int
-asm_fill (asmscn, bytes, len)
- AsmScn_t *asmscn;
- void *bytes;
- size_t len;
+asm_fill (AsmScn_t *asmscn, void *bytes, size_t len)
{
struct FillPattern *pattern;
struct FillPattern *old_pattern;
diff --git a/libasm/asm_getelf.c b/libasm/asm_getelf.c
index edeff13..2a5c37b 100644
--- a/libasm/asm_getelf.c
+++ b/libasm/asm_getelf.c
@@ -37,8 +37,7 @@
Elf *
-asm_getelf (ctx)
- AsmCtx_t *ctx;
+asm_getelf (AsmCtx_t *ctx)
{
return ctx != NULL ? ctx->out.elf : NULL;
}
diff --git a/libasm/asm_newabssym.c b/libasm/asm_newabssym.c
index 4e59901..c5b7bea 100644
--- a/libasm/asm_newabssym.c
+++ b/libasm/asm_newabssym.c
@@ -52,13 +52,8 @@ static const AsmScn_t __libasm_abs_scn =
AsmSym_t *
-asm_newabssym (ctx, name, size, value, type, binding)
- AsmCtx_t *ctx;
- const char *name;
- GElf_Xword size;
- GElf_Addr value;
- int type;
- int binding;
+asm_newabssym (AsmCtx_t *ctx, const char *name, GElf_Xword size,
+ GElf_Addr value, int type, int binding)
{
AsmSym_t *result;
diff --git a/libasm/asm_newcomsym.c b/libasm/asm_newcomsym.c
index 7a578e0..ee5c140 100644
--- a/libasm/asm_newcomsym.c
+++ b/libasm/asm_newcomsym.c
@@ -52,11 +52,8 @@ static const AsmScn_t __libasm_com_scn =
AsmSym_t *
-asm_newcomsym (ctx, name, size, align)
- AsmCtx_t *ctx;
- const char *name;
- GElf_Xword size;
- GElf_Addr align;
+asm_newcomsym (AsmCtx_t *ctx, const char *name, GElf_Xword size,
+ GElf_Addr align)
{
AsmSym_t *result;
diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c
index ece7f5c..e236769 100644
--- a/libasm/asm_newscn.c
+++ b/libasm/asm_newscn.c
@@ -158,11 +158,8 @@ binary_newscn (AsmScn_t *result, GElf_Word type, GElf_Xword flags,
AsmScn_t *
-asm_newscn (ctx, scnname, type, flags)
- AsmCtx_t *ctx;
- const char *scnname;
- GElf_Word type;
- GElf_Xword flags;
+asm_newscn (AsmCtx_t *ctx, const char *scnname, GElf_Word type,
+ GElf_Xword flags)
{
size_t scnname_len = strlen (scnname) + 1;
AsmScn_t *result;
diff --git a/libasm/asm_newscn_ingrp.c b/libasm/asm_newscn_ingrp.c
index 6ef7cb9..fd45be6 100644
--- a/libasm/asm_newscn_ingrp.c
+++ b/libasm/asm_newscn_ingrp.c
@@ -37,12 +37,8 @@
AsmScn_t *
-asm_newscn_ingrp (ctx, scnname, type, flags, grp)
- AsmCtx_t *ctx;
- const char *scnname;
- GElf_Word type;
- GElf_Xword flags;
- AsmScnGrp_t *grp;
+asm_newscn_ingrp (AsmCtx_t *ctx, const char *scnname, GElf_Word type,
+ GElf_Xword flags, AsmScnGrp_t *grp)
{
AsmScn_t *result = INTUSE (asm_newscn) (ctx, scnname, type, flags);
diff --git a/libasm/asm_newscngrp.c b/libasm/asm_newscngrp.c
index 2808e69..c5968c1 100644
--- a/libasm/asm_newscngrp.c
+++ b/libasm/asm_newscngrp.c
@@ -41,11 +41,8 @@
AsmScnGrp_t *
-asm_newscngrp (ctx, grpname, signature, flags)
- AsmCtx_t *ctx;
- const char *grpname;
- AsmSym_t *signature;
- Elf32_Word flags;
+asm_newscngrp (AsmCtx_t *ctx, const char *grpname, AsmSym_t *signature,
+ Elf32_Word flags)
{
AsmScnGrp_t *result;
size_t grpname_len = strlen (grpname) + 1;
diff --git a/libasm/asm_newsubscn.c b/libasm/asm_newsubscn.c
index a83607a..906240a 100644
--- a/libasm/asm_newsubscn.c
+++ b/libasm/asm_newsubscn.c
@@ -38,9 +38,7 @@
AsmScn_t *
-asm_newsubscn (asmscn, nr)
- AsmScn_t *asmscn;
- unsigned int nr;
+asm_newsubscn (AsmScn_t *asmscn, unsigned int nr)
{
AsmScn_t *runp;
AsmScn_t *newp;
diff --git a/libasm/asm_newsym.c b/libasm/asm_newsym.c
index deca08a..7f52291 100644
--- a/libasm/asm_newsym.c
+++ b/libasm/asm_newsym.c
@@ -41,12 +41,8 @@
AsmSym_t *
-asm_newsym (asmscn, name, size, type, binding)
- AsmScn_t *asmscn;
- const char *name;
- GElf_Xword size;
- int type;
- int binding;
+asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size,
+ int type, int binding)
{
#define TEMPSYMLEN 10
char tempsym[TEMPSYMLEN];
diff --git a/libasm/asm_scngrp_newsignature.c b/libasm/asm_scngrp_newsignature.c
index d87f4a4..2fbb334 100644
--- a/libasm/asm_scngrp_newsignature.c
+++ b/libasm/asm_scngrp_newsignature.c
@@ -35,9 +35,7 @@
int
-asm_scngrp_newsignature (grp, signature)
- AsmScnGrp_t *grp;
- AsmSym_t *signature;
+asm_scngrp_newsignature (AsmScnGrp_t *grp, AsmSym_t *signature)
{
if (grp == NULL || signature == NULL)
return 1;
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 2e27ff9..cb5ec9c 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-22 Mark Wielaard <mjw(a)redhat.com>
+
+ * *.c: Remove old-style function definitions.
+
2015-09-15 Mark Wielaard <mjw(a)redhat.com>
* dwarf_peel_type.c (dwarf_peel_type): Don't reassign result pointer.
diff --git a/libdw/dwarf_abbrevhaschildren.c b/libdw/dwarf_abbrevhaschildren.c
index 4a83e31..0f17c7e 100644
--- a/libdw/dwarf_abbrevhaschildren.c
+++ b/libdw/dwarf_abbrevhaschildren.c
@@ -37,8 +37,7 @@
int
-dwarf_abbrevhaschildren (abbrev)
- Dwarf_Abbrev *abbrev;
+dwarf_abbrevhaschildren (Dwarf_Abbrev *abbrev)
{
return abbrev == NULL ? -1 : abbrev->has_children;
}
diff --git a/libdw/dwarf_addrdie.c b/libdw/dwarf_addrdie.c
index 94eb148..3a08ab7 100644
--- a/libdw/dwarf_addrdie.c
+++ b/libdw/dwarf_addrdie.c
@@ -35,10 +35,7 @@
Dwarf_Die *
-dwarf_addrdie (dbg, addr, result)
- Dwarf *dbg;
- Dwarf_Addr addr;
- Dwarf_Die *result;
+dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr, Dwarf_Die *result)
{
Dwarf_Aranges *aranges;
size_t naranges;
diff --git a/libdw/dwarf_aggregate_size.c b/libdw/dwarf_aggregate_size.c
index 0247847..aaeb7ed 100644
--- a/libdw/dwarf_aggregate_size.c
+++ b/libdw/dwarf_aggregate_size.c
@@ -230,9 +230,7 @@ aggregate_size (Dwarf_Die *die, Dwarf_Word *size, Dwarf_Die *type_mem)
}
int
-dwarf_aggregate_size (die, size)
- Dwarf_Die *die;
- Dwarf_Word *size;
+dwarf_aggregate_size (Dwarf_Die *die, Dwarf_Word *size)
{
Dwarf_Die type_mem;
diff --git a/libdw/dwarf_arrayorder.c b/libdw/dwarf_arrayorder.c
index 759fa4d..da64f99 100644
--- a/libdw/dwarf_arrayorder.c
+++ b/libdw/dwarf_arrayorder.c
@@ -36,8 +36,7 @@
int
-dwarf_arrayorder (die)
- Dwarf_Die *die;
+dwarf_arrayorder (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
Dwarf_Word value;
diff --git a/libdw/dwarf_attr.c b/libdw/dwarf_attr.c
index f247c1a..db8acfe 100644
--- a/libdw/dwarf_attr.c
+++ b/libdw/dwarf_attr.c
@@ -36,10 +36,7 @@
Dwarf_Attribute *
-dwarf_attr (die, search_name, result)
- Dwarf_Die *die;
- unsigned int search_name;
- Dwarf_Attribute *result;
+dwarf_attr (Dwarf_Die *die, unsigned int search_name, Dwarf_Attribute *result)
{
if (die == NULL)
return NULL;
diff --git a/libdw/dwarf_begin.c b/libdw/dwarf_begin.c
index 9f3050f..d04e5b9 100644
--- a/libdw/dwarf_begin.c
+++ b/libdw/dwarf_begin.c
@@ -39,9 +39,7 @@
Dwarf *
-dwarf_begin (fd, cmd)
- int fd;
- Dwarf_Cmd cmd;
+dwarf_begin (int fd, Dwarf_Cmd cmd)
{
Elf *elf;
Elf_Cmd elfcmd;
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 6d38946..63532fd 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -341,10 +341,7 @@ scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Elf_Scn *scngrp)
Dwarf *
-dwarf_begin_elf (elf, cmd, scngrp)
- Elf *elf;
- Dwarf_Cmd cmd;
- Elf_Scn *scngrp;
+dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp)
{
GElf_Ehdr *ehdr;
GElf_Ehdr ehdr_mem;
diff --git a/libdw/dwarf_bitoffset.c b/libdw/dwarf_bitoffset.c
index 1648ecd..c1a3a34 100644
--- a/libdw/dwarf_bitoffset.c
+++ b/libdw/dwarf_bitoffset.c
@@ -36,8 +36,7 @@
int
-dwarf_bitoffset (die)
- Dwarf_Die *die;
+dwarf_bitoffset (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
Dwarf_Word value;
diff --git a/libdw/dwarf_bitsize.c b/libdw/dwarf_bitsize.c
index ea9946b..0ed9b71 100644
--- a/libdw/dwarf_bitsize.c
+++ b/libdw/dwarf_bitsize.c
@@ -36,8 +36,7 @@
int
-dwarf_bitsize (die)
- Dwarf_Die *die;
+dwarf_bitsize (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
Dwarf_Word value;
diff --git a/libdw/dwarf_bytesize.c b/libdw/dwarf_bytesize.c
index 6499a0a..116cd32 100644
--- a/libdw/dwarf_bytesize.c
+++ b/libdw/dwarf_bytesize.c
@@ -36,8 +36,7 @@
int
-dwarf_bytesize (die)
- Dwarf_Die *die;
+dwarf_bytesize (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
Dwarf_Word value;
diff --git a/libdw/dwarf_cfi_addrframe.c b/libdw/dwarf_cfi_addrframe.c
index 1c0da03..4424027 100644
--- a/libdw/dwarf_cfi_addrframe.c
+++ b/libdw/dwarf_cfi_addrframe.c
@@ -33,10 +33,7 @@
#include "cfi.h"
int
-dwarf_cfi_addrframe (cache, address, frame)
- Dwarf_CFI *cache;
- Dwarf_Addr address;
- Dwarf_Frame **frame;
+dwarf_cfi_addrframe (Dwarf_CFI *cache, Dwarf_Addr address, Dwarf_Frame **frame)
{
/* Maybe there was a previous error. */
if (cache == NULL)
diff --git a/libdw/dwarf_cfi_end.c b/libdw/dwarf_cfi_end.c
index 6eb2ade..d68e2db 100644
--- a/libdw/dwarf_cfi_end.c
+++ b/libdw/dwarf_cfi_end.c
@@ -35,8 +35,7 @@
#include <stdlib.h>
int
-dwarf_cfi_end (cache)
- Dwarf_CFI *cache;
+dwarf_cfi_end (Dwarf_CFI *cache)
{
if (cache != NULL)
{
diff --git a/libdw/dwarf_child.c b/libdw/dwarf_child.c
index 58a438b..cc95fb3 100644
--- a/libdw/dwarf_child.c
+++ b/libdw/dwarf_child.c
@@ -115,9 +115,7 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name,
int
-dwarf_child (die, result)
- Dwarf_Die *die;
- Dwarf_Die *result;
+dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
{
/* Ignore previous errors. */
if (die == NULL)
diff --git a/libdw/dwarf_cu_die.c b/libdw/dwarf_cu_die.c
index 48f4176..194da58 100644
--- a/libdw/dwarf_cu_die.c
+++ b/libdw/dwarf_cu_die.c
@@ -35,16 +35,10 @@
Dwarf_Die *
-dwarf_cu_die (cu, result, versionp, abbrev_offsetp, address_sizep,
- offset_sizep, type_signaturep, type_offsetp)
- Dwarf_CU *cu;
- Dwarf_Die *result;
- Dwarf_Half *versionp;
- Dwarf_Off *abbrev_offsetp;
- uint8_t *address_sizep;
- uint8_t *offset_sizep;
- uint64_t *type_signaturep;
- Dwarf_Off *type_offsetp;
+dwarf_cu_die (Dwarf_CU *cu, Dwarf_Die *result, Dwarf_Half *versionp,
+ Dwarf_Off *abbrev_offsetp, uint8_t *address_sizep,
+ uint8_t *offset_sizep, uint64_t *type_signaturep,
+ Dwarf_Off *type_offsetp)
{
if (cu == NULL)
return NULL;
diff --git a/libdw/dwarf_cu_getdwarf.c b/libdw/dwarf_cu_getdwarf.c
index f8a2e9b..562460f 100644
--- a/libdw/dwarf_cu_getdwarf.c
+++ b/libdw/dwarf_cu_getdwarf.c
@@ -36,8 +36,7 @@
Dwarf *
-dwarf_cu_getdwarf (cu)
- Dwarf_CU *cu;
+dwarf_cu_getdwarf (Dwarf_CU *cu)
{
if (cu == NULL)
/* Some error occurred before. */
diff --git a/libdw/dwarf_cuoffset.c b/libdw/dwarf_cuoffset.c
index 3ceffdb..ba37648 100644
--- a/libdw/dwarf_cuoffset.c
+++ b/libdw/dwarf_cuoffset.c
@@ -36,8 +36,7 @@
Dwarf_Off
-dwarf_cuoffset (die)
- Dwarf_Die *die;
+dwarf_cuoffset (Dwarf_Die *die)
{
return (die == NULL
? (Dwarf_Off) -1l
diff --git a/libdw/dwarf_diecu.c b/libdw/dwarf_diecu.c
index bd9a37a..5281c35 100644
--- a/libdw/dwarf_diecu.c
+++ b/libdw/dwarf_diecu.c
@@ -35,11 +35,8 @@
Dwarf_Die *
-dwarf_diecu (die, result, address_sizep, offset_sizep)
- Dwarf_Die *die;
- Dwarf_Die *result;
- uint8_t *address_sizep;
- uint8_t *offset_sizep;
+dwarf_diecu (Dwarf_Die *die, Dwarf_Die *result, uint8_t *address_sizep,
+ uint8_t *offset_sizep)
{
if (die == NULL)
return NULL;
diff --git a/libdw/dwarf_diename.c b/libdw/dwarf_diename.c
index 050d8f1..96450c1 100644
--- a/libdw/dwarf_diename.c
+++ b/libdw/dwarf_diename.c
@@ -36,8 +36,7 @@
const char *
-dwarf_diename (die)
- Dwarf_Die *die;
+dwarf_diename (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
diff --git a/libdw/dwarf_dieoffset.c b/libdw/dwarf_dieoffset.c
index 965b2c8..8028f6d 100644
--- a/libdw/dwarf_dieoffset.c
+++ b/libdw/dwarf_dieoffset.c
@@ -36,8 +36,7 @@
Dwarf_Off
-dwarf_dieoffset (die)
- Dwarf_Die *die;
+dwarf_dieoffset (Dwarf_Die *die)
{
return (die == NULL
? ~0ul
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index 922dc8f..32b551d 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
@@ -76,8 +76,7 @@ __libdw_free_zdata (Dwarf *dwarf)
#endif
int
-dwarf_end (dwarf)
- Dwarf *dwarf;
+dwarf_end (Dwarf *dwarf)
{
if (dwarf != NULL)
{
diff --git a/libdw/dwarf_entry_breakpoints.c b/libdw/dwarf_entry_breakpoints.c
index ffd5169..abfee73 100644
--- a/libdw/dwarf_entry_breakpoints.c
+++ b/libdw/dwarf_entry_breakpoints.c
@@ -35,9 +35,7 @@
int
-dwarf_entry_breakpoints (die, bkpts)
- Dwarf_Die *die;
- Dwarf_Addr **bkpts;
+dwarf_entry_breakpoints (Dwarf_Die *die, Dwarf_Addr **bkpts)
{
int nbkpts = 0;
*bkpts = NULL;
diff --git a/libdw/dwarf_entrypc.c b/libdw/dwarf_entrypc.c
index 8eb39db..0ef3b0e 100644
--- a/libdw/dwarf_entrypc.c
+++ b/libdw/dwarf_entrypc.c
@@ -35,9 +35,7 @@
int
-dwarf_entrypc (die, return_addr)
- Dwarf_Die *die;
- Dwarf_Addr *return_addr;
+dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr)
{
Dwarf_Attribute attr_mem;
diff --git a/libdw/dwarf_error.c b/libdw/dwarf_error.c
index fe38999..c431bd3 100644
--- a/libdw/dwarf_error.c
+++ b/libdw/dwarf_error.c
@@ -100,8 +100,7 @@ static const char *errmsgs[] =
void
-__libdw_seterrno (value)
- int value;
+__libdw_seterrno (int value)
{
global_error = (value >= 0 && value < (int) nerrmsgs
? value : DWARF_E_UNKNOWN_ERROR);
@@ -109,8 +108,7 @@ __libdw_seterrno (value)
const char *
-dwarf_errmsg (error)
- int error;
+dwarf_errmsg (int error)
{
int last_error = global_error;
diff --git a/libdw/dwarf_formaddr.c b/libdw/dwarf_formaddr.c
index 9d4a388..ddc4838 100644
--- a/libdw/dwarf_formaddr.c
+++ b/libdw/dwarf_formaddr.c
@@ -36,9 +36,7 @@
int
-dwarf_formaddr (attr, return_addr)
- Dwarf_Attribute *attr;
- Dwarf_Addr *return_addr;
+dwarf_formaddr (Dwarf_Attribute *attr, Dwarf_Addr *return_addr)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_formblock.c b/libdw/dwarf_formblock.c
index 3d56f22..13f9e72 100644
--- a/libdw/dwarf_formblock.c
+++ b/libdw/dwarf_formblock.c
@@ -36,9 +36,7 @@
int
-dwarf_formblock (attr, return_block)
- Dwarf_Attribute *attr;
- Dwarf_Block *return_block;
+dwarf_formblock (Dwarf_Attribute *attr, Dwarf_Block *return_block)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_formflag.c b/libdw/dwarf_formflag.c
index bdc2267..b48ede4 100644
--- a/libdw/dwarf_formflag.c
+++ b/libdw/dwarf_formflag.c
@@ -36,9 +36,7 @@
int
-dwarf_formflag (attr, return_bool)
- Dwarf_Attribute *attr;
- bool *return_bool;
+dwarf_formflag (Dwarf_Attribute *attr, bool *return_bool)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_formref.c b/libdw/dwarf_formref.c
index 2592437..c5fb19b 100644
--- a/libdw/dwarf_formref.c
+++ b/libdw/dwarf_formref.c
@@ -35,9 +35,7 @@
#include "libdwP.h"
int
-__libdw_formref (attr, return_offset)
- Dwarf_Attribute *attr;
- Dwarf_Off *return_offset;
+__libdw_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
{
const unsigned char *datap = attr->valp;
const unsigned char *endp = attr->cu->endp;
@@ -102,9 +100,7 @@ __libdw_formref (attr, return_offset)
/* This is the old public entry point.
It is now deprecated in favor of dwarf_formref_die. */
int
-dwarf_formref (attr, return_offset)
- Dwarf_Attribute *attr;
- Dwarf_Off *return_offset;
+dwarf_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c
index 8b92e22..7e2b11a 100644
--- a/libdw/dwarf_formref_die.c
+++ b/libdw/dwarf_formref_die.c
@@ -36,9 +36,7 @@
Dwarf_Die *
-dwarf_formref_die (attr, result)
- Dwarf_Attribute *attr;
- Dwarf_Die *result;
+dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *result)
{
if (attr == NULL)
return NULL;
diff --git a/libdw/dwarf_formsdata.c b/libdw/dwarf_formsdata.c
index 2380bf4..e7deaee 100644
--- a/libdw/dwarf_formsdata.c
+++ b/libdw/dwarf_formsdata.c
@@ -36,9 +36,7 @@
int
-dwarf_formsdata (attr, return_sval)
- Dwarf_Attribute *attr;
- Dwarf_Sword *return_sval;
+dwarf_formsdata (Dwarf_Attribute *attr, Dwarf_Sword *return_sval)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_formstring.c b/libdw/dwarf_formstring.c
index 02b56d4..83abd53 100644
--- a/libdw/dwarf_formstring.c
+++ b/libdw/dwarf_formstring.c
@@ -36,8 +36,7 @@
const char *
-dwarf_formstring (attrp)
- Dwarf_Attribute *attrp;
+dwarf_formstring (Dwarf_Attribute *attrp)
{
/* Ignore earlier errors. */
if (attrp == NULL)
diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c
index a01ff31..e41981a 100644
--- a/libdw/dwarf_formudata.c
+++ b/libdw/dwarf_formudata.c
@@ -94,9 +94,7 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
}
int
-dwarf_formudata (attr, return_uval)
- Dwarf_Attribute *attr;
- Dwarf_Word *return_uval;
+dwarf_formudata (Dwarf_Attribute *attr, Dwarf_Word *return_uval)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_frame_cfa.c b/libdw/dwarf_frame_cfa.c
index a9ae7e7..07f998c 100644
--- a/libdw/dwarf_frame_cfa.c
+++ b/libdw/dwarf_frame_cfa.c
@@ -35,10 +35,7 @@
#include <stdlib.h>
int
-dwarf_frame_cfa (fs, ops, nops)
- Dwarf_Frame *fs;
- Dwarf_Op **ops;
- size_t *nops;
+dwarf_frame_cfa (Dwarf_Frame *fs, Dwarf_Op **ops, size_t *nops)
{
/* Maybe there was a previous error. */
if (fs == NULL)
diff --git a/libdw/dwarf_frame_info.c b/libdw/dwarf_frame_info.c
index 7da46fb..9ba560f 100644
--- a/libdw/dwarf_frame_info.c
+++ b/libdw/dwarf_frame_info.c
@@ -33,11 +33,8 @@
#include "cfi.h"
int
-dwarf_frame_info (fs, start, end, signalp)
- Dwarf_Frame *fs;
- Dwarf_Addr *start;
- Dwarf_Addr *end;
- bool *signalp;
+dwarf_frame_info (Dwarf_Frame *fs, Dwarf_Addr *start, Dwarf_Addr *end,
+ bool *signalp)
{
/* Maybe there was a previous error. */
if (fs == NULL)
diff --git a/libdw/dwarf_frame_register.c b/libdw/dwarf_frame_register.c
index 10d2fe4..37e8e91 100644
--- a/libdw/dwarf_frame_register.c
+++ b/libdw/dwarf_frame_register.c
@@ -34,12 +34,8 @@
#include <dwarf.h>
int
-dwarf_frame_register (fs, regno, ops_mem, ops, nops)
- Dwarf_Frame *fs;
- int regno;
- Dwarf_Op ops_mem[3];
- Dwarf_Op **ops;
- size_t *nops;
+dwarf_frame_register (Dwarf_Frame *fs, int regno, Dwarf_Op *ops_mem,
+ Dwarf_Op **ops, size_t *nops)
{
/* Maybe there was a previous error. */
if (fs == NULL)
diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c
index 0efde45..ef51b84 100644
--- a/libdw/dwarf_getabbrev.c
+++ b/libdw/dwarf_getabbrev.c
@@ -37,12 +37,8 @@
Dwarf_Abbrev *
internal_function
-__libdw_getabbrev (dbg, cu, offset, lengthp, result)
- Dwarf *dbg;
- struct Dwarf_CU *cu;
- Dwarf_Off offset;
- size_t *lengthp;
- Dwarf_Abbrev *result;
+__libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu, Dwarf_Off offset,
+ size_t *lengthp, Dwarf_Abbrev *result)
{
/* Don't fail if there is not .debug_abbrev section. */
if (dbg->sectiondata[IDX_debug_abbrev] == NULL)
@@ -154,10 +150,7 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result)
Dwarf_Abbrev *
-dwarf_getabbrev (die, offset, lengthp)
- Dwarf_Die *die;
- Dwarf_Off offset;
- size_t *lengthp;
+dwarf_getabbrev (Dwarf_Die *die, Dwarf_Off offset, size_t *lengthp)
{
return __libdw_getabbrev (die->cu->dbg, die->cu,
die->cu->orig_abbrev_offset + offset, lengthp,
diff --git a/libdw/dwarf_getabbrevattr.c b/libdw/dwarf_getabbrevattr.c
index 574467c..3b4da99 100644
--- a/libdw/dwarf_getabbrevattr.c
+++ b/libdw/dwarf_getabbrevattr.c
@@ -37,12 +37,8 @@
int
-dwarf_getabbrevattr (abbrev, idx, namep, formp, offsetp)
- Dwarf_Abbrev *abbrev;
- size_t idx;
- unsigned int *namep;
- unsigned int *formp;
- Dwarf_Off *offsetp;
+dwarf_getabbrevattr (Dwarf_Abbrev *abbrev, size_t idx, unsigned int *namep,
+ unsigned int *formp, Dwarf_Off *offsetp)
{
if (abbrev == NULL)
return -1;
diff --git a/libdw/dwarf_getabbrevcode.c b/libdw/dwarf_getabbrevcode.c
index 0df9064..8691708 100644
--- a/libdw/dwarf_getabbrevcode.c
+++ b/libdw/dwarf_getabbrevcode.c
@@ -37,8 +37,7 @@
unsigned int
-dwarf_getabbrevcode (abbrev)
- Dwarf_Abbrev *abbrev;
+dwarf_getabbrevcode (Dwarf_Abbrev *abbrev)
{
return abbrev == NULL ? 0 : abbrev->code;
}
diff --git a/libdw/dwarf_getabbrevtag.c b/libdw/dwarf_getabbrevtag.c
index 36a5262..52aaa3f 100644
--- a/libdw/dwarf_getabbrevtag.c
+++ b/libdw/dwarf_getabbrevtag.c
@@ -37,8 +37,7 @@
unsigned int
-dwarf_getabbrevtag (abbrev)
- Dwarf_Abbrev *abbrev;
+dwarf_getabbrevtag (Dwarf_Abbrev *abbrev)
{
return abbrev == NULL ? 0 : abbrev->tag;
}
diff --git a/libdw/dwarf_getarange_addr.c b/libdw/dwarf_getarange_addr.c
index fc143de..d383e22 100644
--- a/libdw/dwarf_getarange_addr.c
+++ b/libdw/dwarf_getarange_addr.c
@@ -35,9 +35,7 @@
Dwarf_Arange *
-dwarf_getarange_addr (aranges, addr)
- Dwarf_Aranges *aranges;
- Dwarf_Addr addr;
+dwarf_getarange_addr (Dwarf_Aranges *aranges, Dwarf_Addr addr)
{
if (aranges == NULL)
return NULL;
diff --git a/libdw/dwarf_getaranges.c b/libdw/dwarf_getaranges.c
index 6c6169e..4252746 100644
--- a/libdw/dwarf_getaranges.c
+++ b/libdw/dwarf_getaranges.c
@@ -54,10 +54,7 @@ compare_aranges (const void *a, const void *b)
}
int
-dwarf_getaranges (dbg, aranges, naranges)
- Dwarf *dbg;
- Dwarf_Aranges **aranges;
- size_t *naranges;
+dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges, size_t *naranges)
{
if (dbg == NULL)
return -1;
diff --git a/libdw/dwarf_getattrcnt.c b/libdw/dwarf_getattrcnt.c
index 72be766..2bfb4ac 100644
--- a/libdw/dwarf_getattrcnt.c
+++ b/libdw/dwarf_getattrcnt.c
@@ -35,9 +35,7 @@
int
-dwarf_getattrcnt (abbrev, attrcntp)
- Dwarf_Abbrev *abbrev;
- size_t *attrcntp;
+dwarf_getattrcnt (Dwarf_Abbrev *abbrev, size_t *attrcntp)
{
if (abbrev == NULL)
return -1;
diff --git a/libdw/dwarf_getcfi.c b/libdw/dwarf_getcfi.c
index a49a9f0..9aed403 100644
--- a/libdw/dwarf_getcfi.c
+++ b/libdw/dwarf_getcfi.c
@@ -35,8 +35,7 @@
#include <dwarf.h>
Dwarf_CFI *
-dwarf_getcfi (dbg)
- Dwarf *dbg;
+dwarf_getcfi (Dwarf *dbg)
{
if (dbg == NULL)
return NULL;
diff --git a/libdw/dwarf_getcfi_elf.c b/libdw/dwarf_getcfi_elf.c
index 3e611f8..315cc02 100644
--- a/libdw/dwarf_getcfi_elf.c
+++ b/libdw/dwarf_getcfi_elf.c
@@ -311,8 +311,7 @@ getcfi_shdr (Elf *elf, const GElf_Ehdr *ehdr)
}
Dwarf_CFI *
-dwarf_getcfi_elf (elf)
- Elf *elf;
+dwarf_getcfi_elf (Elf *elf)
{
if (elf_kind (elf) != ELF_K_ELF)
{
diff --git a/libdw/dwarf_getelf.c b/libdw/dwarf_getelf.c
index ecd1859..2d6268e 100644
--- a/libdw/dwarf_getelf.c
+++ b/libdw/dwarf_getelf.c
@@ -37,8 +37,7 @@
Elf *
-dwarf_getelf (dwarf)
- Dwarf *dwarf;
+dwarf_getelf (Dwarf *dwarf)
{
if (dwarf == NULL)
/* Some error occurred before. */
diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c
index 0a0e04b..a4a2761 100644
--- a/libdw/dwarf_getlocation.c
+++ b/libdw/dwarf_getlocation.c
@@ -113,10 +113,8 @@ store_implicit_value (Dwarf *dbg, void **cache, Dwarf_Op *op)
}
int
-dwarf_getlocation_implicit_value (attr, op, return_block)
- Dwarf_Attribute *attr;
- const Dwarf_Op *op;
- Dwarf_Block *return_block;
+dwarf_getlocation_implicit_value (Dwarf_Attribute *attr, const Dwarf_Op *op,
+ Dwarf_Block *return_block)
{
if (attr == NULL)
return -1;
@@ -609,10 +607,7 @@ getlocation (struct Dwarf_CU *cu, const Dwarf_Block *block,
}
int
-dwarf_getlocation (attr, llbuf, listlen)
- Dwarf_Attribute *attr;
- Dwarf_Op **llbuf;
- size_t *listlen;
+dwarf_getlocation (Dwarf_Attribute *attr, Dwarf_Op **llbuf, size_t *listlen)
{
if (! attr_ok (attr))
return -1;
@@ -630,9 +625,7 @@ dwarf_getlocation (attr, llbuf, listlen)
}
static int
-attr_base_address (attr, basep)
- Dwarf_Attribute *attr;
- Dwarf_Addr *basep;
+attr_base_address (Dwarf_Attribute *attr, Dwarf_Addr *basep)
{
/* Fetch the CU's base address. */
Dwarf_Die cudie = CUDIE (attr->cu);
@@ -661,10 +654,8 @@ attr_base_address (attr, basep)
}
static int
-initial_offset_base (attr, offset, basep)
- Dwarf_Attribute *attr;
- ptrdiff_t *offset;
- Dwarf_Addr *basep;
+initial_offset_base (Dwarf_Attribute *attr, ptrdiff_t *offset,
+ Dwarf_Addr *basep)
{
if (attr_base_address (attr, basep) != 0)
return -1;
@@ -738,12 +729,8 @@ getlocations_addr (Dwarf_Attribute *attr, ptrdiff_t offset,
}
int
-dwarf_getlocation_addr (attr, address, llbufs, listlens, maxlocs)
- Dwarf_Attribute *attr;
- Dwarf_Addr address;
- Dwarf_Op **llbufs;
- size_t *listlens;
- size_t maxlocs;
+dwarf_getlocation_addr (Dwarf_Attribute *attr, Dwarf_Addr address,
+ Dwarf_Op **llbufs, size_t *listlens, size_t maxlocs)
{
if (! attr_ok (attr))
return -1;
@@ -813,14 +800,9 @@ dwarf_getlocation_addr (attr, address, llbufs, listlens, maxlocs)
}
ptrdiff_t
-dwarf_getlocations (attr, offset, basep, startp, endp, expr, exprlen)
- Dwarf_Attribute *attr;
- ptrdiff_t offset;
- Dwarf_Addr *basep;
- Dwarf_Addr *startp;
- Dwarf_Addr *endp;
- Dwarf_Op **expr;
- size_t *exprlen;
+dwarf_getlocations (Dwarf_Attribute *attr, ptrdiff_t offset, Dwarf_Addr *basep,
+ Dwarf_Addr *startp, Dwarf_Addr *endp, Dwarf_Op **expr,
+ size_t *exprlen)
{
if (! attr_ok (attr))
return -1;
diff --git a/libdw/dwarf_getlocation_attr.c b/libdw/dwarf_getlocation_attr.c
index 3229baf..8b6a4af 100644
--- a/libdw/dwarf_getlocation_attr.c
+++ b/libdw/dwarf_getlocation_attr.c
@@ -53,10 +53,7 @@ attr_form_cu (Dwarf_Attribute *attr)
}
int
-dwarf_getlocation_attr (attr, op, result)
- Dwarf_Attribute *attr;
- const Dwarf_Op *op;
- Dwarf_Attribute *result;
+dwarf_getlocation_attr (Dwarf_Attribute *attr, const Dwarf_Op *op, Dwarf_Attribute *result)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_getlocation_die.c b/libdw/dwarf_getlocation_die.c
index fa03aac..b4908d2 100644
--- a/libdw/dwarf_getlocation_die.c
+++ b/libdw/dwarf_getlocation_die.c
@@ -34,10 +34,8 @@
#include <libdwP.h>
int
-dwarf_getlocation_die (attr, op, result)
- Dwarf_Attribute *attr;
- const Dwarf_Op *op;
- Dwarf_Die *result;
+dwarf_getlocation_die (Dwarf_Attribute *attr, const Dwarf_Op *op,
+ Dwarf_Die *result)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_getlocation_implicit_pointer.c b/libdw/dwarf_getlocation_implicit_pointer.c
index f1c16be..9505382 100644
--- a/libdw/dwarf_getlocation_implicit_pointer.c
+++ b/libdw/dwarf_getlocation_implicit_pointer.c
@@ -49,10 +49,8 @@ __libdw_empty_loc_attr (Dwarf_Attribute *attr)
}
int
-dwarf_getlocation_implicit_pointer (attr, op, result)
- Dwarf_Attribute *attr;
- const Dwarf_Op *op;
- Dwarf_Attribute *result;
+dwarf_getlocation_implicit_pointer (Dwarf_Attribute *attr, const Dwarf_Op *op,
+ Dwarf_Attribute *result)
{
if (attr == NULL)
return -1;
diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c
index a326e58..eb50508 100644
--- a/libdw/dwarf_getmacros.c
+++ b/libdw/dwarf_getmacros.c
@@ -511,11 +511,8 @@ dwarf_getmacros_off (Dwarf *dbg, Dwarf_Off macoff,
}
ptrdiff_t
-dwarf_getmacros (cudie, callback, arg, token)
- Dwarf_Die *cudie;
- int (*callback) (Dwarf_Macro *, void *);
- void *arg;
- ptrdiff_t token;
+dwarf_getmacros (Dwarf_Die *cudie, int (*callback) (Dwarf_Macro *, void *),
+ void *arg, ptrdiff_t token)
{
if (cudie == NULL)
{
diff --git a/libdw/dwarf_getpubnames.c b/libdw/dwarf_getpubnames.c
index 41b2407..462b6ff 100644
--- a/libdw/dwarf_getpubnames.c
+++ b/libdw/dwarf_getpubnames.c
@@ -140,11 +140,9 @@ get_offsets (Dwarf *dbg)
ptrdiff_t
-dwarf_getpubnames (dbg, callback, arg, offset)
- Dwarf *dbg;
- int (*callback) (Dwarf *, Dwarf_Global *, void *);
- void *arg;
- ptrdiff_t offset;
+dwarf_getpubnames (Dwarf *dbg,
+ int (*callback) (Dwarf *, Dwarf_Global *, void *),
+ void *arg, ptrdiff_t offset)
{
if (dbg == NULL)
return -1l;
diff --git a/libdw/dwarf_getsrcdirs.c b/libdw/dwarf_getsrcdirs.c
index 47283ec..8160ed3 100644
--- a/libdw/dwarf_getsrcdirs.c
+++ b/libdw/dwarf_getsrcdirs.c
@@ -34,10 +34,7 @@
int
-dwarf_getsrcdirs (files, result, ndirs)
- Dwarf_Files *files;
- const char *const **result;
- size_t *ndirs;
+dwarf_getsrcdirs (Dwarf_Files *files, const char *const **result, size_t *ndirs)
{
if (files == NULL)
return -1;
diff --git a/libdw/dwarf_getstring.c b/libdw/dwarf_getstring.c
index 672bb27..5620cb0 100644
--- a/libdw/dwarf_getstring.c
+++ b/libdw/dwarf_getstring.c
@@ -36,10 +36,7 @@
const char *
-dwarf_getstring (dbg, offset, lenp)
- Dwarf *dbg;
- Dwarf_Off offset;
- size_t *lenp;
+dwarf_getstring (Dwarf *dbg, Dwarf_Off offset, size_t *lenp)
{
if (dbg == NULL)
return NULL;
diff --git a/libdw/dwarf_hasattr.c b/libdw/dwarf_hasattr.c
index 812c09b..2bb8dc8 100644
--- a/libdw/dwarf_hasattr.c
+++ b/libdw/dwarf_hasattr.c
@@ -36,9 +36,7 @@
int
-dwarf_hasattr (die, search_name)
- Dwarf_Die *die;
- unsigned int search_name;
+dwarf_hasattr (Dwarf_Die *die, unsigned int search_name)
{
if (die == NULL)
return 0;
diff --git a/libdw/dwarf_haschildren.c b/libdw/dwarf_haschildren.c
index d0ce51e..03a8173 100644
--- a/libdw/dwarf_haschildren.c
+++ b/libdw/dwarf_haschildren.c
@@ -36,8 +36,7 @@
int
-dwarf_haschildren (die)
- Dwarf_Die *die;
+dwarf_haschildren (Dwarf_Die *die)
{
/* Find the abbreviation entry. */
Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, NULL);
diff --git a/libdw/dwarf_hasform.c b/libdw/dwarf_hasform.c
index a95ca9e..a0c3229 100644
--- a/libdw/dwarf_hasform.c
+++ b/libdw/dwarf_hasform.c
@@ -36,9 +36,7 @@
int
-dwarf_hasform (attr, search_form)
- Dwarf_Attribute *attr;
- unsigned int search_form;
+dwarf_hasform (Dwarf_Attribute *attr, unsigned int search_form)
{
if (attr == NULL)
return 0;
diff --git a/libdw/dwarf_highpc.c b/libdw/dwarf_highpc.c
index 8bf93f0..2070254 100644
--- a/libdw/dwarf_highpc.c
+++ b/libdw/dwarf_highpc.c
@@ -36,9 +36,7 @@
int
-dwarf_highpc (die, return_addr)
- Dwarf_Die *die;
- Dwarf_Addr *return_addr;
+dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
{
Dwarf_Attribute attr_high_mem;
Dwarf_Attribute *attr_high = INTUSE(dwarf_attr) (die, DW_AT_high_pc,
diff --git a/libdw/dwarf_lowpc.c b/libdw/dwarf_lowpc.c
index 4677aed..b3be2b0 100644
--- a/libdw/dwarf_lowpc.c
+++ b/libdw/dwarf_lowpc.c
@@ -36,9 +36,7 @@
int
-dwarf_lowpc (die, return_addr)
- Dwarf_Die *die;
- Dwarf_Addr *return_addr;
+dwarf_lowpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
{
Dwarf_Attribute attr_mem;
diff --git a/libdw/dwarf_nextcu.c b/libdw/dwarf_nextcu.c
index 875d869..fa9b0af 100644
--- a/libdw/dwarf_nextcu.c
+++ b/libdw/dwarf_nextcu.c
@@ -36,18 +36,11 @@
int
-dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
- address_sizep, offset_sizep, type_signaturep, type_offsetp)
- Dwarf *dwarf;
- Dwarf_Off off;
- Dwarf_Off *next_off;
- size_t *header_sizep;
- Dwarf_Half *versionp;
- Dwarf_Off *abbrev_offsetp;
- uint8_t *address_sizep;
- uint8_t *offset_sizep;
- uint64_t *type_signaturep;
- Dwarf_Off *type_offsetp;
+dwarf_next_unit (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
+ size_t *header_sizep, Dwarf_Half *versionp,
+ Dwarf_Off *abbrev_offsetp, uint8_t *address_sizep,
+ uint8_t *offset_sizep, uint64_t *type_signaturep,
+ Dwarf_Off *type_offsetp)
{
const bool debug_types = type_signaturep != NULL;
const size_t sec_idx = debug_types ? IDX_debug_types : IDX_debug_info;
@@ -182,15 +175,9 @@ dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
INTDEF(dwarf_next_unit)
int
-dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp,
- address_sizep, offset_sizep)
- Dwarf *dwarf;
- Dwarf_Off off;
- Dwarf_Off *next_off;
- size_t *header_sizep;
- Dwarf_Off *abbrev_offsetp;
- uint8_t *address_sizep;
- uint8_t *offset_sizep;
+dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
+ size_t *header_sizep, Dwarf_Off *abbrev_offsetp,
+ uint8_t *address_sizep, uint8_t *offset_sizep)
{
return INTUSE(dwarf_next_unit) (dwarf, off, next_off, header_sizep, NULL,
abbrev_offsetp, address_sizep, offset_sizep,
diff --git a/libdw/dwarf_offdie.c b/libdw/dwarf_offdie.c
index b5dd405..15f55c2 100644
--- a/libdw/dwarf_offdie.c
+++ b/libdw/dwarf_offdie.c
@@ -71,20 +71,14 @@ __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result,
Dwarf_Die *
-dwarf_offdie (dbg, offset, result)
- Dwarf *dbg;
- Dwarf_Off offset;
- Dwarf_Die *result;
+dwarf_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result)
{
return __libdw_offdie (dbg, offset, result, false);
}
INTDEF(dwarf_offdie)
Dwarf_Die *
-dwarf_offdie_types (dbg, offset, result)
- Dwarf *dbg;
- Dwarf_Off offset;
- Dwarf_Die *result;
+dwarf_offdie_types (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result)
{
return __libdw_offdie (dbg, offset, result, true);
}
diff --git a/libdw/dwarf_peel_type.c b/libdw/dwarf_peel_type.c
index 7b29d35..5dca8f8 100644
--- a/libdw/dwarf_peel_type.c
+++ b/libdw/dwarf_peel_type.c
@@ -36,9 +36,7 @@
int
-dwarf_peel_type (die, result)
- Dwarf_Die *die;
- Dwarf_Die *result;
+dwarf_peel_type (Dwarf_Die *die, Dwarf_Die *result)
{
int tag;
diff --git a/libdw/dwarf_siblingof.c b/libdw/dwarf_siblingof.c
index 0dafc17..df39c1c 100644
--- a/libdw/dwarf_siblingof.c
+++ b/libdw/dwarf_siblingof.c
@@ -37,9 +37,7 @@
int
-dwarf_siblingof (die, result)
- Dwarf_Die *die;
- Dwarf_Die *result;
+dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
{
/* Ignore previous errors. */
if (die == NULL)
diff --git a/libdw/dwarf_srclang.c b/libdw/dwarf_srclang.c
index 6cc06ff..f10e764 100644
--- a/libdw/dwarf_srclang.c
+++ b/libdw/dwarf_srclang.c
@@ -36,8 +36,7 @@
int
-dwarf_srclang (die)
- Dwarf_Die *die;
+dwarf_srclang (Dwarf_Die *die)
{
Dwarf_Attribute attr_mem;
Dwarf_Word value;
diff --git a/libdw/dwarf_tag.c b/libdw/dwarf_tag.c
index 0b1a4b0..331eaa0 100644
--- a/libdw/dwarf_tag.c
+++ b/libdw/dwarf_tag.c
@@ -79,8 +79,7 @@ __libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code)
int
-dwarf_tag (die)
- Dwarf_Die *die;
+dwarf_tag (Dwarf_Die *die)
{
/* Find the abbreviation entry. */
Dwarf_Abbrev *abbrevp = __libdw_dieabbrev (die, NULL);
diff --git a/libdw/dwarf_whatattr.c b/libdw/dwarf_whatattr.c
index 8fe5535..d664b02 100644
--- a/libdw/dwarf_whatattr.c
+++ b/libdw/dwarf_whatattr.c
@@ -36,8 +36,7 @@
unsigned int
-dwarf_whatattr (attr)
- Dwarf_Attribute *attr;
+dwarf_whatattr (Dwarf_Attribute *attr)
{
return attr == NULL ? 0 : attr->code;
}
diff --git a/libdw/dwarf_whatform.c b/libdw/dwarf_whatform.c
index 1d0d14b..dee29a9 100644
--- a/libdw/dwarf_whatform.c
+++ b/libdw/dwarf_whatform.c
@@ -36,8 +36,7 @@
unsigned int
-dwarf_whatform (attr)
- Dwarf_Attribute *attr;
+dwarf_whatform (Dwarf_Attribute *attr)
{
return attr == NULL ? 0 : attr->form;
}
diff --git a/libdw/libdw_visit_scopes.c b/libdw/libdw_visit_scopes.c
index d0b5134..c882e4a 100644
--- a/libdw/libdw_visit_scopes.c
+++ b/libdw/libdw_visit_scopes.c
@@ -65,13 +65,15 @@ may_have_scopes (Dwarf_Die *die)
}
int
-__libdw_visit_scopes (depth, root, imports, previsit, postvisit, arg)
- unsigned int depth;
- struct Dwarf_Die_Chain *root;
- struct Dwarf_Die_Chain *imports;
- int (*previsit) (unsigned int depth, struct Dwarf_Die_Chain *, void *);
- int (*postvisit) (unsigned int depth, struct Dwarf_Die_Chain *, void *);
- void *arg;
+__libdw_visit_scopes (unsigned int depth, struct Dwarf_Die_Chain *root,
+ struct Dwarf_Die_Chain *imports,
+ int (*previsit) (unsigned int,
+ struct Dwarf_Die_Chain *,
+ void *),
+ int (*postvisit) (unsigned int,
+ struct Dwarf_Die_Chain *,
+ void *),
+ void *arg)
{
struct Dwarf_Die_Chain child;
int ret;
@@ -97,8 +99,8 @@ __libdw_visit_scopes (depth, root, imports, previsit, postvisit, arg)
return false;
}
- inline int walk_children ()
- {
+ inline int walk_children (void)
+{
do
{
/* For an imported unit, it is logically as if the children of
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0ab386f..f34087c 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,13 @@
+2015-09-22 Mark Wielaard <mjw(a)redhat.com>
+
+ * core-file.c: Remove old-style function definitions.
+ * dwfl_error.c: Likewise.
+ * dwfl_module_dwarf_cfi.c: Likewise.
+ * dwfl_module_eh_cfi.c: Likewise.
+ * dwfl_module_register_names.c: Likewise.
+ * dwfl_module_return_value_location.c: Likewise.
+ * dwfl_version.c: Likewise.
+
2015-09-09 Chih-Hung Hsieh <chh(a)google.com>
Mark Wielaard <mjw(a)redhat.com>
diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
index bbe0899..ea0725b 100644
--- a/libdwfl/core-file.c
+++ b/libdwfl/core-file.c
@@ -270,8 +270,8 @@ dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx,
GElf_Off end;
GElf_Addr end_vaddr;
- inline void update_end ()
- {
+ inline void update_end (void)
+{
end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align;
end_vaddr = (phdr.p_vaddr + phdr.p_memsz + align - 1) & -align;
}
diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
index 56ec2b0..7bcf61c 100644
--- a/libdwfl/dwfl_error.c
+++ b/libdwfl/dwfl_error.c
@@ -138,8 +138,7 @@ __libdwfl_seterrno (Dwfl_Error error)
const char *
-dwfl_errmsg (error)
- int error;
+dwfl_errmsg (int error)
{
if (error == 0 || error == -1)
{
diff --git a/libdwfl/dwfl_module_dwarf_cfi.c b/libdwfl/dwfl_module_dwarf_cfi.c
index 5182d6a..1dac26d 100644
--- a/libdwfl/dwfl_module_dwarf_cfi.c
+++ b/libdwfl/dwfl_module_dwarf_cfi.c
@@ -51,9 +51,7 @@ __libdwfl_set_cfi (Dwfl_Module *mod, Dwarf_CFI **slot, Dwarf_CFI *cfi)
}
Dwarf_CFI *
-dwfl_module_dwarf_cfi (mod, bias)
- Dwfl_Module *mod;
- Dwarf_Addr *bias;
+dwfl_module_dwarf_cfi (Dwfl_Module *mod, Dwarf_Addr *bias)
{
if (mod == NULL)
return NULL;
diff --git a/libdwfl/dwfl_module_eh_cfi.c b/libdwfl/dwfl_module_eh_cfi.c
index da10d9f..dbe43b0 100644
--- a/libdwfl/dwfl_module_eh_cfi.c
+++ b/libdwfl/dwfl_module_eh_cfi.c
@@ -30,9 +30,7 @@
#include "../libdw/cfi.h"
Dwarf_CFI *
-dwfl_module_eh_cfi (mod, bias)
- Dwfl_Module *mod;
- Dwarf_Addr *bias;
+dwfl_module_eh_cfi (Dwfl_Module *mod, Dwarf_Addr *bias)
{
if (mod == NULL)
return NULL;
diff --git a/libdwfl/dwfl_module_register_names.c b/libdwfl/dwfl_module_register_names.c
index 2da4b53..18fed37 100644
--- a/libdwfl/dwfl_module_register_names.c
+++ b/libdwfl/dwfl_module_register_names.c
@@ -30,12 +30,11 @@
int
-dwfl_module_register_names (mod, func, arg)
- Dwfl_Module *mod;
- int (*func) (void *, int regno, const char *setname,
- const char *prefix, const char *regname,
- int bits, int type);
- void *arg;
+dwfl_module_register_names (Dwfl_Module *mod,
+ int (*func) (void *, int, const char *,
+ const char *, const char *,
+ int, int),
+ void *arg)
{
if (unlikely (mod == NULL))
return -1;
diff --git a/libdwfl/dwfl_module_return_value_location.c b/libdwfl/dwfl_module_return_value_location.c
index ad83cbf..29da61f 100644
--- a/libdwfl/dwfl_module_return_value_location.c
+++ b/libdwfl/dwfl_module_return_value_location.c
@@ -30,10 +30,8 @@
int
-dwfl_module_return_value_location (mod, functypedie, locops)
- Dwfl_Module *mod;
- Dwarf_Die *functypedie;
- const Dwarf_Op **locops;
+dwfl_module_return_value_location (Dwfl_Module *mod, Dwarf_Die *functypedie,
+ const Dwarf_Op **locops)
{
if (mod == NULL)
return -1;
diff --git a/libdwfl/dwfl_version.c b/libdwfl/dwfl_version.c
index 9673a53..d1c5d91 100644
--- a/libdwfl/dwfl_version.c
+++ b/libdwfl/dwfl_version.c
@@ -29,8 +29,7 @@
#include "libdwflP.h"
const char *
-dwfl_version (dwfl)
- Dwfl *dwfl __attribute__ ((unused));
+dwfl_version (Dwfl *dwfl __attribute__ ((unused)))
{
return PACKAGE_VERSION;
}
diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index aab0857..4ea6d49 100644
--- a/libebl/ChangeLog
+++ b/libebl/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-22 Mark Wielaard <mjw(a)redhat.com>
+
+ * *.c: Remove old-style function definitions.
+
2015-09-09 Chih-Hung Hsieh <chh(a)google.com>
* ebldwarftoregno.c (ebl_dwarf_to_regno): Remove redundant NULL tests
diff --git a/libebl/ebl_check_special_section.c b/libebl/ebl_check_special_section.c
index aabe44e..903b69d 100644
--- a/libebl/ebl_check_special_section.c
+++ b/libebl/ebl_check_special_section.c
@@ -34,11 +34,8 @@
bool
-ebl_check_special_section (ebl, ndx, shdr, sname)
- Ebl *ebl;
- int ndx;
- const GElf_Shdr *shdr;
- const char *sname;
+ebl_check_special_section (Ebl *ebl, int ndx, const GElf_Shdr *shdr,
+ const char *sname)
{
return ebl != NULL && ebl->check_special_section (ebl, ndx, shdr, sname);
}
diff --git a/libebl/ebl_check_special_symbol.c b/libebl/ebl_check_special_symbol.c
index 8e702ba..bdcb026 100644
--- a/libebl/ebl_check_special_symbol.c
+++ b/libebl/ebl_check_special_symbol.c
@@ -35,12 +35,8 @@
bool
-ebl_check_special_symbol (ebl, ehdr, sym, name, destshdr)
- Ebl *ebl;
- GElf_Ehdr *ehdr;
- const GElf_Sym *sym;
- const char *name;
- const GElf_Shdr *destshdr;
+ebl_check_special_symbol (Ebl *ebl, GElf_Ehdr *ehdr, const GElf_Sym *sym,
+ const char *name, const GElf_Shdr *destshdr)
{
if (ebl == NULL)
return false;
diff --git a/libebl/ebl_syscall_abi.c b/libebl/ebl_syscall_abi.c
index de73703..a25369d 100644
--- a/libebl/ebl_syscall_abi.c
+++ b/libebl/ebl_syscall_abi.c
@@ -34,12 +34,7 @@
int
-ebl_syscall_abi (ebl, sp, pc, callno, args)
- Ebl *ebl;
- int *sp;
- int *pc;
- int *callno;
- int args[6];
+ebl_syscall_abi (Ebl *ebl, int *sp, int *pc, int *callno, int *args)
{
return ebl != NULL ? ebl->syscall_abi (ebl, sp, pc, callno, args) : -1;
}
diff --git a/libebl/eblabicfi.c b/libebl/eblabicfi.c
index 20a29ea..6b0e18e 100644
--- a/libebl/eblabicfi.c
+++ b/libebl/eblabicfi.c
@@ -34,9 +34,7 @@
int
-ebl_abi_cfi (ebl, abi_info)
- Ebl *ebl;
- Dwarf_CIE *abi_info;
+ebl_abi_cfi (Ebl *ebl, Dwarf_CIE *abi_info)
{
return ebl == NULL ? -1 : ebl->abi_cfi (ebl, abi_info);
}
diff --git a/libebl/eblauxvinfo.c b/libebl/eblauxvinfo.c
index 5c310b2..ce1141b 100644
--- a/libebl/eblauxvinfo.c
+++ b/libebl/eblauxvinfo.c
@@ -85,11 +85,8 @@ static const struct
#define nauxv_types (sizeof auxv_types / sizeof auxv_types[0])
int
-ebl_auxv_info (ebl, a_type, name, format)
- Ebl *ebl;
- GElf_Xword a_type;
- const char **name;
- const char **format;
+ebl_auxv_info (Ebl *ebl, GElf_Xword a_type, const char **name,
+ const char **format)
{
int result = ebl->auxv_info (a_type, name, format);
if (result == 0 && a_type < nauxv_types && auxv_types[a_type].name != NULL)
diff --git a/libebl/eblbackendname.c b/libebl/eblbackendname.c
index 92e576e..a2b2df6 100644
--- a/libebl/eblbackendname.c
+++ b/libebl/eblbackendname.c
@@ -36,8 +36,7 @@
const char *
-ebl_backend_name (ebl)
- Ebl *ebl;
+ebl_backend_name (Ebl *ebl)
{
return ebl != NULL ? ebl->emulation : gettext ("No backend");
}
diff --git a/libebl/eblbsspltp.c b/libebl/eblbsspltp.c
index 95a5d8a..24c4a08 100644
--- a/libebl/eblbsspltp.c
+++ b/libebl/eblbsspltp.c
@@ -35,8 +35,7 @@
bool
-ebl_bss_plt_p (ebl)
- Ebl *ebl;
+ebl_bss_plt_p (Ebl *ebl)
{
return ebl == NULL ? false : ebl->bss_plt_p (ebl->elf);
}
diff --git a/libebl/eblcheckobjattr.c b/libebl/eblcheckobjattr.c
index b0481d2..b590a03 100644
--- a/libebl/eblcheckobjattr.c
+++ b/libebl/eblcheckobjattr.c
@@ -35,13 +35,9 @@
bool
-ebl_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name)
- Ebl *ebl;
- const char *vendor;
- int tag;
- uint64_t value;
- const char **tag_name;
- const char **value_name;
+ebl_check_object_attribute (Ebl *ebl, const char *vendor, int tag,
+ uint64_t value, const char **tag_name,
+ const char **value_name)
{
if (ebl->check_object_attribute (ebl, vendor, tag, value,
tag_name, value_name))
diff --git a/libebl/eblcopyrelocp.c b/libebl/eblcopyrelocp.c
index 702f8c7..0458c4f 100644
--- a/libebl/eblcopyrelocp.c
+++ b/libebl/eblcopyrelocp.c
@@ -35,9 +35,7 @@
bool
-ebl_copy_reloc_p (ebl, reloc)
- Ebl *ebl;
- int reloc;
+ebl_copy_reloc_p (Ebl *ebl, int reloc)
{
return ebl->copy_reloc_p (reloc);
}
diff --git a/libebl/eblcorenote.c b/libebl/eblcorenote.c
index 2a79278..783f981 100644
--- a/libebl/eblcorenote.c
+++ b/libebl/eblcorenote.c
@@ -40,16 +40,10 @@
int
-ebl_core_note (ebl, nhdr, name,
- regs_offset, nregloc, reglocs, nitems, items)
- Ebl *ebl;
- const GElf_Nhdr *nhdr;
- const char *name;
- GElf_Word *regs_offset;
- size_t *nregloc;
- const Ebl_Register_Location **reglocs;
- size_t *nitems;
- const Ebl_Core_Item **items;
+ebl_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const char *name,
+ GElf_Word *regs_offset, size_t *nregloc,
+ const Ebl_Register_Location **reglocs, size_t *nitems,
+ const Ebl_Core_Item **items)
{
int result = ebl->core_note (nhdr, name,
regs_offset, nregloc, reglocs, nitems, items);
diff --git a/libebl/eblcorenotetypename.c b/libebl/eblcorenotetypename.c
index b6db6cd..826f9a1 100644
--- a/libebl/eblcorenotetypename.c
+++ b/libebl/eblcorenotetypename.c
@@ -36,11 +36,7 @@
#include <libeblP.h>
const char *
-ebl_core_note_type_name (ebl, type, buf, len)
- Ebl *ebl;
- uint32_t type;
- char *buf;
- size_t len;
+ebl_core_note_type_name (Ebl *ebl, uint32_t type, char *buf, size_t len)
{
const char *res = ebl->core_note_type_name (type, buf, len);
diff --git a/libebl/ebldebugscnp.c b/libebl/ebldebugscnp.c
index 01a5675..2964fdb 100644
--- a/libebl/ebldebugscnp.c
+++ b/libebl/ebldebugscnp.c
@@ -36,9 +36,7 @@
bool
-ebl_debugscn_p (ebl, name)
- Ebl *ebl;
- const char *name;
+ebl_debugscn_p (Ebl *ebl, const char *name)
{
return name != NULL && ebl->debugscn_p (name);
}
diff --git a/libebl/ebldynamictagcheck.c b/libebl/ebldynamictagcheck.c
index 17acee0..c2311cc 100644
--- a/libebl/ebldynamictagcheck.c
+++ b/libebl/ebldynamictagcheck.c
@@ -36,9 +36,7 @@
bool
-ebl_dynamic_tag_check (ebl, tag)
- Ebl *ebl;
- int64_t tag;
+ebl_dynamic_tag_check (Ebl *ebl, int64_t tag)
{
bool res = ebl != NULL ? ebl->dynamic_tag_check (tag) : false;
diff --git a/libebl/ebldynamictagname.c b/libebl/ebldynamictagname.c
index 6b09ee6..3aaccd0 100644
--- a/libebl/ebldynamictagname.c
+++ b/libebl/ebldynamictagname.c
@@ -37,11 +37,7 @@
const char *
-ebl_dynamic_tag_name (ebl, tag, buf, len)
- Ebl *ebl;
- int64_t tag;
- char *buf;
- size_t len;
+ebl_dynamic_tag_name (Ebl *ebl, int64_t tag, char *buf, size_t len)
{
const char *res = ebl != NULL ? ebl->dynamic_tag_name (tag, buf, len) : NULL;
diff --git a/libebl/eblelfclass.c b/libebl/eblelfclass.c
index 62d1283..2ffef30 100644
--- a/libebl/eblelfclass.c
+++ b/libebl/eblelfclass.c
@@ -35,8 +35,7 @@
int
-ebl_get_elfclass (ebl)
- Ebl *ebl;
+ebl_get_elfclass (Ebl *ebl)
{
return ebl->class;
}
diff --git a/libebl/eblelfdata.c b/libebl/eblelfdata.c
index b09dbb5..072924b 100644
--- a/libebl/eblelfdata.c
+++ b/libebl/eblelfdata.c
@@ -35,8 +35,7 @@
int
-ebl_get_elfdata (ebl)
- Ebl *ebl;
+ebl_get_elfdata (Ebl *ebl)
{
return ebl->data;
}
diff --git a/libebl/eblelfmachine.c b/libebl/eblelfmachine.c
index cd961e7..c2c8627 100644
--- a/libebl/eblelfmachine.c
+++ b/libebl/eblelfmachine.c
@@ -35,8 +35,7 @@
int
-ebl_get_elfmachine (ebl)
- Ebl *ebl;
+ebl_get_elfmachine (Ebl *ebl)
{
return ebl->machine;
}
diff --git a/libebl/eblgotpcreloccheck.c b/libebl/eblgotpcreloccheck.c
index 55625de..7c9c079 100644
--- a/libebl/eblgotpcreloccheck.c
+++ b/libebl/eblgotpcreloccheck.c
@@ -36,9 +36,7 @@
bool
-ebl_gotpc_reloc_check (ebl, reloc)
- Ebl *ebl;
- int reloc;
+ebl_gotpc_reloc_check (Ebl *ebl, int reloc)
{
return ebl != NULL ? ebl->gotpc_reloc_check (ebl->elf, reloc) : false;
}
diff --git a/libebl/eblmachineflagcheck.c b/libebl/eblmachineflagcheck.c
index d6d7931..e98b600 100644
--- a/libebl/eblmachineflagcheck.c
+++ b/libebl/eblmachineflagcheck.c
@@ -35,9 +35,7 @@
bool
-ebl_machine_flag_check (ebl, flags)
- Ebl *ebl;
- Elf64_Word flags;
+ebl_machine_flag_check (Ebl *ebl, Elf64_Word flags)
{
return ebl != NULL ? ebl->machine_flag_check (flags) : (flags == 0);
}
diff --git a/libebl/eblmachineflagname.c b/libebl/eblmachineflagname.c
index e392f5a..6079a61 100644
--- a/libebl/eblmachineflagname.c
+++ b/libebl/eblmachineflagname.c
@@ -37,11 +37,7 @@
const char *
-ebl_machine_flag_name (ebl, flags, buf, len)
- Ebl *ebl;
- Elf64_Word flags;
- char *buf;
- size_t len;
+ebl_machine_flag_name (Ebl *ebl, Elf64_Word flags, char *buf, size_t len)
{
const char *res;
diff --git a/libebl/eblmachinesectionflagcheck.c b/libebl/eblmachinesectionflagcheck.c
index 671eb8c..a73b230 100644
--- a/libebl/eblmachinesectionflagcheck.c
+++ b/libebl/eblmachinesectionflagcheck.c
@@ -34,9 +34,7 @@
bool
-ebl_machine_section_flag_check (ebl, flags)
- Ebl *ebl;
- GElf_Xword flags;
+ebl_machine_section_flag_check (Ebl *ebl, GElf_Xword flags)
{
return ebl != NULL ? ebl->machine_section_flag_check (flags) : (flags == 0);
}
diff --git a/libebl/eblnonerelocp.c b/libebl/eblnonerelocp.c
index 07c6b0e..e51a3b0 100644
--- a/libebl/eblnonerelocp.c
+++ b/libebl/eblnonerelocp.c
@@ -35,9 +35,7 @@
bool
-ebl_none_reloc_p (ebl, reloc)
- Ebl *ebl;
- int reloc;
+ebl_none_reloc_p (Ebl *ebl, int reloc)
{
return ebl->none_reloc_p (reloc);
}
diff --git a/libebl/eblobjecttypename.c b/libebl/eblobjecttypename.c
index 1a2c8e8..b0fd372 100644
--- a/libebl/eblobjecttypename.c
+++ b/libebl/eblobjecttypename.c
@@ -36,11 +36,7 @@
const char *
-ebl_object_type_name (ebl, object, buf, len)
- Ebl *ebl;
- int object;
- char *buf;
- size_t len;
+ebl_object_type_name (Ebl *ebl, int object, char *buf, size_t len)
{
const char *res;
diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
index b9bf1c0..fa1eb93 100644
--- a/libebl/eblobjnote.c
+++ b/libebl/eblobjnote.c
@@ -39,12 +39,8 @@
void
-ebl_object_note (ebl, name, type, descsz, desc)
- Ebl *ebl;
- const char *name;
- uint32_t type;
- uint32_t descsz;
- const char *desc;
+ebl_object_note (Ebl *ebl, const char *name, uint32_t type,
+ uint32_t descsz, const char *desc)
{
if (! ebl->object_note (name, type, descsz, desc))
/* The machine specific function did not know this type. */
diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c
index 8a70e61..8e2e329 100644
--- a/libebl/eblobjnotetypename.c
+++ b/libebl/eblobjnotetypename.c
@@ -38,12 +38,8 @@
const char *
-ebl_object_note_type_name (ebl, name, type, buf, len)
- Ebl *ebl;
- const char *name;
- uint32_t type;
- char *buf;
- size_t len;
+ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type,
+ char *buf, size_t len)
{
const char *res = ebl->object_note_type_name (name, type, buf, len);
diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
index 02b24d3..b301400 100644
--- a/libebl/eblopenbackend.c
+++ b/libebl/eblopenbackend.c
@@ -254,10 +254,7 @@ fill_defaults (Ebl *result)
/* Find an appropriate backend for the file associated with ELF. */
static Ebl *
-openbackend (elf, emulation, machine)
- Elf *elf;
- const char *emulation;
- GElf_Half machine;
+openbackend (Elf *elf, const char *emulation, GElf_Half machine)
{
Ebl *result;
size_t cnt;
@@ -397,8 +394,7 @@ openbackend (elf, emulation, machine)
/* Find an appropriate backend for the file associated with ELF. */
Ebl *
-ebl_openbackend (elf)
- Elf *elf;
+ebl_openbackend (Elf *elf)
{
GElf_Ehdr ehdr_mem;
GElf_Ehdr *ehdr;
diff --git a/libebl/eblosabiname.c b/libebl/eblosabiname.c
index 3ea6f56..b60f2af 100644
--- a/libebl/eblosabiname.c
+++ b/libebl/eblosabiname.c
@@ -36,11 +36,7 @@
const char *
-ebl_osabi_name (ebl, osabi, buf, len)
- Ebl *ebl;
- int osabi;
- char *buf;
- size_t len;
+ebl_osabi_name (Ebl *ebl, int osabi, char *buf, size_t len)
{
const char *res = ebl != NULL ? ebl->osabi_name (osabi, buf, len) : NULL;
diff --git a/libebl/eblreginfo.c b/libebl/eblreginfo.c
index f213b4a..acc4849 100644
--- a/libebl/eblreginfo.c
+++ b/libebl/eblreginfo.c
@@ -35,15 +35,9 @@
ssize_t
-ebl_register_info (ebl, regno, name, namelen, prefix, setname, bits, type)
- Ebl *ebl;
- int regno;
- char *name;
- size_t namelen;
- const char **prefix;
- const char **setname;
- int *bits;
- int *type;
+ebl_register_info (Ebl *ebl, int regno, char *name, size_t namelen,
+ const char **prefix, const char **setname,
+ int *bits, int *type)
{
return ebl == NULL ? -1 : ebl->register_info (ebl, regno, name, namelen,
prefix, setname, bits, type);
diff --git a/libebl/eblrelativerelocp.c b/libebl/eblrelativerelocp.c
index 297caec..51f5dce 100644
--- a/libebl/eblrelativerelocp.c
+++ b/libebl/eblrelativerelocp.c
@@ -35,9 +35,7 @@
bool
-ebl_relative_reloc_p (ebl, reloc)
- Ebl *ebl;
- int reloc;
+ebl_relative_reloc_p (Ebl *ebl, int reloc)
{
return ebl->relative_reloc_p (reloc);
}
diff --git a/libebl/eblrelocsimpletype.c b/libebl/eblrelocsimpletype.c
index 085fc93..9bd2928 100644
--- a/libebl/eblrelocsimpletype.c
+++ b/libebl/eblrelocsimpletype.c
@@ -34,9 +34,7 @@
Elf_Type
-ebl_reloc_simple_type (ebl, reloc)
- Ebl *ebl;
- int reloc;
+ebl_reloc_simple_type (Ebl *ebl, int reloc)
{
return ebl != NULL ? ebl->reloc_simple_type (ebl, reloc) : ELF_T_NUM;
}
diff --git a/libebl/eblreloctypecheck.c b/libebl/eblreloctypecheck.c
index e322ace..80e67ef 100644
--- a/libebl/eblreloctypecheck.c
+++ b/libebl/eblreloctypecheck.c
@@ -35,9 +35,7 @@
bool
-ebl_reloc_type_check (ebl, reloc)
- Ebl *ebl;
- int reloc;
+ebl_reloc_type_check (Ebl *ebl, int reloc)
{
return ebl != NULL ? ebl->reloc_type_check (reloc) : false;
}
diff --git a/libebl/eblreloctypename.c b/libebl/eblreloctypename.c
index fb39101..e53ec0c 100644
--- a/libebl/eblreloctypename.c
+++ b/libebl/eblreloctypename.c
@@ -36,11 +36,7 @@
const char *
-ebl_reloc_type_name (ebl, reloc, buf, len)
- Ebl *ebl;
- int reloc;
- char *buf;
- size_t len;
+ebl_reloc_type_name (Ebl *ebl, int reloc, char *buf, size_t len)
{
const char *res;
diff --git a/libebl/eblrelocvaliduse.c b/libebl/eblrelocvaliduse.c
index 62c4ae7..f0bed34 100644
--- a/libebl/eblrelocvaliduse.c
+++ b/libebl/eblrelocvaliduse.c
@@ -35,9 +35,7 @@
bool
-ebl_reloc_valid_use (ebl, reloc)
- Ebl *ebl;
- int reloc;
+ebl_reloc_valid_use (Ebl *ebl, int reloc)
{
return ebl != NULL ? ebl->reloc_valid_use (ebl->elf, reloc) : false;
}
diff --git a/libebl/eblretval.c b/libebl/eblretval.c
index 056a549..7c03982 100644
--- a/libebl/eblretval.c
+++ b/libebl/eblretval.c
@@ -35,10 +35,8 @@
int
-ebl_return_value_location (ebl, functypedie, locops)
- Ebl *ebl;
- Dwarf_Die *functypedie;
- const Dwarf_Op **locops;
+ebl_return_value_location (Ebl *ebl, Dwarf_Die *functypedie,
+ const Dwarf_Op **locops)
{
return ebl == NULL ? -1 : ebl->return_value_location (functypedie, locops);
}
diff --git a/libebl/eblsectionname.c b/libebl/eblsectionname.c
index 81c7add..21c537f 100644
--- a/libebl/eblsectionname.c
+++ b/libebl/eblsectionname.c
@@ -36,14 +36,8 @@
const char *
-ebl_section_name (ebl, section, xsection, buf, len, scnnames, shnum)
- Ebl *ebl;
- int section;
- int xsection;
- char *buf;
- size_t len;
- const char *scnnames[];
- size_t shnum;
+ebl_section_name (Ebl *ebl, int section, int xsection, char *buf, size_t len,
+ const char *scnnames[], size_t shnum)
{
const char *res = ebl != NULL ? ebl->section_name (section, xsection,
buf, len) : NULL;
diff --git a/libebl/eblsectiontypename.c b/libebl/eblsectiontypename.c
index 3a30cd6..5dc1ec6 100644
--- a/libebl/eblsectiontypename.c
+++ b/libebl/eblsectiontypename.c
@@ -36,11 +36,7 @@
const char *
-ebl_section_type_name (ebl, section, buf, len)
- Ebl *ebl;
- int section;
- char *buf;
- size_t len;
+ebl_section_type_name (Ebl *ebl, int section, char *buf, size_t len)
{
const char *res = ebl->section_type_name (section, buf, len);
diff --git a/libebl/eblsegmenttypename.c b/libebl/eblsegmenttypename.c
index 3cad66e..14eda76 100644
--- a/libebl/eblsegmenttypename.c
+++ b/libebl/eblsegmenttypename.c
@@ -36,11 +36,7 @@
const char *
-ebl_segment_type_name (ebl, segment, buf, len)
- Ebl *ebl;
- int segment;
- char *buf;
- size_t len;
+ebl_segment_type_name (Ebl *ebl, int segment, char *buf, size_t len)
{
const char *res;
diff --git a/libebl/eblshflagscombine.c b/libebl/eblshflagscombine.c
index 87625f8..4deaaaa 100644
--- a/libebl/eblshflagscombine.c
+++ b/libebl/eblshflagscombine.c
@@ -35,10 +35,7 @@
GElf_Word
-ebl_sh_flags_combine (ebl, flags1, flags2)
- Ebl *ebl;
- GElf_Word flags1;
- GElf_Word flags2;
+ebl_sh_flags_combine (Ebl *ebl, GElf_Word flags1, GElf_Word flags2)
{
return ebl->sh_flags_combine (flags1, flags2);
}
diff --git a/libebl/eblsymbolbindingname.c b/libebl/eblsymbolbindingname.c
index fd5bfda..9797425 100644
--- a/libebl/eblsymbolbindingname.c
+++ b/libebl/eblsymbolbindingname.c
@@ -36,11 +36,7 @@
const char *
-ebl_symbol_binding_name (ebl, binding, buf, len)
- Ebl *ebl;
- int binding;
- char *buf;
- size_t len;
+ebl_symbol_binding_name (Ebl *ebl, int binding, char *buf, size_t len)
{
const char *res;
diff --git a/libebl/eblsymboltypename.c b/libebl/eblsymboltypename.c
index 4e653d2..09fa874 100644
--- a/libebl/eblsymboltypename.c
+++ b/libebl/eblsymboltypename.c
@@ -36,11 +36,7 @@
const char *
-ebl_symbol_type_name (ebl, symbol, buf, len)
- Ebl *ebl;
- int symbol;
- char *buf;
- size_t len;
+ebl_symbol_type_name (Ebl *ebl, int symbol, char *buf, size_t len)
{
const char *res;
diff --git a/libebl/eblsysvhashentrysize.c b/libebl/eblsysvhashentrysize.c
index f966646..2049431 100644
--- a/libebl/eblsysvhashentrysize.c
+++ b/libebl/eblsysvhashentrysize.c
@@ -35,8 +35,7 @@
int
-ebl_sysvhash_entrysize (ebl)
- Ebl *ebl;
+ebl_sysvhash_entrysize (Ebl *ebl)
{
return ebl->sysvhash_entrysize;
}
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index bb56e5b..f7b1dda 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-22 Mark Wielaard <mjw(a)redhat.com>
+
+ * *.c: Remove old-style function definitions.
+
2015-06-18 Mark Wielaard <mjw(a)redhat.com>
* elf32_updatefile.c (updatefile): Always free shdr_data and scns
diff --git a/libelf/elf32_checksum.c b/libelf/elf32_checksum.c
index 4c59856..f9dfccb 100644
--- a/libelf/elf32_checksum.c
+++ b/libelf/elf32_checksum.c
@@ -1,5 +1,5 @@
/* Compute simple checksum from permanent parts of the ELF file.
- Copyright (C) 2002, 2003, 2004, 2005, 2009 Red Hat, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2009, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2002.
@@ -51,8 +51,7 @@
long int
-elfw2(LIBELFBITS,checksum) (elf)
- Elf *elf;
+elfw2(LIBELFBITS,checksum) (Elf *elf)
{
size_t shstrndx;
Elf_Scn *scn;
diff --git a/libelf/elf32_fsize.c b/libelf/elf32_fsize.c
index d7496fa..fddae91 100644
--- a/libelf/elf32_fsize.c
+++ b/libelf/elf32_fsize.c
@@ -1,5 +1,5 @@
/* Return the size of an object file type.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -40,10 +40,7 @@
size_t
-elfw2(LIBELFBITS, fsize) (type, count, version)
- Elf_Type type;
- size_t count;
- unsigned int version;
+elfw2(LIBELFBITS, fsize) (Elf_Type type, size_t count, unsigned int version)
{
/* We do not have differences between file and memory sizes. Better
not since otherwise `mmap' would not work. */
diff --git a/libelf/elf32_getehdr.c b/libelf/elf32_getehdr.c
index ee0a2e0..2b9ad1f 100644
--- a/libelf/elf32_getehdr.c
+++ b/libelf/elf32_getehdr.c
@@ -1,5 +1,5 @@
/* Get ELF header.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -42,9 +42,7 @@
static ElfW2(LIBELFBITS,Ehdr) *
-getehdr_impl (elf, wrlock)
- Elf *elf;
- int wrlock;
+getehdr_impl (Elf *elf, int wrlock)
{
if (elf == NULL)
return NULL;
@@ -77,15 +75,13 @@ getehdr_impl (elf, wrlock)
}
ElfW2(LIBELFBITS,Ehdr) *
-__elfw2(LIBELFBITS,getehdr_wrlock) (elf)
- Elf *elf;
+__elfw2(LIBELFBITS,getehdr_wrlock) (Elf *elf)
{
return getehdr_impl (elf, 1);
}
ElfW2(LIBELFBITS,Ehdr) *
-elfw2(LIBELFBITS,getehdr) (elf)
- Elf *elf;
+elfw2(LIBELFBITS,getehdr) (Elf *elf)
{
ElfW2(LIBELFBITS,Ehdr) *result;
if (elf == NULL)
diff --git a/libelf/elf32_getphdr.c b/libelf/elf32_getphdr.c
index 38e489d..99b4ac0 100644
--- a/libelf/elf32_getphdr.c
+++ b/libelf/elf32_getphdr.c
@@ -1,5 +1,5 @@
/* Get ELF program header table.
- Copyright (C) 1998-2010, 2014 Red Hat, Inc.
+ Copyright (C) 1998-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -46,8 +46,7 @@
#endif
ElfW2(LIBELFBITS,Phdr) *
-__elfw2(LIBELFBITS,getphdr_wrlock) (elf)
- Elf *elf;
+__elfw2(LIBELFBITS,getphdr_wrlock) (Elf *elf)
{
ElfW2(LIBELFBITS,Phdr) *result;
@@ -237,8 +236,7 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf)
}
ElfW2(LIBELFBITS,Phdr) *
-elfw2(LIBELFBITS,getphdr) (elf)
- Elf *elf;
+elfw2(LIBELFBITS,getphdr) (Elf *elf)
{
ElfW2(LIBELFBITS,Phdr) *result;
diff --git a/libelf/elf32_getshdr.c b/libelf/elf32_getshdr.c
index ee1aed8..a5fdb54 100644
--- a/libelf/elf32_getshdr.c
+++ b/libelf/elf32_getshdr.c
@@ -1,5 +1,5 @@
/* Return section header.
- Copyright (C) 1998-2002, 2005, 2007, 2009, 2012, 2014 Red Hat, Inc.
+ Copyright (C) 1998-2002, 2005, 2007, 2009, 2012, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -243,8 +243,7 @@ scn_valid (Elf_Scn *scn)
}
ElfW2(LIBELFBITS,Shdr) *
-__elfw2(LIBELFBITS,getshdr_rdlock) (scn)
- Elf_Scn *scn;
+__elfw2(LIBELFBITS,getshdr_rdlock) (Elf_Scn *scn)
{
ElfW2(LIBELFBITS,Shdr) *result;
@@ -265,8 +264,7 @@ __elfw2(LIBELFBITS,getshdr_rdlock) (scn)
}
ElfW2(LIBELFBITS,Shdr) *
-__elfw2(LIBELFBITS,getshdr_wrlock) (scn)
- Elf_Scn *scn;
+__elfw2(LIBELFBITS,getshdr_wrlock) (Elf_Scn *scn)
{
ElfW2(LIBELFBITS,Shdr) *result;
@@ -281,8 +279,7 @@ __elfw2(LIBELFBITS,getshdr_wrlock) (scn)
}
ElfW2(LIBELFBITS,Shdr) *
-elfw2(LIBELFBITS,getshdr) (scn)
- Elf_Scn *scn;
+elfw2(LIBELFBITS,getshdr) (Elf_Scn *scn)
{
ElfW2(LIBELFBITS,Shdr) *result;
diff --git a/libelf/elf32_newehdr.c b/libelf/elf32_newehdr.c
index 4b547bc..775d115 100644
--- a/libelf/elf32_newehdr.c
+++ b/libelf/elf32_newehdr.c
@@ -1,5 +1,5 @@
/* Create new ELF header.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -42,8 +42,7 @@
ElfW2(LIBELFBITS,Ehdr) *
-elfw2(LIBELFBITS,newehdr) (elf)
- Elf *elf;
+elfw2(LIBELFBITS,newehdr) (Elf *elf)
{
ElfW2(LIBELFBITS,Ehdr) *result;
diff --git a/libelf/elf32_newphdr.c b/libelf/elf32_newphdr.c
index f89153b..4aa7213 100644
--- a/libelf/elf32_newphdr.c
+++ b/libelf/elf32_newphdr.c
@@ -1,5 +1,5 @@
/* Create new ELF program header table.
- Copyright (C) 1999-2010, 2014 Red Hat, Inc.
+ Copyright (C) 1999-2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -43,9 +43,7 @@
ElfW2(LIBELFBITS,Phdr) *
-elfw2(LIBELFBITS,newphdr) (elf, count)
- Elf *elf;
- size_t count;
+elfw2(LIBELFBITS,newphdr) (Elf *elf, size_t count)
{
ElfW2(LIBELFBITS,Phdr) *result;
diff --git a/libelf/elf32_offscn.c b/libelf/elf32_offscn.c
index a1ff6d4..9e757c8 100644
--- a/libelf/elf32_offscn.c
+++ b/libelf/elf32_offscn.c
@@ -1,5 +1,5 @@
/* Get section at specific index.
- Copyright (C) 2005, 2008 Red Hat, Inc.
+ Copyright (C) 2005, 2008, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 2005.
@@ -43,9 +43,7 @@
Elf_Scn *
-elfw2(LIBELFBITS,offscn) (elf, offset)
- Elf *elf;
- ElfW2(LIBELFBITS,Off) offset;
+elfw2(LIBELFBITS,offscn) (Elf *elf, ElfW2(LIBELFBITS,Off) offset)
{
if (elf == NULL)
return NULL;
diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c
index 27a973e..ac4eaf4 100644
--- a/libelf/elf32_xlatetof.c
+++ b/libelf/elf32_xlatetof.c
@@ -1,5 +1,5 @@
/* Convert from memory to file representation.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -43,10 +43,8 @@
Elf_Data *
-elfw2(LIBELFBITS, xlatetof) (dest, src, encode)
- Elf_Data *dest;
- const Elf_Data *src;
- unsigned int encode;
+elfw2(LIBELFBITS, xlatetof) (Elf_Data *dest, const Elf_Data *src,
+ unsigned int encode)
{
/* First test whether the input data is really suitable for this
type. This means, whether there is an integer number of records.
diff --git a/libelf/elf32_xlatetom.c b/libelf/elf32_xlatetom.c
index 368df07..13cd485 100644
--- a/libelf/elf32_xlatetom.c
+++ b/libelf/elf32_xlatetom.c
@@ -1,5 +1,5 @@
/* Convert from file to memory representation.
- Copyright (C) 1998, 1999, 2000, 2002, 2012 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2012, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -43,10 +43,8 @@
Elf_Data *
-elfw2(LIBELFBITS, xlatetom) (dest, src, encode)
- Elf_Data *dest;
- const Elf_Data *src;
- unsigned int encode;
+elfw2(LIBELFBITS, xlatetom) (Elf_Data *dest, const Elf_Data *src,
+ unsigned int encode)
{
/* First test whether the input data is really suitable for this
type. This means, whether there is an integer number of records.
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index f002ebf..213b5c0 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -775,8 +775,7 @@ read_long_names (Elf *elf)
/* Read the next archive header. */
int
internal_function
-__libelf_next_arhdr_wrlock (elf)
- Elf *elf;
+__libelf_next_arhdr_wrlock (Elf *elf)
{
struct ar_hdr *ar_hdr;
Elf_Arhdr *elf_ar_hdr;
@@ -1043,10 +1042,7 @@ write_file (int fd, Elf_Cmd cmd)
/* Return a descriptor for the file belonging to FILDES. */
Elf *
-elf_begin (fildes, cmd, ref)
- int fildes;
- Elf_Cmd cmd;
- Elf *ref;
+elf_begin (int fildes, Elf_Cmd cmd, Elf *ref)
{
Elf *retval;
@@ -1067,7 +1063,7 @@ elf_begin (fildes, cmd, ref)
return NULL;
}
- Elf *lock_dup_elf ()
+ Elf *lock_dup_elf (void)
{
/* We need wrlock to dup an archive. */
if (ref->kind == ELF_K_AR)
diff --git a/libelf/elf_cntl.c b/libelf/elf_cntl.c
index a3c5805..ab13ffb 100644
--- a/libelf/elf_cntl.c
+++ b/libelf/elf_cntl.c
@@ -1,5 +1,5 @@
/* Control an ELF file desrciptor.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -37,9 +37,7 @@
int
-elf_cntl (elf, cmd)
- Elf *elf;
- Elf_Cmd cmd;
+elf_cntl (Elf *elf, Elf_Cmd cmd)
{
int result = 0;
diff --git a/libelf/elf_end.c b/libelf/elf_end.c
index d4ae051..7ea876c 100644
--- a/libelf/elf_end.c
+++ b/libelf/elf_end.c
@@ -1,5 +1,5 @@
/* Free resources associated with Elf descriptor.
- Copyright (C) 1998,1999,2000,2001,2002,2004,2005,2007 Red Hat, Inc.
+ Copyright (C) 1998,1999,2000,2001,2002,2004,2005,2007,2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -40,8 +40,7 @@
int
-elf_end (elf)
- Elf *elf;
+elf_end (Elf *elf)
{
Elf *parent;
diff --git a/libelf/elf_error.c b/libelf/elf_error.c
index aa7f917..d6e5183 100644
--- a/libelf/elf_error.c
+++ b/libelf/elf_error.c
@@ -1,5 +1,5 @@
/* Error handling in libelf.
- Copyright (C) 1998-2010 Red Hat, Inc.
+ Copyright (C) 1998-2010, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -283,16 +283,14 @@ static const uint_fast16_t msgidx[ELF_E_NUM] =
void
-__libelf_seterrno (value)
- int value;
+__libelf_seterrno (int value)
{
global_error = value >= 0 && value < nmsgidx ? value : ELF_E_UNKNOWN_ERROR;
}
const char *
-elf_errmsg (error)
- int error;
+elf_errmsg (int error)
{
int last_error = global_error;
diff --git a/libelf/elf_fill.c b/libelf/elf_fill.c
index 174ab45..6ebdf63 100644
--- a/libelf/elf_fill.c
+++ b/libelf/elf_fill.c
@@ -1,5 +1,5 @@
/* Set fill byte used when constructing ELF objects.
- Copyright (C) 1998, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -40,8 +40,7 @@ int __libelf_fill_byte;
void
-elf_fill (fill)
- int fill;
+elf_fill (int fill)
{
__libelf_fill_byte = fill;
}
diff --git a/libelf/elf_flagdata.c b/libelf/elf_flagdata.c
index ace8cc5..cd2b123 100644
--- a/libelf/elf_flagdata.c
+++ b/libelf/elf_flagdata.c
@@ -1,5 +1,5 @@
/* Manipulate ELF data flag.
- Copyright (C) 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,10 +38,7 @@
unsigned int
-elf_flagdata (data, cmd, flags)
- Elf_Data *data;
- Elf_Cmd cmd;
- unsigned int flags;
+elf_flagdata (Elf_Data *data, Elf_Cmd cmd, unsigned int flags)
{
Elf_Data_Scn *data_scn;
unsigned int result;
diff --git a/libelf/elf_flagehdr.c b/libelf/elf_flagehdr.c
index d3a320b..a98276d 100644
--- a/libelf/elf_flagehdr.c
+++ b/libelf/elf_flagehdr.c
@@ -1,5 +1,5 @@
/* Manipulate ELF header flags.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -38,10 +38,7 @@
unsigned int
-elf_flagehdr (elf, cmd, flags)
- Elf *elf;
- Elf_Cmd cmd;
- unsigned int flags;
+elf_flagehdr (Elf *elf, Elf_Cmd cmd, unsigned int flags)
{
unsigned int result;
diff --git a/libelf/elf_flagelf.c b/libelf/elf_flagelf.c
index b34bd4f..bd90a21 100644
--- a/libelf/elf_flagelf.c
+++ b/libelf/elf_flagelf.c
@@ -1,5 +1,5 @@
/* Manipulate ELF file flags.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -38,10 +38,7 @@
unsigned int
-elf_flagelf (elf, cmd, flags)
- Elf *elf;
- Elf_Cmd cmd;
- unsigned int flags;
+elf_flagelf (Elf *elf, Elf_Cmd cmd, unsigned int flags)
{
unsigned int result;
diff --git a/libelf/elf_flagphdr.c b/libelf/elf_flagphdr.c
index 2a589cc..0682d1f 100644
--- a/libelf/elf_flagphdr.c
+++ b/libelf/elf_flagphdr.c
@@ -1,5 +1,5 @@
/* Manipulate ELF program header flags.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -38,10 +38,7 @@
unsigned int
-elf_flagphdr (elf, cmd, flags)
- Elf *elf;
- Elf_Cmd cmd;
- unsigned int flags;
+elf_flagphdr (Elf *elf, Elf_Cmd cmd, unsigned int flags)
{
unsigned int result;
diff --git a/libelf/elf_flagscn.c b/libelf/elf_flagscn.c
index 3ff826c..2164a8c 100644
--- a/libelf/elf_flagscn.c
+++ b/libelf/elf_flagscn.c
@@ -1,5 +1,5 @@
/* Manipulate ELF section flags.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -38,10 +38,7 @@
unsigned int
-elf_flagscn (scn, cmd, flags)
- Elf_Scn *scn;
- Elf_Cmd cmd;
- unsigned int flags;
+elf_flagscn (Elf_Scn *scn, Elf_Cmd cmd, unsigned int flags)
{
unsigned int result;
diff --git a/libelf/elf_flagshdr.c b/libelf/elf_flagshdr.c
index 8d797af..febf4ab 100644
--- a/libelf/elf_flagshdr.c
+++ b/libelf/elf_flagshdr.c
@@ -1,5 +1,5 @@
/* Manipulate ELF section header flags.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -38,10 +38,7 @@
unsigned int
-elf_flagshdr (scn, cmd, flags)
- Elf_Scn *scn;
- Elf_Cmd cmd;
- unsigned int flags;
+elf_flagshdr (Elf_Scn *scn, Elf_Cmd cmd, unsigned int flags)
{
unsigned int result;
diff --git a/libelf/elf_getarhdr.c b/libelf/elf_getarhdr.c
index f8b36b8..509f1da 100644
--- a/libelf/elf_getarhdr.c
+++ b/libelf/elf_getarhdr.c
@@ -1,5 +1,5 @@
/* Read header of next archive member.
- Copyright (C) 1998, 1999, 2000, 2002, 2008 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2008, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -39,8 +39,7 @@
Elf_Arhdr *
-elf_getarhdr (elf)
- Elf *elf;
+elf_getarhdr (Elf *elf)
{
if (elf == NULL)
return NULL;
diff --git a/libelf/elf_getaroff.c b/libelf/elf_getaroff.c
index 62da34d..5b59203 100644
--- a/libelf/elf_getaroff.c
+++ b/libelf/elf_getaroff.c
@@ -1,5 +1,5 @@
/* Return offset in archive for current file ELF.
- Copyright (C) 2005, 2008 Red Hat, Inc.
+ Copyright (C) 2005, 2008, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 2005.
@@ -39,8 +39,7 @@
off_t
-elf_getaroff (elf)
- Elf *elf;
+elf_getaroff (Elf *elf)
{
/* Be gratious, the specs demand it. */
if (elf == NULL || elf->parent == NULL)
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
index 8324244..1ab94ca 100644
--- a/libelf/elf_getarsym.c
+++ b/libelf/elf_getarsym.c
@@ -74,9 +74,7 @@ read_number_entries (uint64_t *nump, Elf *elf, size_t *offp, bool index64_p)
}
Elf_Arsym *
-elf_getarsym (elf, ptr)
- Elf *elf;
- size_t *ptr;
+elf_getarsym (Elf *elf, size_t *ptr)
{
if (elf->kind != ELF_K_AR)
{
diff --git a/libelf/elf_getbase.c b/libelf/elf_getbase.c
index ff0feb4..8ec5f87 100644
--- a/libelf/elf_getbase.c
+++ b/libelf/elf_getbase.c
@@ -1,5 +1,5 @@
/* Return offset of first byte for the object.
- Copyright (C) 1998, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,8 +38,7 @@
off_t
-elf_getbase (elf)
- Elf *elf;
+elf_getbase (Elf *elf)
{
return elf == NULL ? (off_t) -1 : elf->start_offset;
}
diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c
index 770e035..9a567e5 100644
--- a/libelf/elf_getdata.c
+++ b/libelf/elf_getdata.c
@@ -422,9 +422,7 @@ __libelf_set_data_list_rdlock (Elf_Scn *scn, int wrlocked)
Elf_Data *
internal_function
-__elf_getdata_rdlock (scn, data)
- Elf_Scn *scn;
- Elf_Data *data;
+__elf_getdata_rdlock (Elf_Scn *scn, Elf_Data *data)
{
Elf_Data *result = NULL;
Elf *elf;
@@ -520,9 +518,7 @@ __elf_getdata_rdlock (scn, data)
}
Elf_Data *
-elf_getdata (scn, data)
- Elf_Scn *scn;
- Elf_Data *data;
+elf_getdata (Elf_Scn *scn, Elf_Data *data)
{
Elf_Data *result;
diff --git a/libelf/elf_getdata_rawchunk.c b/libelf/elf_getdata_rawchunk.c
index 5cc11e7..51b3e3e 100644
--- a/libelf/elf_getdata_rawchunk.c
+++ b/libelf/elf_getdata_rawchunk.c
@@ -1,5 +1,5 @@
/* Return converted data from raw chunk of ELF file.
- Copyright (C) 2007, 2014 Red Hat, Inc.
+ Copyright (C) 2007, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -41,11 +41,7 @@
#include "common.h"
Elf_Data *
-elf_getdata_rawchunk (elf, offset, size, type)
- Elf *elf;
- off64_t offset;
- size_t size;
- Elf_Type type;
+elf_getdata_rawchunk (Elf *elf, off64_t offset, size_t size, Elf_Type type)
{
if (unlikely (elf == NULL))
return NULL;
diff --git a/libelf/elf_getident.c b/libelf/elf_getident.c
index 10beeaf..5abf8c9 100644
--- a/libelf/elf_getident.c
+++ b/libelf/elf_getident.c
@@ -1,5 +1,5 @@
/* Retrieve file identification data.
- Copyright (C) 1998, 1999, 2000, 2002, 2004 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2004, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -37,9 +37,7 @@
char *
-elf_getident (elf, ptr)
- Elf *elf;
- size_t *ptr;
+elf_getident (Elf *elf, size_t *ptr)
{
/* In case this is no ELF file, the handle is invalid and we return
NULL. */
diff --git a/libelf/elf_getphdrnum.c b/libelf/elf_getphdrnum.c
index f2fad87..fe70345 100644
--- a/libelf/elf_getphdrnum.c
+++ b/libelf/elf_getphdrnum.c
@@ -1,5 +1,5 @@
/* Return number of program headers in the ELF file.
- Copyright (C) 2010, 2014 Red Hat, Inc.
+ Copyright (C) 2010, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -38,9 +38,7 @@
int
-__elf_getphdrnum_rdlock (elf, dst)
- Elf *elf;
- size_t *dst;
+__elf_getphdrnum_rdlock (Elf *elf, size_t *dst)
{
if (unlikely (elf->state.elf64.ehdr == NULL))
{
@@ -80,9 +78,7 @@ __elf_getphdrnum_rdlock (elf, dst)
}
int
-__elf_getphdrnum_chk_rdlock (elf, dst)
- Elf *elf;
- size_t *dst;
+__elf_getphdrnum_chk_rdlock (Elf *elf, size_t *dst)
{
int result = __elf_getphdrnum_rdlock (elf, dst);
@@ -119,9 +115,7 @@ __elf_getphdrnum_chk_rdlock (elf, dst)
}
int
-elf_getphdrnum (elf, dst)
- Elf *elf;
- size_t *dst;
+elf_getphdrnum (Elf *elf, size_t *dst)
{
int result;
diff --git a/libelf/elf_getscn.c b/libelf/elf_getscn.c
index 7c6b7de..9f7213b 100644
--- a/libelf/elf_getscn.c
+++ b/libelf/elf_getscn.c
@@ -1,5 +1,5 @@
/* Get section at specific index.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -39,9 +39,7 @@
Elf_Scn *
-elf_getscn (elf, idx)
- Elf *elf;
- size_t idx;
+elf_getscn (Elf *elf, size_t idx)
{
if (elf == NULL)
return NULL;
diff --git a/libelf/elf_getshdrnum.c b/libelf/elf_getshdrnum.c
index 73a3300..4875c19 100644
--- a/libelf/elf_getshdrnum.c
+++ b/libelf/elf_getshdrnum.c
@@ -1,5 +1,5 @@
/* Return number of sections in the ELF file.
- Copyright (C) 2002, 2009 Red Hat, Inc.
+ Copyright (C) 2002, 2009, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2002.
@@ -39,9 +39,7 @@
int
-__elf_getshdrnum_rdlock (elf, dst)
- Elf *elf;
- size_t *dst;
+__elf_getshdrnum_rdlock (Elf *elf, size_t *dst)
{
int result = 0;
int idx;
@@ -71,9 +69,7 @@ __elf_getshdrnum_rdlock (elf, dst)
}
int
-elf_getshdrnum (elf, dst)
- Elf *elf;
- size_t *dst;
+elf_getshdrnum (Elf *elf, size_t *dst)
{
int result;
diff --git a/libelf/elf_getshdrstrndx.c b/libelf/elf_getshdrstrndx.c
index 6f8d66e..aead2fe 100644
--- a/libelf/elf_getshdrstrndx.c
+++ b/libelf/elf_getshdrstrndx.c
@@ -1,5 +1,5 @@
/* Return section index of section header string table.
- Copyright (C) 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2002.
@@ -43,9 +43,7 @@
int
-elf_getshdrstrndx (elf, dst)
- Elf *elf;
- size_t *dst;
+elf_getshdrstrndx (Elf *elf, size_t *dst)
{
int result = 0;
diff --git a/libelf/elf_gnu_hash.c b/libelf/elf_gnu_hash.c
index 4c21857..5a1b852 100644
--- a/libelf/elf_gnu_hash.c
+++ b/libelf/elf_gnu_hash.c
@@ -1,5 +1,5 @@
/* GNU-style Hash function used in ELF implementations.
- Copyright (C) 2006 Red Hat, Inc.
+ Copyright (C) 2006, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 2006.
@@ -37,8 +37,7 @@
#include <dl-hash.h>
unsigned long int
-elf_gnu_hash (string)
- const char *string;
+elf_gnu_hash (const char *string)
{
uint_fast32_t h = 5381;
for (unsigned char c = *string; c != '\0'; c = *++string)
diff --git a/libelf/elf_hash.c b/libelf/elf_hash.c
index 306ebc2..345697e 100644
--- a/libelf/elf_hash.c
+++ b/libelf/elf_hash.c
@@ -1,5 +1,5 @@
/* Hash function used in ELF implementations.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -37,8 +37,7 @@
#include <dl-hash.h>
unsigned long int
-elf_hash (string)
- const char *string;
+elf_hash (const char *string)
{
return _dl_elf_hash (string);
}
diff --git a/libelf/elf_kind.c b/libelf/elf_kind.c
index d8ab2fd..0fb3f0c 100644
--- a/libelf/elf_kind.c
+++ b/libelf/elf_kind.c
@@ -1,5 +1,5 @@
/* Return the kind of file associated with the descriptor.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,8 +38,7 @@
Elf_Kind
-elf_kind (elf)
- Elf *elf;
+elf_kind (Elf *elf)
{
return elf == NULL ? ELF_K_NONE : elf->kind;
}
diff --git a/libelf/elf_memory.c b/libelf/elf_memory.c
index 08f85a1..a47f1d2 100644
--- a/libelf/elf_memory.c
+++ b/libelf/elf_memory.c
@@ -1,5 +1,5 @@
/* Create descriptor for memory region.
- Copyright (C) 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -38,9 +38,7 @@
Elf *
-elf_memory (image, size)
- char *image;
- size_t size;
+elf_memory (char *image, size_t size)
{
if (image == NULL)
{
diff --git a/libelf/elf_ndxscn.c b/libelf/elf_ndxscn.c
index bd4bfbf..488c4e5 100644
--- a/libelf/elf_ndxscn.c
+++ b/libelf/elf_ndxscn.c
@@ -1,5 +1,5 @@
/* Get index of section.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,8 +38,7 @@
size_t
-elf_ndxscn (scn)
- Elf_Scn *scn;
+elf_ndxscn (Elf_Scn *scn)
{
if (scn == NULL)
return SHN_UNDEF;
diff --git a/libelf/elf_newscn.c b/libelf/elf_newscn.c
index 6e0029e..d15a642 100644
--- a/libelf/elf_newscn.c
+++ b/libelf/elf_newscn.c
@@ -1,5 +1,5 @@
/* Append new section.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 1998,1999,2000,2001,2002,2005,2009,2014,2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -41,8 +41,7 @@
Elf_Scn *
-elf_newscn (elf)
- Elf *elf;
+elf_newscn (Elf *elf)
{
Elf_Scn *result = NULL;
bool first = false;
diff --git a/libelf/elf_next.c b/libelf/elf_next.c
index 1f5c03c..6edafd2 100644
--- a/libelf/elf_next.c
+++ b/libelf/elf_next.c
@@ -1,5 +1,5 @@
/* Advance in archive to next element.
- Copyright (C) 1998-2009 Red Hat, Inc.
+ Copyright (C) 1998-2009, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -39,8 +39,7 @@
Elf_Cmd
-elf_next (elf)
- Elf *elf;
+elf_next (Elf *elf)
{
Elf *parent;
Elf_Cmd ret;
diff --git a/libelf/elf_nextscn.c b/libelf/elf_nextscn.c
index 0d2bd66..62cb891 100644
--- a/libelf/elf_nextscn.c
+++ b/libelf/elf_nextscn.c
@@ -1,5 +1,5 @@
/* Get next section.
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -39,9 +39,7 @@
Elf_Scn *
-elf_nextscn (elf, scn)
- Elf *elf;
- Elf_Scn *scn;
+elf_nextscn (Elf *elf, Elf_Scn *scn)
{
Elf_Scn *result = NULL;
diff --git a/libelf/elf_rand.c b/libelf/elf_rand.c
index cef4e44..f1850e7 100644
--- a/libelf/elf_rand.c
+++ b/libelf/elf_rand.c
@@ -1,5 +1,5 @@
/* Select specific element in archive.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,9 +38,7 @@
size_t
-elf_rand (elf, offset)
- Elf *elf;
- size_t offset;
+elf_rand (Elf *elf, size_t offset)
{
/* Be gratious, the specs demand it. */
if (elf == NULL || elf->kind != ELF_K_AR)
diff --git a/libelf/elf_rawdata.c b/libelf/elf_rawdata.c
index 9672652..db28f5d 100644
--- a/libelf/elf_rawdata.c
+++ b/libelf/elf_rawdata.c
@@ -1,5 +1,5 @@
/* Return raw section content.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -37,9 +37,7 @@
Elf_Data *
-elf_rawdata (scn, data)
- Elf_Scn *scn;
- Elf_Data *data;
+elf_rawdata (Elf_Scn *scn, Elf_Data *data)
{
if (scn == NULL || scn->elf->kind != ELF_K_ELF)
{
diff --git a/libelf/elf_rawfile.c b/libelf/elf_rawfile.c
index dd71b88..b3837f4 100644
--- a/libelf/elf_rawfile.c
+++ b/libelf/elf_rawfile.c
@@ -1,5 +1,5 @@
/* Retrieve uninterpreted file contents.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,9 +38,7 @@
char *
-elf_rawfile (elf, ptr)
- Elf *elf;
- size_t *ptr;
+elf_rawfile (Elf *elf, size_t *ptr)
{
char *result;
diff --git a/libelf/elf_readall.c b/libelf/elf_readall.c
index 0101618..52a0b4e 100644
--- a/libelf/elf_readall.c
+++ b/libelf/elf_readall.c
@@ -1,5 +1,5 @@
/* Read all of the file associated with the descriptor.
- Copyright (C) 1998-2009 Red Hat, Inc.
+ Copyright (C) 1998-2009, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -66,8 +66,7 @@ set_address (Elf *elf, size_t offset)
char *
-__libelf_readall (elf)
- Elf *elf;
+__libelf_readall (Elf *elf)
{
/* Get the file. */
rwlock_wrlock (elf->lock);
diff --git a/libelf/elf_strptr.c b/libelf/elf_strptr.c
index e73bf36..c5138dc 100644
--- a/libelf/elf_strptr.c
+++ b/libelf/elf_strptr.c
@@ -38,10 +38,7 @@
char *
-elf_strptr (elf, idx, offset)
- Elf *elf;
- size_t idx;
- size_t offset;
+elf_strptr (Elf *elf, size_t idx, size_t offset)
{
if (elf == NULL)
return NULL;
diff --git a/libelf/elf_update.c b/libelf/elf_update.c
index 9eb007b..00f7a01 100644
--- a/libelf/elf_update.c
+++ b/libelf/elf_update.c
@@ -137,9 +137,7 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
off_t
-elf_update (elf, cmd)
- Elf *elf;
- Elf_Cmd cmd;
+elf_update (Elf *elf, Elf_Cmd cmd)
{
size_t shnum;
off_t size;
diff --git a/libelf/elf_version.c b/libelf/elf_version.c
index dcb6758..7c336ff 100644
--- a/libelf/elf_version.c
+++ b/libelf/elf_version.c
@@ -1,5 +1,5 @@
/* Coordinate ELF library and application versions.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -42,8 +42,7 @@ unsigned int __libelf_version = EV_CURRENT;
unsigned int
-elf_version (version)
- unsigned int version;
+elf_version (unsigned int version)
{
if (version == EV_NONE)
return __libelf_version;
diff --git a/libelf/gelf_checksum.c b/libelf/gelf_checksum.c
index 4906782..831c54c 100644
--- a/libelf/gelf_checksum.c
+++ b/libelf/gelf_checksum.c
@@ -1,5 +1,5 @@
/* Convert from file to memory representation. Generic ELF version.
- Copyright (C) 2002 Red Hat, Inc.
+ Copyright (C) 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2002.
@@ -38,8 +38,7 @@
long int
-gelf_checksum (elf)
- Elf *elf;
+gelf_checksum (Elf *elf)
{
if (elf == NULL)
return -1l;
diff --git a/libelf/gelf_fsize.c b/libelf/gelf_fsize.c
index a9d2288..a124fa8 100644
--- a/libelf/gelf_fsize.c
+++ b/libelf/gelf_fsize.c
@@ -1,5 +1,5 @@
/* Return the size of an object file type.
- Copyright (C) 1998-2010 Red Hat, Inc.
+ Copyright (C) 1998-2010, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -79,11 +79,7 @@ const size_t __libelf_type_sizes[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] =
size_t
-gelf_fsize (elf, type, count, version)
- Elf *elf;
- Elf_Type type;
- size_t count;
- unsigned int version;
+gelf_fsize (Elf *elf, Elf_Type type, size_t count, unsigned int version)
{
/* We do not have differences between file and memory sizes. Better
not since otherwise `mmap' would not work. */
diff --git a/libelf/gelf_getauxv.c b/libelf/gelf_getauxv.c
index a2f04e7..1591be2 100644
--- a/libelf/gelf_getauxv.c
+++ b/libelf/gelf_getauxv.c
@@ -1,5 +1,5 @@
/* Get information from auxiliary vector at the given index.
- Copyright (C) 2007 Red Hat, Inc.
+ Copyright (C) 2007, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -38,10 +38,7 @@
GElf_auxv_t *
-gelf_getauxv (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_auxv_t *dst;
+gelf_getauxv (Elf_Data *data, int ndx, GElf_auxv_t *dst)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
GElf_auxv_t *result = NULL;
diff --git a/libelf/gelf_getclass.c b/libelf/gelf_getclass.c
index 53759dc..7d0924b 100644
--- a/libelf/gelf_getclass.c
+++ b/libelf/gelf_getclass.c
@@ -1,5 +1,5 @@
/* Return the class of file associated with the descriptor.
- Copyright (C) 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -38,8 +38,7 @@
int
-gelf_getclass (elf)
- Elf *elf;
+gelf_getclass (Elf *elf)
{
return elf == NULL || elf->kind != ELF_K_ELF ? ELFCLASSNONE : elf->class;
}
diff --git a/libelf/gelf_getdyn.c b/libelf/gelf_getdyn.c
index c366fd5..a0090e1 100644
--- a/libelf/gelf_getdyn.c
+++ b/libelf/gelf_getdyn.c
@@ -1,5 +1,5 @@
/* Get information from dynamic table at the given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -39,10 +39,7 @@
GElf_Dyn *
-gelf_getdyn (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_Dyn *dst;
+gelf_getdyn (Elf_Data *data, int ndx, GElf_Dyn *dst)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
GElf_Dyn *result = NULL;
diff --git a/libelf/gelf_getehdr.c b/libelf/gelf_getehdr.c
index ea83fc0..cace0ef 100644
--- a/libelf/gelf_getehdr.c
+++ b/libelf/gelf_getehdr.c
@@ -1,5 +1,5 @@
/* Get ELF header.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -40,9 +40,7 @@
GElf_Ehdr *
-__gelf_getehdr_rdlock (elf, dest)
- Elf *elf;
- GElf_Ehdr *dest;
+__gelf_getehdr_rdlock (Elf *elf, GElf_Ehdr *dest)
{
GElf_Ehdr *result = NULL;
@@ -95,9 +93,7 @@ __gelf_getehdr_rdlock (elf, dest)
}
GElf_Ehdr *
-gelf_getehdr (elf, dest)
- Elf *elf;
- GElf_Ehdr *dest;
+gelf_getehdr (Elf *elf, GElf_Ehdr *dest)
{
GElf_Ehdr *result;
if (elf == NULL)
diff --git a/libelf/gelf_getlib.c b/libelf/gelf_getlib.c
index 880817e..a8ac478 100644
--- a/libelf/gelf_getlib.c
+++ b/libelf/gelf_getlib.c
@@ -1,5 +1,5 @@
/* Get library from table at the given index.
- Copyright (C) 2004, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2004, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2004.
@@ -39,10 +39,7 @@
GElf_Lib *
-gelf_getlib (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_Lib *dst;
+gelf_getlib (Elf_Data *data, int ndx, GElf_Lib *dst)
{
if (data == NULL)
return NULL;
diff --git a/libelf/gelf_getmove.c b/libelf/gelf_getmove.c
index b81d61f..18efedc 100644
--- a/libelf/gelf_getmove.c
+++ b/libelf/gelf_getmove.c
@@ -1,5 +1,5 @@
/* Get move structure at the given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -39,10 +39,7 @@
GElf_Move *
-gelf_getmove (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_Move *dst;
+gelf_getmove (Elf_Data *data, int ndx, GElf_Move *dst)
{
GElf_Move *result = NULL;
Elf *elf;
diff --git a/libelf/gelf_getnote.c b/libelf/gelf_getnote.c
index 7dc8215..c75edda 100644
--- a/libelf/gelf_getnote.c
+++ b/libelf/gelf_getnote.c
@@ -1,5 +1,5 @@
/* Get note information at the supplied offset.
- Copyright (C) 2007, 2014 Red Hat, Inc.
+ Copyright (C) 2007, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -37,12 +37,8 @@
#include "libelfP.h"
size_t
-gelf_getnote (data, offset, result, name_offset, desc_offset)
- Elf_Data *data;
- size_t offset;
- GElf_Nhdr *result;
- size_t *name_offset;
- size_t *desc_offset;
+gelf_getnote (Elf_Data *data, size_t offset, GElf_Nhdr *result,
+ size_t *name_offset, size_t *desc_offset)
{
if (data == NULL)
return 0;
diff --git a/libelf/gelf_getphdr.c b/libelf/gelf_getphdr.c
index 1a6ee62..c719e4b 100644
--- a/libelf/gelf_getphdr.c
+++ b/libelf/gelf_getphdr.c
@@ -1,5 +1,5 @@
/* Return program header table entry.
- Copyright (C) 1998-2010 Red Hat, Inc.
+ Copyright (C) 1998-2010, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -39,10 +39,7 @@
GElf_Phdr *
-gelf_getphdr (elf, ndx, dst)
- Elf *elf;
- int ndx;
- GElf_Phdr *dst;
+gelf_getphdr (Elf *elf, int ndx, GElf_Phdr *dst)
{
GElf_Phdr *result = NULL;
diff --git a/libelf/gelf_getrel.c b/libelf/gelf_getrel.c
index 1f786ff..309e3d3 100644
--- a/libelf/gelf_getrel.c
+++ b/libelf/gelf_getrel.c
@@ -1,5 +1,5 @@
/* Get REL relocation information at given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -38,10 +38,7 @@
GElf_Rel *
-gelf_getrel (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_Rel *dst;
+gelf_getrel (Elf_Data *data, int ndx, GElf_Rel *dst)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
Elf_Scn *scn;
diff --git a/libelf/gelf_getrela.c b/libelf/gelf_getrela.c
index cead7ee..d695f65 100644
--- a/libelf/gelf_getrela.c
+++ b/libelf/gelf_getrela.c
@@ -1,5 +1,5 @@
/* Get RELA relocation information at given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -38,10 +38,7 @@
GElf_Rela *
-gelf_getrela (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_Rela *dst;
+gelf_getrela (Elf_Data *data, int ndx, GElf_Rela *dst)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
Elf_Scn *scn;
diff --git a/libelf/gelf_getshdr.c b/libelf/gelf_getshdr.c
index 4a48cb6..3858c8e 100644
--- a/libelf/gelf_getshdr.c
+++ b/libelf/gelf_getshdr.c
@@ -1,5 +1,5 @@
/* Return section header.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,9 +38,7 @@
GElf_Shdr *
-gelf_getshdr (scn, dst)
- Elf_Scn *scn;
- GElf_Shdr *dst;
+gelf_getshdr (Elf_Scn *scn, GElf_Shdr *dst)
{
GElf_Shdr *result = NULL;
diff --git a/libelf/gelf_getsym.c b/libelf/gelf_getsym.c
index a141c2d..01534d2 100644
--- a/libelf/gelf_getsym.c
+++ b/libelf/gelf_getsym.c
@@ -1,5 +1,5 @@
/* Get symbol information from symbol table at the given index.
- Copyright (C) 1999, 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -39,10 +39,7 @@
GElf_Sym *
-gelf_getsym (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_Sym *dst;
+gelf_getsym (Elf_Data *data, int ndx, GElf_Sym *dst)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
GElf_Sym *result = NULL;
diff --git a/libelf/gelf_getsyminfo.c b/libelf/gelf_getsyminfo.c
index 8d7da7f..8360ed3 100644
--- a/libelf/gelf_getsyminfo.c
+++ b/libelf/gelf_getsyminfo.c
@@ -1,5 +1,5 @@
/* Get additional symbol information from symbol table at the given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -39,10 +39,7 @@
GElf_Syminfo *
-gelf_getsyminfo (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_Syminfo *dst;
+gelf_getsyminfo (Elf_Data *data, int ndx, GElf_Syminfo *dst)
{
GElf_Syminfo *result = NULL;
diff --git a/libelf/gelf_getsymshndx.c b/libelf/gelf_getsymshndx.c
index c19e876..17c90fc 100644
--- a/libelf/gelf_getsymshndx.c
+++ b/libelf/gelf_getsymshndx.c
@@ -1,6 +1,6 @@
/* Get symbol information and separate section index from symbol table
at the given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -40,12 +40,8 @@
GElf_Sym *
-gelf_getsymshndx (symdata, shndxdata, ndx, dst, dstshndx)
- Elf_Data *symdata;
- Elf_Data *shndxdata;
- int ndx;
- GElf_Sym *dst;
- Elf32_Word *dstshndx;
+gelf_getsymshndx (Elf_Data *symdata, Elf_Data *shndxdata, int ndx,
+ GElf_Sym *dst, Elf32_Word *dstshndx)
{
Elf_Data_Scn *symdata_scn = (Elf_Data_Scn *) symdata;
Elf_Data_Scn *shndxdata_scn = (Elf_Data_Scn *) shndxdata;
diff --git a/libelf/gelf_getverdaux.c b/libelf/gelf_getverdaux.c
index d125d9e..739a765 100644
--- a/libelf/gelf_getverdaux.c
+++ b/libelf/gelf_getverdaux.c
@@ -1,5 +1,5 @@
/* Get additional symbol version definition information at the given offset.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -39,10 +39,7 @@
GElf_Verdaux *
-gelf_getverdaux (data, offset, dst)
- Elf_Data *data;
- int offset;
- GElf_Verdaux *dst;
+gelf_getverdaux (Elf_Data *data, int offset, GElf_Verdaux *dst)
{
GElf_Verdaux *result;
diff --git a/libelf/gelf_getverdef.c b/libelf/gelf_getverdef.c
index 59a3214..651f4fa 100644
--- a/libelf/gelf_getverdef.c
+++ b/libelf/gelf_getverdef.c
@@ -1,5 +1,5 @@
/* Get symbol version definition information at the given offset.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -39,10 +39,7 @@
GElf_Verdef *
-gelf_getverdef (data, offset, dst)
- Elf_Data *data;
- int offset;
- GElf_Verdef *dst;
+gelf_getverdef (Elf_Data *data, int offset, GElf_Verdef *dst)
{
GElf_Verdef *result;
diff --git a/libelf/gelf_getvernaux.c b/libelf/gelf_getvernaux.c
index 8ebf56a..e47fb0a 100644
--- a/libelf/gelf_getvernaux.c
+++ b/libelf/gelf_getvernaux.c
@@ -1,5 +1,5 @@
/* Get additional required symbol version information at the given offset.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -39,10 +39,7 @@
GElf_Vernaux *
-gelf_getvernaux (data, offset, dst)
- Elf_Data *data;
- int offset;
- GElf_Vernaux *dst;
+gelf_getvernaux (Elf_Data *data, int offset, GElf_Vernaux *dst)
{
GElf_Vernaux *result;
diff --git a/libelf/gelf_getverneed.c b/libelf/gelf_getverneed.c
index 95fd11f..c1f5d34 100644
--- a/libelf/gelf_getverneed.c
+++ b/libelf/gelf_getverneed.c
@@ -1,5 +1,5 @@
/* Get required symbol version information at the given offset.
- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -39,10 +39,7 @@
GElf_Verneed *
-gelf_getverneed (data, offset, dst)
- Elf_Data *data;
- int offset;
- GElf_Verneed *dst;
+gelf_getverneed (Elf_Data *data, int offset, GElf_Verneed *dst)
{
GElf_Verneed *result;
diff --git a/libelf/gelf_getversym.c b/libelf/gelf_getversym.c
index fe8dc62..68d23c7 100644
--- a/libelf/gelf_getversym.c
+++ b/libelf/gelf_getversym.c
@@ -1,5 +1,5 @@
/* Get symbol version information at the given index.
- Copyright (C) 1999, 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -39,10 +39,7 @@
GElf_Versym *
-gelf_getversym (data, ndx, dst)
- Elf_Data *data;
- int ndx;
- GElf_Versym *dst;
+gelf_getversym (Elf_Data *data, int ndx, GElf_Versym *dst)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
Elf_Scn *scn;
diff --git a/libelf/gelf_newehdr.c b/libelf/gelf_newehdr.c
index e9f7a58..cfa80e1 100644
--- a/libelf/gelf_newehdr.c
+++ b/libelf/gelf_newehdr.c
@@ -1,5 +1,5 @@
/* Create new ELF header.
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,9 +38,7 @@
unsigned long int
-gelf_newehdr (elf, class)
- Elf *elf;
- int class;
+gelf_newehdr (Elf *elf, int class)
{
return (class == ELFCLASS32
? (unsigned long int) INTUSE(elf32_newehdr) (elf)
diff --git a/libelf/gelf_newphdr.c b/libelf/gelf_newphdr.c
index b634037..4e95474 100644
--- a/libelf/gelf_newphdr.c
+++ b/libelf/gelf_newphdr.c
@@ -1,5 +1,5 @@
/* Create new ELF program header.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -38,9 +38,7 @@
unsigned long int
-gelf_newphdr (elf, phnum)
- Elf *elf;
- size_t phnum;
+gelf_newphdr ( Elf *elf, size_t phnum)
{
return (elf->class == ELFCLASS32
? (unsigned long int) INTUSE(elf32_newphdr) (elf, phnum)
diff --git a/libelf/gelf_offscn.c b/libelf/gelf_offscn.c
index 62d12e4..cf206f5 100644
--- a/libelf/gelf_offscn.c
+++ b/libelf/gelf_offscn.c
@@ -1,5 +1,5 @@
/* Create new ELF header.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2005.
@@ -38,9 +38,7 @@
Elf_Scn *
-gelf_offscn (elf, offset)
- Elf *elf;
- GElf_Off offset;
+gelf_offscn (Elf *elf, GElf_Off offset)
{
if (elf->class == ELFCLASS32)
{
diff --git a/libelf/gelf_update_auxv.c b/libelf/gelf_update_auxv.c
index dd8f472..e4e5229 100644
--- a/libelf/gelf_update_auxv.c
+++ b/libelf/gelf_update_auxv.c
@@ -1,5 +1,5 @@
/* Update information in dynamic table at the given index.
- Copyright (C) 2007 Red Hat, Inc.
+ Copyright (C) 2007, 2015 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -37,10 +37,7 @@
int
-gelf_update_auxv (data, ndx, src)
- Elf_Data *data;
- int ndx;
- GElf_auxv_t *src;
+gelf_update_auxv (Elf_Data *data, int ndx, GElf_auxv_t *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
Elf_Scn *scn;
diff --git a/libelf/gelf_update_dyn.c b/libelf/gelf_update_dyn.c
index 2eb526e..5c515d2 100644
--- a/libelf/gelf_update_dyn.c
+++ b/libelf/gelf_update_dyn.c
@@ -1,5 +1,5 @@
/* Update information in dynamic table at the given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -38,10 +38,7 @@
int
-gelf_update_dyn (data, ndx, src)
- Elf_Data *data;
- int ndx;
- GElf_Dyn *src;
+gelf_update_dyn (Elf_Data *data, int ndx, GElf_Dyn *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
Elf_Scn *scn;
diff --git a/libelf/gelf_update_lib.c b/libelf/gelf_update_lib.c
index 1c8c23d..d0f235e 100644
--- a/libelf/gelf_update_lib.c
+++ b/libelf/gelf_update_lib.c
@@ -1,5 +1,5 @@
/* Update library in table at the given index.
- Copyright (C) 2004, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2004, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2004.
@@ -39,10 +39,7 @@
int
-gelf_update_lib (data, ndx, src)
- Elf_Data *data;
- int ndx;
- GElf_Lib *src;
+gelf_update_lib (Elf_Data *data, int ndx, GElf_Lib *src)
{
if (data == NULL)
return 0;
diff --git a/libelf/gelf_update_move.c b/libelf/gelf_update_move.c
index ad2ca6a..4190ee3 100644
--- a/libelf/gelf_update_move.c
+++ b/libelf/gelf_update_move.c
@@ -1,5 +1,5 @@
/* Update move structure at the given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -39,10 +39,7 @@
int
-gelf_update_move (data, ndx, src)
- Elf_Data *data;
- int ndx;
- GElf_Move *src;
+gelf_update_move (Elf_Data *data, int ndx, GElf_Move *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
diff --git a/libelf/gelf_update_sym.c b/libelf/gelf_update_sym.c
index 278129c..0f47885 100644
--- a/libelf/gelf_update_sym.c
+++ b/libelf/gelf_update_sym.c
@@ -1,5 +1,5 @@
/* Update symbol information in symbol table at the given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -39,10 +39,7 @@
int
-gelf_update_sym (data, ndx, src)
- Elf_Data *data;
- int ndx;
- GElf_Sym *src;
+gelf_update_sym (Elf_Data *data, int ndx, GElf_Sym *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
Elf_Scn *scn;
diff --git a/libelf/gelf_update_syminfo.c b/libelf/gelf_update_syminfo.c
index 640a1ed..6f7f302 100644
--- a/libelf/gelf_update_syminfo.c
+++ b/libelf/gelf_update_syminfo.c
@@ -1,5 +1,5 @@
/* Update additional symbol information in symbol table at the given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -39,10 +39,7 @@
int
-gelf_update_syminfo (data, ndx, src)
- Elf_Data *data;
- int ndx;
- GElf_Syminfo *src;
+gelf_update_syminfo (Elf_Data *data, int ndx, GElf_Syminfo *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
Elf_Scn *scn;
diff --git a/libelf/gelf_update_symshndx.c b/libelf/gelf_update_symshndx.c
index 5e2c7f7..eb80afa 100644
--- a/libelf/gelf_update_symshndx.c
+++ b/libelf/gelf_update_symshndx.c
@@ -1,6 +1,6 @@
/* Update symbol information and section index in symbol table at the
given index.
- Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -40,12 +40,8 @@
int
-gelf_update_symshndx (symdata, shndxdata, ndx, src, srcshndx)
- Elf_Data *symdata;
- Elf_Data *shndxdata;
- int ndx;
- GElf_Sym *src;
- Elf32_Word srcshndx;
+gelf_update_symshndx (Elf_Data *symdata, Elf_Data *shndxdata, int ndx,
+ GElf_Sym *src, Elf32_Word srcshndx)
{
Elf_Data_Scn *symdata_scn = (Elf_Data_Scn *) symdata;
Elf_Data_Scn *shndxdata_scn = (Elf_Data_Scn *) shndxdata;
diff --git a/libelf/gelf_update_verdaux.c b/libelf/gelf_update_verdaux.c
index b377d40..f3554fd 100644
--- a/libelf/gelf_update_verdaux.c
+++ b/libelf/gelf_update_verdaux.c
@@ -1,5 +1,5 @@
/* Update additional symbol version definition information.
- Copyright (C) 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2001.
@@ -39,10 +39,7 @@
int
-gelf_update_verdaux (data, offset, src)
- Elf_Data *data;
- int offset;
- GElf_Verdaux *src;
+gelf_update_verdaux (Elf_Data *data, int offset, GElf_Verdaux *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
diff --git a/libelf/gelf_update_verdef.c b/libelf/gelf_update_verdef.c
index d591a4f..adb5db1 100644
--- a/libelf/gelf_update_verdef.c
+++ b/libelf/gelf_update_verdef.c
@@ -1,5 +1,5 @@
/* Update symbol version definition information.
- Copyright (C) 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2001.
@@ -39,10 +39,7 @@
int
-gelf_update_verdef (data, offset, src)
- Elf_Data *data;
- int offset;
- GElf_Verdef *src;
+gelf_update_verdef (Elf_Data *data, int offset, GElf_Verdef *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
diff --git a/libelf/gelf_update_vernaux.c b/libelf/gelf_update_vernaux.c
index 1f691b0..854afab 100644
--- a/libelf/gelf_update_vernaux.c
+++ b/libelf/gelf_update_vernaux.c
@@ -1,5 +1,5 @@
/* Update additional required symbol version information.
- Copyright (C) 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2001.
@@ -39,10 +39,7 @@
int
-gelf_update_vernaux (data, offset, src)
- Elf_Data *data;
- int offset;
- GElf_Vernaux *src;
+gelf_update_vernaux (Elf_Data *data, int offset, GElf_Vernaux *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
diff --git a/libelf/gelf_update_verneed.c b/libelf/gelf_update_verneed.c
index 713c017..bf5af5a 100644
--- a/libelf/gelf_update_verneed.c
+++ b/libelf/gelf_update_verneed.c
@@ -1,5 +1,5 @@
/* Update required symbol version information.
- Copyright (C) 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 201r Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2001.
@@ -39,10 +39,7 @@
int
-gelf_update_verneed (data, offset, src)
- Elf_Data *data;
- int offset;
- GElf_Verneed *src;
+gelf_update_verneed (Elf_Data *data, int offset, GElf_Verneed *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
diff --git a/libelf/gelf_update_versym.c b/libelf/gelf_update_versym.c
index 03a3c5a..9949dff 100644
--- a/libelf/gelf_update_versym.c
+++ b/libelf/gelf_update_versym.c
@@ -1,5 +1,5 @@
/* Update symbol version information.
- Copyright (C) 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
+ Copyright (C) 2001, 2002, 2005, 2009, 2014, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2001.
@@ -39,10 +39,7 @@
int
-gelf_update_versym (data, ndx, src)
- Elf_Data *data;
- int ndx;
- GElf_Versym *src;
+gelf_update_versym (Elf_Data *data, int ndx, GElf_Versym *src)
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
diff --git a/libelf/gelf_xlatetof.c b/libelf/gelf_xlatetof.c
index 3366bdc..e266180 100644
--- a/libelf/gelf_xlatetof.c
+++ b/libelf/gelf_xlatetof.c
@@ -1,5 +1,5 @@
/* Convert from memory to file representation. Generic ELF version.
- Copyright (C) 2000, 2002 Red Hat, Inc.
+ Copyright (C) 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -38,11 +38,8 @@
Elf_Data *
-gelf_xlatetof (elf, dest, src, encode)
- Elf *elf;
- Elf_Data *dest;
- const Elf_Data * src;
- unsigned int encode;
+gelf_xlatetof (Elf *elf, Elf_Data *dest, const Elf_Data * src,
+ unsigned int encode)
{
if (elf == NULL)
return NULL;
diff --git a/libelf/gelf_xlatetom.c b/libelf/gelf_xlatetom.c
index c3e812f..8499c71 100644
--- a/libelf/gelf_xlatetom.c
+++ b/libelf/gelf_xlatetom.c
@@ -1,5 +1,5 @@
/* Convert from file to memory representation. Generic ELF version.
- Copyright (C) 2000, 2002 Red Hat, Inc.
+ Copyright (C) 2000, 2002, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 2000.
@@ -38,11 +38,8 @@
Elf_Data *
-gelf_xlatetom (elf, dest, src, encode)
- Elf *elf;
- Elf_Data *dest;
- const Elf_Data * src;
- unsigned int encode;
+gelf_xlatetom (Elf *elf, Elf_Data *dest, const Elf_Data * src,
+ unsigned int encode)
{
if (elf == NULL)
return NULL;
diff --git a/src/ChangeLog b/src/ChangeLog
index 238c416..49aa3f7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-22 Mark Wielaard <mjw(a)redhat.com>
+
+ * strip.c (cleanup_debug): Remove old-style function definitions.
+
2015-09-09 Chih-Hung Hsieh <chh(a)google.com>
* readelf.c (print_debug_exception_table): Initialize variable before
diff --git a/src/strip.c b/src/strip.c
index 5e69334..a26ba93 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -2208,7 +2208,7 @@ cannot set access and modification date of '%s'"),
}
static void
-cleanup_debug ()
+cleanup_debug (void)
{
if (debug_fd >= 0)
{
--
1.8.3.1
8 years, 2 months
[PATCH] Update dl-hash.h from glibc.
by Mark Wielaard
Our dl-hash.h implementation originally came from, or was written at the
same time as, the glibc implementation. At some point (around 9 years ago)
they diverged and the elfutils version got an updated copyright header.
The glibc version saw various updates/optimizations. Just treat the file
like we do for elf.h. Copy it whenever the glibc version is updated.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libelf/dl-hash.h | 75 +++++++++++++++++++++++++-------------------------------
1 file changed, 34 insertions(+), 41 deletions(-)
diff --git a/libelf/dl-hash.h b/libelf/dl-hash.h
index e286d2e..6ee5d1a 100644
--- a/libelf/dl-hash.h
+++ b/libelf/dl-hash.h
@@ -1,31 +1,20 @@
/* Compute hash value for given string according to ELF standard.
- Copyright (C) 2006 Red Hat, Inc.
- This file is part of elfutils.
- Written by Ulrich Drepper <drepper(a)redhat.com>, 1995.
+ Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
- This file is free software; you can redistribute it and/or modify
- it under the terms of either
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at
- your option) any later version
-
- or
-
- * the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at
- your option) any later version
-
- or both in parallel, as here.
-
- elfutils is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ Lesser General Public License for more details.
- You should have received copies of the GNU General Public License and
- the GNU Lesser General Public License along with this program. If
- not, see <http://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _DL_HASH_H
#define _DL_HASH_H 1
@@ -34,44 +23,48 @@
/* This is the hashing function specified by the ELF ABI. In the
first five operations no overflow is possible so we optimized it a
bit. */
-static inline unsigned int
-__attribute__ ((__pure__))
-_dl_elf_hash (const char *name)
+static unsigned int
+__attribute__ ((unused))
+_dl_elf_hash (const char *name_arg)
{
- const unsigned char *iname = (const unsigned char *) name;
- unsigned int hash = (unsigned int) *iname++;
- if (*iname != '\0')
+ const unsigned char *name = (const unsigned char *) name_arg;
+ unsigned long int hash = *name;
+ if (hash != 0 && name[1] != '\0')
{
- hash = (hash << 4) + (unsigned int) *iname++;
- if (*iname != '\0')
+ hash = (hash << 4) + name[1];
+ if (name[2] != '\0')
{
- hash = (hash << 4) + (unsigned int) *iname++;
- if (*iname != '\0')
+ hash = (hash << 4) + name[2];
+ if (name[3] != '\0')
{
- hash = (hash << 4) + (unsigned int) *iname++;
- if (*iname != '\0')
+ hash = (hash << 4) + name[3];
+ if (name[4] != '\0')
{
- hash = (hash << 4) + (unsigned int) *iname++;
- while (*iname != '\0')
+ hash = (hash << 4) + name[4];
+ name += 5;
+ while (*name != '\0')
{
- unsigned int hi;
- hash = (hash << 4) + (unsigned int) *iname++;
+ unsigned long int hi;
+ hash = (hash << 4) + *name++;
hi = hash & 0xf0000000;
/* The algorithm specified in the ELF ABI is as
follows:
if (hi != 0)
- hash ^= hi >> 24;
+ hash ^= hi >> 24;
hash &= ~hi;
But the following is equivalent and a lot
faster, especially on modern processors. */
- hash ^= hi;
hash ^= hi >> 24;
}
+
+ /* Second part of the modified formula. This
+ operation can be lifted outside the loop. */
+ hash &= 0x0fffffff;
}
}
}
--
1.8.3.1
8 years, 2 months
Difficulties while adding local init_regs support to libebl
by Ben Gamari
I now have a few patches [1] adding support for collecting initial
register values from the current thread. While I believe the initial
register collection logic works (it works for GHC), I have encountered
an unfortunate issue while folding this code into libebl. Namely, it
seems that libebl backends are dynamically loaded.
To see why this is problematic, consider this example,
// libdwfl now provides this,
int dwfl_linux_local_attach (Dwfl *dwfl) {
// local_thread_callbacks uses ebl_set_initial_registers_local
// which is now provided by libebl
dwfl_attach_state(dwfl, NULL, pid, &local_thread_callbacks, NULL);
}
// Here is the test-case,
void test() {
Dwfl *dwfl = dwfl_begin (&proc_callbacks);
// Figure out what modules are loaded
dwfl_linux_proc_report(dwfl, getpid());
dwfl_report_end (dwfl, NULL, NULL);
// but the ebl backend, libebl_x86_64.so, only gets loaded here
dwfl_linux_local_attach(dwfl);
// therefore when we begin to unwind we have no debug information
// for libebl, which is where PC sits when we collect the initial
// register values. Unwinding consequently fails
dwfl_getthread_frames (dwfl, getpid(), frame_cb, dwfl) != 0;
}
The issue here is that debug information is not reported to libdwfl as
it is not loaded at the time we report the loaded modules.
At this point I'm a bit unsure of how to proceed. I can think of a few
options,
* teach dwfl_linux_local_attach to report libebl when it gets
loaded. This would be rather ugly as we would either need to
re-read the /proc map data or somehow extract the necessary
information from the dynamic linker
* Expose an entirely different interface from dwfl_getthread_frames
for local unwinding such that PC doesn't sit within libebl when
initial register values are collected.
This would likely involve turning it into an inline function defined
in a header which could grab the initial register values,
// For instance, in the case of x86_64
#if defined(__x86_64__) && defined(__linux__)
static inline void
dwfl_get_frames_here(Dwfl *dwfl,
void (*cb)(Frame *, void*),
void *cbdata)
{
Thread thread = ...; // need to figure out what to put here
Dwarf_Word regs[17];
__asm__ (( "// Grab registers " ));
dwfl_thread_state_registers(thread, 0, 17, regs);
}
Unfortunately this is quite a departure from the current interface
and seems to break the nice separation between libebl and the
libdwfl.
I also don't really know how to correctly handle the
rather subtle distinction between 32-/64-bit programs running on
32-/64-bit kernels.
* Something I haven't yet thought of...
Any ideas?
Cheers,
- Ben
[1] https://github.com/bgamari/elfutils/compare/master...local-unwind
8 years, 2 months