Only in ../base/frysk/frysk-imports/elfutils: aclocal.m4
Only in ../base/frysk/frysk-imports/elfutils: autom4te.cache
Only in ../base/frysk/frysk-imports/elfutils/backends: Makefile.in
Only in ../base/frysk/frysk-imports/elfutils/config: config.guess
Only in ../base/frysk/frysk-imports/elfutils/config: config.sub
Only in ./config: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/config: depcomp
Only in ../base/frysk/frysk-imports/elfutils/config: install-sh
Only in ../base/frysk/frysk-imports/elfutils/config: Makefile.in
Only in ../base/frysk/frysk-imports/elfutils/config: missing
Only in ../base/frysk/frysk-imports/elfutils/config: ylwrap
Only in ../base/frysk/frysk-imports/elfutils: config.h.in
Only in ../base/frysk/frysk-imports/elfutils: configure
Only in .: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils: debugfiles.list
Only in ../base/frysk/frysk-imports/elfutils: debuglinks.list
Only in ../base/frysk/frysk-imports/elfutils: debugsources.list
Only in .: doc
Only in ../base/frysk/frysk-imports/elfutils: elfutils.spec
Only in .: .git
Only in ../base/frysk/frysk-imports/elfutils: INSTALL
Only in ./lib: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/lib: Makefile.in
Only in ./lib: xstrdup.c
Only in ./libasm: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/libasm: Makefile.in
Only in ./libcpu: .cvsignore
Only in ./libcpu/defs: i386.doc
Only in ../base/frysk/frysk-imports/elfutils/libcpu: i386_lex.c
Only in ../base/frysk/frysk-imports/elfutils/libcpu: i386_parse.c
Only in ../base/frysk/frysk-imports/elfutils/libcpu: i386_parse.h
Only in ../base/frysk/frysk-imports/elfutils/libcpu: Makefile.in
Only in ./libdw: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/libdw: Makefile.in
Only in .: libdwarf
Only in ./libdwfl: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/libdwfl: Makefile.in
Only in ./libebl: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/libebl: Makefile.in
Only in ./libelf: .cvsignore
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/elf32_getphdr.c ./libelf/elf32_getphdr.c
--- ../base/frysk/frysk-imports/elfutils/libelf/elf32_getphdr.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/elf32_getphdr.c 2010-03-25 14:41:45.000000000 -0400
@@ -116,16 +116,6 @@
if (elf->map_address != NULL)
{
- /* First see whether the information in the ELF header is
- valid and it does not ask for too much. */
- if (unlikely (ehdr->e_phoff >= elf->maximum_size)
- || unlikely (ehdr->e_phoff + size > elf->maximum_size))
- {
- /* Something is wrong. */
- __libelf_seterrno (ELF_E_INVALID_PHDR);
- goto out;
- }
-
/* All the data is already mapped. Use it. */
void *file_phdr = ((char *) elf->map_address
+ elf->start_offset + ehdr->e_phoff);
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/elf32_getshdr.c ./libelf/elf32_getshdr.c
--- ../base/frysk/frysk-imports/elfutils/libelf/elf32_getshdr.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/elf32_getshdr.c 2010-03-25 14:41:45.000000000 -0400
@@ -101,8 +101,7 @@
goto out;
size_t shnum;
- if (INTUSE (elf_getshnum) (elf, &shnum) != 0
- || shnum > SIZE_MAX / sizeof (ElfW2(LIBELFBITS,Shdr)))
+ if (INTUSE (elf_getshnum) (elf, &shnum) != 0)
goto out;
size_t size = shnum * sizeof (ElfW2(LIBELFBITS,Shdr));
@@ -119,16 +118,6 @@
if (elf->map_address != NULL)
{
- /* First see whether the information in the ELF header is
- valid and it does not ask for too much. */
- if (unlikely (ehdr->e_shoff >= elf->maximum_size)
- || unlikely (ehdr->e_shoff + size > elf->maximum_size))
- {
- /* Something is wrong. */
- __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER);
- goto free_and_out;
- }
-
ElfW2(LIBELFBITS,Shdr) *notcvt;
/* All the data is already mapped. If we could use it
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/elf32_newphdr.c ./libelf/elf32_newphdr.c
--- ../base/frysk/frysk-imports/elfutils/libelf/elf32_newphdr.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/elf32_newphdr.c 2010-03-25 14:41:45.000000000 -0400
@@ -124,12 +124,6 @@
else if (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum != count
|| elf->state.ELFW(elf,LIBELFBITS).phdr == NULL)
{
- if (unlikely (count > SIZE_MAX / sizeof (ElfW2(LIBELFBITS,Phdr))))
- {
- result = NULL;
- goto out;
- }
-
/* Allocate a new program header with the appropriate number of
elements. */
result = (ElfW2(LIBELFBITS,Phdr) *)
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/elf32_updatefile.c ./libelf/elf32_updatefile.c
--- ../base/frysk/frysk-imports/elfutils/libelf/elf32_updatefile.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/elf32_updatefile.c 2010-03-25 14:41:45.000000000 -0400
@@ -212,9 +212,6 @@
/* Write all the sections. Well, only those which are modified. */
if (shnum > 0)
{
- if (unlikely (shnum > SIZE_MAX / sizeof (Elf_Scn *)))
- return 1;
-
Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns;
Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *));
char *const shdr_start = ((char *) elf->map_address + elf->start_offset
@@ -585,10 +582,6 @@
/* Write all the sections. Well, only those which are modified. */
if (shnum > 0)
{
- if (unlikely (shnum > SIZE_MAX / (sizeof (Elf_Scn *)
- + sizeof (ElfW2(LIBELFBITS,Shdr)))))
- return 1;
-
off_t shdr_offset = elf->start_offset + ehdr->e_shoff;
#if EV_NUM != 2
xfct_t shdr_fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR];
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/elf_begin.c ./libelf/elf_begin.c
--- ../base/frysk/frysk-imports/elfutils/libelf/elf_begin.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/elf_begin.c 2010-03-25 14:41:45.000000000 -0400
@@ -155,8 +155,7 @@
if (unlikely (result == 0) && ehdr.e32->e_shoff != 0)
{
- if (unlikely (ehdr.e32->e_shoff >= maxsize)
- || unlikely (ehdr.e32->e_shoff + sizeof (Elf32_Shdr) > maxsize))
+ if (ehdr.e32->e_shoff + sizeof (Elf32_Shdr) > maxsize)
/* Cannot read the first section header. */
return 0;
@@ -204,8 +203,7 @@
if (unlikely (result == 0) && ehdr.e64->e_shoff != 0)
{
- if (unlikely (ehdr.e64->e_shoff >= maxsize)
- || unlikely (ehdr.e64->e_shoff + sizeof (Elf64_Shdr) > maxsize))
+ if (ehdr.e64->e_shoff + sizeof (Elf64_Shdr) > maxsize)
/* Cannot read the first section header. */
return 0;
@@ -277,15 +275,6 @@
/* Could not determine the number of sections. */
return NULL;
- /* Check for too many sections. */
- if (e_ident[EI_CLASS] == ELFCLASS32)
- {
- if (scncnt > SIZE_MAX / (sizeof (Elf_Scn) + sizeof (Elf32_Shdr)))
- return NULL;
- }
- else if (scncnt > SIZE_MAX / (sizeof (Elf_Scn) + sizeof (Elf64_Shdr)))
- return NULL;
-
/* We can now allocate the memory. */
Elf *elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent,
ELF_K_ELF, scncnt * sizeof (Elf_Scn));
@@ -319,31 +308,13 @@
{
/* We can use the mmapped memory. */
elf->state.elf32.ehdr = ehdr;
-
- if (unlikely (ehdr->e_shoff >= maxsize)
- || unlikely (ehdr->e_shoff
- + scncnt * sizeof (Elf32_Shdr) > maxsize))
- {
- free_and_out:
- free (elf);
- __libelf_seterrno (ELF_E_INVALID_FILE);
- return NULL;
- }
elf->state.elf32.shdr
= (Elf32_Shdr *) ((char *) ehdr + ehdr->e_shoff);
-
if (ehdr->e_phnum > 0)
- {
/* Assign a value only if there really is a program
header. Otherwise the value remains NULL. */
- if (unlikely (ehdr->e_phoff >= maxsize)
- || unlikely (ehdr->e_phoff
- + ehdr->e_phnum
- * sizeof (Elf32_Phdr) > maxsize))
- goto free_and_out;
elf->state.elf32.phdr
= (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff);
- }
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
@@ -425,26 +396,13 @@
{
/* We can use the mmapped memory. */
elf->state.elf64.ehdr = ehdr;
-
- if (unlikely (ehdr->e_shoff >= maxsize)
- || unlikely (ehdr->e_shoff
- + scncnt * sizeof (Elf32_Shdr) > maxsize))
- goto free_and_out;
elf->state.elf64.shdr
= (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff);
-
if (ehdr->e_phnum > 0)
- {
/* Assign a value only if there really is a program
header. Otherwise the value remains NULL. */
- if (unlikely (ehdr->e_phoff >= maxsize)
- || unlikely (ehdr->e_phoff
- + ehdr->e_phnum
- * sizeof (Elf32_Phdr) > maxsize))
- goto free_and_out;
elf->state.elf64.phdr
= (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff);
- }
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/elf_getarsym.c ./libelf/elf_getarsym.c
--- ../base/frysk/frysk-imports/elfutils/libelf/elf_getarsym.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/elf_getarsym.c 2010-03-17 16:06:09.000000000 -0400
@@ -179,9 +179,6 @@
size_t index_size = atol (tmpbuf);
if (SARMAG + sizeof (struct ar_hdr) + index_size > elf->maximum_size
-#if SIZE_MAX <= 4294967295U
- || n >= SIZE_MAX / sizeof (Elf_Arsym)
-#endif
|| n * sizeof (uint32_t) > index_size)
{
/* This index table cannot be right since it does not fit into
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/elf_getshstrndx.c ./libelf/elf_getshstrndx.c
--- ../base/frysk/frysk-imports/elfutils/libelf/elf_getshstrndx.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/elf_getshstrndx.c 2010-03-25 14:41:45.000000000 -0400
@@ -125,25 +125,10 @@
if (elf->map_address != NULL
&& elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
- || (((size_t) ((char *) elf->map_address
- + elf->start_offset + offset))
+ || (((size_t) ((char *) elf->map_address + offset))
& (__alignof__ (Elf32_Shdr) - 1)) == 0))
- {
- /* First see whether the information in the ELF header is
- valid and it does not ask for too much. */
- if (unlikely (offset + sizeof (Elf32_Shdr)
- > elf->maximum_size))
- {
- /* Something is wrong. */
- __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER);
- result = -1;
- goto out;
- }
-
/* We can directly access the memory. */
- num = ((Elf32_Shdr *) (elf->map_address + elf->start_offset
- + offset))->sh_link;
- }
+ num = ((Elf32_Shdr *) (elf->map_address + offset))->sh_link;
else
{
/* We avoid reading in all the section headers. Just read
@@ -178,25 +163,10 @@
if (elf->map_address != NULL
&& elf->state.elf64.ehdr->e_ident[EI_DATA] == MY_ELFDATA
&& (ALLOW_UNALIGNED
- || (((size_t) ((char *) elf->map_address
- + elf->start_offset + offset))
+ || (((size_t) ((char *) elf->map_address + offset))
& (__alignof__ (Elf64_Shdr) - 1)) == 0))
- {
- /* First see whether the information in the ELF header is
- valid and it does not ask for too much. */
- if (unlikely (offset + sizeof (Elf64_Shdr)
- > elf->maximum_size))
- {
- /* Something is wrong. */
- __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER);
- result = -1;
- goto out;
- }
-
/* We can directly access the memory. */
- num = ((Elf64_Shdr *) (elf->map_address
- + elf->start_offset + offset))->sh_link;
- }
+ num = ((Elf64_Shdr *) (elf->map_address + offset))->sh_link;
else
{
/* We avoid reading in all the section headers. Just read
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/elf_newscn.c ./libelf/elf_newscn.c
--- ../base/frysk/frysk-imports/elfutils/libelf/elf_newscn.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/elf_newscn.c 2010-03-17 16:06:09.000000000 -0400
@@ -104,18 +104,10 @@
else
{
/* We must allocate a new element. */
- Elf_ScnList *newp = NULL;
+ Elf_ScnList *newp;
assert (elf->state.elf.scnincr > 0);
- if (
-#if SIZE_MAX <= 4294967295U
- likely (elf->state.elf.scnincr
- < SIZE_MAX / 2 / sizeof (Elf_Scn) - sizeof (Elf_ScnList))
-#else
- 1
-#endif
- )
newp = (Elf_ScnList *) calloc (sizeof (Elf_ScnList)
+ ((elf->state.elf.scnincr *= 2)
* sizeof (Elf_Scn)), 1);
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getdyn.c ./libelf/gelf_getdyn.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getdyn.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getdyn.c 2010-03-17 16:06:09.000000000 -0400
@@ -93,8 +93,7 @@
table entries has to be adopted. The user better has provided
a buffer where we can store the information. While copying the
data we are converting the format. */
- if (INVALID_NDX (ndx, Elf32_Dyn)
- || unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -115,8 +114,7 @@
/* The data is already in the correct form. Just make sure the
index is OK. */
- if (INVALID_NDX (ndx, GElf_Dyn)
- || unlikely ((ndx + 1) * sizeof (GElf_Dyn) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (GElf_Dyn) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getlib.c ./libelf/gelf_getlib.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getlib.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getlib.c 2010-03-17 16:06:09.000000000 -0400
@@ -86,8 +86,7 @@
/* The data is already in the correct form. Just make sure the
index is OK. */
GElf_Lib *result = NULL;
- if (INVALID_NDX (ndx, GElf_Lib)
- || unlikely ((ndx + 1) * sizeof (GElf_Lib) > data->d_size))
+ if (unlikely ((ndx + 1) * sizeof (GElf_Lib) > data->d_size))
__libelf_seterrno (ELF_E_INVALID_INDEX);
else
{
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getmove.c ./libelf/gelf_getmove.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getmove.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getmove.c 2010-03-17 16:06:09.000000000 -0400
@@ -83,8 +83,7 @@
/* The data is already in the correct form. Just make sure the
index is OK. */
- if (INVALID_NDX (ndx, GElf_Move)
- || unlikely ((ndx + 1) * sizeof (GElf_Move) > data->d_size))
+ if (unlikely ((ndx + 1) * sizeof (GElf_Move) > data->d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getrela.c ./libelf/gelf_getrela.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getrela.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getrela.c 2010-03-17 16:06:09.000000000 -0400
@@ -71,6 +71,12 @@
if (data_scn == NULL)
return NULL;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return NULL;
+ }
+
if (unlikely (data_scn->d.d_type != ELF_T_RELA))
{
__libelf_seterrno (ELF_E_INVALID_HANDLE);
@@ -87,8 +93,7 @@
if (scn->elf->class == ELFCLASS32)
{
/* We have to convert the data. */
- if (INVALID_NDX (ndx, Elf32_Rela)
- || unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
result = NULL;
@@ -109,8 +114,7 @@
{
/* Simply copy the data after we made sure we are actually getting
correct data. */
- if (INVALID_NDX (ndx, Elf64_Rela)
- || unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
result = NULL;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getrel.c ./libelf/gelf_getrel.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getrel.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getrel.c 2010-03-17 16:06:09.000000000 -0400
@@ -71,6 +71,12 @@
if (data_scn == NULL)
return NULL;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return NULL;
+ }
+
if (unlikely (data_scn->d.d_type != ELF_T_REL))
{
__libelf_seterrno (ELF_E_INVALID_HANDLE);
@@ -87,8 +93,7 @@
if (scn->elf->class == ELFCLASS32)
{
/* We have to convert the data. */
- if (INVALID_NDX (ndx, Elf32_Rel)
- || unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
result = NULL;
@@ -108,8 +113,7 @@
{
/* Simply copy the data after we made sure we are actually getting
correct data. */
- if (INVALID_NDX (ndx, Elf64_Rel)
- || unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
result = NULL;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getsym.c ./libelf/gelf_getsym.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getsym.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getsym.c 2010-03-17 16:06:09.000000000 -0400
@@ -90,8 +90,7 @@
table entries has to be adopted. The user better has provided
a buffer where we can store the information. While copying the
data we are converting the format. */
- if (INVALID_NDX (ndx, Elf32_Sym)
- || unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data->d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data->d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -120,8 +119,7 @@
/* The data is already in the correct form. Just make sure the
index is OK. */
- if (INVALID_NDX (ndx, GElf_Sym)
- || unlikely ((ndx + 1) * sizeof (GElf_Sym) > data->d_size))
+ if (unlikely ((ndx + 1) * sizeof (GElf_Sym) > data->d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getsyminfo.c ./libelf/gelf_getsyminfo.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getsyminfo.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getsyminfo.c 2010-03-17 16:06:09.000000000 -0400
@@ -84,8 +84,7 @@
/* The data is already in the correct form. Just make sure the
index is OK. */
- if (INVALID_NDX (ndx, GElf_Syminfo)
- || unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data->d_size))
+ if (unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data->d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getsymshndx.c ./libelf/gelf_getsymshndx.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getsymshndx.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getsymshndx.c 2010-03-17 16:06:09.000000000 -0400
@@ -90,9 +90,7 @@
section index table. */
if (likely (shndxdata_scn != NULL))
{
- if (INVALID_NDX (ndx, Elf32_Word)
- || unlikely ((ndx + 1) * sizeof (Elf32_Word)
- > shndxdata_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Word) > shndxdata_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -112,8 +110,7 @@
table entries has to be adopted. The user better has provided
a buffer where we can store the information. While copying the
data we are converting the format. */
- if (INVALID_NDX (ndx, Elf32_Sym)
- || unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata->d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata->d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -142,8 +139,7 @@
/* The data is already in the correct form. Just make sure the
index is OK. */
- if (INVALID_NDX (ndx, GElf_Sym)
- || unlikely ((ndx + 1) * sizeof (GElf_Sym) > symdata->d_size))
+ if (unlikely ((ndx + 1) * sizeof (GElf_Sym) > symdata->d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_getversym.c ./libelf/gelf_getversym.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_getversym.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_getversym.c 2010-03-17 16:06:09.000000000 -0400
@@ -92,8 +92,7 @@
/* The data is already in the correct form. Just make sure the
index is OK. */
- if (INVALID_NDX (ndx, GElf_Versym)
- || unlikely ((ndx + 1) * sizeof (GElf_Versym) > data->d_size))
+ if (unlikely ((ndx + 1) * sizeof (GElf_Versym) > data->d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
result = NULL;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_dyn.c ./libelf/gelf_update_dyn.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_dyn.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_dyn.c 2010-03-17 16:06:09.000000000 -0400
@@ -71,6 +71,12 @@
if (data == NULL)
return 0;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return 0;
+ }
+
if (unlikely (data_scn->d.d_type != ELF_T_DYN))
{
/* The type of the data better should match. */
@@ -96,8 +102,7 @@
}
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf32_Dyn)
- || unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -111,8 +116,7 @@
else
{
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf64_Dyn)
- || unlikely ((ndx + 1) * sizeof (Elf64_Dyn) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf64_Dyn) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_lib.c ./libelf/gelf_update_lib.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_lib.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_lib.c 2010-03-17 16:06:09.000000000 -0400
@@ -68,6 +68,12 @@
if (data == NULL)
return 0;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return 0;
+ }
+
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
if (unlikely (data_scn->d.d_type != ELF_T_LIB))
{
@@ -81,8 +87,7 @@
/* Check whether we have to resize the data buffer. */
int result = 0;
- if (INVALID_NDX (ndx, Elf64_Lib)
- || unlikely ((ndx + 1) * sizeof (Elf64_Lib) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf64_Lib) > data_scn->d.d_size))
__libelf_seterrno (ELF_E_INVALID_INDEX);
else
{
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_move.c ./libelf/gelf_update_move.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_move.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_move.c 2010-03-17 16:06:09.000000000 -0400
@@ -75,7 +75,7 @@
assert (sizeof (GElf_Move) == sizeof (Elf64_Move));
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, GElf_Move)
+ if (unlikely (ndx < 0)
|| unlikely ((ndx + 1) * sizeof (GElf_Move) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_rela.c ./libelf/gelf_update_rela.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_rela.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_rela.c 2010-03-17 16:06:09.000000000 -0400
@@ -68,6 +68,12 @@
if (dst == NULL)
return 0;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return 0;
+ }
+
if (unlikely (data_scn->d.d_type != ELF_T_RELA))
{
/* The type of the data better should match. */
@@ -95,8 +101,7 @@
}
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf32_Rela)
- || unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -112,8 +117,7 @@
else
{
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf64_Rela)
- || unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_rel.c ./libelf/gelf_update_rel.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_rel.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_rel.c 2010-03-17 16:06:09.000000000 -0400
@@ -68,6 +68,12 @@
if (dst == NULL)
return 0;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return 0;
+ }
+
if (unlikely (data_scn->d.d_type != ELF_T_REL))
{
/* The type of the data better should match. */
@@ -93,8 +99,7 @@
}
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf32_Rel)
- || unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -109,8 +114,7 @@
else
{
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf64_Rel)
- || unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_sym.c ./libelf/gelf_update_sym.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_sym.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_sym.c 2010-03-17 16:06:09.000000000 -0400
@@ -72,6 +72,12 @@
if (data == NULL)
return 0;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return 0;
+ }
+
if (unlikely (data_scn->d.d_type != ELF_T_SYM))
{
/* The type of the data better should match. */
@@ -96,8 +102,7 @@
}
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf32_Sym)
- || unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -120,8 +125,7 @@
else
{
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf64_Sym)
- || unlikely ((ndx + 1) * sizeof (Elf64_Sym) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf64_Sym) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_syminfo.c ./libelf/gelf_update_syminfo.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_syminfo.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_syminfo.c 2010-03-17 16:06:09.000000000 -0400
@@ -72,6 +72,12 @@
if (data == NULL)
return 0;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return 0;
+ }
+
if (unlikely (data_scn->d.d_type != ELF_T_SYMINFO))
{
/* The type of the data better should match. */
@@ -87,8 +93,7 @@
rwlock_wrlock (scn->elf->lock);
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, GElf_Syminfo)
- || unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_symshndx.c ./libelf/gelf_update_symshndx.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_symshndx.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_symshndx.c 2010-03-17 16:06:09.000000000 -0400
@@ -77,6 +77,12 @@
if (symdata == NULL)
return 0;
+ if (unlikely (ndx < 0))
+ {
+ __libelf_seterrno (ELF_E_INVALID_INDEX);
+ return 0;
+ }
+
if (unlikely (symdata_scn->d.d_type != ELF_T_SYM))
{
/* The type of the data better should match. */
@@ -122,8 +128,7 @@
}
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf32_Sym)
- || unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -146,8 +151,7 @@
else
{
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, Elf64_Sym)
- || unlikely ((ndx + 1) * sizeof (Elf64_Sym) > symdata_scn->d.d_size))
+ if (unlikely ((ndx + 1) * sizeof (Elf64_Sym) > symdata_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_versym.c ./libelf/gelf_update_versym.c
--- ../base/frysk/frysk-imports/elfutils/libelf/gelf_update_versym.c 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/gelf_update_versym.c 2010-03-17 16:06:09.000000000 -0400
@@ -75,7 +75,7 @@
assert (sizeof (GElf_Versym) == sizeof (Elf64_Versym));
/* Check whether we have to resize the data buffer. */
- if (INVALID_NDX (ndx, GElf_Versym)
+ if (unlikely (ndx < 0)
|| unlikely ((ndx + 1) * sizeof (GElf_Versym) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
diff -r -u ../base/frysk/frysk-imports/elfutils/libelf/libelfP.h ./libelf/libelfP.h
--- ../base/frysk/frysk-imports/elfutils/libelf/libelfP.h 2008-04-17 09:23:47.000000000 -0400
+++ ./libelf/libelfP.h 2010-03-25 14:41:45.000000000 -0400
@@ -596,13 +596,4 @@
/* Align offset to 4 bytes as needed for note name and descriptor data. */
#define NOTE_ALIGN(n) (((n) + 3) & -4U)
-/* Convenience macro. Assumes int NDX and TYPE with size at least
- 2 bytes. */
-#if SIZE_MAX > 4294967295U
-# define INVALID_NDX(ndx, type) unlikely (ndx < 0)
-#else
-# define INVALID_NDX(ndx, type) \
- unlikely ((unsigned int) (ndx) >= SIZE_MAX / sizeof (type))
-#endif
-
#endif /* libelfP.h */
Only in ../base/frysk/frysk-imports/elfutils/libelf: Makefile.in
Only in ./m4: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/m4: Makefile.in
Only in ../base/frysk/frysk-imports/elfutils: Makefile.in
Only in .: .mtn-ignore
Only in ./po: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/po: elfutils.pot
Only in ../base/frysk/frysk-imports/elfutils/po: stamp-po
Only in ./src: .cvsignore
diff -r -u ../base/frysk/frysk-imports/elfutils/src/elflint.c ./src/elflint.c
--- ../base/frysk/frysk-imports/elfutils/src/elflint.c 2008-04-17 09:23:47.000000000 -0400
+++ ./src/elflint.c 2010-03-25 14:41:45.000000000 -0400
@@ -131,9 +131,6 @@
/* Array to count references in section groups. */
static int *scnref;
-/* Number of sections. */
-static unsigned int shnum;
-
int
main (int argc, char *argv[])
@@ -323,19 +320,10 @@
{
GElf_Shdr shdr_mem;
GElf_Shdr *shdr;
- const char *ret;
-
- if ((unsigned int) idx > shnum)
- return "<invalid>";
shdr = gelf_getshdr (elf_getscn (ebl->elf, idx), &shdr_mem);
- if (shdr == NULL)
- return "<invalid>";
- ret = elf_strptr (ebl->elf, shstrndx, shdr->sh_name);
- if (ret == NULL)
- return "<invalid>";
- return ret;
+ return elf_strptr (ebl->elf, shstrndx, shdr->sh_name);
}
@@ -357,6 +345,10 @@
(sizeof (valid_e_machine) / sizeof (valid_e_machine[0]))
+/* Number of sections. */
+static unsigned int shnum;
+
+
static void
check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size)
{
@@ -618,8 +610,7 @@
}
}
- size_t sh_entsize = gelf_fsize (ebl->elf, ELF_T_SYM, 1, EV_CURRENT);
- if (shdr->sh_entsize != sh_entsize)
+ if (shdr->sh_entsize != gelf_fsize (ebl->elf, ELF_T_SYM, 1, EV_CURRENT))
ERROR (gettext ("\
section [%2u] '%s': entry size is does not match ElfXX_Sym\n"),
idx, section_name (ebl, idx));
@@ -657,7 +648,7 @@
xndxscnidx, section_name (ebl, xndxscnidx));
}
- for (size_t cnt = 1; cnt < shdr->sh_size / sh_entsize; ++cnt)
+ for (size_t cnt = 1; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
{
sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, &xndx);
if (sym == NULL)
@@ -675,8 +666,7 @@
else
{
name = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name);
- assert (name != NULL
- || strshdr->sh_type != SHT_STRTAB);
+ assert (name != NULL);
}
if (sym->st_shndx == SHN_XINDEX)
@@ -1006,11 +996,9 @@
{
GElf_Shdr rcshdr_mem;
const GElf_Shdr *rcshdr = gelf_getshdr (scn, &rcshdr_mem);
+ assert (rcshdr != NULL);
- if (rcshdr == NULL)
- break;
-
- if (rcshdr->sh_type == SHT_DYNAMIC && rcshdr->sh_entsize)
+ if (rcshdr->sh_type == SHT_DYNAMIC)
{
/* Found the dynamic section. Look through it. */
Elf_Data *d = elf_getdata (scn, NULL);
@@ -1020,9 +1008,7 @@
{
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (d, cnt, &dyn_mem);
-
- if (dyn == NULL)
- break;
+ assert (dyn != NULL);
if (dyn->d_tag == DT_RELCOUNT)
{
@@ -1036,9 +1022,7 @@
/* Does the number specified number of relative
relocations exceed the total number of
relocations? */
- if (shdr->sh_entsize != 0
- && dyn->d_un.d_val > (shdr->sh_size
- / shdr->sh_entsize))
+ if (dyn->d_un.d_val > shdr->sh_size / shdr->sh_entsize)
ERROR (gettext ("\
section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"),
idx, section_name (ebl, idx),
@@ -1198,8 +1182,7 @@
}
}
- size_t sh_entsize = gelf_fsize (ebl->elf, reltype, 1, EV_CURRENT);
- if (shdr->sh_entsize != sh_entsize)
+ if (shdr->sh_entsize != gelf_fsize (ebl->elf, reltype, 1, EV_CURRENT))
ERROR (gettext (reltype == ELF_T_RELA ? "\
section [%2d] '%s': section entry size does not match ElfXX_Rela\n" : "\
section [%2d] '%s': section entry size does not match ElfXX_Rel\n"),
@@ -1422,8 +1405,7 @@
Elf_Data *symdata = elf_getdata (symscn, NULL);
enum load_state state = state_undecided;
- size_t sh_entsize = gelf_fsize (ebl->elf, ELF_T_RELA, 1, EV_CURRENT);
- for (size_t cnt = 0; cnt < shdr->sh_size / sh_entsize; ++cnt)
+ for (size_t cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
{
GElf_Rela rela_mem;
GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem);
@@ -1473,8 +1455,7 @@
Elf_Data *symdata = elf_getdata (symscn, NULL);
enum load_state state = state_undecided;
- size_t sh_entsize = gelf_fsize (ebl->elf, ELF_T_REL, 1, EV_CURRENT);
- for (size_t cnt = 0; cnt < shdr->sh_size / sh_entsize; ++cnt)
+ for (size_t cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
{
GElf_Rel rel_mem;
GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem);
@@ -1577,8 +1558,7 @@
shdr->sh_link, section_name (ebl, shdr->sh_link),
idx, section_name (ebl, idx));
- size_t sh_entsize = gelf_fsize (ebl->elf, ELF_T_DYN, 1, EV_CURRENT);
- if (shdr->sh_entsize != sh_entsize)
+ if (shdr->sh_entsize != gelf_fsize (ebl->elf, ELF_T_DYN, 1, EV_CURRENT))
ERROR (gettext ("\
section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"),
idx, section_name (ebl, idx));
@@ -1588,7 +1568,7 @@
idx, section_name (ebl, idx));
bool non_null_warned = false;
- for (cnt = 0; cnt < shdr->sh_size / sh_entsize; ++cnt)
+ for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
{
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem);
@@ -1869,8 +1849,6 @@
idx, section_name (ebl, idx));
if (symshdr != NULL
- && shdr->sh_entsize
- && symshdr->sh_entsize
&& (shdr->sh_size / shdr->sh_entsize
< symshdr->sh_size / symshdr->sh_entsize))
ERROR (gettext ("\
@@ -1897,12 +1875,6 @@
}
Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL);
- if (data == NULL)
- {
- ERROR (gettext ("section [%2d] '%s': cannot get section data\n"),
- idx, section_name (ebl, idx));
- return;
- }
if (*((Elf32_Word *) data->d_buf) != 0)
ERROR (gettext ("symbol 0 should have zero extended section index\n"));
@@ -1945,7 +1917,7 @@
size_t maxidx = nchain;
- if (symshdr != NULL && symshdr->sh_entsize != 0)
+ if (symshdr != NULL)
{
size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
@@ -1956,28 +1928,18 @@
maxidx = symsize;
}
- Elf32_Word *buf = (Elf32_Word *) data->d_buf;
- Elf32_Word *end = (Elf32_Word *) ((char *) data->d_buf + shdr->sh_size);
size_t cnt;
for (cnt = 2; cnt < 2 + nbucket; ++cnt)
- {
- if (buf + cnt >= end)
- break;
- else if (buf[cnt] >= maxidx)
+ if (((Elf32_Word *) data->d_buf)[cnt] >= maxidx)
ERROR (gettext ("\
section [%2d] '%s': hash bucket reference %zu out of bounds\n"),
idx, section_name (ebl, idx), cnt - 2);
- }
for (; cnt < 2 + nbucket + nchain; ++cnt)
- {
- if (buf + cnt >= end)
- break;
- else if (buf[cnt] >= maxidx)
+ if (((Elf32_Word *) data->d_buf)[cnt] >= maxidx)
ERROR (gettext ("\
section [%2d] '%s': hash chain reference %zu out of bounds\n"),
idx, section_name (ebl, idx), cnt - 2 - nbucket);
- }
}
@@ -2007,28 +1969,18 @@
maxidx = symsize;
}
- Elf64_Xword *buf = (Elf64_Xword *) data->d_buf;
- Elf64_Xword *end = (Elf64_Xword *) ((char *) data->d_buf + shdr->sh_size);
size_t cnt;
for (cnt = 2; cnt < 2 + nbucket; ++cnt)
- {
- if (buf + cnt >= end)
- break;
- else if (buf[cnt] >= maxidx)
+ if (((Elf64_Xword *) data->d_buf)[cnt] >= maxidx)
ERROR (gettext ("\
section [%2d] '%s': hash bucket reference %zu out of bounds\n"),
idx, section_name (ebl, idx), cnt - 2);
- }
for (; cnt < 2 + nbucket + nchain; ++cnt)
- {
- if (buf + cnt >= end)
- break;
- else if (buf[cnt] >= maxidx)
+ if (((Elf64_Xword *) data->d_buf)[cnt] >= maxidx)
ERROR (gettext ("\
section [%2d] '%s': hash chain reference %" PRIu64 " out of bounds\n"),
- idx, section_name (ebl, idx), (uint64_t) cnt - 2 - nbucket);
- }
+ idx, section_name (ebl, idx), (uint64_t) (cnt - 2 - nbucket));
}
@@ -2053,7 +2005,7 @@
if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))
{
ERROR (gettext ("\
-section [%2d] '%s': hash table section is too small (is %ld, expected at least %ld)\n"),
+section [%2d] '%s': hash table section is too small (is %ld, expected at least%ld)\n"),
idx, section_name (ebl, idx), (long int) shdr->sh_size,
(long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)));
return;
@@ -2725,9 +2677,8 @@
/* The number of elements in the version symbol table must be the
same as the number of symbols. */
- if (shdr->sh_entsize && symshdr->sh_entsize
- && (shdr->sh_size / shdr->sh_entsize
- != symshdr->sh_size / symshdr->sh_entsize))
+ if (shdr->sh_size / shdr->sh_entsize
+ != symshdr->sh_size / symshdr->sh_entsize)
ERROR (gettext ("\
section [%2d] '%s' has different number of entries than symbol table [%2d] '%s'\n"),
idx, section_name (ebl, idx),
Only in ../base/frysk/frysk-imports/elfutils/src: elflint.c.orig
Only in ../base/frysk/frysk-imports/elfutils/src: ldlex.c
Only in ../base/frysk/frysk-imports/elfutils/src: ldscript.c
Only in ../base/frysk/frysk-imports/elfutils/src: ldscript.h
Only in ../base/frysk/frysk-imports/elfutils/src: Makefile.in
diff -r -u ../base/frysk/frysk-imports/elfutils/src/readelf.c ./src/readelf.c
--- ../base/frysk/frysk-imports/elfutils/src/readelf.c 2008-04-17 09:23:47.000000000 -0400
+++ ./src/readelf.c 2010-03-25 14:41:45.000000000 -0400
@@ -1111,8 +1111,6 @@
Elf32_Word *grpref = (Elf32_Word *) data->d_buf;
GElf_Sym sym_mem;
- GElf_Sym *sym = gelf_getsym (symdata, shdr->sh_info, &sym_mem);
-
printf ((grpref[0] & GRP_COMDAT)
? ngettext ("\
\nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n",
@@ -1125,8 +1123,8 @@
data->d_size / sizeof (Elf32_Word) - 1),
elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
- (sym == NULL ? NULL
- : elf_strptr (ebl->elf, symshdr->sh_link, sym->st_name))
+ elf_strptr (ebl->elf, symshdr->sh_link,
+ gelf_getsym (symdata, shdr->sh_info, &sym_mem)->st_name)
?: gettext ("<INVALID SYMBOL>"),
data->d_size / sizeof (Elf32_Word) - 1);
@@ -1277,8 +1275,7 @@
handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
- GElf_Shdr glink_mem;
- GElf_Shdr *glink;
+ GElf_Shdr glink;
Elf_Data *data;
size_t cnt;
size_t shstrndx;
@@ -1293,11 +1290,6 @@
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
- glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem);
- if (glink == NULL)
- error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
- elf_ndxscn (scn));
-
printf (ngettext ("\
\nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\
@@ -1307,7 +1299,9 @@
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset,
(int) shdr->sh_link,
- elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+ elf_strptr (ebl->elf, shstrndx,
+ gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+ &glink)->sh_name));
fputs_unlocked (gettext (" Type Value\n"), stdout);
for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
@@ -1807,13 +1801,6 @@
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
- GElf_Shdr glink_mem;
- GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
- &glink_mem);
- if (glink == NULL)
- error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
- elf_ndxscn (scn));
-
/* Now we can compute the number of entries in the section. */
unsigned int nsyms = data->d_size / (class == ELFCLASS32
? sizeof (Elf32_Sym)
@@ -1824,12 +1811,15 @@
nsyms),
(unsigned int) elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms);
+ GElf_Shdr glink;
printf (ngettext (" %lu local symbol String table: [%2u] '%s'\n",
" %lu local symbols String table: [%2u] '%s'\n",
shdr->sh_info),
(unsigned long int) shdr->sh_info,
(unsigned int) shdr->sh_link,
- elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+ elf_strptr (ebl->elf, shstrndx,
+ gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+ &glink)->sh_name));
fputs_unlocked (class == ELFCLASS32
? gettext ("\
@@ -2065,13 +2055,7 @@
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
- GElf_Shdr glink_mem;
- GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
- &glink_mem);
- if (glink == NULL)
- error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
- elf_ndxscn (scn));
-
+ GElf_Shdr glink;
printf (ngettext ("\
\nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\
@@ -2082,7 +2066,9 @@
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
- elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+ elf_strptr (ebl->elf, shstrndx,
+ gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+ &glink)->sh_name));
unsigned int offset = 0;
for (int cnt = shdr->sh_info; --cnt >= 0; )
@@ -2135,14 +2121,8 @@
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
- GElf_Shdr glink_mem;
- GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
- &glink_mem);
- if (glink == NULL)
- error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
- elf_ndxscn (scn));
-
int class = gelf_getclass (ebl->elf);
+ GElf_Shdr glink;
printf (ngettext ("\
\nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\
@@ -2154,7 +2134,9 @@
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
- elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+ elf_strptr (ebl->elf, shstrndx,
+ gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+ &glink)->sh_name));
unsigned int offset = 0;
for (int cnt = shdr->sh_info; --cnt >= 0; )
@@ -2416,14 +2398,8 @@
filename = NULL;
}
- GElf_Shdr glink_mem;
- GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
- &glink_mem);
- if (glink == NULL)
- error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
- elf_ndxscn (scn));
-
/* Print the header. */
+ GElf_Shdr glink;
printf (ngettext ("\
\nVersion symbols section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'",
"\
@@ -2435,7 +2411,9 @@
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
- elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+ elf_strptr (ebl->elf, shstrndx,
+ gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+ &glink)->sh_name));
/* Now we can finally look at the actual contents of this section. */
for (unsigned int cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
@@ -2487,17 +2465,7 @@
for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
++counts[lengths[cnt]];
- GElf_Shdr glink_mem;
- GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf,
- shdr->sh_link),
- &glink_mem);
- if (glink == NULL)
- {
- error (0, 0, gettext ("invalid sh_link value in section %Zu"),
- elf_ndxscn (scn));
- return;
- }
-
+ GElf_Shdr glink;
printf (ngettext ("\
\nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\
@@ -2510,7 +2478,9 @@
shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
- elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+ elf_strptr (ebl->elf, shstrndx,
+ gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+ &glink)->sh_name));
if (extrastr != NULL)
fputs (extrastr, stdout);
@@ -4069,16 +4039,6 @@
return;
}
- GElf_Shdr glink_mem;
- GElf_Shdr *glink;
- glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem);
- if (glink == NULL)
- {
- error (0, 0, gettext ("invalid sh_link value in section %Zu"),
- elf_ndxscn (scn));
- return;
- }
-
printf (ngettext ("\
\nDWARF section '%s' at offset %#" PRIx64 " contains %zu entry:\n",
"\
Only in ../base/frysk/frysk-imports/elfutils/src: readelf.c.orig
diff -r -u ../base/frysk/frysk-imports/elfutils/src/strip.c ./src/strip.c
--- ../base/frysk/frysk-imports/elfutils/src/strip.c 2008-04-17 09:23:47.000000000 -0400
+++ ./src/strip.c 2010-03-25 14:41:45.000000000 -0400
@@ -400,7 +400,6 @@
Elf_Scn *newscn;
struct Ebl_Strent *se;
Elf32_Word *newsymidx;
- void *debug_data;
} *shdr_info = NULL;
Elf_Scn *scn;
size_t cnt;
@@ -544,11 +543,6 @@
goto fail_close;
}
- if (shstrndx >= shnum)
- goto illformed;
-
-#define elf_assert(test) do { if (!(test)) goto illformed; } while (0)
-
/* Storage for section information. We leave room for two more
entries since we unconditionally create a section header string
table. Maybe some weird tool created an ELF file without one.
@@ -570,7 +564,7 @@
{
/* This should always be true (i.e., there should not be any
holes in the numbering). */
- elf_assert (elf_ndxscn (scn) == cnt);
+ assert (elf_ndxscn (scn) == cnt);
shdr_info[cnt].scn = scn;
@@ -583,7 +577,6 @@
shdr_info[cnt].shdr.sh_name);
if (shdr_info[cnt].name == NULL)
{
- illformed:
error (0, 0, gettext ("illformed file '%s'"), fname);
goto fail_close;
}
@@ -593,8 +586,6 @@
/* Remember the shdr.sh_link value. */
shdr_info[cnt].old_sh_link = shdr_info[cnt].shdr.sh_link;
- if (shdr_info[cnt].old_sh_link >= shnum)
- goto illformed;
/* Sections in files other than relocatable object files which
are not loaded can be freely moved by us. In relocatable
@@ -607,7 +598,7 @@
appropriate reference. */
if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX))
{
- elf_assert (shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0);
+ assert (shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0);
shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx = cnt;
}
else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GROUP))
@@ -624,12 +615,7 @@
for (inner = 1;
inner < shdr_info[cnt].data->d_size / sizeof (Elf32_Word);
++inner)
- {
- if (grpref[inner] < shnum)
shdr_info[grpref[inner]].group_idx = cnt;
- else
- goto illformed;
- }
if (inner == 1 || (inner == 2 && (grpref[0] & GRP_COMDAT) == 0))
/* If the section group contains only one element and this
@@ -640,7 +626,7 @@
}
else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym))
{
- elf_assert (shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0);
+ assert (shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0);
shdr_info[shdr_info[cnt].shdr.sh_link].version_idx = cnt;
}
@@ -648,7 +634,7 @@
discarded right away. */
if ((shdr_info[cnt].shdr.sh_flags & SHF_GROUP) != 0)
{
- elf_assert (shdr_info[cnt].group_idx != 0);
+ assert (shdr_info[cnt].group_idx != 0);
if (shdr_info[shdr_info[cnt].group_idx].idx == 0)
{
@@ -723,15 +709,11 @@
{
/* If a relocation section is marked as being removed make
sure the section it is relocating is removed, too. */
- if (shdr_info[cnt].shdr.sh_type == SHT_REL
+ if ((shdr_info[cnt].shdr.sh_type == SHT_REL
|| shdr_info[cnt].shdr.sh_type == SHT_RELA)
- {
- if (shdr_info[cnt].shdr.sh_info >= shnum)
- goto illformed;
- else if (shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
+ && shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
shdr_info[cnt].idx = 1;
}
- }
if (shdr_info[cnt].idx == 1)
{
@@ -756,7 +738,7 @@
if (shdr_info[cnt].symtab_idx != 0
&& shdr_info[shdr_info[cnt].symtab_idx].data == NULL)
{
- elf_assert (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB);
+ assert (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB);
shdr_info[shdr_info[cnt].symtab_idx].data
= elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn,
@@ -796,9 +778,6 @@
else if (scnidx == SHN_XINDEX)
scnidx = xndx;
- if (scnidx >= shnum)
- goto illformed;
-
if (shdr_info[scnidx].idx == 0)
{
/* Mark this section as used. */
@@ -830,16 +809,12 @@
}
/* Handle references through sh_info. */
- if (SH_INFO_LINK_P (&shdr_info[cnt].shdr))
- {
- if (shdr_info[cnt].shdr.sh_info >= shnum)
- goto illformed;
- else if ( shdr_info[shdr_info[cnt].shdr.sh_info].idx == 0)
+ if (SH_INFO_LINK_P (&shdr_info[cnt].shdr)
+ && shdr_info[shdr_info[cnt].shdr.sh_info].idx == 0)
{
shdr_info[shdr_info[cnt].shdr.sh_info].idx = 1;
changes |= shdr_info[cnt].shdr.sh_info < cnt;
}
- }
/* Mark the section as investigated. */
shdr_info[cnt].idx = 2;
@@ -852,37 +827,6 @@
The ones that are not removed in the stripped file are SHT_NOBITS. */
if (debug_fname != NULL)
{
- /* libbfd and apps using it don't cope with separate debuginfo objects
- with relocation sections against SHT_NOBITS .symtab/.strtab
- - libbfd isn't able to look up the .symtab/.strtab in the stripped
- object instead. As a workaround, emit .symtab/.strtab in both
- places. */
- for (cnt = 1; cnt < shnum; ++cnt)
- {
- if (shdr_info[cnt].idx == 0
- && (shdr_info[cnt].shdr.sh_type == SHT_REL
- || shdr_info[cnt].shdr.sh_type == SHT_RELA)
- && (shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) == 0)
- {
- Elf32_Word symtabidx = shdr_info[cnt].old_sh_link;
- struct shdr_info *si = &shdr_info[symtabidx];
- si->debug_data = "";
- shdr_info[si->old_sh_link].debug_data = "";
- if (si->symtab_idx)
- shdr_info[si->symtab_idx].debug_data = "";
-
- if (si->shdr.sh_type != SHT_SYMTAB
- || (si->shdr.sh_flags & SHF_ALLOC)
- || shdr_info[si->old_sh_link].shdr.sh_type != SHT_STRTAB
- || (shdr_info[si->old_sh_link].shdr.sh_flags & SHF_ALLOC)
- || (si->symtab_idx
- && (shdr_info[si->symtab_idx].shdr.sh_flags
- & SHF_ALLOC)))
- error (EXIT_FAILURE, 0,
- gettext ("invalid symtab/strtab referenced by nonallocated section"));
- }
- }
-
for (cnt = 1; cnt < shnum; ++cnt)
{
scn = elf_newscn (debugelf);
@@ -892,7 +836,6 @@
elf_errmsg (-1));
bool discard_section = (shdr_info[cnt].idx > 0
- && shdr_info[cnt].debug_data == NULL
&& shdr_info[cnt].shdr.sh_type != SHT_NOTE
&& cnt != ehdr->e_shstrndx);
@@ -923,13 +866,6 @@
*debugdata = *shdr_info[cnt].data;
if (discard_section)
debugdata->d_buf = NULL;
- else if (shdr_info[cnt].debug_data != NULL)
- {
- shdr_info[cnt].debug_data = xmalloc (debugdata->d_size);
- memcpy (shdr_info[cnt].debug_data, debugdata->d_buf,
- debugdata->d_size);
- debugdata->d_buf = shdr_info[cnt].debug_data;
- }
}
/* Finish the ELF header. Fill in the fields not handled by
@@ -978,7 +914,7 @@
error (EXIT_FAILURE, 0, gettext ("while generating output file: %s"),
elf_errmsg (-1));
- elf_assert (elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx);
+ assert (elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx);
/* Add this name to the section header string table. */
shdr_info[cnt].se = ebl_strtabadd (shst, shdr_info[cnt].name, 0);
@@ -1015,7 +951,7 @@
error (EXIT_FAILURE, 0,
gettext ("while create section header section: %s"),
elf_errmsg (-1));
- elf_assert (elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx);
+ assert (elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx);
shdr_info[cnt].data = elf_newdata (shdr_info[cnt].newscn);
if (shdr_info[cnt].data == NULL)
@@ -1071,7 +1007,7 @@
error (EXIT_FAILURE, 0,
gettext ("while create section header section: %s"),
elf_errmsg (-1));
- elf_assert (elf_ndxscn (shdr_info[cnt].newscn) == idx);
+ assert (elf_ndxscn (shdr_info[cnt].newscn) == idx);
/* Finalize the string table and fill in the correct indices in the
section headers. */
@@ -1121,7 +1057,7 @@
shdr_info[shdr_info[cnt].shdr.sh_info].idx;
/* Get the data from the old file if necessary. We already
- created the data for the section header string table. */
+ created the data for the section header string table. */
if (cnt < shnum)
{
if (shdr_info[cnt].data == NULL)
@@ -1161,20 +1097,20 @@
shndxdata = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn,
NULL);
- elf_assert ((versiondata->d_size / sizeof (Elf32_Word))
+ assert ((versiondata->d_size / sizeof (Elf32_Word))
>= shdr_info[cnt].data->d_size / elsize);
}
if (shdr_info[cnt].version_idx != 0)
{
- elf_assert (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM);
+ assert (shdr_info[cnt].shdr.sh_type == SHT_DYNSYM);
/* This section has associated version
information. We have to modify that
information, too. */
versiondata = elf_getdata (shdr_info[shdr_info[cnt].version_idx].scn,
NULL);
- elf_assert ((versiondata->d_size / sizeof (GElf_Versym))
+ assert ((versiondata->d_size / sizeof (GElf_Versym))
>= shdr_info[cnt].data->d_size / elsize);
}
@@ -1229,7 +1165,7 @@
sec = shdr_info[sym->st_shndx].idx;
else
{
- elf_assert (shndxdata != NULL);
+ assert (shndxdata != NULL);
sec = shdr_info[xshndx].idx;
}
@@ -1250,7 +1186,7 @@
nxshndx = sec;
}
- elf_assert (sec < SHN_LORESERVE || shndxdata != NULL);
+ assert (sec < SHN_LORESERVE || shndxdata != NULL);
if ((inner != destidx || nshndx != sym->st_shndx
|| (shndxdata != NULL && nxshndx != xshndx))
@@ -1273,7 +1209,7 @@
else
/* This is a section symbol for a section which has
been removed. */
- elf_assert (GELF_ST_TYPE (sym->st_info) == STT_SECTION);
+ assert (GELF_ST_TYPE (sym->st_info) == STT_SECTION);
}
if (destidx != inner)
@@ -1348,13 +1284,6 @@
if (shdr_info[shdr_info[cnt].old_sh_link].newsymidx == NULL)
continue;
- /* If the symbol table is not discarded, but additionally
- duplicated in separate debug file and this section
- is discarded, don't adjust anything. */
- if (shdr_info[cnt].idx == 0
- && shdr_info[shdr_info[cnt].old_sh_link].debug_data != NULL)
- continue;
-
Elf32_Word *newsymidx
= shdr_info[shdr_info[cnt].old_sh_link].newsymidx;
Elf_Data *d = elf_getdata (shdr_info[cnt].idx == 0
@@ -1413,13 +1342,6 @@
if (shdr_info[symtabidx].newsymidx == NULL)
continue;
- /* If the symbol table is not discarded, but additionally
- duplicated in separate debug file and this section
- is discarded, don't adjust anything. */
- if (shdr_info[cnt].idx == 0
- && shdr_info[symtabidx].debug_data != NULL)
- continue;
-
assert (shdr_info[cnt].idx > 0);
/* The hash section in the new file. */
@@ -1466,11 +1388,11 @@
{
GElf_Sym sym_mem;
GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem);
- elf_assert (sym != NULL);
+ assert (sym != NULL);
const char *name = elf_strptr (elf, strshndx,
sym->st_name);
- elf_assert (name != NULL);
+ assert (name != NULL);
size_t hidx = elf_hash (name) % nbucket;
if (bucket[hidx] == 0)
@@ -1489,7 +1411,7 @@
else
{
/* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */
- elf_assert (shdr_info[cnt].shdr.sh_entsize
+ assert (shdr_info[cnt].shdr.sh_entsize
== sizeof (Elf64_Xword));
Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf;
@@ -1520,11 +1442,11 @@
{
GElf_Sym sym_mem;
GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem);
- elf_assert (sym != NULL);
+ assert (sym != NULL);
const char *name = elf_strptr (elf, strshndx,
sym->st_name);
- elf_assert (name != NULL);
+ assert (name != NULL);
size_t hidx = elf_hash (name) % nbucket;
if (bucket[hidx] == 0)
@@ -1539,7 +1461,7 @@
chain[hidx] = inner;
}
}
- }
+ }
}
else if (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym)
{
@@ -1552,13 +1474,6 @@
if (shdr_info[symtabidx].newsymidx == NULL)
continue;
- /* If the symbol table is not discarded, but additionally
- duplicated in separate debug file and this section
- is discarded, don't adjust anything. */
- if (shdr_info[cnt].idx == 0
- && shdr_info[symtabidx].debug_data != NULL)
- continue;
-
assert (shdr_info[cnt].idx > 0);
/* The symbol version section in the new file. */
@@ -1601,27 +1516,20 @@
else if (shdr_info[cnt].shdr.sh_type == SHT_GROUP)
{
/* Check whether the associated symbol table changed. */
- if (shdr_info[shdr_info[cnt].old_sh_link].newsymidx == NULL)
- continue;
-
- /* If the symbol table is not discarded, but additionally
- duplicated in separate debug file and this section
- is discarded, don't adjust anything. */
- if (shdr_info[cnt].idx == 0
- && shdr_info[shdr_info[cnt].old_sh_link].debug_data != NULL)
- continue;
-
- /* Yes the symbol table changed. Update the section
- header of the section group. */
- scn = elf_getscn (newelf, shdr_info[cnt].idx);
- GElf_Shdr shdr_mem;
- GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
- assert (shdr != NULL);
+ if (shdr_info[shdr_info[cnt].old_sh_link].newsymidx != NULL)
+ {
+ /* Yes the symbol table changed. Update the section
+ header of the section group. */
+ scn = elf_getscn (newelf, shdr_info[cnt].idx);
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ assert (shdr != NULL);
- size_t stabidx = shdr_info[cnt].old_sh_link;
- shdr->sh_info = shdr_info[stabidx].newsymidx[shdr->sh_info];
+ size_t stabidx = shdr_info[cnt].old_sh_link;
+ shdr->sh_info = shdr_info[stabidx].newsymidx[shdr->sh_info];
- (void) gelf_update_shdr (scn, shdr);
+ (void) gelf_update_shdr (scn, shdr);
+ }
}
}
}
@@ -1751,10 +1659,7 @@
table indices. */
if (any_symtab_changes)
for (cnt = 1; cnt <= shdridx; ++cnt)
- {
- free (shdr_info[cnt].newsymidx);
- free (shdr_info[cnt].debug_data);
- }
+ free (shdr_info[cnt].newsymidx);
/* Free the memory. */
if ((shnum + 2) * sizeof (struct shdr_info) > MAX_STACK_ALLOC)
Only in ../base/frysk/frysk-imports/elfutils/src: strip.c.orig
Only in ./tests: configure.ac
Only in ./tests: .cvsignore
Only in ../base/frysk/frysk-imports/elfutils/tests: Makefile.in
diff -r -u ../base/frysk/frysk-imports/elfutils/tests/run-strip-test5.sh ./tests/run-strip-test5.sh
--- ../base/frysk/frysk-imports/elfutils/tests/run-strip-test5.sh 2008-04-17 09:23:47.000000000 -0400
+++ ./tests/run-strip-test5.sh 2010-03-17 16:06:09.000000000 -0400
@@ -1,5 +1,5 @@
original=testfile8
-stripped=testfile16.symtab
-debugfile=testfile16.symtab.debug
+stripped=testfile16
+debugfile=testfile16.debug
. $srcdir/run-strip-test.sh
Only in ./tests: show-ciefde.c
Only in ../base/frysk/frysk-imports/elfutils/tests: testfile16.symtab.bz2
Only in ../base/frysk/frysk-imports/elfutils/tests: testfile16.symtab.debug.bz2