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