elfutils: update to elfutils-0.158

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2014-04-12 17:26:56 +02:00
parent e813e3b021
commit 76df65db71
10 changed files with 471 additions and 1776 deletions

View File

@ -17,7 +17,7 @@
################################################################################
PKG_NAME="elfutils"
PKG_VERSION="0.155"
PKG_VERSION="0.158"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
@ -32,7 +32,8 @@ PKG_LONGDESC="Elfutils is a collection of utilities, including eu-ld (a linker),
PKG_IS_ADDON="no"
PKG_AUTORECONF="yes"
PKG_CONFIGURE_OPTS_TARGET="--disable-werror \
PKG_CONFIGURE_OPTS_TARGET="utrace_cv_cc_biarch=false \
--disable-werror \
--disable-progs \
--with-zlib \
--without-bzlib \

View File

@ -1,92 +0,0 @@
Allow the usage of an external implementation of the argp functions
uClibc lack the argp family of functions that glibc has. Therefore, we
add a check in the configure script to see if argp_parse is available
in the C library. If not, we look if it is available in the additional
'argp' library. If so, we link against that library. If not, we error
out.
This allows to build elfutils against uClibc with an external argp
library.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -269,6 +269,13 @@
enable_progs=yes)
AM_CONDITIONAL(ENABLE_PROGS, test "$enable_progs" = yes)
+AC_CHECK_FUNC([argp_parse])
+if test "$ac_cv_func_argp_parse" != yes; then
+ AC_CHECK_LIB([argp],[argp_parse],ARGP_LIBS=-largp,
+ AC_MSG_ERROR([No argp_parse function available.]))
+fi
+AC_SUBST(ARGP_LIBS)
+
dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am
dnl conditional and config.h USE_ZLIB/USE_BZLIB #define.
save_LIBS="$LIBS"
Index: b/src/Makefile.am
===================================================================
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,26 +98,29 @@
# Buggy old compilers.
readelf_no_Werror = yes
-readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
+readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
+ $(ARGP_LIBS)
nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
- $(demanglelib)
-size_LDADD = $(libelf) $(libeu) $(libmudflap)
-strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
-ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
+ $(demanglelib) $(ARGP_LIBS)
+size_LDADD = $(libelf) $(libeu) $(libmudflap) $(ARGP_LIBS)
+strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl $(ARGP_LIBS)
+ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl $(ARGP_LIBS)
if NATIVE_LD
# -ldl is always needed for libebl.
ld_LDADD += libld_elf.a
endif
ld_LDFLAGS = -rdynamic
-elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
-findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap)
-addr2line_LDADD = $(libdw) $(libelf) $(libmudflap)
-elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl
-objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
-ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap)
-strings_LDADD = $(libelf) $(libeu) $(libmudflap)
-ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap)
-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl
+elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl $(ARGP_LIBS)
+findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) $(ARGP_LIBS)
+addr2line_LDADD = $(libdw) $(libelf) $(libmudflap) $(ARGP_LIBS)
+elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl $(ARGP_LIBS)
+objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
+ $(ARGP_LIBS)
+ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) $(ARGP_LIBS)
+strings_LDADD = $(libelf) $(libeu) $(libmudflap) $(ARGP_LIBS)
+ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) $(ARGP_LIBS)
+unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl \
+ $(ARGP_LIBS)
ldlex.o: ldscript.c
ldlex_no_Werror = yes
Index: b/libdw/Makefile.am
===================================================================
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -111,7 +111,7 @@
-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
- -ldl $(zip_LIBS)
+ -ldl $(zip_LIBS) $(ARGP_LIBS)
if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)

View File

@ -1,24 +0,0 @@
Provide a compatibility alias __memcpy
For some reason, libelf uses the internal glibc alias __memcpy, which
doesn't exist in uClibc. Add a manual alias so that the build can
proceed with uClibc.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Index: b/libelf/libelf.h
===================================================================
--- a/libelf/libelf.h
+++ b/libelf/libelf.h
@@ -34,6 +34,11 @@
/* Get the ELF types. */
#include <elf.h>
+#ifndef _LIBC
+#ifndef __mempcpy
+#define __mempcpy mempcpy
+#endif
+#endif
/* Known translation types. */
typedef enum

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
commit 7f1eec317db79627b473c5b149a22a1b20d1f68f
Author: Mark Wielaard <mjw@redhat.com>
Date: Wed Apr 9 11:33:23 2014 +0200
CVE-2014-0172 Check for overflow before calling malloc to uncompress data.
https://bugzilla.redhat.com/show_bug.cgi?id=1085663
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 79daeac..34ea373 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -282,6 +282,12 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
memcpy (&size, data->d_buf + 4, sizeof size);
size = be64toh (size);
+ /* Check for unsigned overflow so malloc always allocated
+ enough memory for both the Elf_Data header and the
+ uncompressed section data. */
+ if (unlikely (sizeof (Elf_Data) + size < size))
+ break;
+
Elf_Data *zdata = malloc (sizeof (Elf_Data) + size);
if (unlikely (zdata == NULL))
break;

View File

@ -0,0 +1,62 @@
commit 65cefbd0793c0f9e90a326d7bebf0a47c93294ad
Author: Josh Stone <jistone@redhat.com>
Date: Tue Mar 11 10:19:28 2014 -0700
libdwfl: dwfl_module_getdwarf.c (open_elf) only (re)set mod->e_type once.
As noted in https://sourceware.org/bugzilla/show_bug.cgi?id=16676#c2 for
systemtap, the heuristic used by open_elf to set the kernel Dwfl_Module
type to ET_DYN, even if the underlying ELF file e_type was set to
ET_EXEC, could trigger erroneously for non-kernel/non-main (debug or
aux) files. Make sure we only set the e_type of the module once when
processing the main file (when the phdrs can be trusted).
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index c4bd739..f8de80b 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -1,5 +1,5 @@
/* Find debugging and symbol information for a module in libdwfl.
- Copyright (C) 2005-2012 Red Hat, Inc.
+ Copyright (C) 2005-2012, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -77,7 +77,7 @@ open_elf (Dwfl_Module *mod, struct dwfl_file *file)
return DWFL_E (LIBELF, elf_errno ());
}
- if (mod->e_type != ET_REL)
+ if (ehdr->e_type != ET_REL)
{
/* In any non-ET_REL file, we compute the "synchronization address".
@@ -131,11 +131,24 @@ open_elf (Dwfl_Module *mod, struct dwfl_file *file)
}
}
- mod->e_type = ehdr->e_type;
+ /* We only want to set the module e_type explictly once, derived from
+ the main ELF file. (It might be changed for the kernel, because
+ that is special - see below.) open_elf is always called first for
+ the main ELF file, because both find_dw and find_symtab call
+ __libdwfl_getelf first to open the main file. So don't let debug
+ or aux files override the module e_type. The kernel heuristic
+ below could otherwise trigger for non-kernel/non-main files, since
+ their phdrs might not match the actual load addresses. */
+ if (file == &mod->main)
+ {
+ mod->e_type = ehdr->e_type;
- /* Relocatable Linux kernels are ET_EXEC but act like ET_DYN. */
- if (mod->e_type == ET_EXEC && file->vaddr != mod->low_addr)
- mod->e_type = ET_DYN;
+ /* Relocatable Linux kernels are ET_EXEC but act like ET_DYN. */
+ if (mod->e_type == ET_EXEC && file->vaddr != mod->low_addr)
+ mod->e_type = ET_DYN;
+ }
+ else
+ assert (mod->main.elf != NULL);
return DWFL_E_NOERROR;
}

View File

@ -1,77 +0,0 @@
diff -Naur elfutils-0.155/libasm/Makefile.am elfutils-0.155.patch/libasm/Makefile.am
--- elfutils-0.155/libasm/Makefile.am 2012-08-27 20:27:31.000000000 +0200
+++ elfutils-0.155.patch/libasm/Makefile.am 2013-03-05 18:11:43.841545009 +0100
@@ -69,7 +69,6 @@
-Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \
-Wl,--soname,$@.$(VERSION) \
../libebl/libebl.a ../libelf/libelf.so $(libasm_so_LDLIBS)
- if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
install: install-am libasm.so
diff -Naur elfutils-0.155/libasm/Makefile.in elfutils-0.155.patch/libasm/Makefile.in
--- elfutils-0.155/libasm/Makefile.in 2012-08-27 20:29:45.000000000 +0200
+++ elfutils-0.155.patch/libasm/Makefile.in 2013-03-05 18:12:05.604432305 +0100
@@ -654,7 +654,6 @@
@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \
@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION) \
@MUDFLAP_FALSE@ ../libebl/libebl.a ../libelf/libelf.so $(libasm_so_LDLIBS)
-@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
@MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION)
@MUDFLAP_FALSE@install: install-am libasm.so
diff -Naur elfutils-0.155/libdw/Makefile.am elfutils-0.155.patch/libdw/Makefile.am
--- elfutils-0.155/libdw/Makefile.am 2012-08-27 20:27:31.000000000 +0200
+++ elfutils-0.155.patch/libdw/Makefile.am 2013-03-05 18:12:26.753322780 +0100
@@ -112,7 +112,6 @@
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-ldl $(zip_LIBS)
- if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
install: install-am libdw.so
diff -Naur elfutils-0.155/libdw/Makefile.in elfutils-0.155.patch/libdw/Makefile.in
--- elfutils-0.155/libdw/Makefile.in 2012-08-27 20:29:45.000000000 +0200
+++ elfutils-0.155.patch/libdw/Makefile.in 2013-03-05 18:12:41.272246520 +0100
@@ -844,7 +844,6 @@
@MUDFLAP_FALSE@ -Wl,--version-script,$<,--no-undefined \
@MUDFLAP_FALSE@ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
@MUDFLAP_FALSE@ -ldl $(zip_LIBS)
-@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
@MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION)
@MUDFLAP_FALSE@install: install-am libdw.so
diff -Naur elfutils-0.155/libelf/Makefile.am elfutils-0.155.patch/libelf/Makefile.am
--- elfutils-0.155/libelf/Makefile.am 2012-08-27 20:27:31.000000000 +0200
+++ elfutils-0.155.patch/libelf/Makefile.am 2013-03-05 18:13:23.328024851 +0100
@@ -106,7 +106,6 @@
$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
-Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
- if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
install: install-am libelf.so
diff -Naur elfutils-0.155/libelf/Makefile.in elfutils-0.155.patch/libelf/Makefile.in
--- elfutils-0.155/libelf/Makefile.in 2012-08-27 20:29:45.000000000 +0200
+++ elfutils-0.155.patch/libelf/Makefile.in 2013-03-05 18:13:37.270951393 +0100
@@ -830,7 +830,6 @@
@MUDFLAP_FALSE@ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
-@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
@MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION)
@MUDFLAP_FALSE@install: install-am libelf.so
diff -Naur elfutils-0.155/src/Makefile.in elfutils-0.155.patch/src/Makefile.in
--- elfutils-0.155/src/Makefile.in 2012-08-27 20:29:46.000000000 +0200
+++ elfutils-0.155.patch/src/Makefile.in 2013-03-05 18:14:22.361713943 +0100
@@ -867,7 +867,6 @@
@NATIVE_LD_FALSE@ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
@NATIVE_LD_FALSE@ $(libelf) $(libeu) \
@NATIVE_LD_FALSE@ -Wl,--version-script,$(srcdir)/libld_elf_i386.map
-@NATIVE_LD_FALSE@ $(textrel_check)
# Special rule to make it possible to define libld_elf_a_SOURCES as we do.
# Otherwise make would complain.

View File

@ -1,26 +0,0 @@
diff -Naur elfutils-0.155/Makefile.am elfutils-0.155.patch/Makefile.am
--- elfutils-0.155/Makefile.am 2012-08-27 20:27:31.000000000 +0200
+++ elfutils-0.155.patch/Makefile.am 2013-03-05 18:38:47.565095550 +0100
@@ -23,8 +23,7 @@
pkginclude_HEADERS = version.h
# Add doc back when we have some real content.
-SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
- src po tests
+SUBDIRS = config m4 lib libelf libebl libdwfl libdw
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
COPYING COPYING-GPLV2 COPYING-LGPLV3
diff -Naur elfutils-0.155/Makefile.in elfutils-0.155.patch/Makefile.in
--- elfutils-0.155/Makefile.in 2012-08-27 20:29:45.000000000 +0200
+++ elfutils-0.155.patch/Makefile.in 2013-03-05 18:39:11.176974119 +0100
@@ -256,8 +256,7 @@
pkginclude_HEADERS = version.h
# Add doc back when we have some real content.
-SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
- src po tests
+SUBDIRS = config m4 lib libelf libebl libdwfl libdw
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
COPYING COPYING-GPLV2 COPYING-LGPLV3

View File

@ -1,6 +1,6 @@
--- elfutils/libdwfl/ChangeLog
+++ elfutils/libdwfl/ChangeLog
@@ -52,6 +52,11 @@
@@ -680,6 +680,11 @@
* dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL.
Reported by Kurt Roeckx <kurt@roeckx.be>.
@ -21,7 +21,7 @@
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -457,7 +457,10 @@ relocate_section (Dwfl_Module *mod, Elf
@@ -456,7 +456,10 @@ relocate_section (Dwfl_Module *mod, Elf
}
}
@ -33,7 +33,7 @@
size_t complete = 0;
if (shdr->sh_type == SHT_REL)
for (size_t relidx = 0; !result && relidx < nrels; ++relidx)
@@ -559,7 +562,7 @@ relocate_section (Dwfl_Module *mod, Elf
@@ -558,7 +561,7 @@ relocate_section (Dwfl_Module *mod, Elf
nrels = next;
}
@ -44,7 +44,7 @@
--- elfutils/libelf/ChangeLog
+++ elfutils/libelf/ChangeLog
@@ -703,10 +703,53 @@
@@ -754,10 +754,53 @@
If section content hasn't been read yet, do it before looking for the
block size. If no section data present, infer size of section header.
@ -253,7 +253,7 @@
--- elfutils/libelf/elf_getarsym.c
+++ elfutils/libelf/elf_getarsym.c
@@ -181,6 +181,9 @@ elf_getarsym (elf, ptr)
@@ -183,6 +183,9 @@ elf_getarsym (elf, ptr)
size_t index_size = atol (tmpbuf);
if (SARMAG + sizeof (struct ar_hdr) + index_size > elf->maximum_size
@ -902,7 +902,7 @@
#endif /* libelfP.h */
--- elfutils/src/ChangeLog
+++ elfutils/src/ChangeLog
@@ -344,6 +344,12 @@
@@ -702,6 +702,12 @@
* readelf.c (dwarf_attr_string): Grok DW_AT_GNU_odr_signature.
@ -915,7 +915,7 @@
2011-02-11 Roland McGrath <roland@redhat.com>
* elfcmp.c (verbose): New variable.
@@ -2056,6 +2062,16 @@
@@ -2414,6 +2420,16 @@
object symbols or symbols with unknown type.
(check_rel): Likewise.
@ -932,7 +932,7 @@
2005-06-08 Roland McGrath <roland@redhat.com>
* readelf.c (print_ops): Add consts.
@@ -2101,6 +2117,19 @@
@@ -2459,6 +2475,19 @@
* readelf.c (dwarf_tag_string): Add new tags.
@ -1027,7 +1027,7 @@
}
if (sym->st_shndx == SHN_XINDEX)
@@ -1032,9 +1042,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
@@ -1040,9 +1050,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
{
GElf_Shdr rcshdr_mem;
const GElf_Shdr *rcshdr = gelf_getshdr (scn, &rcshdr_mem);
@ -1041,7 +1041,7 @@
{
/* Found the dynamic section. Look through it. */
Elf_Data *d = elf_getdata (scn, NULL);
@@ -1044,7 +1056,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
@@ -1052,7 +1064,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
{
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (d, cnt, &dyn_mem);
@ -1052,7 +1052,7 @@
if (dyn->d_tag == DT_RELCOUNT)
{
@@ -1058,7 +1072,9 @@ section [%2d] '%s': DT_RELCOUNT used for
@@ -1066,7 +1080,9 @@ section [%2d] '%s': DT_RELCOUNT used for
/* Does the number specified number of relative
relocations exceed the total number of
relocations? */
@ -1063,7 +1063,7 @@
ERROR (gettext ("\
section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"),
idx, section_name (ebl, idx),
@@ -1218,7 +1234,8 @@ section [%2d] '%s': no relocations for m
@@ -1226,7 +1242,8 @@ section [%2d] '%s': no relocations for m
}
}
@ -1073,7 +1073,7 @@
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"),
@@ -1441,7 +1458,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G
@@ -1449,7 +1466,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G
Elf_Data *symdata = elf_getdata (symscn, NULL);
enum load_state state = state_undecided;
@ -1083,7 +1083,7 @@
{
GElf_Rela rela_mem;
GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem);
@@ -1491,7 +1509,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE
@@ -1499,7 +1517,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE
Elf_Data *symdata = elf_getdata (symscn, NULL);
enum load_state state = state_undecided;
@ -1093,7 +1093,7 @@
{
GElf_Rel rel_mem;
GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem);
@@ -1590,7 +1609,8 @@ section [%2d] '%s': referenced as string
@@ -1598,7 +1617,8 @@ section [%2d] '%s': referenced as string
shdr->sh_link, section_name (ebl, shdr->sh_link),
idx, section_name (ebl, idx));
@ -1103,7 +1103,7 @@
ERROR (gettext ("\
section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"),
idx, section_name (ebl, idx));
@@ -1600,7 +1620,7 @@ section [%2d] '%s': section entry size d
@@ -1608,7 +1628,7 @@ section [%2d] '%s': section entry size d
idx, section_name (ebl, idx));
bool non_null_warned = false;
@ -1112,7 +1112,7 @@
{
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem);
@@ -1872,6 +1892,8 @@ section [%2d] '%s': entry size does not
@@ -1880,6 +1900,8 @@ section [%2d] '%s': entry size does not
idx, section_name (ebl, idx));
if (symshdr != NULL
@ -1121,7 +1121,7 @@
&& (shdr->sh_size / shdr->sh_entsize
< symshdr->sh_size / symshdr->sh_entsize))
ERROR (gettext ("\
@@ -1898,6 +1920,12 @@ section [%2d] '%s': extended section ind
@@ -1906,6 +1928,12 @@ section [%2d] '%s': extended section ind
}
Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL);
@ -1134,7 +1134,7 @@
if (*((Elf32_Word *) data->d_buf) != 0)
ERROR (gettext ("symbol 0 should have zero extended section index\n"));
@@ -1940,7 +1968,7 @@ section [%2d] '%s': hash table section i
@@ -1948,7 +1976,7 @@ section [%2d] '%s': hash table section i
size_t maxidx = nchain;
@ -1143,7 +1143,7 @@
{
size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
@@ -1951,18 +1979,28 @@ section [%2d] '%s': hash table section i
@@ -1959,18 +1987,28 @@ section [%2d] '%s': hash table section i
maxidx = symsize;
}
@ -1174,7 +1174,7 @@
}
@@ -1992,18 +2030,28 @@ section [%2d] '%s': hash table section i
@@ -2000,18 +2038,28 @@ section [%2d] '%s': hash table section i
maxidx = symsize;
}
@ -1206,7 +1206,7 @@
}
@@ -2028,7 +2076,7 @@ section [%2d] '%s': bitmask size not pow
@@ -2036,7 +2084,7 @@ section [%2d] '%s': bitmask size not pow
if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))
{
ERROR (gettext ("\
@ -1215,7 +1215,7 @@
idx, section_name (ebl, idx), (long int) shdr->sh_size,
(long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)));
return;
@@ -2700,8 +2748,9 @@ section [%2d] '%s' refers in sh_link to
@@ -2708,8 +2756,9 @@ section [%2d] '%s' refers in sh_link to
/* The number of elements in the version symbol table must be the
same as the number of symbols. */
@ -1229,7 +1229,7 @@
idx, section_name (ebl, idx),
--- elfutils/src/readelf.c
+++ elfutils/src/readelf.c
@@ -1189,6 +1189,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
@@ -1364,6 +1364,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
Elf32_Word *grpref = (Elf32_Word *) data->d_buf;
GElf_Sym sym_mem;
@ -1238,7 +1238,7 @@
printf ((grpref[0] & GRP_COMDAT)
? ngettext ("\
\nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n",
@@ -1201,8 +1203,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
@@ -1376,8 +1378,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
data->d_size / sizeof (Elf32_Word) - 1),
elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
@ -1249,7 +1249,7 @@
?: gettext ("<INVALID SYMBOL>"),
data->d_size / sizeof (Elf32_Word) - 1);
@@ -1353,10 +1355,12 @@ static void
@@ -1528,10 +1530,12 @@ static void
handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
@ -1263,7 +1263,7 @@
/* Get the data of the section. */
data = elf_getdata (scn, NULL);
@@ -1368,21 +1372,26 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
@@ -1543,21 +1547,26 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@ -1296,7 +1296,7 @@
{
GElf_Dyn dynmem;
GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dynmem);
@@ -1531,7 +1540,8 @@ static void
@@ -1706,7 +1715,8 @@ static void
handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
@ -1306,7 +1306,7 @@
/* Get the data of the section. */
Elf_Data *data = elf_getdata (scn, NULL);
@@ -1717,7 +1727,8 @@ static void
@@ -1892,7 +1902,8 @@ static void
handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
@ -1316,7 +1316,7 @@
/* Get the data of the section. */
Elf_Data *data = elf_getdata (scn, NULL);
@@ -1964,6 +1975,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
@@ -2139,6 +2150,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@ -1330,7 +1330,7 @@
/* Now we can compute the number of entries in the section. */
unsigned int nsyms = data->d_size / (class == ELFCLASS32
? sizeof (Elf32_Sym)
@@ -1974,15 +1992,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
@@ -2149,15 +2167,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
nsyms),
(unsigned int) elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms);
@ -1347,7 +1347,7 @@
fputs_unlocked (class == ELFCLASS32
? gettext ("\
@@ -2218,7 +2233,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
@@ -2393,7 +2408,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@ -1362,7 +1362,7 @@
printf (ngettext ("\
\nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\
@@ -2229,9 +2250,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
@@ -2404,9 +2425,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
@ -1373,7 +1373,7 @@
unsigned int offset = 0;
for (int cnt = shdr->sh_info; --cnt >= 0; )
@@ -2284,8 +2303,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
@@ -2459,8 +2478,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@ -1389,7 +1389,7 @@
printf (ngettext ("\
\nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\
@@ -2297,9 +2322,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
@@ -2472,9 +2497,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
@ -1400,7 +1400,7 @@
unsigned int offset = 0;
for (int cnt = shdr->sh_info; --cnt >= 0; )
@@ -2561,25 +2584,30 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
@@ -2736,25 +2759,30 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
filename = NULL;
}
@ -1438,7 +1438,7 @@
{
if (cnt % 2 == 0)
printf ("\n %4d:", cnt);
@@ -2628,7 +2656,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
@@ -2803,7 +2831,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
++counts[lengths[cnt]];
@ -1457,7 +1457,7 @@
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",
"\
@@ -2641,9 +2679,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
@@ -2816,9 +2854,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
@ -1468,7 +1468,7 @@
if (extrastr != NULL)
fputs (extrastr, stdout);
@@ -2903,7 +2939,8 @@ print_liblist (Ebl *ebl)
@@ -3078,7 +3114,8 @@ print_liblist (Ebl *ebl)
if (shdr != NULL && shdr->sh_type == SHT_GNU_LIBLIST)
{
@ -1478,7 +1478,7 @@
printf (ngettext ("\
\nLibrary list section [%2zu] '%s' at offset %#0" PRIx64 " contains %d entry:\n",
"\
@@ -4164,6 +4201,16 @@ print_debug_aranges_section (Dwfl_Module
@@ -4398,6 +4435,16 @@ print_decoded_aranges_section (Ebl *ebl,
return;
}
@ -1497,7 +1497,7 @@
"\
--- elfutils/src/strip.c
+++ elfutils/src/strip.c
@@ -564,6 +564,11 @@ handle_elf (int fd, Elf *elf, const char
@@ -565,6 +565,11 @@ handle_elf (int fd, Elf *elf, const char
goto fail_close;
}
@ -1509,7 +1509,7 @@
/* 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.
@@ -585,7 +590,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -586,7 +591,7 @@ handle_elf (int fd, Elf *elf, const char
{
/* This should always be true (i.e., there should not be any
holes in the numbering). */
@ -1518,7 +1518,7 @@
shdr_info[cnt].scn = scn;
@@ -598,6 +603,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -599,6 +604,7 @@ handle_elf (int fd, Elf *elf, const char
shdr_info[cnt].shdr.sh_name);
if (shdr_info[cnt].name == NULL)
{
@ -1526,7 +1526,7 @@
error (0, 0, gettext ("illformed file '%s'"), fname);
goto fail_close;
}
@@ -607,6 +613,8 @@ handle_elf (int fd, Elf *elf, const char
@@ -608,6 +614,8 @@ handle_elf (int fd, Elf *elf, const char
/* Remember the shdr.sh_link value. */
shdr_info[cnt].old_sh_link = shdr_info[cnt].shdr.sh_link;
@ -1535,7 +1535,7 @@
/* Sections in files other than relocatable object files which
are not loaded can be freely moved by us. In relocatable
@@ -619,7 +627,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -620,7 +628,7 @@ handle_elf (int fd, Elf *elf, const char
appropriate reference. */
if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX))
{
@ -1544,7 +1544,7 @@
shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx = cnt;
}
else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GROUP))
@@ -636,7 +644,12 @@ handle_elf (int fd, Elf *elf, const char
@@ -637,7 +645,12 @@ handle_elf (int fd, Elf *elf, const char
for (inner = 1;
inner < shdr_info[cnt].data->d_size / sizeof (Elf32_Word);
++inner)
@ -1557,7 +1557,7 @@
if (inner == 1 || (inner == 2 && (grpref[0] & GRP_COMDAT) == 0))
/* If the section group contains only one element and this
@@ -647,7 +660,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -648,7 +661,7 @@ handle_elf (int fd, Elf *elf, const char
}
else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym))
{
@ -1566,7 +1566,7 @@
shdr_info[shdr_info[cnt].shdr.sh_link].version_idx = cnt;
}
@@ -655,7 +668,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -656,7 +669,7 @@ handle_elf (int fd, Elf *elf, const char
discarded right away. */
if ((shdr_info[cnt].shdr.sh_flags & SHF_GROUP) != 0)
{
@ -1575,7 +1575,7 @@
if (shdr_info[shdr_info[cnt].group_idx].idx == 0)
{
@@ -731,10 +744,14 @@ handle_elf (int fd, Elf *elf, const char
@@ -732,10 +745,14 @@ handle_elf (int fd, Elf *elf, const char
{
/* If a relocation section is marked as being removed make
sure the section it is relocating is removed, too. */
@ -1593,7 +1593,7 @@
/* If a group section is marked as being removed make
sure all the sections it contains are being removed, too. */
@@ -778,7 +795,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -779,7 +796,7 @@ handle_elf (int fd, Elf *elf, const char
if (shdr_info[cnt].symtab_idx != 0
&& shdr_info[shdr_info[cnt].symtab_idx].data == NULL)
{
@ -1602,7 +1602,7 @@
shdr_info[shdr_info[cnt].symtab_idx].data
= elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn,
@@ -818,6 +835,9 @@ handle_elf (int fd, Elf *elf, const char
@@ -819,6 +836,9 @@ handle_elf (int fd, Elf *elf, const char
else if (scnidx == SHN_XINDEX)
scnidx = xndx;
@ -1612,7 +1612,7 @@
if (shdr_info[scnidx].idx == 0)
/* This symbol table has a real symbol in
a discarded section. So preserve the
@@ -848,12 +868,16 @@ handle_elf (int fd, Elf *elf, const char
@@ -849,12 +869,16 @@ handle_elf (int fd, Elf *elf, const char
}
/* Handle references through sh_info. */
@ -1631,7 +1631,7 @@
/* Mark the section as investigated. */
shdr_info[cnt].idx = 2;
@@ -994,7 +1018,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -995,7 +1019,7 @@ handle_elf (int fd, Elf *elf, const char
error (EXIT_FAILURE, 0, gettext ("while generating output file: %s"),
elf_errmsg (-1));
@ -1640,7 +1640,7 @@
/* Add this name to the section header string table. */
shdr_info[cnt].se = ebl_strtabadd (shst, shdr_info[cnt].name, 0);
@@ -1031,7 +1055,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -1032,7 +1056,7 @@ handle_elf (int fd, Elf *elf, const char
error (EXIT_FAILURE, 0,
gettext ("while create section header section: %s"),
elf_errmsg (-1));
@ -1649,7 +1649,7 @@
shdr_info[cnt].data = elf_newdata (shdr_info[cnt].newscn);
if (shdr_info[cnt].data == NULL)
@@ -1087,7 +1111,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -1089,7 +1113,7 @@ handle_elf (int fd, Elf *elf, const char
error (EXIT_FAILURE, 0,
gettext ("while create section header section: %s"),
elf_errmsg (-1));
@ -1658,7 +1658,7 @@
/* Finalize the string table and fill in the correct indices in the
section headers. */
@@ -1177,20 +1201,20 @@ handle_elf (int fd, Elf *elf, const char
@@ -1179,20 +1203,20 @@ handle_elf (int fd, Elf *elf, const char
shndxdata = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn,
NULL);
@ -1682,7 +1682,7 @@
>= shdr_info[cnt].data->d_size / elsize);
}
@@ -1245,7 +1269,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -1247,7 +1271,7 @@ handle_elf (int fd, Elf *elf, const char
sec = shdr_info[sym->st_shndx].idx;
else
{
@ -1691,7 +1691,7 @@
sec = shdr_info[xshndx].idx;
}
@@ -1266,7 +1290,7 @@ handle_elf (int fd, Elf *elf, const char
@@ -1268,7 +1292,7 @@ handle_elf (int fd, Elf *elf, const char
nxshndx = sec;
}
@ -1700,7 +1700,7 @@
if ((inner != destidx || nshndx != sym->st_shndx
|| (shndxdata != NULL && nxshndx != xshndx))
@@ -1293,9 +1317,11 @@ handle_elf (int fd, Elf *elf, const char
@@ -1295,9 +1319,11 @@ handle_elf (int fd, Elf *elf, const char
{
size_t sidx = (sym->st_shndx != SHN_XINDEX
? sym->st_shndx : xshndx);
@ -1715,7 +1715,7 @@
}
}
@@ -1483,11 +1509,11 @@ handle_elf (int fd, Elf *elf, const char
@@ -1485,11 +1511,11 @@ handle_elf (int fd, Elf *elf, const char
{
GElf_Sym sym_mem;
GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem);
@ -1729,7 +1729,7 @@
size_t hidx = elf_hash (name) % nbucket;
if (bucket[hidx] == 0)
@@ -1506,8 +1532,8 @@ handle_elf (int fd, Elf *elf, const char
@@ -1508,8 +1534,8 @@ handle_elf (int fd, Elf *elf, const char
else
{
/* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */
@ -1740,7 +1740,7 @@
Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf;
@@ -1537,11 +1563,11 @@ handle_elf (int fd, Elf *elf, const char
@@ -1539,11 +1565,11 @@ handle_elf (int fd, Elf *elf, const char
{
GElf_Sym sym_mem;
GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem);