diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2010-01-28 12:52:09 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2010-01-28 12:52:09 +0000 |
commit | df6da4baf02d3cc06e312fc60e5f8993a730d616 (patch) | |
tree | ecf9d39807c67c44a4f3ebd128ce5d4b452ae7f7 | |
parent | 7935b8d713cc12dcc0a4afddd9225afc111631e7 (diff) | |
parent | b35baa53df420c2d0816c6a65ef71deec0760836 (diff) | |
download | elfutils-df6da4baf02d3cc06e312fc60e5f8993a730d616.tar.gz |
Merge tag '0.144-2'
79 files changed, 2207 insertions, 1034 deletions
diff --git a/elfutils-0.143-rh-portability.patch b/elfutils-0.143-rh-portability.patch index 471e3f9c..8649d5e9 100644 --- a/elfutils-0.143-rh-portability.patch +++ b/elfutils-0.143-rh-portability.patch @@ -1,6 +1,6 @@ --- elfutils/backends/ChangeLog +++ elfutils/backends/ChangeLog -@@ -57,6 +57,10 @@ +@@ -78,6 +78,10 @@ * ppc_attrs.c (ppc_check_object_attribute): Handle tag GNU_Power_ABI_Struct_Return. @@ -11,7 +11,7 @@ 2008-10-04 Ulrich Drepper <drepper@redhat.com> * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and -@@ -384,6 +388,11 @@ +@@ -405,6 +409,11 @@ * sparc_init.c: Likewise. * x86_64_init.c: Likewise. @@ -23,7 +23,7 @@ 2005-11-19 Roland McGrath <roland@redhat.com> * ppc64_reloc.def: REL30 -> ADDR30. -@@ -406,6 +415,9 @@ +@@ -427,6 +436,9 @@ * Makefile.am (uninstall): Don't try to remove $(pkgincludedir). (CLEANFILES): Add libebl_$(m).so. @@ -101,7 +101,15 @@ # XXX Should not be needed... --- elfutils/ChangeLog +++ elfutils/ChangeLog -@@ -6,6 +6,10 @@ +@@ -1,3 +1,7 @@ ++2009-11-22 Roland McGrath <roland@redhat.com> ++ ++ * configure.ac: Use sed and expr instead of modern bash extensions. ++ + 2009-09-21 Ulrich Drepper <drepper@redhat.com> + + * configure.ac: Update for more modern autoconf. +@@ -6,6 +10,10 @@ * configure.ac (zip_LIBS): Check for liblzma too. @@ -112,7 +120,7 @@ 2009-04-19 Roland McGrath <roland@redhat.com> * configure.ac (eu_version): Round down here, not in version.h macros. -@@ -17,6 +21,8 @@ +@@ -17,6 +25,8 @@ 2009-01-23 Roland McGrath <roland@redhat.com> @@ -121,7 +129,7 @@ * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3. * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of -@@ -97,6 +103,10 @@ +@@ -97,6 +107,10 @@ * configure.ac: Add dummy automake conditional to get dependencies for non-generic linker right. See src/Makefile.am. @@ -132,7 +140,7 @@ 2005-11-18 Roland McGrath <roland@redhat.com> * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable. -@@ -144,6 +154,17 @@ +@@ -144,6 +158,17 @@ * Makefile.am (all_SUBDIRS): Add libdwfl. * configure.ac: Write libdwfl/Makefile. @@ -425,6 +433,24 @@ fi +@@ -5460,7 +5670,7 @@ ac_config_files="$ac_config_files versio + + # 1.234<whatever> -> 1234<whatever> + case "$PACKAGE_VERSION" in +-[0-9].*) eu_version="${PACKAGE_VERSION/./}" ;; ++[0-9].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;; + *) { { $as_echo "$as_me:$LINENO: error: confused by version number '$PACKAGE_VERSION'" >&5 + $as_echo "$as_me: error: confused by version number '$PACKAGE_VERSION'" >&2;} + { (exit 1); exit 1; }; } ;; +@@ -5495,7 +5705,7 @@ $as_echo "$as_me: error: confused by ver + esac + + # Round up to the next release API (x.y) version. +-eu_version=$[($eu_version + 999) / 1000] ++eu_version=`expr \( $eu_version + 999 \) / 1000` + + cat >confcache <<\_ACEOF + # This file is a shell script that caches the results of configure --- elfutils/configure.ac +++ elfutils/configure.ac @@ -73,6 +73,54 @@ CFLAGS="$old_CFLAGS"]) @@ -494,6 +520,23 @@ LOCALEDIR=$datadir AC_SUBST(LOCALEDIR) +@@ -259,7 +310,7 @@ AC_SUBST([eu_version]) + + # 1.234<whatever> -> 1234<whatever> + case "$PACKAGE_VERSION" in +-[[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;; ++[[0-9]].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;; + *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; + esac + case "$eu_version" in +@@ -288,6 +339,6 @@ case "$eu_version" in + esac + + # Round up to the next release API (x.y) version. +-[eu_version=$[($eu_version + 999) / 1000]] ++eu_version=`expr \( $eu_version + 999 \) / 1000` + + AC_OUTPUT --- elfutils/lib/ChangeLog +++ elfutils/lib/ChangeLog @@ -4,6 +4,9 @@ @@ -728,7 +771,7 @@ @MUDFLAP_TRUE@ $($(*F)_no_Werror),,-Werror) --- elfutils/libdw/ChangeLog +++ elfutils/libdw/ChangeLog -@@ -20,6 +20,10 @@ +@@ -49,6 +49,10 @@ * dwarf_hasattr_integrate.c: Integrate DW_AT_specification too. @@ -739,7 +782,7 @@ 2009-08-10 Roland McGrath <roland@redhat.com> * dwarf_getscopevar.c: Use dwarf_diename. -@@ -788,6 +792,11 @@ +@@ -817,6 +821,11 @@ 2005-05-31 Roland McGrath <roland@redhat.com> @@ -753,7 +796,7 @@ --- elfutils/libdw/libdw.h +++ elfutils/libdw/libdw.h -@@ -809,7 +809,7 @@ extern Dwarf_OOM dwarf_new_oom_handler ( +@@ -814,7 +814,7 @@ extern Dwarf_OOM dwarf_new_oom_handler ( /* Inline optimizations. */ @@ -783,7 +826,7 @@ --- elfutils/libdw/Makefile.in +++ elfutils/libdw/Makefile.in -@@ -186,6 +186,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -187,6 +187,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -791,7 +834,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -215,6 +216,7 @@ SHELL = @SHELL@ +@@ -216,6 +217,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 @@ -799,7 +842,7 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -273,9 +275,10 @@ top_builddir = @top_builddir@ +@@ -274,9 +276,10 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Werror -Wshadow \ @@ -814,7 +857,7 @@ $(COMPILE))) --- elfutils/libdwfl/ChangeLog +++ elfutils/libdwfl/ChangeLog -@@ -1139,6 +1139,11 @@ +@@ -1165,6 +1165,11 @@ 2005-07-21 Roland McGrath <roland@redhat.com> @@ -875,7 +918,7 @@ --- elfutils/libebl/ChangeLog +++ elfutils/libebl/ChangeLog -@@ -603,6 +603,11 @@ +@@ -620,6 +620,11 @@ * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency tracking works right. @@ -936,7 +979,7 @@ --- elfutils/libelf/ChangeLog +++ elfutils/libelf/ChangeLog -@@ -580,6 +580,11 @@ +@@ -614,6 +614,11 @@ * elf.h: Update from glibc. @@ -1071,7 +1114,7 @@ /* It was symbol+offset. */ --- elfutils/src/ChangeLog +++ elfutils/src/ChangeLog -@@ -7,8 +7,16 @@ +@@ -59,8 +59,16 @@ * readelf.c (attr_callback): Use print_block only when we don't use print_ops. @@ -1088,7 +1131,7 @@ * ar.c (do_oper_extract): Use pathconf instead of statfs. 2009-08-01 Ulrich Drepper <drepper@redhat.com> -@@ -172,6 +180,8 @@ +@@ -224,6 +232,8 @@ * readelf.c (print_debug_frame_section): Use t instead of j formats for ptrdiff_t OFFSET. @@ -1097,7 +1140,7 @@ 2009-01-21 Ulrich Drepper <drepper@redhat.com> * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section -@@ -355,6 +365,11 @@ +@@ -407,6 +417,11 @@ that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really is valid in RELRO. @@ -1109,7 +1152,7 @@ 2008-02-29 Roland McGrath <roland@redhat.com> * readelf.c (print_attributes): Add a cast. -@@ -606,6 +621,8 @@ +@@ -658,6 +673,8 @@ * readelf.c (hex_dump): Fix rounding error in whitespace calculation. @@ -1118,7 +1161,7 @@ 2007-10-15 Roland McGrath <roland@redhat.com> * make-debug-archive.in: New file. -@@ -1045,6 +1062,10 @@ +@@ -1097,6 +1114,10 @@ * elflint.c (valid_e_machine): Add EM_ALPHA. Reported by Christian Aichinger <Greek0@gmx.net>. @@ -1129,7 +1172,7 @@ 2006-08-08 Ulrich Drepper <drepper@redhat.com> * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB. -@@ -1121,6 +1142,10 @@ +@@ -1173,6 +1194,10 @@ * Makefile.am: Add hacks to create dependency files for non-generic linker. @@ -1140,7 +1183,7 @@ 2006-06-12 Ulrich Drepper <drepper@redhat.com> * ldgeneric.c (ld_generic_generate_sections): Don't create .interp -@@ -1469,6 +1494,11 @@ +@@ -1521,6 +1546,11 @@ * readelf.c (print_debug_loc_section): Fix indentation for larger address size. @@ -1259,7 +1302,7 @@ size_LDADD = $(libelf) $(libeu) $(libmudflap) --- elfutils/src/readelf.c +++ elfutils/src/readelf.c -@@ -7594,7 +7594,7 @@ dump_archive_index (Elf *elf, const char +@@ -7661,7 +7661,7 @@ dump_archive_index (Elf *elf, const char if (unlikely (elf_rand (elf, as_off) == 0) || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf)) == NULL)) diff --git a/elfutils-0.143-rh-robustify.patch b/elfutils-0.143-rh-robustify.patch index 2e162edb..10741aaa 100644 --- a/elfutils-0.143-rh-robustify.patch +++ b/elfutils-0.143-rh-robustify.patch @@ -1,6 +1,6 @@ --- elfutils/libelf/ChangeLog +++ elfutils/libelf/ChangeLog -@@ -572,6 +572,49 @@ +@@ -606,6 +606,49 @@ 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. @@ -52,14 +52,7 @@ * elf.h: Update again. --- elfutils/libelf/elf32_getphdr.c +++ elfutils/libelf/elf32_getphdr.c -@@ -1,5 +1,5 @@ - /* Get ELF program header table. -- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Red Hat, Inc. -+ Copyright (C) 1998-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper <drepper@redhat.com>, 1998. - -@@ -105,6 +105,16 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf) +@@ -107,6 +107,16 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf) if (elf->map_address != NULL) { @@ -114,8 +107,8 @@ /* All the data is already mapped. If we could use it --- elfutils/libelf/elf32_newphdr.c +++ elfutils/libelf/elf32_newphdr.c -@@ -124,6 +124,12 @@ elfw2(LIBELFBITS,newphdr) (elf, count) - else if (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum != count +@@ -135,6 +135,12 @@ elfw2(LIBELFBITS,newphdr) (elf, count) + || count == PN_XNUM || elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) { + if (unlikely (count > SIZE_MAX / sizeof (ElfW2(LIBELFBITS,Phdr)))) @@ -129,7 +122,7 @@ result = (ElfW2(LIBELFBITS,Phdr) *) --- elfutils/libelf/elf32_updatefile.c +++ elfutils/libelf/elf32_updatefile.c -@@ -220,6 +220,9 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf +@@ -223,6 +223,9 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) { @@ -139,7 +132,7 @@ Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns; Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *)); char *const shdr_start = ((char *) elf->map_address + elf->start_offset -@@ -636,6 +639,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf +@@ -645,6 +648,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) { @@ -152,13 +145,6 @@ xfct_t shdr_fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR]; --- elfutils/libelf/elf_begin.c +++ elfutils/libelf/elf_begin.c -@@ -1,5 +1,5 @@ - /* Create descriptor for processing file. -- Copyright (C) 1998-2005, 2006, 2007, 2008 Red Hat, Inc. -+ Copyright (C) 1998-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper <drepper@redhat.com>, 1998. - @@ -165,7 +165,8 @@ get_shnum (void *map_address, unsigned c if (unlikely (result == 0) && ehdr.e32->e_shoff != 0) @@ -192,10 +178,10 @@ + else if (scncnt > SIZE_MAX / (sizeof (Elf_Scn) + sizeof (Elf64_Shdr))) + return NULL; + - /* We can now allocate the memory. */ - Elf *elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent, - ELF_K_ELF, scncnt * sizeof (Elf_Scn)); -@@ -318,13 +329,30 @@ file_read_elf (int fildes, void *map_add + /* We can now allocate the memory. Even if there are no section headers, + we allocate space for a zeroth section in case we need it later. */ + const size_t scnmax = (scncnt ?: (cmd == ELF_C_RDWR || cmd == ELF_C_RDWR_MMAP) +@@ -324,13 +335,33 @@ file_read_elf (int fildes, void *map_add { /* We can use the mmapped memory. */ elf->state.elf32.ehdr = ehdr; @@ -211,22 +197,30 @@ + } elf->state.elf32.shdr = (Elf32_Shdr *) ((char *) ehdr + ehdr->e_shoff); +- if (ehdr->e_phnum > 0) +- /* Assign a value only if there really is a program +- header. Otherwise the value remains NULL. */ +- elf->state.elf32.phdr +- = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff); + - if (ehdr->e_phnum > 0) ++ size_t phnum = ehdr->e_phnum; ++ if (phnum == PN_XNUM && scncnt > 0) ++ phnum = elf->state.elf32.shdr[0].sh_info; ++ if (phnum > 0) + { - /* Assign a value only if there really is a program - header. Otherwise the value remains NULL. */ ++ /* Assign a value only if there really is a program ++ header. Otherwise the value remains NULL. */ + if (unlikely (ehdr->e_phoff >= maxsize) + || unlikely (maxsize - ehdr->e_phoff -+ < ehdr->e_phnum * sizeof (Elf32_Phdr))) ++ < phnum * sizeof (Elf32_Phdr))) + goto free_and_out; - elf->state.elf32.phdr - = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff); ++ elf->state.elf32.phdr ++ = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff); + } for (size_t cnt = 0; cnt < scncnt; ++cnt) { -@@ -406,13 +434,26 @@ file_read_elf (int fildes, void *map_add +@@ -409,13 +440,28 @@ file_read_elf (int fildes, void *map_add { /* We can use the mmapped memory. */ elf->state.elf64.ehdr = ehdr; @@ -237,18 +231,25 @@ + goto free_and_out; elf->state.elf64.shdr = (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff); +- if (ehdr->e_phnum > 0) +- /* Assign a value only if there really is a program +- header. Otherwise the value remains NULL. */ +- elf->state.elf64.phdr +- = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff); + - if (ehdr->e_phnum > 0) ++ size_t phnum = ehdr->e_phnum; ++ if (phnum == PN_XNUM && scncnt > 0) ++ phnum = elf->state.elf64.shdr[0].sh_info; ++ if (phnum > 0) + { - /* Assign a value only if there really is a program - header. Otherwise the value remains NULL. */ ++ /* Assign a value only if there really is a program ++ header. Otherwise the value remains NULL. */ + if (unlikely (ehdr->e_phoff >= maxsize) + || unlikely (ehdr->e_phoff -+ + ehdr->e_phnum -+ * sizeof (Elf32_Phdr) > maxsize)) ++ + phnum * sizeof (Elf32_Phdr) > maxsize)) + goto free_and_out; - elf->state.elf64.phdr - = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff); ++ elf->state.elf64.phdr ++ = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff); + } for (size_t cnt = 0; cnt < scncnt; ++cnt) @@ -893,7 +894,7 @@ return 0; --- elfutils/libelf/libelfP.h +++ elfutils/libelf/libelfP.h -@@ -606,4 +606,8 @@ extern uint32_t __libelf_crc32 (uint32_t +@@ -608,4 +608,8 @@ extern uint32_t __libelf_crc32 (uint32_t /* Align offset to 4 bytes as needed for note name and descriptor data. */ #define NOTE_ALIGN(n) (((n) + 3) & -4U) @@ -904,7 +905,7 @@ #endif /* libelfP.h */ --- elfutils/src/ChangeLog +++ elfutils/src/ChangeLog -@@ -1457,6 +1457,16 @@ +@@ -1509,6 +1509,16 @@ object symbols or symbols with unknown type. (check_rel): Likewise. @@ -921,7 +922,7 @@ 2005-06-08 Roland McGrath <roland@redhat.com> * readelf.c (print_ops): Add consts. -@@ -1502,6 +1512,19 @@ +@@ -1554,6 +1564,19 @@ * readelf.c (dwarf_tag_string): Add new tags. @@ -943,17 +944,18 @@ * strip.c (handle_elf): Don't translate hash and versym data formats, --- elfutils/src/elflint.c +++ elfutils/src/elflint.c -@@ -130,6 +130,9 @@ static uint32_t shstrndx; +@@ -130,6 +130,10 @@ static uint32_t shstrndx; /* Array to count references in section groups. */ static int *scnref; -+/* Number of sections. */ ++/* Numbers of sections and program headers. */ +static unsigned int shnum; ++static unsigned int phnum; + int main (int argc, char *argv[]) -@@ -318,10 +321,19 @@ section_name (Ebl *ebl, int idx) +@@ -318,10 +322,19 @@ section_name (Ebl *ebl, int idx) { GElf_Shdr shdr_mem; GElf_Shdr *shdr; @@ -974,18 +976,19 @@ } -@@ -343,10 +355,6 @@ static const int valid_e_machine[] = +@@ -343,11 +356,6 @@ static const int valid_e_machine[] = (sizeof (valid_e_machine) / sizeof (valid_e_machine[0])) --/* Number of sections. */ +-/* Numbers of sections and program headers. */ -static unsigned int shnum; +-static unsigned int phnum; - - static void check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size) { -@@ -612,7 +620,8 @@ section [%2d] '%s': symbol table cannot +@@ -631,7 +639,8 @@ section [%2d] '%s': symbol table cannot } } @@ -995,7 +998,7 @@ ERROR (gettext ("\ section [%2u] '%s': entry size is does not match ElfXX_Sym\n"), idx, section_name (ebl, idx)); -@@ -650,7 +659,7 @@ section [%2d] '%s': XINDEX for zeroth en +@@ -669,7 +678,7 @@ section [%2d] '%s': XINDEX for zeroth en xndxscnidx, section_name (ebl, xndxscnidx)); } @@ -1004,7 +1007,7 @@ { sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, &xndx); if (sym == NULL) -@@ -670,7 +679,8 @@ section [%2d] '%s': symbol %zu: invalid +@@ -689,7 +698,8 @@ section [%2d] '%s': symbol %zu: invalid else { name = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name); @@ -1014,7 +1017,7 @@ } if (sym->st_shndx == SHN_XINDEX) -@@ -1018,9 +1028,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e +@@ -1037,9 +1047,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e { GElf_Shdr rcshdr_mem; const GElf_Shdr *rcshdr = gelf_getshdr (scn, &rcshdr_mem); @@ -1028,7 +1031,7 @@ { /* Found the dynamic section. Look through it. */ Elf_Data *d = elf_getdata (scn, NULL); -@@ -1030,7 +1042,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e +@@ -1049,7 +1061,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e { GElf_Dyn dyn_mem; GElf_Dyn *dyn = gelf_getdyn (d, cnt, &dyn_mem); @@ -1039,7 +1042,7 @@ if (dyn->d_tag == DT_RELCOUNT) { -@@ -1044,7 +1058,9 @@ section [%2d] '%s': DT_RELCOUNT used for +@@ -1063,7 +1077,9 @@ section [%2d] '%s': DT_RELCOUNT used for /* Does the number specified number of relative relocations exceed the total number of relocations? */ @@ -1050,7 +1053,7 @@ ERROR (gettext ("\ section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"), idx, section_name (ebl, idx), -@@ -1204,7 +1220,8 @@ section [%2d] '%s': no relocations for m +@@ -1223,7 +1239,8 @@ section [%2d] '%s': no relocations for m } } @@ -1060,7 +1063,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"), -@@ -1427,7 +1444,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G +@@ -1446,7 +1463,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G Elf_Data *symdata = elf_getdata (symscn, NULL); enum load_state state = state_undecided; @@ -1070,7 +1073,7 @@ { GElf_Rela rela_mem; GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem); -@@ -1477,7 +1495,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE +@@ -1496,7 +1514,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE Elf_Data *symdata = elf_getdata (symscn, NULL); enum load_state state = state_undecided; @@ -1080,7 +1083,7 @@ { GElf_Rel rel_mem; GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem); -@@ -1580,7 +1599,8 @@ section [%2d] '%s': referenced as string +@@ -1599,7 +1618,8 @@ section [%2d] '%s': referenced as string shdr->sh_link, section_name (ebl, shdr->sh_link), idx, section_name (ebl, idx)); @@ -1090,7 +1093,7 @@ ERROR (gettext ("\ section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"), idx, section_name (ebl, idx)); -@@ -1590,7 +1610,7 @@ section [%2d] '%s': section entry size d +@@ -1609,7 +1629,7 @@ section [%2d] '%s': section entry size d idx, section_name (ebl, idx)); bool non_null_warned = false; @@ -1099,7 +1102,7 @@ { GElf_Dyn dyn_mem; GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem); -@@ -1871,6 +1891,8 @@ section [%2d] '%s': entry size does not +@@ -1890,6 +1910,8 @@ section [%2d] '%s': entry size does not idx, section_name (ebl, idx)); if (symshdr != NULL @@ -1108,7 +1111,7 @@ && (shdr->sh_size / shdr->sh_entsize < symshdr->sh_size / symshdr->sh_entsize)) ERROR (gettext ("\ -@@ -1897,6 +1919,12 @@ section [%2d] '%s': extended section ind +@@ -1916,6 +1938,12 @@ section [%2d] '%s': extended section ind } Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); @@ -1121,7 +1124,7 @@ if (*((Elf32_Word *) data->d_buf) != 0) ERROR (gettext ("symbol 0 should have zero extended section index\n")); -@@ -1939,7 +1967,7 @@ section [%2d] '%s': hash table section i +@@ -1958,7 +1986,7 @@ section [%2d] '%s': hash table section i size_t maxidx = nchain; @@ -1130,7 +1133,7 @@ { size_t symsize = symshdr->sh_size / symshdr->sh_entsize; -@@ -1950,18 +1978,28 @@ section [%2d] '%s': hash table section i +@@ -1969,18 +1997,28 @@ section [%2d] '%s': hash table section i maxidx = symsize; } @@ -1161,7 +1164,7 @@ } -@@ -1991,18 +2029,28 @@ section [%2d] '%s': hash table section i +@@ -2010,18 +2048,28 @@ section [%2d] '%s': hash table section i maxidx = symsize; } @@ -1193,7 +1196,7 @@ } -@@ -2027,7 +2075,7 @@ section [%2d] '%s': bitmask size not pow +@@ -2046,7 +2094,7 @@ section [%2d] '%s': bitmask size not pow if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)) { ERROR (gettext ("\ @@ -1202,7 +1205,7 @@ idx, section_name (ebl, idx), (long int) shdr->sh_size, (long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))); return; -@@ -2699,8 +2747,9 @@ section [%2d] '%s' refers in sh_link to +@@ -2718,8 +2766,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. */ @@ -1216,7 +1219,7 @@ idx, section_name (ebl, idx), --- elfutils/src/readelf.c +++ elfutils/src/readelf.c -@@ -1146,6 +1146,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G +@@ -1169,6 +1169,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G Elf32_Word *grpref = (Elf32_Word *) data->d_buf; GElf_Sym sym_mem; @@ -1225,7 +1228,7 @@ printf ((grpref[0] & GRP_COMDAT) ? ngettext ("\ \nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n", -@@ -1158,8 +1160,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G +@@ -1181,8 +1183,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), @@ -1236,7 +1239,7 @@ ?: gettext ("<INVALID SYMBOL>"), data->d_size / sizeof (Elf32_Word) - 1); -@@ -1310,7 +1312,8 @@ static void +@@ -1333,7 +1335,8 @@ static void handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { int class = gelf_getclass (ebl->elf); @@ -1246,7 +1249,7 @@ Elf_Data *data; size_t cnt; size_t shstrndx; -@@ -1325,6 +1328,11 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, +@@ -1348,6 +1351,11 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1258,7 +1261,7 @@ printf (ngettext ("\ \nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -1334,9 +1342,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, +@@ -1357,9 +1365,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (int) shdr->sh_link, @@ -1269,7 +1272,7 @@ fputs_unlocked (gettext (" Type Value\n"), stdout); for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) -@@ -1919,6 +1925,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G +@@ -1942,6 +1948,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1283,7 +1286,7 @@ /* Now we can compute the number of entries in the section. */ unsigned int nsyms = data->d_size / (class == ELFCLASS32 ? sizeof (Elf32_Sym) -@@ -1929,15 +1942,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G +@@ -1952,15 +1965,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G nsyms), (unsigned int) elf_ndxscn (scn), elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms); @@ -1300,7 +1303,7 @@ fputs_unlocked (class == ELFCLASS32 ? gettext ("\ -@@ -2173,7 +2183,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, +@@ -2196,7 +2206,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1315,7 +1318,7 @@ printf (ngettext ("\ \nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -2184,9 +2200,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, +@@ -2207,9 +2223,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1326,7 +1329,7 @@ unsigned int offset = 0; for (int cnt = shdr->sh_info; --cnt >= 0; ) -@@ -2239,8 +2253,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G +@@ -2262,8 +2276,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1342,7 +1345,7 @@ printf (ngettext ("\ \nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -2252,9 +2272,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G +@@ -2275,9 +2295,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1353,7 +1356,7 @@ unsigned int offset = 0; for (int cnt = shdr->sh_info; --cnt >= 0; ) -@@ -2516,8 +2534,14 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G +@@ -2539,8 +2557,14 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G filename = NULL; } @@ -1369,7 +1372,7 @@ printf (ngettext ("\ \nVersion symbols section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'", "\ -@@ -2529,9 +2553,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G +@@ -2552,9 +2576,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1380,7 +1383,7 @@ /* Now we can finally look at the actual contents of this section. */ for (unsigned int cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) -@@ -2583,7 +2605,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, +@@ -2606,7 +2628,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt) ++counts[lengths[cnt]]; @@ -1399,7 +1402,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", "\ -@@ -2596,9 +2628,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, +@@ -2619,9 +2651,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1410,7 +1413,7 @@ if (extrastr != NULL) fputs (extrastr, stdout); -@@ -4231,6 +4261,16 @@ print_debug_aranges_section (Dwfl_Module +@@ -4262,6 +4292,16 @@ print_debug_aranges_section (Dwfl_Module return; } diff --git a/elfutils-0.144-sloppy-include.patch b/elfutils-0.144-sloppy-include.patch new file mode 100644 index 00000000..361af835 --- /dev/null +++ b/elfutils-0.144-sloppy-include.patch @@ -0,0 +1,114 @@ +From b337b1fd5f3b3410fe522a690ccee70bce8519ee Mon Sep 17 00:00:00 2001 +From: Roland McGrath <roland@redhat.com> +Date: Fri, 15 Jan 2010 01:02:27 -0800 +Subject: [PATCH] Fix sloppy #include use, breaks with latest glibc. + +--- + src/ChangeLog | 8 ++++++++ + src/ar.c | 3 ++- + src/elflint.c | 1 + + src/readelf.c | 1 + + src/strip.c | 3 ++- + src/unstrip.c | 3 ++- + 6 files changed, 16 insertions(+), 3 deletions(-) + +diff --git a/src/ChangeLog b/src/ChangeLog +index c4b5b05..ee1b733 100644 +--- a/src/ChangeLog ++++ b/src/ChangeLog +@@ -1,3 +1,11 @@ ++2010-01-15 Roland McGrath <roland@redhat.com> ++ ++ * ar.c: Include <sys/stat.h>. ++ * elflint.c: Likewise. ++ * readelf.c: Likewise. ++ * strip.c: Likewise. ++ * unstrip.c: Likewise ++ + 2010-01-07 Roland McGrath <roland@redhat.com> + + * readelf.c (print_ehdr): Handle PN_XNUM. +diff --git a/src/ar.c b/src/ar.c +index 5d7a6e7..149d116 100644 +--- a/src/ar.c ++++ b/src/ar.c +@@ -1,5 +1,5 @@ + /* Create, modify, and extract from archives. +- Copyright (C) 2005, 2007, 2009 Red Hat, Inc. ++ Copyright (C) 2005-2010 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2005. + + Red Hat elfutils is free software; you can redistribute it and/or modify +@@ -45,6 +45,7 @@ + #include <time.h> + #include <unistd.h> + #include <sys/mman.h> ++#include <sys/stat.h> + #include <sys/time.h> + + #include <system.h> +diff --git a/src/elflint.c b/src/elflint.c +index 63d8389..531122b 100644 +--- a/src/elflint.c ++++ b/src/elflint.c +@@ -42,6 +42,7 @@ + #include <stdlib.h> + #include <string.h> + #include <unistd.h> ++#include <sys/stat.h> + #include <sys/param.h> + + #include <elf-knowledge.h> +diff --git a/src/readelf.c b/src/readelf.c +index 4464866..6ba259c 100644 +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -49,6 +49,7 @@ + #include <time.h> + #include <unistd.h> + #include <sys/param.h> ++#include <sys/stat.h> + + #include <system.h> + #include "../libelf/libelfP.h" +diff --git a/src/strip.c b/src/strip.c +index 32cf0d7..7b2b889 100644 +--- a/src/strip.c ++++ b/src/strip.c +@@ -1,5 +1,5 @@ + /* Discard section not used at runtime from object files. +- Copyright (C) 2000-2008, 2009 Red Hat, Inc. ++ Copyright (C) 2000-2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + +@@ -46,6 +46,7 @@ + #include <string.h> + #include <unistd.h> + #include <sys/param.h> ++#include <sys/stat.h> + #include <sys/time.h> + + #include <elf-knowledge.h> +diff --git a/src/unstrip.c b/src/unstrip.c +index 284607b..0984e6b 100644 +--- a/src/unstrip.c ++++ b/src/unstrip.c +@@ -1,5 +1,5 @@ + /* Combine stripped files with separate symbols and debug information. +- Copyright (C) 2007, 2009 Red Hat, Inc. ++ Copyright (C) 2007-2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Roland McGrath <roland@redhat.com>, 2007. + +@@ -52,6 +52,7 @@ + #include <stdlib.h> + #include <string.h> + #include <unistd.h> ++#include <sys/stat.h> + + #include <gelf.h> + #include <libebl.h> +-- +1.6.2.5 + diff --git a/elfutils/Makefile.in b/elfutils/Makefile.in index ab28f854..a9a8cafb 100644 --- a/elfutils/Makefile.in +++ b/elfutils/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -344,7 +344,7 @@ uninstall-pkgincludeHEADERS: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -369,7 +369,7 @@ $(RECURSIVE_TARGETS): fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -539,7 +539,8 @@ distdir: $(DISTFILES) fi; \ done -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ @@ -582,17 +583,17 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff --git a/elfutils/NEWS b/elfutils/NEWS index b93cfd13..4a8163f2 100644 --- a/elfutils/NEWS +++ b/elfutils/NEWS @@ -1,3 +1,14 @@ +Version 0.144: + +libelf: New function elf_getphdrnum. + Now support using more than 65536 program headers in a file. + +libdw: New function dwarf_aggregate_size for computing (constant) type + sizes, including array_type cases with nontrivial calculation. + +readelf: Don't give errors for missing info under -a. + Handle Linux "VMCOREINFO" notes under -n. + Version 0.143: libdw: Various convenience functions for individual attributes now use diff --git a/elfutils/aclocal.m4 b/elfutils/aclocal.m4 index d6b19bf8..a0a17389 100644 --- a/elfutils/aclocal.m4 +++ b/elfutils/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.11 -*- Autoconf -*- +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. @@ -34,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11], [], +m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -50,7 +50,7 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11])dnl +[AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) diff --git a/elfutils/backends/ChangeLog b/elfutils/backends/ChangeLog index c7f6d366..b52d75dd 100644 --- a/elfutils/backends/ChangeLog +++ b/elfutils/backends/ChangeLog @@ -1,3 +1,24 @@ +2010-01-05 Roland McGrath <roland@redhat.com> + + * arm_retval.c (arm_return_value_location): Use dwarf_aggregate_size. + * ia64_retval.c (ia64_return_value_location): Likewise. + * ppc_retval.c (ppc_return_value_location): Likewise. + * ppc64_retval.c (ppc64_return_value_location): Likewise. + * sparc_retval.c (sparc_return_value_location): Likewise. + + * ppc64_retval.c (ppc64_return_value_location): + Use vr2 for DW_TAG_array_type with DW_AT_GNU_vector. + * ppc_retval.c (ppc_return_value_location): Likewise. + +2010-01-04 Roland McGrath <roland@redhat.com> + + * linux-core-note.c (vmcoreinfo_items): New static const variable. + (EBLHOOK(core_note)): Update arguments for new protocol. + Validate the name as "CORE" or "LINUX" for known n_type cases. + Handle name "VMCOREINFO" n_type=0 with vmcoreinfo_items. + * i386_corenote.c (EXTRA_NOTES): Update parameter usage. + * x86_corenote.c (EXTRA_NOTES_IOPERM): Likewise. + 2009-09-10 Mark Wielaard <mjw@redhat.com> * sparc_retval.c: Fix license header. diff --git a/elfutils/backends/Makefile.in b/elfutils/backends/Makefile.in index fffd581e..d0af9f05 100644 --- a/elfutils/backends/Makefile.in +++ b/elfutils/backends/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/backends/arm_retval.c b/elfutils/backends/arm_retval.c index 4ffc6e7c..191cb174 100644 --- a/elfutils/backends/arm_retval.c +++ b/elfutils/backends/arm_retval.c @@ -1,5 +1,5 @@ /* Function return value location for ARM EABI. - Copyright (C) 2009 Red Hat, Inc. + Copyright (C) 2009-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -124,8 +124,7 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_class_type: case DW_TAG_union_type: case DW_TAG_array_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) == 0 + if (dwarf_aggregate_size (typedie, &size) == 0 && size > 0 && size <= 4) goto intreg; goto aggregate; diff --git a/elfutils/backends/i386_corenote.c b/elfutils/backends/i386_corenote.c index 89890252..40b6a24e 100644 --- a/elfutils/backends/i386_corenote.c +++ b/elfutils/backends/i386_corenote.c @@ -1,5 +1,5 @@ /* i386 specific core note handling. - Copyright (C) 2007-2009 Red Hat, Inc. + Copyright (C) 2007-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -103,7 +103,8 @@ static const Ebl_Register_Location prxfpreg_regs[] = #define EXTRA_NOTES \ EXTRA_REGSET (NT_PRXFPREG, 512, prxfpreg_regs) \ case NT_386_TLS: \ - return tls_info (descsz, regs_offset, nregloc, reglocs, nitems, items); \ + return tls_info (nhdr->n_descsz, regs_offset, nregloc, reglocs, \ + nitems, items); \ EXTRA_NOTES_IOPERM static const Ebl_Core_Item tls_items[] = diff --git a/elfutils/backends/ia64_retval.c b/elfutils/backends/ia64_retval.c index 238cd9ef..7645c3c8 100644 --- a/elfutils/backends/ia64_retval.c +++ b/elfutils/backends/ia64_retval.c @@ -1,5 +1,5 @@ /* Function return value location for IA64 ABI. - Copyright (C) 2006, 2007 Red Hat, Inc. + Copyright (C) 2006-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -89,7 +89,8 @@ static const Dwarf_Op loc_aggregate[] = /* If this type is an HFA small enough to be returned in FP registers, return the number of registers to use. Otherwise 9, or -1 for errors. */ static int -hfa_type (Dwarf_Die *typedie, const Dwarf_Op **locp, int fpregs_used) +hfa_type (Dwarf_Die *typedie, Dwarf_Word size, + const Dwarf_Op **locp, int fpregs_used) { /* Descend the type structure, counting elements and finding their types. If we find a datum that's not an FP type (and not quad FP), punt. @@ -114,10 +115,6 @@ hfa_type (Dwarf_Die *typedie, const Dwarf_Op **locp, int fpregs_used) return -1; case DW_TAG_base_type:; - int size = dwarf_bytesize (typedie); - if (size < 0) - return -1; - Dwarf_Word encoding; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, &attr_mem), &encoding) != 0) @@ -178,9 +175,13 @@ hfa_type (Dwarf_Die *typedie, const Dwarf_Op **locp, int fpregs_used) DW_AT_type, &attr_mem), &child_type_mem); + Dwarf_Word child_size; + if (dwarf_aggregate_size (child_typedie, &child_size) != 0) + return -1; if (tag == DW_TAG_union_type) { - int used = hfa_type (child_typedie, locp, fpregs_used); + int used = hfa_type (child_typedie, child_size, + locp, fpregs_used); if (used < 0 || used > 8) return used; if (used > max_used) @@ -188,7 +189,8 @@ hfa_type (Dwarf_Die *typedie, const Dwarf_Op **locp, int fpregs_used) } else { - fpregs_used = hfa_type (child_typedie, locp, fpregs_used); + fpregs_used = hfa_type (child_typedie, child_size, + locp, fpregs_used); if (fpregs_used < 0 || fpregs_used > 8) return fpregs_used; } @@ -200,10 +202,7 @@ hfa_type (Dwarf_Die *typedie, const Dwarf_Op **locp, int fpregs_used) } break; - case DW_TAG_array_type:; - size = dwarf_bytesize (typedie); - if (size < 0) - return 9; + case DW_TAG_array_type: if (size == 0) break; @@ -212,14 +211,16 @@ hfa_type (Dwarf_Die *typedie, const Dwarf_Op **locp, int fpregs_used) = dwarf_formref_die (dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem), &base_type_mem); + Dwarf_Word base_size; + if (dwarf_aggregate_size (base_typedie, &base_size) != 0) + return -1; - int used = hfa_type (base_typedie, locp, 0); + int used = hfa_type (base_typedie, base_size, locp, 0); if (used < 0 || used > 8) return used; if (size % (*locp)[1].number != 0) return 0; - size /= (*locp)[1].number; - fpregs_used += used * size; + fpregs_used += used * (size / (*locp)[1].number); break; default: @@ -346,13 +347,12 @@ ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_class_type: case DW_TAG_union_type: case DW_TAG_array_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) + if (dwarf_aggregate_size (typedie, &size) != 0) return -1; /* If this qualifies as an homogeneous floating-point aggregate (HFA), then it should be returned in FP regs. */ - int nfpreg = hfa_type (typedie, locp, 0); + int nfpreg = hfa_type (typedie, size, locp, 0); if (nfpreg < 0) return nfpreg; else if (nfpreg > 0 && nfpreg <= 8) diff --git a/elfutils/backends/linux-core-note.c b/elfutils/backends/linux-core-note.c index 7b1fc025..9d01219c 100644 --- a/elfutils/backends/linux-core-note.c +++ b/elfutils/backends/linux-core-note.c @@ -1,5 +1,5 @@ /* Common core note type descriptions for Linux. - Copyright (C) 2007, 2008 Red Hat, Inc. + Copyright (C) 2007-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -23,6 +23,8 @@ Network licensing program, please visit www.openinventionnetwork.com <http://www.openinventionnetwork.com>. */ +#include <string.h> + /* The including CPU_corenote.c file provides prstatus_regs and defines macros ULONG, [PUG]ID_T, and ALIGN_*, TYPE_*. @@ -163,23 +165,61 @@ static const Ebl_Core_Item prpsinfo_items[] = FIELD (command, CHAR, psargs, 's', .count = PRARGSZ), }; +static const Ebl_Core_Item vmcoreinfo_items[] = + { + { + .type = ELF_T_BYTE, .format = '\n' + } + }; + #undef FIELD int -EBLHOOK(core_note) (n_type, descsz, - regs_offset, nregloc, reglocs, nitems, items) - GElf_Word n_type; - GElf_Word descsz; +EBLHOOK(core_note) (nhdr, name, regs_offset, nregloc, reglocs, nitems, items) + const GElf_Nhdr *nhdr; + const char *name; GElf_Word *regs_offset; size_t *nregloc; const Ebl_Register_Location **reglocs; size_t *nitems; const Ebl_Core_Item **items; { - switch (n_type) + switch (nhdr->n_namesz) + { + case sizeof "CORE" - 1: /* Buggy old Linux kernels. */ + if (memcmp (name, "CORE", nhdr->n_namesz) == 0) + break; + return 0; + + case sizeof "CORE": + if (memcmp (name, "CORE", nhdr->n_namesz) == 0) + break; + /* Buggy old Linux kernels didn't terminate "LINUX". + Fall through. */ + + case sizeof "LINUX": + if (memcmp (name, "LINUX", nhdr->n_namesz) == 0) + break; + return 0; + + case sizeof "VMCOREINFO": + if (nhdr->n_type != 0 + || memcmp (name, "VMCOREINFO", sizeof "VMCOREINFO") != 0) + return 0; + *regs_offset = 0; + *nregloc = 0; + *nitems = 1; + *items = vmcoreinfo_items; + return 1; + + default: + return 0; + } + + switch (nhdr->n_type) { case NT_PRSTATUS: - if (descsz != sizeof (struct EBLHOOK(prstatus))) + if (nhdr->n_descsz != sizeof (struct EBLHOOK(prstatus))) return 0; *regs_offset = offsetof (struct EBLHOOK(prstatus), pr_reg); *nregloc = sizeof prstatus_regs / sizeof prstatus_regs[0]; @@ -189,7 +229,7 @@ EBLHOOK(core_note) (n_type, descsz, return 1; case NT_PRPSINFO: - if (descsz != sizeof (struct EBLHOOK(prpsinfo))) + if (nhdr->n_descsz != sizeof (struct EBLHOOK(prpsinfo))) return 0; *regs_offset = 0; *nregloc = 0; @@ -200,7 +240,7 @@ EBLHOOK(core_note) (n_type, descsz, #define EXTRA_REGSET(type, size, table) \ case type: \ - if (descsz != size) \ + if (nhdr->n_descsz != size) \ return 0; \ *regs_offset = 0; \ *nregloc = sizeof table / sizeof table[0]; \ diff --git a/elfutils/backends/ppc64_retval.c b/elfutils/backends/ppc64_retval.c index 454897cc..a5fc0dc8 100644 --- a/elfutils/backends/ppc64_retval.c +++ b/elfutils/backends/ppc64_retval.c @@ -1,5 +1,5 @@ /* Function return value location for Linux/PPC64 ABI. - Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -53,6 +53,13 @@ static const Dwarf_Op loc_fpreg[] = #define nloc_fp2regs 4 #define nloc_fp4regs 8 +/* vr2. */ +static const Dwarf_Op loc_vmxreg[] = + { + { .atom = DW_OP_regx, .number = 1124 + 2 } + }; +#define nloc_vmxreg 1 + /* The return value is a structure and is actually stored in stack space passed in a hidden argument by the caller. But, the compiler helpfully returns the address of that space in r3. */ @@ -150,11 +157,21 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) *locp = loc_aggregate; return nloc_aggregate; - case DW_TAG_string_type: case DW_TAG_array_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) == 0 - && size <= 8) + { + bool is_vector; + if (dwarf_formflag (dwarf_attr_integrate (typedie, DW_AT_GNU_vector, + &attr_mem), &is_vector) == 0 + && is_vector) + { + *locp = loc_vmxreg; + return nloc_vmxreg; + } + } + /* Fall through. */ + + case DW_TAG_string_type: + if (dwarf_aggregate_size (typedie, &size) == 0 && size <= 8) { if (tag == DW_TAG_array_type) { diff --git a/elfutils/backends/ppc_retval.c b/elfutils/backends/ppc_retval.c index fa0e303c..15a0dba8 100644 --- a/elfutils/backends/ppc_retval.c +++ b/elfutils/backends/ppc_retval.c @@ -1,5 +1,5 @@ /* Function return value location for Linux/PPC ABI. - Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -38,14 +38,17 @@ #define SVR4_STRUCT_RETURN 0 -/* r3, or pair r3, r4. */ +/* r3, or pair r3, r4, or quad r3-r6. */ static const Dwarf_Op loc_intreg[] = { { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 }, { .atom = DW_OP_reg4 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg5 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg6 }, { .atom = DW_OP_piece, .number = 4 }, }; #define nloc_intreg 1 #define nloc_intregpair 4 +#define nloc_intregquad 8 /* f1. */ static const Dwarf_Op loc_fpreg[] = @@ -54,6 +57,13 @@ static const Dwarf_Op loc_fpreg[] = }; #define nloc_fpreg 1 +/* vr2. */ +static const Dwarf_Op loc_vmxreg[] = + { + { .atom = DW_OP_regx, .number = 1124 + 2 } + }; +#define nloc_vmxreg 1 + /* The return value is a structure and is actually stored in stack space passed in a hidden argument by the caller. But, the compiler helpfully returns the address of that space in r3. */ @@ -64,6 +74,13 @@ static const Dwarf_Op loc_aggregate[] = #define nloc_aggregate 1 +/* XXX We should check the SHT_GNU_ATTRIBUTES bits here (or in ppc_init). */ +static bool +ppc_altivec_abi (void) +{ + return true; +} + int ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { @@ -143,13 +160,32 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) *locp = loc_aggregate; return nloc_aggregate; + case DW_TAG_array_type: + { + bool is_vector; + if (dwarf_formflag (dwarf_attr_integrate (typedie, DW_AT_GNU_vector, + &attr_mem), &is_vector) == 0 + && is_vector + && dwarf_aggregate_size (typedie, &size) == 0) + switch (size) + { + case 16: + if (ppc_altivec_abi ()) + { + *locp = loc_vmxreg; + return nloc_vmxreg; + } + *locp = loc_intreg; + return nloc_intregquad; + } + } + /* Fall through. */ + case DW_TAG_structure_type: case DW_TAG_class_type: case DW_TAG_union_type: - case DW_TAG_array_type: if (SVR4_STRUCT_RETURN - && dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) == 0 + && dwarf_aggregate_size (typedie, &size) == 0 && size > 0 && size <= 8) goto intreg; goto aggregate; diff --git a/elfutils/backends/sparc_retval.c b/elfutils/backends/sparc_retval.c index 7d7cbf2c..dcff67a2 100644 --- a/elfutils/backends/sparc_retval.c +++ b/elfutils/backends/sparc_retval.c @@ -1,5 +1,5 @@ /* Function return value location for SPARC. - Copyright (C) 2006, 2007 Red Hat, Inc. + Copyright (C) 2006-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -154,8 +154,7 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_class_type: case DW_TAG_union_type: case DW_TAG_array_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) == 0 + if (dwarf_aggregate_size (typedie, &size) == 0 && size > 0 && size <= 8) goto intreg; goto aggregate; diff --git a/elfutils/backends/x86_64_retval.c b/elfutils/backends/x86_64_retval.c index 3109431e..ba772bb9 100644 --- a/elfutils/backends/x86_64_retval.c +++ b/elfutils/backends/x86_64_retval.c @@ -1,5 +1,5 @@ /* Function return value location for Linux/x86-64 ABI. - Copyright (C) 2005, 2007 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -181,9 +181,8 @@ x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_class_type: case DW_TAG_union_type: case DW_TAG_array_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - return -1; + if (dwarf_aggregate_size (typedie, &size) != 0) + goto large; if (size > 16) goto large; diff --git a/elfutils/backends/x86_corenote.c b/elfutils/backends/x86_corenote.c index 7d550676..78849a66 100644 --- a/elfutils/backends/x86_corenote.c +++ b/elfutils/backends/x86_corenote.c @@ -1,5 +1,5 @@ /* x86-specific core note handling, pieces common to x86-64 and i386. - Copyright (C) 2005, 2008 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -25,7 +25,8 @@ #define EXTRA_NOTES_IOPERM \ case NT_386_IOPERM: \ - return ioperm_info (descsz, regs_offset, nregloc, reglocs, nitems, items); + return ioperm_info (nhdr->n_descsz, \ + regs_offset, nregloc, reglocs, nitems, items); static int ioperm_info (GElf_Word descsz, GElf_Word *regs_offset, diff --git a/elfutils/config/Makefile.in b/elfutils/config/Makefile.in index 6109e263..5ff877b0 100644 --- a/elfutils/config/Makefile.in +++ b/elfutils/config/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/configure b/elfutils/configure index 89d4f0e3..184ba827 100755 --- a/elfutils/configure +++ b/elfutils/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for Red Hat elfutils 0.143. +# Generated by GNU Autoconf 2.63 for Red Hat elfutils 0.144. # # Report bugs to <http://bugzilla.redhat.com/bugzilla/>. # @@ -598,8 +598,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Red Hat elfutils' PACKAGE_TARNAME='elfutils' -PACKAGE_VERSION='0.143' -PACKAGE_STRING='Red Hat elfutils 0.143' +PACKAGE_VERSION='0.144' +PACKAGE_STRING='Red Hat elfutils 0.144' PACKAGE_BUGREPORT='http://bugzilla.redhat.com/bugzilla/' ac_unique_file="libelf/libelf.h" @@ -1323,7 +1323,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Red Hat elfutils 0.143 to adapt to many kinds of systems. +\`configure' configures Red Hat elfutils 0.144 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1393,7 +1393,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Red Hat elfutils 0.143:";; + short | recursive ) echo "Configuration of Red Hat elfutils 0.144:";; esac cat <<\_ACEOF @@ -1505,7 +1505,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Red Hat elfutils configure 0.143 +Red Hat elfutils configure 0.144 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1521,7 +1521,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Red Hat elfutils $as_me 0.143, which was +It was created by Red Hat elfutils $as_me 0.144, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -2376,7 +2376,7 @@ fi # Define the identity of the package. PACKAGE='elfutils' - VERSION='0.143' + VERSION='0.144' cat >>confdefs.h <<_ACEOF @@ -6036,7 +6036,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Red Hat elfutils $as_me 0.143, which was +This file was extended by Red Hat elfutils $as_me 0.144, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6099,7 +6099,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -Red Hat elfutils config.status 0.143 +Red Hat elfutils config.status 0.144 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/elfutils/configure.ac b/elfutils/configure.ac index 6c18d830..e9fbfccf 100644 --- a/elfutils/configure.ac +++ b/elfutils/configure.ac @@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software Foundation, dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. dnl -AC_INIT([Red Hat elfutils],[0.143],[http://bugzilla.redhat.com/bugzilla/],[elfutils]) +AC_INIT([Red Hat elfutils],[0.144],[http://bugzilla.redhat.com/bugzilla/],[elfutils]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_FILES([config/Makefile]) diff --git a/elfutils/elfutils.spec b/elfutils/elfutils.spec index 232090ec..44c7c3ed 100644 --- a/elfutils/elfutils.spec +++ b/elfutils/elfutils.spec @@ -1,7 +1,7 @@ # -*- rpm-spec-*- Summary: A collection of utilities and DSOs to handle compiled objects Name: elfutils -Version: 0.143 +Version: 0.144 Release: 1 License: GPLv2 with exceptions Group: Development/Tools diff --git a/elfutils/lib/Makefile.in b/elfutils/lib/Makefile.in index 2013563b..8f7c157d 100644 --- a/elfutils/lib/Makefile.in +++ b/elfutils/lib/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/libasm/Makefile.in b/elfutils/libasm/Makefile.in index 7c4174c4..b6a620b0 100644 --- a/elfutils/libasm/Makefile.in +++ b/elfutils/libasm/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/libcpu/Makefile.in b/elfutils/libcpu/Makefile.in index bcbaf1fd..3675ff29 100644 --- a/elfutils/libcpu/Makefile.in +++ b/elfutils/libcpu/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/libcpu/i386_lex.c b/elfutils/libcpu/i386_lex.c index 6bd4a0de..a4540b92 100644 --- a/elfutils/libcpu/i386_lex.c +++ b/elfutils/libcpu/i386_lex.c @@ -667,7 +667,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( i386_text, i386_leng, 1, i386_out ) +#define ECHO do { if (fwrite( i386_text, i386_leng, 1, i386_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, diff --git a/elfutils/libdw/ChangeLog b/elfutils/libdw/ChangeLog index 2208f772..97f87da0 100644 --- a/elfutils/libdw/ChangeLog +++ b/elfutils/libdw/ChangeLog @@ -1,3 +1,32 @@ +2010-01-07 Roland McGrath <roland@redhat.com> + + * dwarf_getcfi_elf.c (getcfi_phdr): Use elf_getphdrnum. + +2010-01-05 Roland McGrath <roland@redhat.com> + + * dwarf_aggregate_size.c: New file. + * Makefile.am (libdw_a_SOURCES): Add it. + * libdw.h: Declare it. + * libdwP.h: Add INTDECL. + * libdw.map (ELFUTILS_0.144): New set. Add dwarf_aggregate_size. + + * dwarf_srclang.c: Add INTDEF. + * libdwP.h: Add INTDECL. + + * dwarf.h: Add some more DW_AT_GNU_* types from gcc. + + * dwarf.h: Add DW_AT_GNU_vector, DW_AT_GNU_template_name. + +2009-11-21 Roland McGrath <roland@redhat.com> + + * dwarf_getlocation.c (check_constant_offset): Return 1 for all + non-constant forms. + +2009-10-15 Roland McGrath <roland@redhat.com> + + * libdw_form.c (__libdw_form_val_len): Grok DW_FORM_sec_offset, + DW_FORM_exprloc, DW_FORM_flag_present, and DW_FORM_ref_sig8. + 2009-09-17 Roland McGrath <roland@redhat.com> * dwarf_getlocation.c (dwarf_getlocation_implicit_value): Make OP diff --git a/elfutils/libdw/Makefile.am b/elfutils/libdw/Makefile.am index 4d041cf7..23896fa6 100644 --- a/elfutils/libdw/Makefile.am +++ b/elfutils/libdw/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2002-2009 Red Hat, Inc. +## Copyright (C) 2002-2010 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -88,7 +88,8 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ cie.c fde.c cfi.c frame-cache.c \ dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \ dwarf_cfi_addrframe.c \ - dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c + dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \ + dwarf_aggregate_size.c if MAINTAINER_MODE BUILT_SOURCES = $(srcdir)/known-dwarf.h diff --git a/elfutils/libdw/Makefile.in b/elfutils/libdw/Makefile.in index 33f80456..f77dd161 100644 --- a/elfutils/libdw/Makefile.in +++ b/elfutils/libdw/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -133,7 +133,8 @@ am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \ cfi.$(OBJEXT) frame-cache.$(OBJEXT) dwarf_frame_info.$(OBJEXT) \ dwarf_frame_cfa.$(OBJEXT) dwarf_frame_register.$(OBJEXT) \ dwarf_cfi_addrframe.$(OBJEXT) dwarf_getcfi.$(OBJEXT) \ - dwarf_getcfi_elf.$(OBJEXT) dwarf_cfi_end.$(OBJEXT) + dwarf_getcfi_elf.$(OBJEXT) dwarf_cfi_end.$(OBJEXT) \ + dwarf_aggregate_size.$(OBJEXT) libdw_a_OBJECTS = $(am_libdw_a_OBJECTS) libdw_pic_a_AR = $(AR) $(ARFLAGS) libdw_pic_a_LIBADD = @@ -323,7 +324,8 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ cie.c fde.c cfi.c frame-cache.c \ dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \ dwarf_cfi_addrframe.c \ - dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c + dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \ + dwarf_aggregate_size.c @MAINTAINER_MODE_TRUE@BUILT_SOURCES = $(srcdir)/known-dwarf.h @MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h @@ -432,6 +434,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_abbrev_hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_abbrevhaschildren.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_addrdie.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_aggregate_size.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_arrayorder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_attr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_attr_integrate.Po@am__quote@ diff --git a/elfutils/libdw/dwarf.h b/elfutils/libdw/dwarf.h index 196ef85e..aefc1a79 100644 --- a/elfutils/libdw/dwarf.h +++ b/elfutils/libdw/dwarf.h @@ -1,5 +1,5 @@ /* This file defines standard DWARF types, structures, and macros. - Copyright (C) 2000,2002,2005,2006,2007,2008,2009 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -228,6 +228,7 @@ enum DW_AT_const_expr = 0x6c, DW_AT_lo_user = 0x2000, + DW_AT_MIPS_fde = 0x2001, DW_AT_MIPS_loop_begin = 0x2002, DW_AT_MIPS_tail_loop_begin = 0x2003, @@ -245,12 +246,25 @@ enum DW_AT_MIPS_allocatable_dopetype = 0x200f, DW_AT_MIPS_assumed_shape_dopetype = 0x2010, DW_AT_MIPS_assumed_size = 0x2011, + + /* GNU extensions. */ DW_AT_sf_names = 0x2101, DW_AT_src_info = 0x2102, DW_AT_mac_info = 0x2103, DW_AT_src_coords = 0x2104, DW_AT_body_begin = 0x2105, DW_AT_body_end = 0x2106, + DW_AT_GNU_vector = 0x2107, + DW_AT_GNU_guarded_by = 0x2108, + DW_AT_GNU_pt_guarded_by = 0x2109, + DW_AT_GNU_guarded = 0x210a, + DW_AT_GNU_pt_guarded = 0x210b, + DW_AT_GNU_locks_excluded = 0x210c, + DW_AT_GNU_exclusive_locks_required = 0x210d, + DW_AT_GNU_shared_locks_required = 0x210e, + DW_AT_GNU_odr_signature = 0x210f, + DW_AT_GNU_template_name = 0x2110, + DW_AT_hi_user = 0x3fff }; diff --git a/elfutils/libdw/dwarf_aggregate_size.c b/elfutils/libdw/dwarf_aggregate_size.c new file mode 100644 index 00000000..e7420141 --- /dev/null +++ b/elfutils/libdw/dwarf_aggregate_size.c @@ -0,0 +1,243 @@ +/* Compute size of an aggregate type from DWARF. + Copyright (C) 2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <dwarf.h> +#include "libdwP.h" + + +static Dwarf_Die * +get_type (Dwarf_Die *die, Dwarf_Attribute *attr_mem, Dwarf_Die *type_mem) +{ + return INTUSE(dwarf_formref_die) + (INTUSE(dwarf_attr_integrate) (die, DW_AT_type, attr_mem), type_mem); +} + +static int +array_size (Dwarf_Die *die, Dwarf_Word *size, + Dwarf_Attribute *attr_mem, Dwarf_Die *type_mem) +{ + Dwarf_Word eltsize; + if (INTUSE(dwarf_aggregate_size) (get_type (die, attr_mem, type_mem), + &eltsize) != 0) + return -1; + + /* An array can have DW_TAG_subrange_type or DW_TAG_enumeration_type + children instead that give the size of each dimension. */ + + Dwarf_Die child; + if (INTUSE(dwarf_child) (die, &child) != 0) + return -1; + + bool any = false; + Dwarf_Word total = 0; + do + { + Dwarf_Word count; + switch (INTUSE(dwarf_tag) (&child)) + { + case DW_TAG_subrange_type: + /* This has either DW_AT_count or DW_AT_upper_bound. */ + if (INTUSE(dwarf_attr_integrate) (&child, DW_AT_count, + attr_mem) != NULL) + { + if (INTUSE(dwarf_formudata) (attr_mem, &count) != 0) + return -1; + } + else + { + Dwarf_Sword upper; + Dwarf_Sword lower; + if (INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr_integrate) + (&child, DW_AT_upper_bound, + attr_mem), &upper) != 0) + return -1; + + /* Having DW_AT_lower_bound is optional. */ + if (INTUSE(dwarf_attr_integrate) (&child, DW_AT_lower_bound, + attr_mem) != NULL) + { + if (INTUSE(dwarf_formsdata) (attr_mem, &lower) != 0) + return -1; + } + else + { + /* Determine default lower bound from language, + as per "4.12 Subrange Type Entries". */ + Dwarf_Die cu = CUDIE (die->cu); + switch (INTUSE(dwarf_srclang) (&cu)) + { + case DW_LANG_C: + case DW_LANG_C89: + case DW_LANG_C99: + case DW_LANG_C_plus_plus: + case DW_LANG_Objc: + case DW_LANG_ObjC_plus_plus: + case DW_LANG_Java: + case DW_LANG_D: + case DW_LANG_UPC: + lower = 0; + break; + + case DW_LANG_Ada83: + case DW_LANG_Ada95: + case DW_LANG_Cobol74: + case DW_LANG_Cobol85: + case DW_LANG_Fortran77: + case DW_LANG_Fortran90: + case DW_LANG_Fortran95: + case DW_LANG_Pascal83: + case DW_LANG_Modula2: + case DW_LANG_PL1: + lower = 1; + break; + + default: + return -1; + } + } + if (unlikely (lower > upper)) + return -1; + count = upper - lower + 1; + } + break; + + case DW_TAG_enumeration_type: + /* We have to find the DW_TAG_enumerator child with the + highest value to know the array's element count. */ + count = 0; + Dwarf_Die enum_child; + int has_children = INTUSE(dwarf_child) (die, &enum_child); + if (has_children < 0) + return -1; + if (has_children > 0) + do + if (INTUSE(dwarf_tag) (&enum_child) == DW_TAG_enumerator) + { + Dwarf_Word value; + if (INTUSE(dwarf_formudata) (INTUSE(dwarf_attr_integrate) + (&enum_child, DW_AT_const_value, + attr_mem), &value) != 0) + return -1; + if (value >= count) + count = value + 1; + } + while (INTUSE(dwarf_siblingof) (&enum_child, &enum_child) > 0); + break; + + default: + continue; + } + + /* This is a subrange_type or enumeration_type and we've set COUNT. + Now determine the stride for this array dimension. */ + Dwarf_Word stride = eltsize; + if (INTUSE(dwarf_attr_integrate) (&child, DW_AT_byte_stride, + attr_mem) != NULL) + { + if (INTUSE(dwarf_formudata) (attr_mem, &stride) != 0) + return -1; + } + else if (INTUSE(dwarf_attr_integrate) (&child, DW_AT_bit_stride, + attr_mem) != NULL) + { + if (INTUSE(dwarf_formudata) (attr_mem, &stride) != 0) + return -1; + if (stride % 8) /* XXX maybe compute in bits? */ + return -1; + stride /= 8; + } + + any = true; + total += stride * count; + } + while (INTUSE(dwarf_siblingof) (&child, &child) == 0); + + if (!any) + return -1; + + *size = total; + return 0; +} + +static int +aggregate_size (Dwarf_Die *die, Dwarf_Word *size, Dwarf_Die *type_mem) +{ + Dwarf_Attribute attr_mem; + + if (INTUSE(dwarf_attr_integrate) (die, DW_AT_byte_size, &attr_mem) != NULL) + return INTUSE(dwarf_formudata) (&attr_mem, size); + + switch (INTUSE(dwarf_tag) (die)) + { + case DW_TAG_typedef: + case DW_TAG_subrange_type: + return aggregate_size (get_type (die, &attr_mem, type_mem), + size, type_mem); /* Tail call. */ + + case DW_TAG_array_type: + return array_size (die, size, &attr_mem, type_mem); + } + + /* Most types must give their size directly. */ + return -1; +} + +int +dwarf_aggregate_size (die, size) + Dwarf_Die *die; + Dwarf_Word *size; +{ + Dwarf_Die type_mem; + return aggregate_size (die, size, &type_mem); +} +INTDEF (dwarf_aggregate_size) diff --git a/elfutils/libdw/dwarf_getcfi_elf.c b/elfutils/libdw/dwarf_getcfi_elf.c index 949515e5..64a2a885 100644 --- a/elfutils/libdw/dwarf_getcfi_elf.c +++ b/elfutils/libdw/dwarf_getcfi_elf.c @@ -1,5 +1,5 @@ /* Get CFI from ELF file's exception-handling info. - Copyright (C) 2009 Red Hat, Inc. + Copyright (C) 2009-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -208,9 +208,11 @@ getcfi_gnu_eh_frame (Elf *elf, const GElf_Ehdr *ehdr, const GElf_Phdr *phdr) static Dwarf_CFI * getcfi_phdr (Elf *elf, const GElf_Ehdr *ehdr) { - const uint_fast16_t phnum = ehdr->e_phnum; + size_t phnum; + if (unlikely (elf_getphdrnum (elf, &phnum) != 0)) + return NULL; - for (uint_fast16_t i = 0; i < phnum; ++i) + for (size_t i = 0; i < phnum; ++i) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); diff --git a/elfutils/libdw/dwarf_getlocation.c b/elfutils/libdw/dwarf_getlocation.c index 17df8fe9..720b20f4 100644 --- a/elfutils/libdw/dwarf_getlocation.c +++ b/elfutils/libdw/dwarf_getlocation.c @@ -154,11 +154,29 @@ static int check_constant_offset (Dwarf_Attribute *attr, Dwarf_Op **llbuf, size_t *listlen) { - if (attr->code != DW_AT_data_member_location - || attr->form == DW_FORM_data4 - || attr->form == DW_FORM_data8) + if (attr->code != DW_AT_data_member_location) return 1; + switch (attr->form) + { + /* Punt for any non-constant form. */ + default: + return 1; + + case DW_FORM_data1: + case DW_FORM_data2: + case DW_FORM_sdata: + case DW_FORM_udata: + break; + + case DW_FORM_data4: + case DW_FORM_data8: + /* These are loclistptr, not constants. + XXX check cu->version > 3??? + */ + return 1; + } + /* Check whether we already cached this location. */ struct loc_s fake = { .addr = attr->valp }; struct loc_s **found = tfind (&fake, &attr->cu->locs, loc_compare); diff --git a/elfutils/libdw/dwarf_srclang.c b/elfutils/libdw/dwarf_srclang.c index f1ff954c..305ffcd0 100644 --- a/elfutils/libdw/dwarf_srclang.c +++ b/elfutils/libdw/dwarf_srclang.c @@ -1,5 +1,5 @@ /* Return source language attribute of DIE. - Copyright (C) 2003, 2005, 2009 Red Hat, Inc. + Copyright (C) 2003-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -67,5 +67,6 @@ dwarf_srclang (die) (die, DW_AT_language, &attr_mem), &value) == 0 ? (int) value : -1; } +INTDEF (dwarf_srclang) OLD_VERSION (dwarf_srclang, ELFUTILS_0.122) NEW_VERSION (dwarf_srclang, ELFUTILS_0.143) diff --git a/elfutils/libdw/libdw.h b/elfutils/libdw/libdw.h index 7602e611..94320c7b 100644 --- a/elfutils/libdw/libdw.h +++ b/elfutils/libdw/libdw.h @@ -1,5 +1,5 @@ /* Interfaces for libdw. - Copyright (C) 2002-2009 Red Hat, Inc. + Copyright (C) 2002-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -362,7 +362,7 @@ extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result) Returns 1 if no sibling could be found and, if RESULT is not the same as DIE, it sets RESULT->addr to the address of the (non-sibling) DIE that follows this one, or NULL if this DIE - was the last one in the cokmpilation unit. */ + was the last one in the compilation unit. */ extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result) __nonnull_attribute__ (2); @@ -632,6 +632,11 @@ extern int dwarf_getlocation_implicit_value (Dwarf_Attribute *attr, __nonnull_attribute__ (2, 3); +/* Compute the byte-size of a type DIE according to DWARF rules. + For most types, this is just DW_AT_byte_size. + For DW_TAG_array_type it can apply much more complex rules. */ +extern int dwarf_aggregate_size (Dwarf_Die *die, Dwarf_Word *size); + /* Return scope DIEs containing PC address. Sets *SCOPES to a malloc'd array of Dwarf_Die structures, diff --git a/elfutils/libdw/libdw.map b/elfutils/libdw/libdw.map index b39db481..8eaeacd5 100644 --- a/elfutils/libdw/libdw.map +++ b/elfutils/libdw/libdw.map @@ -227,3 +227,8 @@ ELFUTILS_0.143 { dwarf_srclang; } ELFUTILS_0.142; + +ELFUTILS_0.144 { + global: + dwarf_aggregate_size; +} ELFUTILS_0.143; diff --git a/elfutils/libdw/libdwP.h b/elfutils/libdw/libdwP.h index 0284580f..248a58d5 100644 --- a/elfutils/libdw/libdwP.h +++ b/elfutils/libdw/libdwP.h @@ -1,5 +1,5 @@ /* Internal definitions for libdwarf. - Copyright (C) 2002-2009 Red Hat, Inc. + Copyright (C) 2002-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -595,6 +595,7 @@ unsigned char * __libdw_formptr (Dwarf_Attribute *attr, int sec_index, /* Aliases to avoid PLTs. */ +INTDECL (dwarf_aggregate_size) INTDECL (dwarf_attr) INTDECL (dwarf_attr_integrate) INTDECL (dwarf_begin_elf) @@ -624,6 +625,7 @@ INTDECL (dwarf_nextcu) INTDECL (dwarf_offdie) INTDECL (dwarf_ranges) INTDECL (dwarf_siblingof) +INTDECL (dwarf_srclang) INTDECL (dwarf_tag) #endif /* libdwP.h */ diff --git a/elfutils/libdw/libdw_form.c b/elfutils/libdw/libdw_form.c index ad78f4b4..219dd793 100644 --- a/elfutils/libdw/libdw_form.c +++ b/elfutils/libdw/libdw_form.c @@ -1,5 +1,5 @@ /* Helper functions for form handling. - Copyright (C) 2003, 2004, 2006, 2007 Red Hat, Inc. + Copyright (C) 2003-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -78,6 +78,7 @@ __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form, break; case DW_FORM_strp: + case DW_FORM_sec_offset: result = cu->offset_size; break; @@ -94,11 +95,16 @@ __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form, break; case DW_FORM_block: + case DW_FORM_exprloc: saved = valp; get_uleb128 (u128, valp); result = u128 + (valp - saved); break; + case DW_FORM_flag_present: + result = 0; + break; + case DW_FORM_ref1: case DW_FORM_data1: case DW_FORM_flag: @@ -117,6 +123,7 @@ __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form, case DW_FORM_data8: case DW_FORM_ref8: + case DW_FORM_ref_sig8: result = 8; break; diff --git a/elfutils/libdwfl/ChangeLog b/elfutils/libdwfl/ChangeLog index 5b876d33..d9e6e654 100644 --- a/elfutils/libdwfl/ChangeLog +++ b/elfutils/libdwfl/ChangeLog @@ -1,3 +1,29 @@ +2010-01-07 Roland McGrath <roland@redhat.com> + + * core-file.c (dwfl_core_file_report): Use elf_getphdrnum. + * dwfl_module_build_id.c (__libdwfl_find_build_id): Likewise. + * dwfl_module_getdwarf.c (open_elf, find_dynsym): Likewise. + * dwfl_report_elf.c (__libdwfl_report_elf): Likewise. + +2010-01-06 Roland McGrath <roland@redhat.com> + + * relocate.c (relocate_getsym): For SHN_COMMON, zero st_value. + (relocate_section): Let unresolved SHN_COMMON symbol stay 0. + +2009-11-16 Roland McGrath <roland@redhat.com> + + * relocate.c (relocate_section): Skip SHT_NOBITS or empty target scn. + +2009-11-12 Petr Machata <pmachata@redhat.com> + + * core-file.c (dwfl_elf_phdr_memory_callback): Only load ahead if + the chunk is both offset-contiguous and vaddr-contiguous. + +2009-11-05 Roland McGrath <roland@redhat.com> + + * link_map.c (report_r_debug): Skip entries with l_ld==0. + Use dwfl_addrmodule for l_ld lookup, don't bail on lookup failure. + 2009-09-04 Roland McGrath <roland@redhat.com> * image-header.c (__libdw_image_header): Fix tranposed comparison. diff --git a/elfutils/libdwfl/Makefile.in b/elfutils/libdwfl/Makefile.in index 968790e6..511706ed 100644 --- a/elfutils/libdwfl/Makefile.in +++ b/elfutils/libdwfl/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/libdwfl/core-file.c b/elfutils/libdwfl/core-file.c index 77f208cc..1872d8ab 100644 --- a/elfutils/libdwfl/core-file.c +++ b/elfutils/libdwfl/core-file.c @@ -1,5 +1,5 @@ /* Core file handling. - Copyright (C) 2008, 2009 Red Hat, Inc. + Copyright (C) 2008-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -141,24 +141,17 @@ elf_begin_rand (Elf *parent, loff_t offset, loff_t size, loff_t *next) int -dwfl_report_core_segments (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr, - GElf_Phdr *notes) +dwfl_report_core_segments (Dwfl *dwfl, Elf *elf, size_t phnum, GElf_Phdr *notes) { if (unlikely (dwfl == NULL)) return -1; - if (unlikely (elf == NULL) || unlikely (ehdr == NULL)) - { - __libdw_seterrno (DWFL_E_LIBELF); - return -1; - } - int result = 0; if (notes != NULL) notes->p_type = PT_NULL; - for (int ndx = 0; result >= 0 && ndx < ehdr->e_phnum; ++ndx) + for (size_t ndx = 0; result >= 0 && ndx < phnum; ++ndx) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (elf, ndx, &phdr_mem); @@ -283,7 +276,16 @@ dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx, || ((phdr.p_vaddr + phdr.p_memsz + align - 1) & -align) <= vaddr); GElf_Off start = vaddr - phdr.p_vaddr + phdr.p_offset; - GElf_Off end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align; + GElf_Off end; + GElf_Addr end_vaddr; + + inline void update_end () + { + end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align; + end_vaddr = (phdr.p_vaddr + phdr.p_memsz + align - 1) & -align; + } + + update_end (); /* Use following contiguous segments to get towards SIZE. */ inline bool more (size_t size) @@ -299,11 +301,12 @@ dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx, if (phdr.p_type == PT_LOAD) { - if (phdr.p_offset > end) + if (phdr.p_offset > end + || phdr.p_vaddr > end_vaddr) /* It's discontiguous! */ return false; - end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align; + update_end (); } } return true; @@ -404,8 +407,15 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr) { GElf_Phdr notes_phdr; + size_t phnum; + if (unlikely (ehdr == NULL) || unlikely (elf_getphdrnum (elf, &phnum) != 0)) + { + __libdw_seterrno (DWFL_E_LIBELF); + return -1; + } + /* First report each PT_LOAD segment. */ - int ndx = dwfl_report_core_segments (dwfl, elf, ehdr, ¬es_phdr); + int ndx = dwfl_report_core_segments (dwfl, elf, phnum, ¬es_phdr); if (unlikely (ndx <= 0)) return ndx; @@ -420,7 +430,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr) return seg; ndx = seg > ndx ? seg : ndx + 1; } - while (ndx < ehdr->e_phnum); + while (ndx < (int) phnum); /* Next, we should follow the chain from DT_DEBUG. */ diff --git a/elfutils/libdwfl/dwfl_module_build_id.c b/elfutils/libdwfl/dwfl_module_build_id.c index 07a62ba4..9dc7f678 100644 --- a/elfutils/libdwfl/dwfl_module_build_id.c +++ b/elfutils/libdwfl/dwfl_module_build_id.c @@ -1,5 +1,5 @@ /* Return build ID information for a module. - Copyright (C) 2007, 2008, 2009 Red Hat, Inc. + Copyright (C) 2007-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -107,12 +107,14 @@ __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf) /* No sections, have to look for phdrs. */ GElf_Ehdr ehdr_mem; GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); - if (unlikely (ehdr == NULL)) + size_t phnum; + if (unlikely (ehdr == NULL) + || unlikely (elf_getphdrnum (elf, &phnum) != 0)) { __libdwfl_seterrno (DWFL_E_LIBELF); return -1; } - for (uint_fast16_t i = 0; result == 0 && i < ehdr_mem.e_phnum; ++i) + for (size_t i = 0; result == 0 && i < phnum; ++i) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); diff --git a/elfutils/libdwfl/dwfl_module_getdwarf.c b/elfutils/libdwfl/dwfl_module_getdwarf.c index f48fabe7..b084673e 100644 --- a/elfutils/libdwfl/dwfl_module_getdwarf.c +++ b/elfutils/libdwfl/dwfl_module_getdwarf.c @@ -1,5 +1,5 @@ /* Find debugging and symbol information for a module in libdwfl. - Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -95,19 +95,25 @@ open_elf (Dwfl_Module *mod, struct dwfl_file *file) sh_addr of any program sections refer to. */ file->bias = 0; if (mod->e_type != ET_EXEC) - for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) - { - GElf_Phdr ph_mem; - GElf_Phdr *ph = gelf_getphdr (file->elf, i, &ph_mem); - if (ph == NULL) - goto elf_error; - if (ph->p_type == PT_LOAD) - { - file->bias = ((mod->low_addr & -ph->p_align) - - (ph->p_vaddr & -ph->p_align)); - break; - } - } + { + size_t phnum; + if (unlikely (elf_getphdrnum (file->elf, &phnum) != 0)) + goto elf_error; + + for (size_t i = 0; i < phnum; ++i) + { + GElf_Phdr ph_mem; + GElf_Phdr *ph = gelf_getphdr (file->elf, i, &ph_mem); + if (ph == NULL) + goto elf_error; + if (ph->p_type == PT_LOAD) + { + file->bias = ((mod->low_addr & -ph->p_align) + - (ph->p_vaddr & -ph->p_align)); + break; + } + } + } mod->e_type = ehdr->e_type; @@ -285,11 +291,11 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile, /* Translate addresses into file offsets. OFFS[*] start out zero and remain zero if unresolved. */ static void -find_offsets (Elf *elf, const GElf_Ehdr *ehdr, size_t n, +find_offsets (Elf *elf, size_t phnum, size_t n, GElf_Addr addrs[n], GElf_Off offs[n]) { size_t unsolved = n; - for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) + for (size_t i = 0; i < phnum; ++i) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); @@ -313,7 +319,11 @@ find_dynsym (Dwfl_Module *mod) GElf_Ehdr ehdr_mem; GElf_Ehdr *ehdr = gelf_getehdr (mod->main.elf, &ehdr_mem); - for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) + size_t phnum; + if (unlikely (elf_getphdrnum (mod->main.elf, &phnum) != 0)) + return; + + for (size_t i = 0; i < phnum; ++i) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (mod->main.elf, i, &phdr_mem); @@ -380,7 +390,7 @@ find_dynsym (Dwfl_Module *mod) /* Translate pointers into file offsets. */ GElf_Off offs[i_max] = { 0, }; - find_offsets (mod->main.elf, ehdr, i_max, addrs, offs); + find_offsets (mod->main.elf, phnum, i_max, addrs, offs); /* Figure out the size of the symbol table. */ if (offs[i_hash] != 0) diff --git a/elfutils/libdwfl/dwfl_report_elf.c b/elfutils/libdwfl/dwfl_report_elf.c index 52b0c57d..062a647f 100644 --- a/elfutils/libdwfl/dwfl_report_elf.c +++ b/elfutils/libdwfl/dwfl_report_elf.c @@ -1,5 +1,5 @@ /* Report a module to libdwfl based on ELF program headers. - Copyright (C) 2005, 2007, 2009 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -187,8 +187,11 @@ __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, base = 0; case ET_DYN: - default: - for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) + default:; + size_t phnum; + if (unlikely (elf_getphdrnum (elf, &phnum) != 0)) + goto elf_error; + for (size_t i = 0; i < phnum; ++i) { GElf_Phdr phdr_mem, *ph = gelf_getphdr (elf, i, &phdr_mem); if (unlikely (ph == NULL)) @@ -203,7 +206,7 @@ __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, } bias = base; - for (uint_fast16_t i = ehdr->e_phnum; i-- > 0;) + for (size_t i = phnum; i-- > 0;) { GElf_Phdr phdr_mem, *ph = gelf_getphdr (elf, i, &phdr_mem); if (unlikely (ph == NULL)) diff --git a/elfutils/libdwfl/link_map.c b/elfutils/libdwfl/link_map.c index 2d4d75f1..ecb49905 100644 --- a/elfutils/libdwfl/link_map.c +++ b/elfutils/libdwfl/link_map.c @@ -346,6 +346,11 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata, GElf_Addr l_ld = addrs[2]; next = addrs[3]; + /* If a clobbered or truncated memory image has no useful pointer, + just skip this element. */ + if (l_ld == 0) + continue; + /* Fetch the string at the l_name address. */ const char *name = NULL; if (buffer != NULL @@ -373,11 +378,7 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata, the same area, find that existing module to adjust. The l_ld address is the only one we know for sure to be within the module's own segments (its .dynamic). */ - Dwfl_Module *mod; - int segndx = INTUSE(dwfl_addrsegment) (dwfl, l_ld, &mod); - if (unlikely (segndx < 0)) - return release_buffer (-1); - + Dwfl_Module *mod = INTUSE(dwfl_addrmodule) (dwfl, l_ld); if (mod != NULL) { /* We have a module. We can give it a better name from l_name. */ diff --git a/elfutils/libdwfl/relocate.c b/elfutils/libdwfl/relocate.c index a31fe152..121a481b 100644 --- a/elfutils/libdwfl/relocate.c +++ b/elfutils/libdwfl/relocate.c @@ -191,7 +191,10 @@ relocate_getsym (Dwfl_Module *mod, { case SHN_ABS: case SHN_UNDEF: + return DWFL_E_NOERROR; + case SHN_COMMON: + sym->st_value = 0; /* Value is size, not helpful. */ return DWFL_E_NOERROR; } @@ -302,6 +305,10 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, if (tname == NULL) return DWFL_E_LIBELF; + if (unlikely (tshdr->sh_type == SHT_NOBITS) || unlikely (tshdr->sh_size == 0)) + /* No contents to relocate. */ + return DWFL_E_NOERROR; + if (debugscn && ! ebl_debugscn_p (mod->ebl, tname)) /* This relocation section is not for a debugging section. Nothing to do here. */ @@ -346,7 +353,8 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, { /* Maybe we can figure it out anyway. */ error = resolve_symbol (mod, reloc_symtab, &sym, shndx); - if (error != DWFL_E_NOERROR) + if (error != DWFL_E_NOERROR + && !(error == DWFL_E_RELUNDEF && shndx == SHN_COMMON)) return error; } diff --git a/elfutils/libebl/ChangeLog b/elfutils/libebl/ChangeLog index ba3dc7db..aaa1c86d 100644 --- a/elfutils/libebl/ChangeLog +++ b/elfutils/libebl/ChangeLog @@ -1,3 +1,20 @@ +2010-01-04 Roland McGrath <roland@redhat.com> + + * eblcorenote.c (ebl_core_note): Take GElf_Nhdr * and name data + pointer instead of only n_type and n_descsz. + * libebl.h: Update declaration. + * ebl-hooks.h: Update core_note hook signature. + * eblopenbackend.c (default_core_note): Likewise. + +2009-10-14 Roland McGrath <roland@redhat.com> + + * eblobjnote.c (ebl_object_note): Clean up NT_GNU_GOLD_VERSION printing. + +2009-10-05 Roland McGrath <roland@redhat.com> + + * eblopenbackend.c (default_debugscn_p): Match .debug_pubtypes and + .debug_types too. + 2009-09-02 Petr Machata <pmachata@redhat.com> * libebl/eblstrtab.c (morememory): Allocate memory in multiples of diff --git a/elfutils/libebl/Makefile.in b/elfutils/libebl/Makefile.in index bc37a44d..c42056ec 100644 --- a/elfutils/libebl/Makefile.in +++ b/elfutils/libebl/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/libebl/ebl-hooks.h b/elfutils/libebl/ebl-hooks.h index d483f2a3..59e73c54 100644 --- a/elfutils/libebl/ebl-hooks.h +++ b/elfutils/libebl/ebl-hooks.h @@ -1,5 +1,5 @@ /* Backend hook signatures internal interface for libebl. - Copyright (C) 2000-2009 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -114,8 +114,8 @@ const char *EBLHOOK(core_note_type_name) (uint32_t, char *, size_t); const char *EBLHOOK(object_note_type_name) (uint32_t, char *, size_t); /* Describe core note format. */ -int EBLHOOK(core_note) (GElf_Word, GElf_Word, GElf_Word *, size_t *, - const Ebl_Register_Location **, +int EBLHOOK(core_note) (const GElf_Nhdr *, const char *, + GElf_Word *, size_t *, const Ebl_Register_Location **, size_t *, const Ebl_Core_Item **); /* Handle object file note. */ diff --git a/elfutils/libebl/eblcorenote.c b/elfutils/libebl/eblcorenote.c index 553d5ba9..7549ca61 100644 --- a/elfutils/libebl/eblcorenote.c +++ b/elfutils/libebl/eblcorenote.c @@ -1,5 +1,5 @@ /* Describe known core note formats. - Copyright (C) 2007 Red Hat, Inc. + Copyright (C) 2007, 2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -61,19 +61,19 @@ int -ebl_core_note (ebl, n_type, descsz, +ebl_core_note (ebl, nhdr, name, regs_offset, nregloc, reglocs, nitems, items) Ebl *ebl; - GElf_Word n_type; - GElf_Word descsz; + const GElf_Nhdr *nhdr; + const char *name; GElf_Word *regs_offset; size_t *nregloc; const Ebl_Register_Location **reglocs; size_t *nitems; const Ebl_Core_Item **items; { - int result = ebl->core_note (n_type, descsz, regs_offset, nregloc, reglocs, - nitems, items); + int result = ebl->core_note (nhdr, name, + regs_offset, nregloc, reglocs, nitems, items); if (result == 0) { /* The machine specific function did not know this type. */ @@ -81,7 +81,7 @@ ebl_core_note (ebl, n_type, descsz, *regs_offset = 0; *nregloc = 0; *reglocs = NULL; - switch (n_type) + switch (nhdr->n_type) { #define ITEMS(type, table) \ case type: \ diff --git a/elfutils/libebl/eblobjnote.c b/elfutils/libebl/eblobjnote.c index 9b36be6a..b56c6cbc 100644 --- a/elfutils/libebl/eblobjnote.c +++ b/elfutils/libebl/eblobjnote.c @@ -84,8 +84,8 @@ ebl_object_note (ebl, name, type, descsz, desc) case NT_GNU_GOLD_VERSION: if (strcmp (name, "GNU") == 0 && descsz > 0) /* A non-null terminated version string. */ - printf ("%s%.*s\n", - gettext (" Version String: "), (int) descsz, desc); + printf (gettext (" Linker version: %.*s\n"), + (int) descsz, desc); break; case NT_GNU_ABI_TAG: diff --git a/elfutils/libebl/eblopenbackend.c b/elfutils/libebl/eblopenbackend.c index cb17f03f..edd8c4a7 100644 --- a/elfutils/libebl/eblopenbackend.c +++ b/elfutils/libebl/eblopenbackend.c @@ -1,5 +1,5 @@ /* Generate ELF backend handle. - Copyright (C) 2000-2009 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -186,7 +186,7 @@ static const char *default_core_note_type_name (uint32_t, char *buf, size_t len); static const char *default_object_note_type_name (uint32_t, char *buf, size_t len); -static int default_core_note (GElf_Word n_type, GElf_Word descsz, +static int default_core_note (const GElf_Nhdr *nhdr, const char *name, GElf_Word *regs_offset, size_t *nregloc, const Ebl_Register_Location **reglocs, size_t *nitems, const Ebl_Core_Item **); @@ -604,8 +604,8 @@ default_auxv_info (GElf_Xword a_type __attribute__ ((unused)), } static int -default_core_note (GElf_Word n_type __attribute__ ((unused)), - GElf_Word descsz __attribute__ ((unused)), +default_core_note (const GElf_Nhdr *nhdr __attribute__ ((unused)), + const char *name __attribute__ ((unused)), GElf_Word *ro __attribute__ ((unused)), size_t *nregloc __attribute__ ((unused)), const Ebl_Register_Location **reglocs @@ -659,6 +659,9 @@ default_debugscn_p (const char *name) ".debug_macinfo", /* DWARF 3 */ ".debug_ranges", + ".debug_pubtypes", + /* DWARF 4 */ + ".debug_types", /* SGI/MIPS DWARF 2 extensions */ ".debug_weaknames", ".debug_funcnames", diff --git a/elfutils/libebl/libebl.h b/elfutils/libebl/libebl.h index 1a56b966..c94ad78f 100644 --- a/elfutils/libebl/libebl.h +++ b/elfutils/libebl/libebl.h @@ -1,5 +1,5 @@ /* Interface for libebl. - Copyright (C) 2000, 2001-2009 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -379,13 +379,13 @@ typedef struct bool thread_identifier; } Ebl_Core_Item; -/* Describe the format of a core file note with type field matching N_TYPE - and descriptor size matching DESCSZ. */ -extern int ebl_core_note (Ebl *ebl, GElf_Word n_type, GElf_Word descsz, +/* Describe the format of a core file note with the given header and NAME. + NAME is not guaranteed terminated, it's NHDR->n_namesz raw bytes. */ +extern int ebl_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const char *name, GElf_Word *regs_offset, size_t *nregloc, const Ebl_Register_Location **reglocs, size_t *nitems, const Ebl_Core_Item **items) - __nonnull_attribute__ (1, 4, 5, 6, 7, 8); + __nonnull_attribute__ (1, 2, 3, 4, 5, 6, 7, 8); /* Describe the auxv type number. */ extern int ebl_auxv_info (Ebl *ebl, GElf_Xword a_type, diff --git a/elfutils/libelf/ChangeLog b/elfutils/libelf/ChangeLog index ba387557..c71c5638 100644 --- a/elfutils/libelf/ChangeLog +++ b/elfutils/libelf/ChangeLog @@ -1,3 +1,37 @@ +2010-01-07 Roland McGrath <roland@redhat.com> + + * elf32_getphdr.c: Use __elf_getphdrnum_rdlock. + * gelf_getphdr.c: Likewise. + * gelf_update_phdr.c: Likewise. + * elf32_updatefile.c (__elf32_updatemmap, __elf32_updatefile): Likewise. + * elf32_updatenull.c (__elf32_updatenull_wrlock): Likewise. + * elf32_newphdr.c: Clear section 0's sh_info when resetting e_phnum. + If COUNT is too large, use store PN_XNUM instead and set sh_info. + * elf_begin.c (file_read_elf): Always allocate space we can use later + for section 0 if doing RDWR. + + * elf_getphdrnum.c: New file. + * Makefile.am (libelf_a_SOURCES): Add it. + * libelf.h: Declare elf_getphdrnum. + * libelfP.h: Declare __elf_getphdrnum_rdlock. + * libelf.map (ELFUTILS_1.6): New set, add elf_getphdrnum. + + * elf.h: Update from glibc. + +2009-10-23 Lubomir Rintel <lkundrak@v3.sk> + + * elf32_updatefile.c (fill_mmap): When starting past shdr_end, start + filling from section start, not shdr_end. + +2009-11-10 Roland McGrath <roland@redhat.com> + + * elf_readall.c (__libelf_readall): Fetch file size if not yet known. + +2009-11-06 Mark Wielaard <mjw@redhat.com> + + * elf_next.c (elf_next): Mark the archive header as unusable when + there is no next ar element. + 2009-08-12 Mark Wielaard <mjw@redhat.com> * Makefile.am (libelf.so): Use -Wl,-z,defs not -defs. diff --git a/elfutils/libelf/Makefile.am b/elfutils/libelf/Makefile.am index 2899043d..b277e944 100644 --- a/elfutils/libelf/Makefile.am +++ b/elfutils/libelf/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 1996-2006, 2007, 2008, 2009 Red Hat, Inc. +## Copyright (C) 1996-2010 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -91,7 +91,7 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ gelf_update_versym.c gelf_update_verneed.c \ gelf_update_vernaux.c gelf_update_verdef.c \ gelf_update_verdaux.c \ - elf_getshdrnum.c elf_getshdrstrndx.c \ + elf_getphdrnum.c elf_getshdrnum.c elf_getshdrstrndx.c \ gelf_checksum.c elf32_checksum.c elf64_checksum.c \ libelf_crc32.c libelf_next_prime.c \ elf_clone.c \ diff --git a/elfutils/libelf/Makefile.in b/elfutils/libelf/Makefile.in index 2d36bd46..283efd47 100644 --- a/elfutils/libelf/Makefile.in +++ b/elfutils/libelf/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -127,15 +127,15 @@ am_libelf_a_OBJECTS = elf_version.$(OBJEXT) elf_hash.$(OBJEXT) \ gelf_getsymshndx.$(OBJEXT) gelf_update_symshndx.$(OBJEXT) \ gelf_update_versym.$(OBJEXT) gelf_update_verneed.$(OBJEXT) \ gelf_update_vernaux.$(OBJEXT) gelf_update_verdef.$(OBJEXT) \ - gelf_update_verdaux.$(OBJEXT) elf_getshdrnum.$(OBJEXT) \ - elf_getshdrstrndx.$(OBJEXT) gelf_checksum.$(OBJEXT) \ - elf32_checksum.$(OBJEXT) elf64_checksum.$(OBJEXT) \ - libelf_crc32.$(OBJEXT) libelf_next_prime.$(OBJEXT) \ - elf_clone.$(OBJEXT) gelf_getlib.$(OBJEXT) \ - gelf_update_lib.$(OBJEXT) elf32_offscn.$(OBJEXT) \ - elf64_offscn.$(OBJEXT) gelf_offscn.$(OBJEXT) \ - elf_getaroff.$(OBJEXT) elf_gnu_hash.$(OBJEXT) \ - elf_scnshndx.$(OBJEXT) + gelf_update_verdaux.$(OBJEXT) elf_getphdrnum.$(OBJEXT) \ + elf_getshdrnum.$(OBJEXT) elf_getshdrstrndx.$(OBJEXT) \ + gelf_checksum.$(OBJEXT) elf32_checksum.$(OBJEXT) \ + elf64_checksum.$(OBJEXT) libelf_crc32.$(OBJEXT) \ + libelf_next_prime.$(OBJEXT) elf_clone.$(OBJEXT) \ + gelf_getlib.$(OBJEXT) gelf_update_lib.$(OBJEXT) \ + elf32_offscn.$(OBJEXT) elf64_offscn.$(OBJEXT) \ + gelf_offscn.$(OBJEXT) elf_getaroff.$(OBJEXT) \ + elf_gnu_hash.$(OBJEXT) elf_scnshndx.$(OBJEXT) libelf_a_OBJECTS = $(am_libelf_a_OBJECTS) libelf_pic_a_AR = $(AR) $(ARFLAGS) libelf_pic_a_LIBADD = @@ -328,7 +328,7 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \ gelf_update_versym.c gelf_update_verneed.c \ gelf_update_vernaux.c gelf_update_verdef.c \ gelf_update_verdaux.c \ - elf_getshdrnum.c elf_getshdrstrndx.c \ + elf_getphdrnum.c elf_getshdrnum.c elf_getshdrstrndx.c \ gelf_checksum.c elf32_checksum.c elf64_checksum.c \ libelf_crc32.c libelf_next_prime.c \ elf_clone.c \ @@ -480,6 +480,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getdata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getdata_rawchunk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getident.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getphdrnum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getscn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getshdrnum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf_getshdrstrndx.Po@am__quote@ diff --git a/elfutils/libelf/elf.h b/elfutils/libelf/elf.h index ce6de07e..1bc8ef34 100644 --- a/elfutils/libelf/elf.h +++ b/elfutils/libelf/elf.h @@ -1,5 +1,5 @@ /* This file defines standard ELF types, structures, and macros. - Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009 + Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -558,6 +558,12 @@ typedef struct Elf64_Xword p_align; /* Segment alignment */ } Elf64_Phdr; +/* Special value for e_phnum. This indicates that the real number of + program headers is too large to fit into e_phnum. Instead the real + value is in the field sh_info of section 0. */ + +#define PN_XNUM 0xffff + /* Legal values for p_type (segment type). */ #define PT_NULL 0 /* Program header table entry unused */ @@ -2041,9 +2047,6 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */ #define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */ -/* Keep this the last entry. */ -#define R_PPC_NUM 95 - /* The remaining relocs are from the Embedded ELF ABI, and are not in the SVR4 ELF ABI. */ #define R_PPC_EMB_NADDR32 101 @@ -2071,11 +2074,14 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ #define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ +/* GNU extension to support local ifunc. */ +#define R_PPC_IRELATIVE 248 + /* GNU relocs used in PIC code sequences. */ -#define R_PPC_REL16 249 /* word32 (sym-.) */ -#define R_PPC_REL16_LO 250 /* half16 (sym-.)@l */ -#define R_PPC_REL16_HI 251 /* half16 (sym-.)@h */ -#define R_PPC_REL16_HA 252 /* half16 (sym-.)@ha */ +#define R_PPC_REL16 249 /* half16 (sym+add-.) */ +#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */ +#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */ +#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */ /* This is a phony reloc to handle any old fashioned TOC16 references that may still be in object files. */ @@ -2197,8 +2203,13 @@ typedef Elf32_Addr Elf32_Conflict; #define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */ #define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */ -/* Keep this the last entry. */ -#define R_PPC64_NUM 107 +/* GNU extension to support local ifunc. */ +#define R_PPC64_JMP_IREL 247 +#define R_PPC64_IRELATIVE 248 +#define R_PPC64_REL16 249 /* half16 (sym+add-.) */ +#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */ +#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */ +#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */ /* PowerPC64 specific values for the Dyn d_tag field. */ #define DT_PPC64_GLINK (DT_LOPROC + 0) diff --git a/elfutils/libelf/elf32_getphdr.c b/elfutils/libelf/elf32_getphdr.c index c32c2827..0a617a67 100644 --- a/elfutils/libelf/elf32_getphdr.c +++ b/elfutils/libelf/elf32_getphdr.c @@ -1,5 +1,5 @@ /* Get ELF program header table. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Red Hat, Inc. + Copyright (C) 1998-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. @@ -94,7 +94,9 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf) ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; /* If no program header exists return NULL. */ - size_t phnum = ehdr->e_phnum; + size_t phnum; + if (__elf_getphdrnum_rdlock (elf, &phnum) != 0) + goto out; if (phnum == 0) { __libelf_seterrno (ELF_E_NO_PHDR); diff --git a/elfutils/libelf/elf32_newphdr.c b/elfutils/libelf/elf32_newphdr.c index d1b16088..03ff100a 100644 --- a/elfutils/libelf/elf32_newphdr.c +++ b/elfutils/libelf/elf32_newphdr.c @@ -1,5 +1,5 @@ /* Create new ELF program header table. - Copyright (C) 1999, 2000, 2002 Red Hat, Inc. + Copyright (C) 1999-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. @@ -79,6 +79,12 @@ elfw2(LIBELFBITS,newphdr) (elf, count) return NULL; } + if (unlikely ((ElfW2(LIBELFBITS,Word)) count != count)) + { + __libelf_seterrno (ELF_E_INVALID_OPERAND); + return NULL; + } + rwlock_wrlock (elf->lock); if (elf->class == 0) @@ -110,6 +116,10 @@ elfw2(LIBELFBITS,newphdr) (elf, count) elf->state.ELFW(elf,LIBELFBITS).phdr = NULL; /* Set the `e_phnum' member to the new value. */ elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = 0; + /* Also clear any old PN_XNUM extended value. */ + if (elf->state.ELFW(elf,LIBELFBITS).scns.cnt > 0) + elf->state.ELFW(elf,LIBELFBITS).scns.data[0] + .shdr.ELFW(e,LIBELFBITS)->sh_info = 0; /* Also set the size. */ elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phentsize = sizeof (ElfW2(LIBELFBITS,Phdr)); @@ -122,6 +132,7 @@ elfw2(LIBELFBITS,newphdr) (elf, count) result = NULL; } else if (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum != count + || count == PN_XNUM || elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) { /* Allocate a new program header with the appropriate number of @@ -135,10 +146,24 @@ elfw2(LIBELFBITS,newphdr) (elf, count) { /* Now set the result. */ elf->state.ELFW(elf,LIBELFBITS).phdr = result; + if (count >= PN_XNUM) + { + /* We have to write COUNT into the zeroth section's sh_info. */ + Elf_Scn *scn0 = &elf->state.ELFW(elf,LIBELFBITS).scns.data[0]; + if (elf->state.ELFW(elf,LIBELFBITS).scns.cnt == 0) + { + assert (elf->state.ELFW(elf,LIBELFBITS).scns.max > 0); + elf->state.ELFW(elf,LIBELFBITS).scns.cnt = 1; + } + scn0->shdr.ELFW(e,LIBELFBITS)->sh_info = count; + scn0->shdr_flags |= ELF_F_DIRTY; + elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = PN_XNUM; + } + else + /* Set the `e_phnum' member to the new value. */ + elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = count; /* Clear the whole memory. */ memset (result, '\0', count * sizeof (ElfW2(LIBELFBITS,Phdr))); - /* Set the `e_phnum' member to the new value. */ - elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum = count; /* Also set the size. */ elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phentsize = elf_typesize (LIBELFBITS, ELF_T_PHDR, 1); @@ -161,6 +186,7 @@ elfw2(LIBELFBITS,newphdr) (elf, count) elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_DIRTY; result = elf->state.ELFW(elf,LIBELFBITS).phdr; + memset (result, '\0', count * sizeof (ElfW2(LIBELFBITS,Phdr))); } out: diff --git a/elfutils/libelf/elf32_updatefile.c b/elfutils/libelf/elf32_updatefile.c index 0539f03d..898cf1ab 100644 --- a/elfutils/libelf/elf32_updatefile.c +++ b/elfutils/libelf/elf32_updatefile.c @@ -1,5 +1,5 @@ /* Write changed data structures. - Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. @@ -165,6 +165,10 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) previous_scn_changed = elf->state.ELFW(elf,LIBELFBITS).phdr == NULL; } + size_t phnum; + if (unlikely (__elf_getphdrnum_rdlock (elf, &phnum) != 0)) + return -1; + /* Write out the program header table. */ if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL && ((elf->state.ELFW(elf,LIBELFBITS).phdr_flags | elf->flags) @@ -195,12 +199,12 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) /* Do the real work. */ (*fctp) (elf->map_address + elf->start_offset + ehdr->e_phoff, elf->state.ELFW(elf,LIBELFBITS).phdr, - sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum, 1); + sizeof (ElfW2(LIBELFBITS,Phdr)) * phnum, 1); } else memcpy (elf->map_address + elf->start_offset + ehdr->e_phoff, elf->state.ELFW(elf,LIBELFBITS).phdr, - sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum); + sizeof (ElfW2(LIBELFBITS,Phdr)) * phnum); elf->state.ELFW(elf,LIBELFBITS).phdr_flags &= ~ELF_F_DIRTY; @@ -214,8 +218,7 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) char *last_position = ((char *) elf->map_address + elf->start_offset + MAX (elf_typesize (LIBELFBITS, ELF_T_EHDR, 1), ehdr->e_phoff) - + elf_typesize (LIBELFBITS, ELF_T_PHDR, - ehdr->e_phnum)); + + elf_typesize (LIBELFBITS, ELF_T_PHDR, phnum)); /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) @@ -322,8 +325,11 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) if (last_position + written != scn_start + offset && shdr_end < scn_start + offset) - memset (shdr_end, __libelf_fill_byte, - scn_start + offset - shdr_end); + { + char *fill_start = MAX (shdr_end, scn_start); + memset (fill_start, __libelf_fill_byte, + scn_start + offset - fill_start); + } } if (scn->data_list_rear != NULL) @@ -560,6 +566,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) assert (sizeof (ElfW2(LIBELFBITS,Phdr)) == elf_typesize (LIBELFBITS, ELF_T_PHDR, 1)); + size_t phnum; + if (unlikely (__elf_getphdrnum_rdlock (elf, &phnum) != 0)) + return -1; + /* Write out the program header table. */ if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL && ((elf->state.ELFW(elf,LIBELFBITS).phdr_flags | elf->flags) @@ -589,7 +599,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) /* Allocate sufficient memory. */ tmp_phdr = (ElfW2(LIBELFBITS,Phdr) *) - malloc (sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum); + malloc (sizeof (ElfW2(LIBELFBITS,Phdr)) * phnum); if (tmp_phdr == NULL) { __libelf_seterrno (ELF_E_NOMEM); @@ -598,14 +608,14 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) /* Write the converted ELF header in a temporary buffer. */ (*fctp) (tmp_phdr, elf->state.ELFW(elf,LIBELFBITS).phdr, - sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum, 1); + sizeof (ElfW2(LIBELFBITS,Phdr)) * phnum, 1); /* This is the buffer we want to write. */ out_phdr = tmp_phdr; } /* Write out the ELF header. */ - size_t phdr_size = sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum; + size_t phdr_size = sizeof (ElfW2(LIBELFBITS,Phdr)) * phnum; if (unlikely ((size_t) pwrite_retry (elf->fildes, out_phdr, phdr_size, ehdr->e_phoff) != phdr_size)) @@ -630,8 +640,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) last_offset = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1); else - last_offset = (ehdr->e_phoff - + sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum); + last_offset = (ehdr->e_phoff + sizeof (ElfW2(LIBELFBITS,Phdr)) * phnum); /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) diff --git a/elfutils/libelf/elf32_updatenull.c b/elfutils/libelf/elf32_updatenull.c index 5ce8bbc9..ca9a8708 100644 --- a/elfutils/libelf/elf32_updatenull.c +++ b/elfutils/libelf/elf32_updatenull.c @@ -1,5 +1,5 @@ /* Update data structures for changes. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. @@ -164,13 +164,17 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) return -1; } + size_t phnum; + if (unlikely (__elf_getphdrnum_rdlock (elf, &phnum) != 0)) + return -1; + if (elf->flags & ELF_F_LAYOUT) { /* The user is supposed to fill out e_phoff. Use it and e_phnum to determine the maximum extend. */ size = MAX ((size_t) size, ehdr->e_phoff - + elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum)); + + elf_typesize (LIBELFBITS, ELF_T_PHDR, phnum)); } else { @@ -179,7 +183,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) ehdr_flags); /* We need no alignment here. */ - size += elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum); + size += elf_typesize (LIBELFBITS, ELF_T_PHDR, phnum); } } diff --git a/elfutils/libelf/elf_begin.c b/elfutils/libelf/elf_begin.c index 04670a45..896d86b6 100644 --- a/elfutils/libelf/elf_begin.c +++ b/elfutils/libelf/elf_begin.c @@ -1,5 +1,5 @@ /* Create descriptor for processing file. - Copyright (C) 1998-2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 1998-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. @@ -285,13 +285,22 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident, /* Could not determine the number of sections. */ return NULL; - /* We can now allocate the memory. */ + /* We can now allocate the memory. Even if there are no section headers, + we allocate space for a zeroth section in case we need it later. */ + const size_t scnmax = (scncnt ?: (cmd == ELF_C_RDWR || cmd == ELF_C_RDWR_MMAP) + ? 1 : 0); Elf *elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent, - ELF_K_ELF, scncnt * sizeof (Elf_Scn)); + ELF_K_ELF, scnmax * sizeof (Elf_Scn)); if (elf == NULL) /* Not enough memory. */ return NULL; + assert ((unsigned int) scncnt == scncnt); + assert (offsetof (struct Elf, state.elf32.scns) + == offsetof (struct Elf, state.elf64.scns)); + elf->state.elf32.scns.cnt = scncnt; + elf->state.elf32.scns.max = scnmax; + /* Some more or less arbitrary value. */ elf->state.elf.scnincr = 10; @@ -304,9 +313,6 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident, not sufficient for the architecture. */ Elf32_Ehdr *ehdr = (Elf32_Ehdr *) ((char *) map_address + offset); - assert ((unsigned int) scncnt == scncnt); - elf->state.elf32.scns.cnt = elf->state.elf32.scns.max = scncnt; - /* This is a 32-bit binary. */ if (map_address != NULL && e_ident[EI_DATA] == MY_ELFDATA && (ALLOW_UNALIGNED @@ -392,9 +398,6 @@ file_read_elf (int fildes, void *map_address, unsigned char *e_ident, not sufficient for the architecture. */ Elf64_Ehdr *ehdr = (Elf64_Ehdr *) ((char *) map_address + offset); - assert ((unsigned int) scncnt == scncnt); - elf->state.elf64.scns.cnt = elf->state.elf64.scns.max = scncnt; - /* This is a 64-bit binary. */ if (map_address != NULL && e_ident[EI_DATA] == MY_ELFDATA && (ALLOW_UNALIGNED diff --git a/elfutils/libelf/elf_getphdrnum.c b/elfutils/libelf/elf_getphdrnum.c new file mode 100644 index 00000000..edf073ec --- /dev/null +++ b/elfutils/libelf/elf_getphdrnum.c @@ -0,0 +1,116 @@ +/* Return number of program headers in the ELF file. + Copyright (C) 2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by the + Free Software Foundation; version 2 of the License. + + Red Hat elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + In addition, as a special exception, Red Hat, Inc. gives You the + additional right to link the code of Red Hat elfutils with code licensed + under any Open Source Initiative certified open source license + (http://www.opensource.org/licenses/index.php) which requires the + distribution of source code with any binary distribution and to + distribute linked combinations of the two. Non-GPL Code permitted under + this exception must only link to the code of Red Hat elfutils through + those well defined interfaces identified in the file named EXCEPTION + found in the source code files (the "Approved Interfaces"). The files + of Non-GPL Code may instantiate templates or use macros or inline + functions from the Approved Interfaces without causing the resulting + work to be covered by the GNU General Public License. Only Red Hat, + Inc. may make changes or additions to the list of Approved Interfaces. + Red Hat's grant of this exception is conditioned upon your not adding + any new exceptions. If you wish to add a new Approved Interface or + exception, please contact Red Hat. You must obey the GNU General Public + License in all respects for all of the Red Hat elfutils code and other + code used in conjunction with Red Hat elfutils except the Non-GPL Code + covered by this exception. If you modify this file, you may extend this + exception to your version of the file, but you are not obligated to do + so. If you do not wish to provide this exception without modification, + you must delete this exception statement from your version and license + this file solely under the GPL without exception. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <gelf.h> +#include <stddef.h> + +#include "libelfP.h" + + +int +__elf_getphdrnum_rdlock (elf, dst) + Elf *elf; + size_t *dst; +{ + if (unlikely (elf->state.elf64.ehdr == NULL)) + { + /* Maybe no ELF header was created yet. */ + __libelf_seterrno (ELF_E_WRONG_ORDER_EHDR); + return -1; + } + + *dst = (elf->class == ELFCLASS32 + ? elf->state.elf32.ehdr->e_phnum + : elf->state.elf64.ehdr->e_phnum); + + if (*dst == PN_XNUM) + { + const Elf_ScnList *const scns = (elf->class == ELFCLASS32 + ? &elf->state.elf32.scns + : &elf->state.elf64.scns); + + /* If there are no section headers, perhaps this is really just 65536 + written without PN_XNUM support. Either that or it's bad data. */ + + if (likely (scns->cnt > 0)) + *dst = (elf->class == ELFCLASS32 + ? scns->data[0].shdr.e32->sh_info + : scns->data[0].shdr.e64->sh_info); + } + + return 0; +} + +int +elf_getphdrnum (elf, dst) + Elf *elf; + size_t *dst; +{ + int result; + + if (elf == NULL) + return -1; + + if (unlikely (elf->kind != ELF_K_ELF)) + { + __libelf_seterrno (ELF_E_INVALID_HANDLE); + return -1; + } + + rwlock_rdlock (elf->lock); + result = __elf_getphdrnum_rdlock (elf, dst); + rwlock_unlock (elf->lock); + + return result; +} diff --git a/elfutils/libelf/elf_next.c b/elfutils/libelf/elf_next.c index fbfb2721..196c65a3 100644 --- a/elfutils/libelf/elf_next.c +++ b/elfutils/libelf/elf_next.c @@ -1,5 +1,5 @@ /* Advance in archive to next element. - Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + Copyright (C) 1998-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. @@ -84,6 +84,10 @@ elf_next (elf) /* Get the next archive header. */ ret = __libelf_next_arhdr_wrlock (parent) != 0 ? ELF_C_NULL : elf->cmd; + /* If necessary, mark the archive header as unusable. */ + if (ret == ELF_C_NULL) + parent->state.ar.elf_ar_hdr.ar_name = NULL; + rwlock_unlock (parent->lock); return ret; diff --git a/elfutils/libelf/elf_readall.c b/elfutils/libelf/elf_readall.c index 8f171b21..1f59932f 100644 --- a/elfutils/libelf/elf_readall.c +++ b/elfutils/libelf/elf_readall.c @@ -1,5 +1,5 @@ /* Read all of the file associated with the descriptor. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + Copyright (C) 1998-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. @@ -54,6 +54,7 @@ #include <errno.h> #include <unistd.h> +#include <sys/stat.h> #include <system.h> #include "libelfP.h" @@ -102,12 +103,30 @@ __libelf_readall (elf) /* If the file is not mmap'ed and not previously loaded, do it now. */ if (elf->map_address == NULL) { - char *mem; + char *mem = NULL; /* If this is an archive and we have derived descriptors get the locks for all of them. */ libelf_acquire_all (elf); + if (elf->maximum_size == ~((size_t) 0)) + { + /* We don't yet know how large the file is. Determine that now. */ + struct stat st; + + if (fstat (elf->fildes, &st) < 0) + goto read_error; + + if (sizeof (size_t) >= sizeof (st.st_size) + || st.st_size <= ~((size_t) 0)) + elf->maximum_size = (size_t) st.st_size; + else + { + errno = EOVERFLOW; + goto read_error; + } + } + /* Allocate all the memory we need. */ mem = (char *) malloc (elf->maximum_size); if (mem != NULL) @@ -119,6 +138,7 @@ __libelf_readall (elf) != elf->maximum_size)) { /* Something went wrong. */ + read_error: __libelf_seterrno (ELF_E_READ_ERROR); free (mem); } diff --git a/elfutils/libelf/gelf_getphdr.c b/elfutils/libelf/gelf_getphdr.c index 66cd143d..7b04b399 100644 --- a/elfutils/libelf/gelf_getphdr.c +++ b/elfutils/libelf/gelf_getphdr.c @@ -1,5 +1,5 @@ /* Return program header table entry. - Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 1998-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1998. @@ -100,7 +100,11 @@ gelf_getphdr (elf, ndx, dst) } /* Test whether the index is ok. */ - if (ndx >= elf->state.elf32.ehdr->e_phnum) + size_t phnum; + if (ndx >= elf->state.elf32.ehdr->e_phnum + && (elf->state.elf32.ehdr->e_phnum != PN_XNUM + || __elf_getphdrnum_rdlock (elf, &phnum) != 0 + || (size_t) ndx >= phnum)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; @@ -138,7 +142,11 @@ gelf_getphdr (elf, ndx, dst) } /* Test whether the index is ok. */ - if (ndx >= elf->state.elf64.ehdr->e_phnum) + size_t phnum; + if (ndx >= elf->state.elf64.ehdr->e_phnum + && (elf->state.elf64.ehdr->e_phnum != PN_XNUM + || __elf_getphdrnum_rdlock (elf, &phnum) != 0 + || (size_t) ndx >= phnum)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; diff --git a/elfutils/libelf/gelf_update_phdr.c b/elfutils/libelf/gelf_update_phdr.c index e8b7f788..d6d5f5ae 100644 --- a/elfutils/libelf/gelf_update_phdr.c +++ b/elfutils/libelf/gelf_update_phdr.c @@ -1,5 +1,5 @@ /* Update program header program header table entry. - Copyright (C) 2000, 2001, 2002 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2000. @@ -101,7 +101,11 @@ gelf_update_phdr (Elf *elf, int ndx, GElf_Phdr *src) } /* Test whether the index is ok. */ - if (unlikely (ndx >= elf->state.elf32.ehdr->e_phnum)) + size_t phnum; + if (ndx >= elf->state.elf32.ehdr->e_phnum + && (elf->state.elf32.ehdr->e_phnum != PN_XNUM + || __elf_getphdrnum_rdlock (elf, &phnum) != 0 + || (size_t) ndx >= phnum)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; @@ -134,7 +138,11 @@ gelf_update_phdr (Elf *elf, int ndx, GElf_Phdr *src) } /* Test whether the index is ok. */ - if (unlikely (ndx >= elf->state.elf64.ehdr->e_phnum)) + size_t phnum; + if (ndx >= elf->state.elf64.ehdr->e_phnum + && (elf->state.elf64.ehdr->e_phnum != PN_XNUM + || __elf_getphdrnum_rdlock (elf, &phnum) != 0 + || (size_t) ndx >= phnum)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; diff --git a/elfutils/libelf/libelf.h b/elfutils/libelf/libelf.h index 16c7a7a2..b0b3a8d7 100644 --- a/elfutils/libelf/libelf.h +++ b/elfutils/libelf/libelf.h @@ -1,5 +1,5 @@ /* Interface for libelf. - Copyright (C) 1998-2000, 2002, 2004-2007, 2009 Red Hat, Inc. + Copyright (C) 1998-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -220,6 +220,12 @@ extern Elf32_Ehdr *elf32_newehdr (Elf *__elf); /* Similar but this time the binary calls is ELFCLASS64. */ extern Elf64_Ehdr *elf64_newehdr (Elf *__elf); +/* Get the number of program headers in the ELF file. If the file uses + more headers than can be represented in the e_phnum field of the ELF + header the information from the sh_info field in the zeroth section + header is used. */ +extern int elf_getphdrnum (Elf *__elf, size_t *__dst); + /* Retrieve class-dependent program header table. */ extern Elf32_Phdr *elf32_getphdr (Elf *__elf); /* Similar but this time the binary calls is ELFCLASS64. */ diff --git a/elfutils/libelf/libelf.map b/elfutils/libelf/libelf.map index e0f40eb8..de6d912a 100644 --- a/elfutils/libelf/libelf.map +++ b/elfutils/libelf/libelf.map @@ -133,3 +133,8 @@ ELFUTILS_1.5 { global: elf_getshdrnum; elf_getshdrstrndx; } ELFUTILS_1.4; + +ELFUTILS_1.6 { + global: + elf_getphdrnum; +} ELFUTILS_1.5; diff --git a/elfutils/libelf/libelfP.h b/elfutils/libelf/libelfP.h index ca754a01..2b8391bd 100644 --- a/elfutils/libelf/libelfP.h +++ b/elfutils/libelf/libelfP.h @@ -1,5 +1,5 @@ /* Internal interfaces for libelf. - Copyright (C) 1998-2003, 2005, 2006, 2007, 2009 Red Hat, Inc. + Copyright (C) 1998-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Contributed by Ulrich Drepper <drepper@redhat.com>, 1998. @@ -530,6 +530,8 @@ extern Elf_Scn *__elf32_offscn_internal (Elf *__elf, Elf32_Off __offset) attribute_hidden; extern Elf_Scn *__elf64_offscn_internal (Elf *__elf, Elf64_Off __offset) attribute_hidden; +extern int __elf_getphdrnum_rdlock (Elf *__elf, size_t *__dst) + internal_function; extern int __elf_getshdrnum_rdlock (Elf *__elf, size_t *__dst) internal_function; extern int __elf_getshdrstrndx_internal (Elf *__elf, size_t *__dst) diff --git a/elfutils/m4/Makefile.in b/elfutils/m4/Makefile.in index b5802ddc..9095b9c6 100644 --- a/elfutils/m4/Makefile.in +++ b/elfutils/m4/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/po/elfutils.pot b/elfutils/po/elfutils.pot index 7461f5f4..d681c86f 100644 --- a/elfutils/po/elfutils.pot +++ b/elfutils/po/elfutils.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://bugzilla.redhat.com/\n" -"POT-Creation-Date: 2009-09-21 08:14-0700\n" +"POT-Creation-Date: 2010-01-14 18:51-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,8 +17,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#: lib/xmalloc.c:51 lib/xmalloc.c:65 lib/xmalloc.c:79 src/readelf.c:2796 -#: src/readelf.c:3135 src/unstrip.c:2086 src/unstrip.c:2294 +#: lib/xmalloc.c:51 lib/xmalloc.c:65 lib/xmalloc.c:79 src/readelf.c:2819 +#: src/readelf.c:3158 src/unstrip.c:2086 src/unstrip.c:2294 #, c-format msgid "memory exhausted" msgstr "" @@ -51,7 +51,7 @@ msgstr "" msgid "invalid size of destination operand" msgstr "" -#: libelf/elf_error.c:108 src/readelf.c:4742 +#: libelf/elf_error.c:108 src/readelf.c:4773 #, c-format msgid "invalid encoding" msgstr "" @@ -144,7 +144,7 @@ msgstr "" msgid "invalid section header" msgstr "" -#: libelf/elf_error.c:208 src/readelf.c:6226 src/readelf.c:6327 +#: libelf/elf_error.c:208 src/readelf.c:6257 src/readelf.c:6358 #, c-format msgid "invalid data" msgstr "" @@ -428,8 +428,9 @@ msgstr "" msgid " Build ID: " msgstr "" -#: libebl/eblobjnote.c:88 -msgid " Version String: " +#: libebl/eblobjnote.c:87 +#, c-format +msgid " Linker version: %.*s\n" msgstr "" #: libebl/eblobjnote.c:136 @@ -573,9 +574,9 @@ msgstr "" msgid "archive name required" msgstr "" -#: src/ar.c:288 src/nm.c:253 src/readelf.c:442 src/size.c:219 src/strip.c:203 +#: src/ar.c:288 src/nm.c:253 src/readelf.c:448 src/size.c:219 src/strip.c:203 #: src/ld.c:957 src/elflint.c:238 src/addr2line.c:185 src/findtextrel.c:170 -#: src/elfcmp.c:522 src/ranlib.c:136 src/strings.c:227 src/unstrip.c:233 +#: src/elfcmp.c:555 src/ranlib.c:136 src/strings.c:227 src/unstrip.c:233 #: src/objdump.c:181 #, c-format msgid "" @@ -584,9 +585,9 @@ msgid "" "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" msgstr "" -#: src/ar.c:293 src/nm.c:258 src/readelf.c:447 src/size.c:224 src/strip.c:208 +#: src/ar.c:293 src/nm.c:258 src/readelf.c:453 src/size.c:224 src/strip.c:208 #: src/ld.c:962 src/elflint.c:243 src/addr2line.c:190 src/findtextrel.c:175 -#: src/elfcmp.c:527 src/ranlib.c:141 src/strings.c:232 src/unstrip.c:238 +#: src/elfcmp.c:560 src/ranlib.c:141 src/strings.c:232 src/unstrip.c:238 #: src/objdump.c:186 #, c-format msgid "Written by %s.\n" @@ -717,7 +718,7 @@ msgstr "" msgid "cannot read ELF header of %s(%s): %s" msgstr "" -#: src/nm.c:74 src/readelf.c:72 src/strip.c:72 +#: src/nm.c:74 src/strip.c:72 msgid "Output selection:" msgstr "" @@ -816,7 +817,7 @@ msgstr "" #: src/nm.c:363 src/size.c:301 src/strip.c:432 src/strip.c:467 #: src/ldgeneric.c:1767 src/ldgeneric.c:4257 src/findtextrel.c:229 -#: src/elfcmp.c:574 src/ranlib.c:169 src/strings.c:183 src/unstrip.c:1899 +#: src/elfcmp.c:607 src/ranlib.c:169 src/strings.c:183 src/unstrip.c:1899 #: src/unstrip.c:1928 #, c-format msgid "cannot open '%s'" @@ -864,11 +865,11 @@ msgstr "" msgid "cannot create search tree" msgstr "" -#: src/nm.c:740 src/nm.c:1002 src/readelf.c:860 src/readelf.c:1003 -#: src/readelf.c:1144 src/readelf.c:1326 src/readelf.c:1524 src/readelf.c:1710 -#: src/readelf.c:1920 src/readelf.c:2174 src/readelf.c:2240 src/readelf.c:2318 -#: src/readelf.c:2815 src/readelf.c:2851 src/readelf.c:2913 src/readelf.c:6476 -#: src/readelf.c:7329 src/readelf.c:7474 src/readelf.c:7543 src/size.c:425 +#: src/nm.c:740 src/nm.c:1002 src/readelf.c:883 src/readelf.c:1026 +#: src/readelf.c:1167 src/readelf.c:1349 src/readelf.c:1547 src/readelf.c:1733 +#: src/readelf.c:1943 src/readelf.c:2197 src/readelf.c:2263 src/readelf.c:2341 +#: src/readelf.c:2838 src/readelf.c:2874 src/readelf.c:2936 src/readelf.c:6508 +#: src/readelf.c:7393 src/readelf.c:7540 src/readelf.c:7610 src/size.c:425 #: src/size.c:499 src/strip.c:482 src/objdump.c:744 #, c-format msgid "cannot get section header string table index" @@ -919,342 +920,360 @@ msgstr "" msgid "%s%s%s: no symbols" msgstr "" -#: src/readelf.c:73 -msgid "Equivalent to: -e -h -l" +#: src/readelf.c:72 +msgid "ELF output selection:" msgstr "" #: src/readelf.c:74 -msgid "Display the dynamic segment" +msgid "All these plus -p .strtab -p .dynstr -p .comment" msgstr "" #: src/readelf.c:75 +msgid "Display the dynamic segment" +msgstr "" + +#: src/readelf.c:76 msgid "Display the ELF file header" msgstr "" -#: src/readelf.c:77 +#: src/readelf.c:78 msgid "Display histogram of bucket list lengths" msgstr "" -#: src/readelf.c:78 +#: src/readelf.c:79 msgid "Display the program headers" msgstr "" -#: src/readelf.c:80 +#: src/readelf.c:81 msgid "Display relocations" msgstr "" -#: src/readelf.c:81 -msgid "Display the sections' header" +#: src/readelf.c:82 +msgid "Display the sections' headers" msgstr "" -#: src/readelf.c:83 +#: src/readelf.c:84 msgid "Display the symbol table" msgstr "" -#: src/readelf.c:84 +#: src/readelf.c:85 msgid "Display versioning information" msgstr "" #: src/readelf.c:86 -msgid "" -"Display DWARF section content. SECTION can be one of abbrev, aranges, " -"frame, info, loc, line, ranges, pubnames, str, macinfo, or exception" +msgid "Display the ELF notes" msgstr "" -#: src/readelf.c:89 -msgid "Display the core notes" +#: src/readelf.c:88 +msgid "Display architecture specific information, if any" msgstr "" -#: src/readelf.c:91 -msgid "Display architecture specific information (if any)" +#: src/readelf.c:90 +msgid "Display sections for exception handling" msgstr "" -#: src/readelf.c:93 -msgid "Dump the uninterpreted contents of SECTION, by number or name" +#: src/readelf.c:92 +msgid "Additional output selection:" msgstr "" -#: src/readelf.c:95 -msgid "Print string contents of sections" +#: src/readelf.c:94 +msgid "" +"Display DWARF section content. SECTION can be one of abbrev, aranges, " +"frame, info, loc, line, ranges, pubnames, str, macinfo, or exception" msgstr "" #: src/readelf.c:98 -msgid "Display the symbol index of an archive" +msgid "Dump the uninterpreted contents of SECTION, by number or name" msgstr "" -#: src/readelf.c:99 -msgid "Display sections for exception handling" +#: src/readelf.c:100 +msgid "Print string contents of sections" +msgstr "" + +#: src/readelf.c:103 +msgid "Display the symbol index of an archive" msgstr "" -#: src/readelf.c:102 +#: src/readelf.c:105 msgid "Output control:" msgstr "" -#: src/readelf.c:104 +#: src/readelf.c:107 msgid "Do not find symbol names for addresses in DWARF data" msgstr "" -#: src/readelf.c:110 +#: src/readelf.c:113 msgid "Print information from ELF file in human-readable form." msgstr "" -#: src/readelf.c:114 src/elflint.c:85 +#: src/readelf.c:117 src/elflint.c:85 msgid "FILE..." msgstr "" -#: src/readelf.c:266 src/elflint.c:158 +#: src/readelf.c:271 src/elflint.c:158 #, c-format msgid "cannot open input file" msgstr "" -#: src/readelf.c:394 +#: src/readelf.c:400 #, c-format msgid "Unknown DWARF debug section `%s'.\n" msgstr "" -#: src/readelf.c:418 src/elflint.c:222 +#: src/readelf.c:424 src/elflint.c:222 msgid "Missing file name.\n" msgstr "" -#: src/readelf.c:423 src/objdump.c:236 +#: src/readelf.c:429 src/objdump.c:236 msgid "No operation specified.\n" msgstr "" -#: src/readelf.c:458 +#: src/readelf.c:464 #, c-format msgid "cannot generate Elf descriptor: %s" msgstr "" -#: src/readelf.c:470 +#: src/readelf.c:476 #, c-format msgid "'%s' is not an archive, cannot print archive index" msgstr "" -#: src/readelf.c:475 +#: src/readelf.c:481 #, c-format msgid "error while closing Elf descriptor: %s" msgstr "" -#: src/readelf.c:567 +#: src/readelf.c:573 #, c-format msgid "cannot stat input file" msgstr "" -#: src/readelf.c:569 +#: src/readelf.c:575 #, c-format msgid "input file is empty" msgstr "" -#: src/readelf.c:571 +#: src/readelf.c:577 #, c-format msgid "failed reading '%s': %s" msgstr "" -#: src/readelf.c:606 +#: src/readelf.c:612 #, c-format msgid "cannot read ELF header: %s" msgstr "" -#: src/readelf.c:614 +#: src/readelf.c:620 #, c-format msgid "cannot create EBL handle" msgstr "" -#: src/readelf.c:621 src/strip.c:542 src/ldgeneric.c:661 src/ldgeneric.c:1122 +#: src/readelf.c:627 src/strip.c:542 src/ldgeneric.c:661 src/ldgeneric.c:1122 #, c-format msgid "cannot determine number of sections: %s" msgstr "" -#: src/readelf.c:707 +#: src/readelf.c:633 +#, c-format +msgid "cannot determine number of program headers: %s" +msgstr "" + +#: src/readelf.c:719 msgid "NONE (None)" msgstr "" -#: src/readelf.c:708 +#: src/readelf.c:720 msgid "REL (Relocatable file)" msgstr "" -#: src/readelf.c:709 +#: src/readelf.c:721 msgid "EXEC (Executable file)" msgstr "" -#: src/readelf.c:710 +#: src/readelf.c:722 msgid "DYN (Shared object file)" msgstr "" -#: src/readelf.c:711 +#: src/readelf.c:723 msgid "CORE (Core file)" msgstr "" -#: src/readelf.c:716 +#: src/readelf.c:728 #, c-format msgid "OS Specific: (%x)\n" msgstr "" -#: src/readelf.c:718 +#: src/readelf.c:730 #, c-format msgid "Processor Specific: (%x)\n" msgstr "" -#: src/readelf.c:728 +#: src/readelf.c:740 msgid "" "ELF Header:\n" " Magic: " msgstr "" -#: src/readelf.c:732 +#: src/readelf.c:744 #, c-format msgid "" "\n" " Class: %s\n" msgstr "" -#: src/readelf.c:737 +#: src/readelf.c:749 #, c-format msgid " Data: %s\n" msgstr "" -#: src/readelf.c:743 +#: src/readelf.c:755 #, c-format msgid " Ident Version: %hhd %s\n" msgstr "" -#: src/readelf.c:745 src/readelf.c:762 +#: src/readelf.c:757 src/readelf.c:774 msgid "(current)" msgstr "" -#: src/readelf.c:749 +#: src/readelf.c:761 #, c-format msgid " OS/ABI: %s\n" msgstr "" -#: src/readelf.c:752 +#: src/readelf.c:764 #, c-format msgid " ABI Version: %hhd\n" msgstr "" -#: src/readelf.c:755 +#: src/readelf.c:767 msgid " Type: " msgstr "" -#: src/readelf.c:758 +#: src/readelf.c:770 #, c-format msgid " Machine: %s\n" msgstr "" -#: src/readelf.c:760 +#: src/readelf.c:772 #, c-format msgid " Version: %d %s\n" msgstr "" -#: src/readelf.c:764 +#: src/readelf.c:776 #, c-format msgid " Entry point address: %#<PRIx64>\n" msgstr "" -#: src/readelf.c:767 +#: src/readelf.c:779 #, c-format msgid " Start of program headers: %<PRId64> %s\n" msgstr "" -#: src/readelf.c:768 src/readelf.c:771 +#: src/readelf.c:780 src/readelf.c:783 msgid "(bytes into file)" msgstr "" -#: src/readelf.c:770 +#: src/readelf.c:782 #, c-format msgid " Start of section headers: %<PRId64> %s\n" msgstr "" -#: src/readelf.c:773 +#: src/readelf.c:785 #, c-format msgid " Flags: %s\n" msgstr "" -#: src/readelf.c:776 +#: src/readelf.c:788 #, c-format msgid " Size of this header: %<PRId16> %s\n" msgstr "" -#: src/readelf.c:777 src/readelf.c:780 src/readelf.c:786 +#: src/readelf.c:789 src/readelf.c:792 src/readelf.c:809 msgid "(bytes)" msgstr "" -#: src/readelf.c:779 +#: src/readelf.c:791 #, c-format msgid " Size of program header entries: %<PRId16> %s\n" msgstr "" -#: src/readelf.c:782 +#: src/readelf.c:794 #, c-format -msgid " Number of program headers entries: %<PRId16>\n" +msgid " Number of program headers entries: %<PRId16>" msgstr "" -#: src/readelf.c:785 +#: src/readelf.c:801 +#, c-format +msgid " (%<PRIu32> in [0].sh_info)" +msgstr "" + +#: src/readelf.c:804 src/readelf.c:821 src/readelf.c:835 +msgid " ([0] not available)" +msgstr "" + +#: src/readelf.c:808 #, c-format msgid " Size of section header entries: %<PRId16> %s\n" msgstr "" -#: src/readelf.c:788 +#: src/readelf.c:811 #, c-format msgid " Number of section headers entries: %<PRId16>" msgstr "" -#: src/readelf.c:795 +#: src/readelf.c:818 #, c-format msgid " (%<PRIu32> in [0].sh_size)" msgstr "" -#: src/readelf.c:798 src/readelf.c:812 -msgid " ([0] not available)" -msgstr "" - -#: src/readelf.c:808 +#: src/readelf.c:831 #, c-format msgid " (%<PRIu32> in [0].sh_link)" msgstr "" -#: src/readelf.c:816 +#: src/readelf.c:839 #, c-format msgid "" " Section header string table index: XINDEX%s\n" "\n" msgstr "" -#: src/readelf.c:820 +#: src/readelf.c:843 #, c-format msgid "" " Section header string table index: %<PRId16>\n" "\n" msgstr "" -#: src/readelf.c:852 +#: src/readelf.c:875 #, c-format msgid "" "There are %d section headers, starting at offset %#<PRIx64>:\n" "\n" msgstr "" -#: src/readelf.c:862 +#: src/readelf.c:885 msgid "Section Headers:" msgstr "" -#: src/readelf.c:865 +#: src/readelf.c:888 msgid "" "[Nr] Name Type Addr Off Size ES Flags Lk " "Inf Al" msgstr "" -#: src/readelf.c:867 +#: src/readelf.c:890 msgid "" "[Nr] Name Type Addr Off Size ES " "Flags Lk Inf Al" msgstr "" -#: src/readelf.c:874 src/readelf.c:1027 +#: src/readelf.c:897 src/readelf.c:1050 #, c-format msgid "cannot get section: %s" msgstr "" -#: src/readelf.c:881 src/readelf.c:1035 src/readelf.c:7494 src/unstrip.c:352 +#: src/readelf.c:904 src/readelf.c:1058 src/readelf.c:7560 src/unstrip.c:352 #: src/unstrip.c:376 src/unstrip.c:426 src/unstrip.c:535 src/unstrip.c:552 #: src/unstrip.c:590 src/unstrip.c:788 src/unstrip.c:1056 src/unstrip.c:1243 #: src/unstrip.c:1304 src/unstrip.c:1426 src/unstrip.c:1479 src/unstrip.c:1587 @@ -1263,39 +1282,39 @@ msgstr "" msgid "cannot get section header: %s" msgstr "" -#: src/readelf.c:939 +#: src/readelf.c:962 msgid "Program Headers:" msgstr "" -#: src/readelf.c:941 +#: src/readelf.c:964 msgid "" " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align" msgstr "" -#: src/readelf.c:944 +#: src/readelf.c:967 msgid "" " Type Offset VirtAddr PhysAddr FileSiz " "MemSiz Flg Align" msgstr "" -#: src/readelf.c:984 +#: src/readelf.c:1007 #, c-format msgid "\t[Requesting program interpreter: %s]\n" msgstr "" -#: src/readelf.c:1005 +#: src/readelf.c:1028 msgid "" "\n" " Section to Segment mapping:\n" " Segment Sections..." msgstr "" -#: src/readelf.c:1016 src/unstrip.c:1823 src/unstrip.c:1862 src/unstrip.c:1869 +#: src/readelf.c:1039 src/unstrip.c:1823 src/unstrip.c:1862 src/unstrip.c:1869 #, c-format msgid "cannot get program header: %s" msgstr "" -#: src/readelf.c:1150 +#: src/readelf.c:1173 #, c-format msgid "" "\n" @@ -1306,7 +1325,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1155 +#: src/readelf.c:1178 #, c-format msgid "" "\n" @@ -1317,15 +1336,15 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1163 +#: src/readelf.c:1186 msgid "<INVALID SYMBOL>" msgstr "" -#: src/readelf.c:1177 +#: src/readelf.c:1200 msgid "<INVALID SECTION>" msgstr "" -#: src/readelf.c:1328 +#: src/readelf.c:1351 #, c-format msgid "" "\n" @@ -1338,43 +1357,43 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1340 +#: src/readelf.c:1363 msgid " Type Value\n" msgstr "" -#: src/readelf.c:1364 +#: src/readelf.c:1387 #, c-format msgid "Shared library: [%s]\n" msgstr "" -#: src/readelf.c:1369 +#: src/readelf.c:1392 #, c-format msgid "Library soname: [%s]\n" msgstr "" -#: src/readelf.c:1374 +#: src/readelf.c:1397 #, c-format msgid "Library rpath: [%s]\n" msgstr "" -#: src/readelf.c:1379 +#: src/readelf.c:1402 #, c-format msgid "Library runpath: [%s]\n" msgstr "" -#: src/readelf.c:1399 +#: src/readelf.c:1422 #, c-format msgid "%<PRId64> (bytes)\n" msgstr "" -#: src/readelf.c:1509 src/readelf.c:1695 +#: src/readelf.c:1532 src/readelf.c:1718 #, c-format msgid "" "\n" "Invalid symbol table at offset %#0<PRIx64>\n" msgstr "" -#: src/readelf.c:1527 src/readelf.c:1712 +#: src/readelf.c:1550 src/readelf.c:1735 #, c-format msgid "" "\n" @@ -1387,7 +1406,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1542 +#: src/readelf.c:1565 #, c-format msgid "" "\n" @@ -1398,37 +1417,37 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1552 +#: src/readelf.c:1575 msgid " Offset Type Value Name\n" msgstr "" -#: src/readelf.c:1554 +#: src/readelf.c:1577 msgid " Offset Type Value Name\n" msgstr "" -#: src/readelf.c:1607 src/readelf.c:1618 src/readelf.c:1631 src/readelf.c:1649 -#: src/readelf.c:1661 src/readelf.c:1780 src/readelf.c:1792 src/readelf.c:1806 -#: src/readelf.c:1825 src/readelf.c:1838 +#: src/readelf.c:1630 src/readelf.c:1641 src/readelf.c:1654 src/readelf.c:1672 +#: src/readelf.c:1684 src/readelf.c:1803 src/readelf.c:1815 src/readelf.c:1829 +#: src/readelf.c:1848 src/readelf.c:1861 msgid "<INVALID RELOC>" msgstr "" -#: src/readelf.c:1619 src/readelf.c:1793 src/objdump.c:379 +#: src/readelf.c:1642 src/readelf.c:1816 src/objdump.c:379 msgid "INVALID SYMBOL" msgstr "" -#: src/readelf.c:1650 src/readelf.c:1826 src/objdump.c:394 +#: src/readelf.c:1673 src/readelf.c:1849 src/objdump.c:394 msgid "INVALID SECTION" msgstr "" -#: src/readelf.c:1724 +#: src/readelf.c:1747 msgid " Offset Type Value Addend Name\n" msgstr "" -#: src/readelf.c:1726 +#: src/readelf.c:1749 msgid " Offset Type Value Addend Name\n" msgstr "" -#: src/readelf.c:1927 +#: src/readelf.c:1950 #, c-format msgid "" "\n" @@ -1439,40 +1458,40 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1933 +#: src/readelf.c:1956 #, c-format msgid " %lu local symbol String table: [%2u] '%s'\n" msgid_plural " %lu local symbols String table: [%2u] '%s'\n" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1943 +#: src/readelf.c:1966 msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: src/readelf.c:1945 +#: src/readelf.c:1968 msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: src/readelf.c:1965 +#: src/readelf.c:1988 #, c-format msgid "%5u: %0*<PRIx64> %6<PRId64> %-7s %-6s %-9s %6s %s" msgstr "" -#: src/readelf.c:2053 +#: src/readelf.c:2076 #, c-format msgid "bad dynamic symbol" msgstr "" -#: src/readelf.c:2135 +#: src/readelf.c:2158 msgid "none" msgstr "" -#: src/readelf.c:2152 +#: src/readelf.c:2175 msgid "| <unknown>" msgstr "" -#: src/readelf.c:2177 +#: src/readelf.c:2200 #, c-format msgid "" "\n" @@ -1485,17 +1504,17 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2200 +#: src/readelf.c:2223 #, c-format msgid " %#06x: Version: %hu File: %s Cnt: %hu\n" msgstr "" -#: src/readelf.c:2213 +#: src/readelf.c:2236 #, c-format msgid " %#06x: Name: %s Flags: %s Version: %hu\n" msgstr "" -#: src/readelf.c:2244 +#: src/readelf.c:2267 #, c-format msgid "" "\n" @@ -1508,17 +1527,17 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2274 +#: src/readelf.c:2297 #, c-format msgid " %#06x: Version: %hd Flags: %s Index: %hd Cnt: %hd Name: %s\n" msgstr "" -#: src/readelf.c:2289 +#: src/readelf.c:2312 #, c-format msgid " %#06x: Parent %d: %s\n" msgstr "" -#: src/readelf.c:2521 +#: src/readelf.c:2544 #, c-format msgid "" "\n" @@ -1531,15 +1550,15 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2551 +#: src/readelf.c:2574 msgid " 0 *local* " msgstr "" -#: src/readelf.c:2556 +#: src/readelf.c:2579 msgid " 1 *global* " msgstr "" -#: src/readelf.c:2587 +#: src/readelf.c:2610 #, c-format msgid "" "\n" @@ -1554,41 +1573,41 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2610 +#: src/readelf.c:2633 #, c-format msgid " Length Number % of total Coverage\n" msgstr "" -#: src/readelf.c:2612 +#: src/readelf.c:2635 #, c-format msgid " 0 %6<PRIu32> %5.1f%%\n" msgstr "" -#: src/readelf.c:2619 +#: src/readelf.c:2642 #, c-format msgid "%7d %6<PRIu32> %5.1f%% %5.1f%%\n" msgstr "" -#: src/readelf.c:2632 +#: src/readelf.c:2655 #, c-format msgid "" " Average number of tests: successful lookup: %f\n" " unsuccessful lookup: %f\n" msgstr "" -#: src/readelf.c:2650 src/readelf.c:2692 src/readelf.c:2733 +#: src/readelf.c:2673 src/readelf.c:2715 src/readelf.c:2756 #, c-format msgid "cannot get data for section %d: %s" msgstr "" -#: src/readelf.c:2787 +#: src/readelf.c:2810 #, c-format msgid "" " Symbol Bias: %u\n" " Bitmask Size: %zu bytes %<PRIuFAST32>%% bits set 2nd hash shift: %u\n" msgstr "" -#: src/readelf.c:2861 +#: src/readelf.c:2884 #, c-format msgid "" "\n" @@ -1599,13 +1618,13 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2875 +#: src/readelf.c:2898 msgid "" " Library Time Stamp Checksum Version " "Flags" msgstr "" -#: src/readelf.c:2925 +#: src/readelf.c:2948 #, c-format msgid "" "\n" @@ -1613,140 +1632,140 @@ msgid "" "#0<PRIx64>:\n" msgstr "" -#: src/readelf.c:2941 +#: src/readelf.c:2964 msgid " Owner Size\n" msgstr "" -#: src/readelf.c:2967 +#: src/readelf.c:2990 #, c-format msgid " %-13s %4<PRIu32>\n" msgstr "" -#: src/readelf.c:2999 +#: src/readelf.c:3022 #, c-format msgid " %-4u %12<PRIu32>\n" msgstr "" -#: src/readelf.c:3004 +#: src/readelf.c:3027 #, c-format msgid " File: %11<PRIu32>\n" msgstr "" -#: src/readelf.c:3039 +#: src/readelf.c:3062 #, c-format msgid " %s: %<PRId64>, %s\n" msgstr "" -#: src/readelf.c:3042 +#: src/readelf.c:3065 #, c-format msgid " %s: %<PRId64>\n" msgstr "" -#: src/readelf.c:3045 +#: src/readelf.c:3068 #, c-format msgid " %s: %s\n" msgstr "" -#: src/readelf.c:3052 +#: src/readelf.c:3075 #, c-format msgid " %u: %<PRId64>\n" msgstr "" -#: src/readelf.c:3055 +#: src/readelf.c:3078 #, c-format msgid " %u: %s\n" msgstr "" -#: src/readelf.c:3091 +#: src/readelf.c:3114 #, c-format msgid "%s+%#<PRIx64> <%s+%#<PRIx64>>" msgstr "" -#: src/readelf.c:3094 +#: src/readelf.c:3117 #, c-format msgid "%s+%#0*<PRIx64> <%s+%#<PRIx64>>" msgstr "" -#: src/readelf.c:3099 +#: src/readelf.c:3122 #, c-format msgid "%#<PRIx64> <%s+%#<PRIx64>>" msgstr "" -#: src/readelf.c:3102 +#: src/readelf.c:3125 #, c-format msgid "%#0*<PRIx64> <%s+%#<PRIx64>>" msgstr "" -#: src/readelf.c:3108 +#: src/readelf.c:3131 #, c-format msgid "%s+%#<PRIx64> <%s>" msgstr "" -#: src/readelf.c:3111 +#: src/readelf.c:3134 #, c-format msgid "%s+%#0*<PRIx64> <%s>" msgstr "" -#: src/readelf.c:3115 +#: src/readelf.c:3138 #, c-format msgid "%#<PRIx64> <%s>" msgstr "" -#: src/readelf.c:3118 +#: src/readelf.c:3141 #, c-format msgid "%#0*<PRIx64> <%s>" msgstr "" -#: src/readelf.c:3123 +#: src/readelf.c:3146 #, c-format msgid "%s+%#<PRIx64>" msgstr "" -#: src/readelf.c:3126 +#: src/readelf.c:3149 #, c-format msgid "%s+%#0*<PRIx64>" msgstr "" -#: src/readelf.c:3234 +#: src/readelf.c:3257 #, c-format msgid "unknown tag %hx" msgstr "" -#: src/readelf.c:3236 +#: src/readelf.c:3259 #, c-format msgid "unknown user tag %hx" msgstr "" -#: src/readelf.c:3446 +#: src/readelf.c:3477 #, c-format msgid "unknown attribute %hx" msgstr "" -#: src/readelf.c:3449 +#: src/readelf.c:3480 #, c-format msgid "unknown user attribute %hx" msgstr "" -#: src/readelf.c:3495 +#: src/readelf.c:3526 #, c-format msgid "unknown form %<PRIx64>" msgstr "" -#: src/readelf.c:3729 +#: src/readelf.c:3760 msgid "empty block" msgstr "" -#: src/readelf.c:3732 +#: src/readelf.c:3763 #, c-format msgid "%zu byte block:" msgstr "" -#: src/readelf.c:4141 +#: src/readelf.c:4172 #, c-format msgid "%*s[%4<PRIuMAX>] %s <TRUNCATED>\n" msgstr "" -#: src/readelf.c:4154 +#: src/readelf.c:4185 #, c-format msgid "" "\n" @@ -1754,37 +1773,37 @@ msgid "" " [ Code]\n" msgstr "" -#: src/readelf.c:4161 +#: src/readelf.c:4192 #, c-format msgid "" "\n" "Abbreviation section at offset %<PRIu64>:\n" msgstr "" -#: src/readelf.c:4174 +#: src/readelf.c:4205 #, c-format msgid " *** error while reading abbreviation: %s\n" msgstr "" -#: src/readelf.c:4190 +#: src/readelf.c:4221 #, c-format msgid " [%5u] offset: %<PRId64>, children: %s, tag: %s\n" msgstr "" -#: src/readelf.c:4193 +#: src/readelf.c:4224 msgid "yes" msgstr "" -#: src/readelf.c:4193 +#: src/readelf.c:4224 msgid "no" msgstr "" -#: src/readelf.c:4229 +#: src/readelf.c:4260 #, c-format msgid "cannot get .debug_aranges content: %s" msgstr "" -#: src/readelf.c:4234 +#: src/readelf.c:4265 #, c-format msgid "" "\n" @@ -1795,118 +1814,118 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:4264 +#: src/readelf.c:4295 #, c-format msgid " [%*zu] ???\n" msgstr "" -#: src/readelf.c:4266 +#: src/readelf.c:4297 #, c-format msgid "" " [%*zu] start: %0#*<PRIx64>, length: %5<PRIu64>, CU DIE offset: %6<PRId64>\n" msgstr "" -#: src/readelf.c:4285 +#: src/readelf.c:4316 #, c-format msgid "cannot get .debug_ranges content: %s" msgstr "" -#: src/readelf.c:4290 src/readelf.c:4773 src/readelf.c:5436 src/readelf.c:5881 -#: src/readelf.c:5976 src/readelf.c:6148 +#: src/readelf.c:4321 src/readelf.c:4804 src/readelf.c:5467 src/readelf.c:5912 +#: src/readelf.c:6007 src/readelf.c:6179 #, c-format msgid "" "\n" "DWARF section [%2zu] '%s' at offset %#<PRIx64>:\n" msgstr "" -#: src/readelf.c:4304 src/readelf.c:5895 +#: src/readelf.c:4335 src/readelf.c:5926 #, c-format msgid " [%6tx] <INVALID DATA>\n" msgstr "" -#: src/readelf.c:4326 src/readelf.c:5917 +#: src/readelf.c:4357 src/readelf.c:5948 #, c-format msgid " [%6tx] base address %s\n" msgstr "" -#: src/readelf.c:4337 +#: src/readelf.c:4368 #, c-format msgid " [%6tx] %s..%s\n" msgstr "" -#: src/readelf.c:4339 +#: src/readelf.c:4370 #, c-format msgid " %s..%s\n" msgstr "" -#: src/readelf.c:4762 src/readelf.c:6214 src/readelf.c:6316 +#: src/readelf.c:4793 src/readelf.c:6245 src/readelf.c:6347 #, c-format msgid "cannot get %s content: %s" msgstr "" -#: src/readelf.c:4769 +#: src/readelf.c:4800 #, c-format msgid "" "\n" "Call frame information section [%2zu] '%s' at offset %#<PRIx64>:\n" msgstr "" -#: src/readelf.c:4796 src/readelf.c:5470 +#: src/readelf.c:4827 src/readelf.c:5501 #, c-format msgid "invalid data in section [%zu] '%s'" msgstr "" -#: src/readelf.c:4818 +#: src/readelf.c:4849 #, c-format msgid "" "\n" " [%6tx] Zero terminator\n" msgstr "" -#: src/readelf.c:4896 +#: src/readelf.c:4927 msgid "FDE address encoding: " msgstr "" -#: src/readelf.c:4902 +#: src/readelf.c:4933 msgid "LSDA pointer encoding: " msgstr "" -#: src/readelf.c:4947 +#: src/readelf.c:4978 #, c-format msgid "invalid augmentation encoding" msgstr "" -#: src/readelf.c:5018 +#: src/readelf.c:5049 #, c-format msgid " (offset: %#<PRIx64>)" msgstr "" -#: src/readelf.c:5025 +#: src/readelf.c:5056 #, c-format msgid " (end offset: %#<PRIx64>)" msgstr "" -#: src/readelf.c:5052 +#: src/readelf.c:5083 #, c-format msgid " %-26sLSDA pointer: %#<PRIx64>\n" msgstr "" -#: src/readelf.c:5098 +#: src/readelf.c:5129 #, c-format msgid "cannot get attribute code: %s" msgstr "" -#: src/readelf.c:5106 +#: src/readelf.c:5137 #, c-format msgid "cannot get attribute form: %s" msgstr "" -#: src/readelf.c:5119 +#: src/readelf.c:5150 #, c-format msgid "cannot get attribute value: %s" msgstr "" -#: src/readelf.c:5315 +#: src/readelf.c:5346 #, c-format msgid "" "\n" @@ -1914,7 +1933,7 @@ msgid "" " [Offset]\n" msgstr "" -#: src/readelf.c:5340 +#: src/readelf.c:5371 #, c-format msgid "" " Compilation unit at offset %<PRIu64>:\n" @@ -1922,44 +1941,44 @@ msgid "" "<PRIu8>, Offset size: %<PRIu8>\n" msgstr "" -#: src/readelf.c:5358 +#: src/readelf.c:5389 #, c-format msgid "cannot get DIE at offset %<PRIu64> in section '%s': %s" msgstr "" -#: src/readelf.c:5369 +#: src/readelf.c:5400 #, c-format msgid "cannot get DIE offset: %s" msgstr "" -#: src/readelf.c:5377 +#: src/readelf.c:5408 #, c-format msgid "cannot get tag of DIE at offset %<PRIu64> in section '%s': %s" msgstr "" -#: src/readelf.c:5406 +#: src/readelf.c:5437 #, c-format msgid "cannot get next DIE: %s\n" msgstr "" -#: src/readelf.c:5413 +#: src/readelf.c:5444 #, c-format msgid "cannot get next DIE: %s" msgstr "" -#: src/readelf.c:5448 +#: src/readelf.c:5479 #, c-format msgid "cannot get line data section data: %s" msgstr "" -#: src/readelf.c:5461 +#: src/readelf.c:5492 #, c-format msgid "" "\n" "Table at offset %Zu:\n" msgstr "" -#: src/readelf.c:5513 +#: src/readelf.c:5544 #, c-format msgid "" "\n" @@ -1975,154 +1994,154 @@ msgid "" "Opcodes:\n" msgstr "" -#: src/readelf.c:5532 +#: src/readelf.c:5563 #, c-format msgid "invalid data at offset %tu in section [%zu] '%s'" msgstr "" -#: src/readelf.c:5547 +#: src/readelf.c:5578 #, c-format msgid " [%*<PRIuFAST8>] %hhu argument\n" msgid_plural " [%*<PRIuFAST8>] %hhu arguments\n" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:5555 +#: src/readelf.c:5586 msgid "" "\n" "Directory table:" msgstr "" -#: src/readelf.c:5571 +#: src/readelf.c:5602 msgid "" "\n" "File name table:\n" " Entry Dir Time Size Name" msgstr "" -#: src/readelf.c:5600 +#: src/readelf.c:5631 msgid "" "\n" "Line number statements:" msgstr "" -#: src/readelf.c:5661 +#: src/readelf.c:5692 #, c-format msgid " special opcode %u: address+%u = %s, line%+d = %zu\n" msgstr "" -#: src/readelf.c:5681 +#: src/readelf.c:5712 #, c-format msgid " extended opcode %u: " msgstr "" -#: src/readelf.c:5686 +#: src/readelf.c:5717 msgid "end of sequence" msgstr "" -#: src/readelf.c:5701 +#: src/readelf.c:5732 #, c-format msgid "set address to %s\n" msgstr "" -#: src/readelf.c:5722 +#: src/readelf.c:5753 #, c-format msgid "define new file: dir=%u, mtime=%<PRIu64>, length=%<PRIu64>, name=%s\n" msgstr "" -#: src/readelf.c:5731 +#: src/readelf.c:5762 msgid "unknown opcode" msgstr "" -#: src/readelf.c:5743 +#: src/readelf.c:5774 msgid " copy" msgstr "" -#: src/readelf.c:5753 +#: src/readelf.c:5784 #, c-format msgid "advance address by %u to %s\n" msgstr "" -#: src/readelf.c:5764 +#: src/readelf.c:5795 #, c-format msgid " advance line by constant %d to %<PRId64>\n" msgstr "" -#: src/readelf.c:5772 +#: src/readelf.c:5803 #, c-format msgid " set file to %<PRIu64>\n" msgstr "" -#: src/readelf.c:5782 +#: src/readelf.c:5813 #, c-format msgid " set column to %<PRIu64>\n" msgstr "" -#: src/readelf.c:5789 +#: src/readelf.c:5820 #, c-format msgid " set '%s' to %<PRIuFAST8>\n" msgstr "" -#: src/readelf.c:5795 +#: src/readelf.c:5826 msgid " set basic block flag" msgstr "" -#: src/readelf.c:5805 +#: src/readelf.c:5836 #, c-format msgid "advance address by constant %u to %s\n" msgstr "" -#: src/readelf.c:5821 +#: src/readelf.c:5852 #, c-format msgid "advance address by fixed value %u to %s\n" msgstr "" -#: src/readelf.c:5830 +#: src/readelf.c:5861 msgid " set prologue end flag" msgstr "" -#: src/readelf.c:5835 +#: src/readelf.c:5866 msgid " set epilogue begin flag" msgstr "" -#: src/readelf.c:5844 +#: src/readelf.c:5875 #, c-format msgid " unknown opcode with %<PRIu8> parameter:" msgid_plural " unknown opcode with %<PRIu8> parameters:" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:5876 +#: src/readelf.c:5907 #, c-format msgid "cannot get .debug_loc content: %s" msgstr "" -#: src/readelf.c:5931 +#: src/readelf.c:5962 #, c-format msgid " [%6tx] %s..%s" msgstr "" -#: src/readelf.c:5933 +#: src/readelf.c:5964 #, c-format msgid " %s..%s" msgstr "" -#: src/readelf.c:5986 +#: src/readelf.c:6017 #, c-format msgid "cannot get macro information section data: %s" msgstr "" -#: src/readelf.c:6065 +#: src/readelf.c:6096 #, c-format msgid "%*s*** non-terminated string at end of section" msgstr "" -#: src/readelf.c:6133 +#: src/readelf.c:6164 #, c-format msgid " [%5d] DIE offset: %6<PRId64>, CU DIE offset: %6<PRId64>, name: %s\n" msgstr "" -#: src/readelf.c:6172 +#: src/readelf.c:6203 #, c-format msgid "" "\n" @@ -2130,47 +2149,47 @@ msgid "" " %*s String\n" msgstr "" -#: src/readelf.c:6186 +#: src/readelf.c:6217 #, c-format msgid " *** error while reading strings: %s\n" msgstr "" -#: src/readelf.c:6206 +#: src/readelf.c:6237 #, c-format msgid "" "\n" "Call frame search table section [%2zu] '.eh_frame_hdr':\n" msgstr "" -#: src/readelf.c:6308 +#: src/readelf.c:6339 #, c-format msgid "" "\n" "Exception handling table section [%2zu] '.gcc_except_table':\n" msgstr "" -#: src/readelf.c:6331 +#: src/readelf.c:6362 #, c-format msgid " LPStart encoding: %#x " msgstr "" -#: src/readelf.c:6343 +#: src/readelf.c:6374 #, c-format msgid " TType encoding: %#x " msgstr "" -#: src/readelf.c:6357 +#: src/readelf.c:6388 #, c-format msgid " Call site encoding: %#x " msgstr "" -#: src/readelf.c:6370 +#: src/readelf.c:6401 msgid "" "\n" " Call site table:" msgstr "" -#: src/readelf.c:6384 +#: src/readelf.c:6415 #, c-format msgid "" " [%4u] Call site start: %#<PRIx64>\n" @@ -2179,128 +2198,128 @@ msgid "" " Action: %u\n" msgstr "" -#: src/readelf.c:6444 +#: src/readelf.c:6475 #, c-format msgid "invalid TType encoding" msgstr "" -#: src/readelf.c:6467 +#: src/readelf.c:6499 #, c-format msgid "cannot get debug context descriptor: %s" msgstr "" -#: src/readelf.c:6602 src/readelf.c:7167 +#: src/readelf.c:6635 src/readelf.c:7227 #, c-format msgid "cannot convert core note data: %s" msgstr "" -#: src/readelf.c:6907 +#: src/readelf.c:6967 #, c-format msgid "" "\n" "%*s... <repeats %u more times> ..." msgstr "" -#: src/readelf.c:7265 +#: src/readelf.c:7326 msgid " Owner Data size Type\n" msgstr "" -#: src/readelf.c:7283 +#: src/readelf.c:7344 #, c-format msgid " %-13.*s %9<PRId32> %s\n" msgstr "" -#: src/readelf.c:7314 +#: src/readelf.c:7378 #, c-format msgid "cannot get content of note section: %s" msgstr "" -#: src/readelf.c:7341 +#: src/readelf.c:7405 #, c-format msgid "" "\n" "Note section [%2zu] '%s' of %<PRIu64> bytes at offset %#0<PRIx64>:\n" msgstr "" -#: src/readelf.c:7364 +#: src/readelf.c:7428 #, c-format msgid "" "\n" "Note segment of %<PRIu64> bytes at offset %#0<PRIx64>:\n" msgstr "" -#: src/readelf.c:7410 +#: src/readelf.c:7474 #, c-format msgid "" "\n" "Section [%Zu] '%s' has no data to dump.\n" msgstr "" -#: src/readelf.c:7416 src/readelf.c:7438 +#: src/readelf.c:7480 src/readelf.c:7503 #, c-format msgid "cannot get data for section [%Zu] '%s': %s" msgstr "" -#: src/readelf.c:7420 +#: src/readelf.c:7484 #, c-format msgid "" "\n" "Hex dump of section [%Zu] '%s', %<PRIu64> bytes at offset %#0<PRIx64>:\n" msgstr "" -#: src/readelf.c:7433 +#: src/readelf.c:7497 #, c-format msgid "" "\n" -"Section [%Zu] '%s' is empty.\n" +"Section [%Zu] '%s' has no strings to dump.\n" msgstr "" -#: src/readelf.c:7442 +#: src/readelf.c:7507 #, c-format msgid "" "\n" "String section [%Zu] '%s' contains %<PRIu64> bytes at offset %#0<PRIx64>:\n" msgstr "" -#: src/readelf.c:7489 +#: src/readelf.c:7555 #, c-format msgid "" "\n" "section [%lu] does not exist" msgstr "" -#: src/readelf.c:7515 +#: src/readelf.c:7582 #, c-format msgid "" "\n" "section '%s' does not exist" msgstr "" -#: src/readelf.c:7576 +#: src/readelf.c:7643 #, c-format msgid "cannot get symbol index of archive '%s': %s" msgstr "" -#: src/readelf.c:7579 +#: src/readelf.c:7646 #, c-format msgid "" "\n" "Archive '%s' has no symbol index\n" msgstr "" -#: src/readelf.c:7583 +#: src/readelf.c:7650 #, c-format msgid "" "\n" "Index of archive '%s' has %Zu entries:\n" msgstr "" -#: src/readelf.c:7601 +#: src/readelf.c:7668 #, c-format msgid "cannot extract member at offset %Zu in '%s': %s" msgstr "" -#: src/readelf.c:7606 +#: src/readelf.c:7673 #, c-format msgid "Archive member '%s' contains:\n" msgstr "" @@ -3257,1552 +3276,1559 @@ msgstr "" msgid "Not an ELF file - it has the wrong magic bytes at the start\n" msgstr "" -#: src/elflint.c:368 +#: src/elflint.c:369 #, c-format msgid "e_ident[%d] == %d is no known class\n" msgstr "" -#: src/elflint.c:373 +#: src/elflint.c:374 #, c-format msgid "e_ident[%d] == %d is no known data encoding\n" msgstr "" -#: src/elflint.c:377 +#: src/elflint.c:378 #, c-format msgid "unknown ELF header version number e_ident[%d] == %d\n" msgstr "" -#: src/elflint.c:383 +#: src/elflint.c:384 #, c-format msgid "unsupported OS ABI e_ident[%d] == '%s'\n" msgstr "" -#: src/elflint.c:389 +#: src/elflint.c:390 #, c-format msgid "unsupport ABI version e_ident[%d] == %d\n" msgstr "" -#: src/elflint.c:394 +#: src/elflint.c:395 #, c-format msgid "e_ident[%zu] is not zero\n" msgstr "" -#: src/elflint.c:399 +#: src/elflint.c:400 #, c-format msgid "unknown object file type %d\n" msgstr "" -#: src/elflint.c:406 +#: src/elflint.c:407 #, c-format msgid "unknown machine type %d\n" msgstr "" -#: src/elflint.c:410 +#: src/elflint.c:411 #, c-format msgid "unknown object file version\n" msgstr "" -#: src/elflint.c:416 +#: src/elflint.c:417 #, c-format msgid "invalid program header offset\n" msgstr "" -#: src/elflint.c:418 +#: src/elflint.c:419 #, c-format msgid "executables and DSOs cannot have zero program header offset\n" msgstr "" -#: src/elflint.c:422 +#: src/elflint.c:423 #, c-format msgid "invalid number of program header entries\n" msgstr "" -#: src/elflint.c:430 +#: src/elflint.c:431 #, c-format msgid "invalid section header table offset\n" msgstr "" -#: src/elflint.c:433 +#: src/elflint.c:434 #, c-format msgid "section header table must be present\n" msgstr "" -#: src/elflint.c:447 +#: src/elflint.c:448 #, c-format msgid "invalid number of section header table entries\n" msgstr "" -#: src/elflint.c:464 +#: src/elflint.c:465 #, c-format msgid "invalid section header index\n" msgstr "" -#: src/elflint.c:469 +#: src/elflint.c:479 +#, c-format +msgid "invalid number of program header table entries\n" +msgstr "" + +#: src/elflint.c:488 #, c-format msgid "invalid machine flags: %s\n" msgstr "" -#: src/elflint.c:476 src/elflint.c:493 +#: src/elflint.c:495 src/elflint.c:512 #, c-format msgid "invalid ELF header size: %hd\n" msgstr "" -#: src/elflint.c:479 src/elflint.c:496 +#: src/elflint.c:498 src/elflint.c:515 #, c-format msgid "invalid program header size: %hd\n" msgstr "" -#: src/elflint.c:482 src/elflint.c:499 +#: src/elflint.c:501 src/elflint.c:518 #, c-format msgid "invalid program header position or size\n" msgstr "" -#: src/elflint.c:485 src/elflint.c:502 +#: src/elflint.c:504 src/elflint.c:521 #, c-format msgid "invalid section header size: %hd\n" msgstr "" -#: src/elflint.c:488 src/elflint.c:505 +#: src/elflint.c:507 src/elflint.c:524 #, c-format msgid "invalid section header position or size\n" msgstr "" -#: src/elflint.c:549 +#: src/elflint.c:568 #, c-format msgid "" "section [%2d] '%s': section with SHF_GROUP flag set not part of a section " "group\n" msgstr "" -#: src/elflint.c:553 +#: src/elflint.c:572 #, c-format msgid "" "section [%2d] '%s': section group [%2zu] '%s' does not preceed group member\n" msgstr "" -#: src/elflint.c:569 src/elflint.c:1412 src/elflint.c:1462 src/elflint.c:1571 -#: src/elflint.c:2165 src/elflint.c:2679 src/elflint.c:2840 src/elflint.c:2970 -#: src/elflint.c:3142 src/elflint.c:4040 +#: src/elflint.c:588 src/elflint.c:1431 src/elflint.c:1481 src/elflint.c:1590 +#: src/elflint.c:2184 src/elflint.c:2698 src/elflint.c:2859 src/elflint.c:2989 +#: src/elflint.c:3161 src/elflint.c:4061 #, c-format msgid "section [%2d] '%s': cannot get section data\n" msgstr "" -#: src/elflint.c:582 src/elflint.c:1578 +#: src/elflint.c:601 src/elflint.c:1597 #, c-format msgid "" "section [%2d] '%s': referenced as string table for section [%2d] '%s' but " "type is not SHT_STRTAB\n" msgstr "" -#: src/elflint.c:605 +#: src/elflint.c:624 #, c-format msgid "" "section [%2d] '%s': symbol table cannot have more than one extended index " "section\n" msgstr "" -#: src/elflint.c:616 +#: src/elflint.c:635 #, c-format msgid "section [%2u] '%s': entry size is does not match ElfXX_Sym\n" msgstr "" -#: src/elflint.c:625 +#: src/elflint.c:644 #, c-format msgid "section [%2d] '%s': cannot get symbol %d: %s\n" msgstr "" -#: src/elflint.c:630 src/elflint.c:633 src/elflint.c:636 src/elflint.c:639 -#: src/elflint.c:642 src/elflint.c:645 +#: src/elflint.c:649 src/elflint.c:652 src/elflint.c:655 src/elflint.c:658 +#: src/elflint.c:661 src/elflint.c:664 #, c-format msgid "section [%2d] '%s': '%s' in zeroth entry not zero\n" msgstr "" -#: src/elflint.c:648 +#: src/elflint.c:667 #, c-format msgid "section [%2d] '%s': XINDEX for zeroth entry not zero\n" msgstr "" -#: src/elflint.c:658 +#: src/elflint.c:677 #, c-format msgid "section [%2d] '%s': cannot get symbol %zu: %s\n" msgstr "" -#: src/elflint.c:667 +#: src/elflint.c:686 #, c-format msgid "section [%2d] '%s': symbol %zu: invalid name value\n" msgstr "" -#: src/elflint.c:680 +#: src/elflint.c:699 #, c-format msgid "" "section [%2d] '%s': symbol %zu: too large section index but no extended " "section index section\n" msgstr "" -#: src/elflint.c:686 +#: src/elflint.c:705 #, c-format msgid "" "section [%2d] '%s': symbol %zu: XINDEX used for index which would fit in " "st_shndx (%<PRIu32>)\n" msgstr "" -#: src/elflint.c:698 +#: src/elflint.c:717 #, c-format msgid "section [%2d] '%s': symbol %zu: invalid section index\n" msgstr "" -#: src/elflint.c:706 +#: src/elflint.c:725 #, c-format msgid "section [%2d] '%s': symbol %zu: unknown type\n" msgstr "" -#: src/elflint.c:712 +#: src/elflint.c:731 #, c-format msgid "section [%2d] '%s': symbol %zu: unknown symbol binding\n" msgstr "" -#: src/elflint.c:717 +#: src/elflint.c:736 #, c-format msgid "section [%2d] '%s': symbol %zu: unique symbol not of object type\n" msgstr "" -#: src/elflint.c:725 +#: src/elflint.c:744 #, c-format msgid "" "section [%2d] '%s': symbol %zu: COMMON only allowed in relocatable files\n" msgstr "" -#: src/elflint.c:729 +#: src/elflint.c:748 #, c-format msgid "section [%2d] '%s': symbol %zu: local COMMON symbols are nonsense\n" msgstr "" -#: src/elflint.c:733 +#: src/elflint.c:752 #, c-format msgid "" "section [%2d] '%s': symbol %zu: function in COMMON section is nonsense\n" msgstr "" -#: src/elflint.c:765 +#: src/elflint.c:784 #, c-format msgid "section [%2d] '%s': symbol %zu: st_value out of bounds\n" msgstr "" -#: src/elflint.c:771 src/elflint.c:796 src/elflint.c:839 +#: src/elflint.c:790 src/elflint.c:815 src/elflint.c:858 #, c-format msgid "" "section [%2d] '%s': symbol %zu does not fit completely in referenced section " "[%2d] '%s'\n" msgstr "" -#: src/elflint.c:780 +#: src/elflint.c:799 #, c-format msgid "" "section [%2d] '%s': symbol %zu: referenced section [%2d] '%s' does not have " "SHF_TLS flag set\n" msgstr "" -#: src/elflint.c:790 src/elflint.c:832 +#: src/elflint.c:809 src/elflint.c:851 #, c-format msgid "" "section [%2d] '%s': symbol %zu: st_value out of bounds of referenced section " "[%2d] '%s'\n" msgstr "" -#: src/elflint.c:817 +#: src/elflint.c:836 #, c-format msgid "" "section [%2d] '%s': symbol %zu: TLS symbol but no TLS program header entry\n" msgstr "" -#: src/elflint.c:825 +#: src/elflint.c:844 #, c-format msgid "" "section [%2d] '%s': symbol %zu: st_value short of referenced section [%2d] '%" "s'\n" msgstr "" -#: src/elflint.c:852 +#: src/elflint.c:871 #, c-format msgid "" "section [%2d] '%s': symbol %zu: local symbol outside range described in " "sh_info\n" msgstr "" -#: src/elflint.c:859 +#: src/elflint.c:878 #, c-format msgid "" "section [%2d] '%s': symbol %zu: non-local symbol outside range described in " "sh_info\n" msgstr "" -#: src/elflint.c:866 +#: src/elflint.c:885 #, c-format msgid "section [%2d] '%s': symbol %zu: non-local section symbol\n" msgstr "" -#: src/elflint.c:916 +#: src/elflint.c:935 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol refers to bad section [%" "2d]\n" msgstr "" -#: src/elflint.c:923 +#: src/elflint.c:942 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol refers to section [%2d] '%" "s'\n" msgstr "" -#: src/elflint.c:939 +#: src/elflint.c:958 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol value %#<PRIx64> does not " "match %s section address %#<PRIx64>\n" msgstr "" -#: src/elflint.c:946 +#: src/elflint.c:965 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol size %<PRIu64> does not " "match %s section size %<PRIu64>\n" msgstr "" -#: src/elflint.c:954 +#: src/elflint.c:973 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol present, but no .got " "section\n" msgstr "" -#: src/elflint.c:970 +#: src/elflint.c:989 #, c-format msgid "" "section [%2d] '%s': _DYNAMIC_ symbol value %#<PRIx64> does not match dynamic " "segment address %#<PRIx64>\n" msgstr "" -#: src/elflint.c:977 +#: src/elflint.c:996 #, c-format msgid "" "section [%2d] '%s': _DYNAMIC symbol size %<PRIu64> does not match dynamic " "segment size %<PRIu64>\n" msgstr "" -#: src/elflint.c:990 +#: src/elflint.c:1009 #, c-format msgid "" "section [%2d] '%s': symbol %zu: symbol in dynamic symbol table with non-" "default visibility\n" msgstr "" -#: src/elflint.c:994 +#: src/elflint.c:1013 #, c-format msgid "section [%2d] '%s': symbol %zu: unknown bit set in st_other\n" msgstr "" -#: src/elflint.c:1039 +#: src/elflint.c:1058 #, c-format msgid "section [%2d] '%s': DT_RELCOUNT used for this RELA section\n" msgstr "" -#: src/elflint.c:1048 src/elflint.c:1100 +#: src/elflint.c:1067 src/elflint.c:1119 #, c-format msgid "section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n" msgstr "" -#: src/elflint.c:1073 src/elflint.c:1125 +#: src/elflint.c:1092 src/elflint.c:1144 #, c-format msgid "" "section [%2d] '%s': relative relocations after index %d as specified by " "DT_RELCOUNT\n" msgstr "" -#: src/elflint.c:1079 src/elflint.c:1131 +#: src/elflint.c:1098 src/elflint.c:1150 #, c-format msgid "" "section [%2d] '%s': non-relative relocation at index %zu; DT_RELCOUNT " "specified %d relative relocations\n" msgstr "" -#: src/elflint.c:1091 +#: src/elflint.c:1110 #, c-format msgid "section [%2d] '%s': DT_RELACOUNT used for this REL section\n" msgstr "" -#: src/elflint.c:1173 +#: src/elflint.c:1192 #, c-format msgid "section [%2d] '%s': invalid destination section index\n" msgstr "" -#: src/elflint.c:1186 +#: src/elflint.c:1205 #, c-format msgid "section [%2d] '%s': invalid destination section type\n" msgstr "" -#: src/elflint.c:1194 +#: src/elflint.c:1213 #, c-format msgid "section [%2d] '%s': sh_info should be zero\n" msgstr "" -#: src/elflint.c:1201 +#: src/elflint.c:1220 #, c-format msgid "section [%2d] '%s': no relocations for merge-able sections possible\n" msgstr "" -#: src/elflint.c:1208 +#: src/elflint.c:1227 #, c-format msgid "section [%2d] '%s': section entry size does not match ElfXX_Rela\n" msgstr "" -#: src/elflint.c:1268 +#: src/elflint.c:1287 #, c-format msgid "text relocation flag set but there is no read-only segment\n" msgstr "" -#: src/elflint.c:1295 +#: src/elflint.c:1314 #, c-format msgid "section [%2d] '%s': relocation %zu: invalid type\n" msgstr "" -#: src/elflint.c:1303 +#: src/elflint.c:1322 #, c-format msgid "" "section [%2d] '%s': relocation %zu: relocation type invalid for the file " "type\n" msgstr "" -#: src/elflint.c:1311 +#: src/elflint.c:1330 #, c-format msgid "section [%2d] '%s': relocation %zu: invalid symbol index\n" msgstr "" -#: src/elflint.c:1329 +#: src/elflint.c:1348 #, c-format msgid "" "section [%2d] '%s': relocation %zu: only symbol '_GLOBAL_OFFSET_TABLE_' can " "be used with %s\n" msgstr "" -#: src/elflint.c:1346 +#: src/elflint.c:1365 #, c-format msgid "section [%2d] '%s': relocation %zu: offset out of bounds\n" msgstr "" -#: src/elflint.c:1361 +#: src/elflint.c:1380 #, c-format msgid "" "section [%2d] '%s': relocation %zu: copy relocation against symbol of type %" "s\n" msgstr "" -#: src/elflint.c:1382 +#: src/elflint.c:1401 #, c-format msgid "" "section [%2d] '%s': relocation %zu: read-only section modified but text " "relocation flag not set\n" msgstr "" -#: src/elflint.c:1397 +#: src/elflint.c:1416 #, c-format msgid "section [%2d] '%s': relocations are against loaded and unloaded data\n" msgstr "" -#: src/elflint.c:1436 src/elflint.c:1486 +#: src/elflint.c:1455 src/elflint.c:1505 #, c-format msgid "section [%2d] '%s': cannot get relocation %zu: %s\n" msgstr "" -#: src/elflint.c:1566 +#: src/elflint.c:1585 #, c-format msgid "more than one dynamic section present\n" msgstr "" -#: src/elflint.c:1584 +#: src/elflint.c:1603 #, c-format msgid "section [%2d] '%s': section entry size does not match ElfXX_Dyn\n" msgstr "" -#: src/elflint.c:1589 src/elflint.c:1881 +#: src/elflint.c:1608 src/elflint.c:1900 #, c-format msgid "section [%2d] '%s': sh_info not zero\n" msgstr "" -#: src/elflint.c:1599 +#: src/elflint.c:1618 #, c-format msgid "section [%2d] '%s': cannot get dynamic section entry %zu: %s\n" msgstr "" -#: src/elflint.c:1607 +#: src/elflint.c:1626 #, c-format msgid "section [%2d] '%s': non-DT_NULL entries follow DT_NULL entry\n" msgstr "" -#: src/elflint.c:1614 +#: src/elflint.c:1633 #, c-format msgid "section [%2d] '%s': entry %zu: unknown tag\n" msgstr "" -#: src/elflint.c:1625 +#: src/elflint.c:1644 #, c-format msgid "section [%2d] '%s': entry %zu: more than one entry with tag %s\n" msgstr "" -#: src/elflint.c:1635 +#: src/elflint.c:1654 #, c-format msgid "section [%2d] '%s': entry %zu: level 2 tag %s used\n" msgstr "" -#: src/elflint.c:1653 +#: src/elflint.c:1672 #, c-format msgid "" "section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n" msgstr "" -#: src/elflint.c:1675 +#: src/elflint.c:1694 #, c-format msgid "" "section [%2d] '%s': entry %zu: pointer does not match address of section [%" "2d] '%s' referenced by sh_link\n" msgstr "" -#: src/elflint.c:1718 +#: src/elflint.c:1737 #, c-format msgid "" "section [%2d] '%s': entry %zu: %s value must point into loaded segment\n" msgstr "" -#: src/elflint.c:1733 +#: src/elflint.c:1752 #, c-format msgid "" "section [%2d] '%s': entry %zu: %s value must be valid offset in section [%" "2d] '%s'\n" msgstr "" -#: src/elflint.c:1753 src/elflint.c:1781 +#: src/elflint.c:1772 src/elflint.c:1800 #, c-format msgid "section [%2d] '%s': contains %s entry but not %s\n" msgstr "" -#: src/elflint.c:1765 +#: src/elflint.c:1784 #, c-format msgid "section [%2d] '%s': mandatory tag %s not present\n" msgstr "" -#: src/elflint.c:1774 +#: src/elflint.c:1793 #, c-format msgid "section [%2d] '%s': no hash section present\n" msgstr "" -#: src/elflint.c:1789 src/elflint.c:1796 +#: src/elflint.c:1808 src/elflint.c:1815 #, c-format msgid "section [%2d] '%s': not all of %s, %s, and %s are present\n" msgstr "" -#: src/elflint.c:1806 src/elflint.c:1810 +#: src/elflint.c:1825 src/elflint.c:1829 #, c-format msgid "section [%2d] '%s': %s tag missing in DSO marked during prelinking\n" msgstr "" -#: src/elflint.c:1816 +#: src/elflint.c:1835 #, c-format msgid "section [%2d] '%s': non-DSO file marked as dependency during prelink\n" msgstr "" -#: src/elflint.c:1827 src/elflint.c:1831 src/elflint.c:1835 src/elflint.c:1839 +#: src/elflint.c:1846 src/elflint.c:1850 src/elflint.c:1854 src/elflint.c:1858 #, c-format msgid "section [%2d] '%s': %s tag missing in prelinked executable\n" msgstr "" -#: src/elflint.c:1851 +#: src/elflint.c:1870 #, c-format msgid "" "section [%2d] '%s': only relocatable files can have extended section index\n" msgstr "" -#: src/elflint.c:1861 +#: src/elflint.c:1880 #, c-format msgid "" "section [%2d] '%s': extended section index section not for symbol table\n" msgstr "" -#: src/elflint.c:1866 +#: src/elflint.c:1885 #, c-format msgid "cannot get data for symbol section\n" msgstr "" -#: src/elflint.c:1869 +#: src/elflint.c:1888 #, c-format msgid "section [%2d] '%s': entry size does not match Elf32_Word\n" msgstr "" -#: src/elflint.c:1876 +#: src/elflint.c:1895 #, c-format msgid "section [%2d] '%s': extended index table too small for symbol table\n" msgstr "" -#: src/elflint.c:1891 +#: src/elflint.c:1910 #, c-format msgid "" "section [%2d] '%s': extended section index in section [%2zu] '%s' refers to " "same symbol table\n" msgstr "" -#: src/elflint.c:1902 +#: src/elflint.c:1921 #, c-format msgid "symbol 0 should have zero extended section index\n" msgstr "" -#: src/elflint.c:1914 +#: src/elflint.c:1933 #, c-format msgid "cannot get data for symbol %zu\n" msgstr "" -#: src/elflint.c:1919 +#: src/elflint.c:1938 #, c-format msgid "extended section index is %<PRIu32> but symbol index is not XINDEX\n" msgstr "" -#: src/elflint.c:1935 src/elflint.c:1976 +#: src/elflint.c:1954 src/elflint.c:1995 #, c-format msgid "" "section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n" msgstr "" -#: src/elflint.c:1947 src/elflint.c:1988 +#: src/elflint.c:1966 src/elflint.c:2007 #, c-format msgid "section [%2d] '%s': chain array too large\n" msgstr "" -#: src/elflint.c:1956 src/elflint.c:1997 +#: src/elflint.c:1975 src/elflint.c:2016 #, c-format msgid "section [%2d] '%s': hash bucket reference %zu out of bounds\n" msgstr "" -#: src/elflint.c:1962 +#: src/elflint.c:1981 #, c-format msgid "section [%2d] '%s': hash chain reference %zu out of bounds\n" msgstr "" -#: src/elflint.c:2003 +#: src/elflint.c:2022 #, c-format msgid "section [%2d] '%s': hash chain reference %<PRIu64> out of bounds\n" msgstr "" -#: src/elflint.c:2018 +#: src/elflint.c:2037 #, c-format msgid "section [%2d] '%s': bitmask size not power of 2: %u\n" msgstr "" -#: src/elflint.c:2029 +#: src/elflint.c:2048 #, c-format msgid "" "section [%2d] '%s': hash table section is too small (is %ld, expected at " "least%ld)\n" msgstr "" -#: src/elflint.c:2037 +#: src/elflint.c:2056 #, c-format msgid "section [%2d] '%s': 2nd hash function shift too big: %u\n" msgstr "" -#: src/elflint.c:2069 +#: src/elflint.c:2088 #, c-format msgid "" "section [%2d] '%s': hash chain for bucket %zu lower than symbol index bias\n" msgstr "" -#: src/elflint.c:2090 +#: src/elflint.c:2109 #, c-format msgid "" "section [%2d] '%s': symbol %u referenced in chain for bucket %zu is " "undefined\n" msgstr "" -#: src/elflint.c:2101 +#: src/elflint.c:2120 #, c-format msgid "" "section [%2d] '%s': hash value for symbol %u in chain for bucket %zu wrong\n" msgstr "" -#: src/elflint.c:2132 +#: src/elflint.c:2151 #, c-format msgid "section [%2d] '%s': hash chain for bucket %zu out of bounds\n" msgstr "" -#: src/elflint.c:2137 +#: src/elflint.c:2156 #, c-format msgid "" "section [%2d] '%s': symbol reference in chain for bucket %zu out of bounds\n" msgstr "" -#: src/elflint.c:2143 +#: src/elflint.c:2162 #, c-format msgid "section [%2d] '%s': bitmask does not match names in the hash table\n" msgstr "" -#: src/elflint.c:2156 +#: src/elflint.c:2175 #, c-format msgid "section [%2d] '%s': relocatable files cannot have hash tables\n" msgstr "" -#: src/elflint.c:2174 +#: src/elflint.c:2193 #, c-format msgid "section [%2d] '%s': hash table not for dynamic symbol table\n" msgstr "" -#: src/elflint.c:2182 +#: src/elflint.c:2201 #, c-format msgid "section [%2d] '%s': hash table entry size incorrect\n" msgstr "" -#: src/elflint.c:2187 +#: src/elflint.c:2206 #, c-format msgid "section [%2d] '%s': not marked to be allocated\n" msgstr "" -#: src/elflint.c:2192 +#: src/elflint.c:2211 #, c-format msgid "" "section [%2d] '%s': hash table has not even room for initial administrative " "entries\n" msgstr "" -#: src/elflint.c:2240 +#: src/elflint.c:2259 #, c-format msgid "sh_link in hash sections [%2zu] '%s' and [%2zu] '%s' not identical\n" msgstr "" -#: src/elflint.c:2318 src/elflint.c:2322 +#: src/elflint.c:2337 src/elflint.c:2341 #, c-format msgid "section [%2zu] '%s': reference to symbol index 0\n" msgstr "" -#: src/elflint.c:2329 +#: src/elflint.c:2348 #, c-format msgid "" "symbol %d referenced in new hash table in [%2zu] '%s' but not in old hash " "table in [%2zu] '%s'\n" msgstr "" -#: src/elflint.c:2341 +#: src/elflint.c:2360 #, c-format msgid "" "symbol %d referenced in old hash table in [%2zu] '%s' but not in new hash " "table in [%2zu] '%s'\n" msgstr "" -#: src/elflint.c:2357 +#: src/elflint.c:2376 #, c-format msgid "section [%2d] '%s': nonzero sh_%s for NULL section\n" msgstr "" -#: src/elflint.c:2377 +#: src/elflint.c:2396 #, c-format msgid "" "section [%2d] '%s': section groups only allowed in relocatable object files\n" msgstr "" -#: src/elflint.c:2388 +#: src/elflint.c:2407 #, c-format msgid "section [%2d] '%s': cannot get symbol table: %s\n" msgstr "" -#: src/elflint.c:2393 +#: src/elflint.c:2412 #, c-format msgid "section [%2d] '%s': section reference in sh_link is no symbol table\n" msgstr "" -#: src/elflint.c:2399 +#: src/elflint.c:2418 #, c-format msgid "section [%2d] '%s': invalid symbol index in sh_info\n" msgstr "" -#: src/elflint.c:2404 +#: src/elflint.c:2423 #, c-format msgid "section [%2d] '%s': sh_flags not zero\n" msgstr "" -#: src/elflint.c:2411 +#: src/elflint.c:2430 #, c-format msgid "section [%2d] '%s': cannot get symbol for signature\n" msgstr "" -#: src/elflint.c:2416 +#: src/elflint.c:2435 #, c-format msgid "section [%2d] '%s': signature symbol canot be empty string\n" msgstr "" -#: src/elflint.c:2422 +#: src/elflint.c:2441 #, c-format msgid "section [%2d] '%s': sh_flags not set correctly\n" msgstr "" -#: src/elflint.c:2428 +#: src/elflint.c:2447 #, c-format msgid "section [%2d] '%s': cannot get data: %s\n" msgstr "" -#: src/elflint.c:2437 +#: src/elflint.c:2456 #, c-format msgid "section [%2d] '%s': section size not multiple of sizeof(Elf32_Word)\n" msgstr "" -#: src/elflint.c:2442 +#: src/elflint.c:2461 #, c-format msgid "section [%2d] '%s': section group without flags word\n" msgstr "" -#: src/elflint.c:2448 +#: src/elflint.c:2467 #, c-format msgid "section [%2d] '%s': section group without member\n" msgstr "" -#: src/elflint.c:2452 +#: src/elflint.c:2471 #, c-format msgid "section [%2d] '%s': section group with only one member\n" msgstr "" -#: src/elflint.c:2463 +#: src/elflint.c:2482 #, c-format msgid "section [%2d] '%s': unknown section group flags\n" msgstr "" -#: src/elflint.c:2475 +#: src/elflint.c:2494 #, c-format msgid "section [%2d] '%s': section index %Zu out of range\n" msgstr "" -#: src/elflint.c:2484 +#: src/elflint.c:2503 #, c-format msgid "section [%2d] '%s': cannot get section header for element %zu: %s\n" msgstr "" -#: src/elflint.c:2491 +#: src/elflint.c:2510 #, c-format msgid "section [%2d] '%s': section group contains another group [%2d] '%s'\n" msgstr "" -#: src/elflint.c:2497 +#: src/elflint.c:2516 #, c-format msgid "" "section [%2d] '%s': element %Zu references section [%2d] '%s' without " "SHF_GROUP flag set\n" msgstr "" -#: src/elflint.c:2504 +#: src/elflint.c:2523 #, c-format msgid "section [%2d] '%s' is contained in more than one section group\n" msgstr "" -#: src/elflint.c:2693 +#: src/elflint.c:2712 #, c-format msgid "" "section [%2d] '%s' refers in sh_link to section [%2d] '%s' which is no " "dynamic symbol table\n" msgstr "" -#: src/elflint.c:2704 +#: src/elflint.c:2723 #, c-format msgid "" "section [%2d] '%s' has different number of entries than symbol table [%2d] '%" "s'\n" msgstr "" -#: src/elflint.c:2720 +#: src/elflint.c:2739 #, c-format msgid "section [%2d] '%s': symbol %d: cannot read version data\n" msgstr "" -#: src/elflint.c:2736 +#: src/elflint.c:2755 #, c-format msgid "section [%2d] '%s': symbol %d: local symbol with global scope\n" msgstr "" -#: src/elflint.c:2744 +#: src/elflint.c:2763 #, c-format msgid "section [%2d] '%s': symbol %d: local symbol with version\n" msgstr "" -#: src/elflint.c:2758 +#: src/elflint.c:2777 #, c-format msgid "section [%2d] '%s': symbol %d: invalid version index %d\n" msgstr "" -#: src/elflint.c:2763 +#: src/elflint.c:2782 #, c-format msgid "" "section [%2d] '%s': symbol %d: version index %d is for defined version\n" msgstr "" -#: src/elflint.c:2773 +#: src/elflint.c:2792 #, c-format msgid "" "section [%2d] '%s': symbol %d: version index %d is for requested version\n" msgstr "" -#: src/elflint.c:2825 +#: src/elflint.c:2844 #, c-format msgid "more than one version reference section present\n" msgstr "" -#: src/elflint.c:2833 src/elflint.c:2962 +#: src/elflint.c:2852 src/elflint.c:2981 #, c-format msgid "section [%2d] '%s': sh_link does not link to string table\n" msgstr "" -#: src/elflint.c:2856 src/elflint.c:3014 +#: src/elflint.c:2875 src/elflint.c:3033 #, c-format msgid "section [%2d] '%s': entry %d has wrong version %d\n" msgstr "" -#: src/elflint.c:2862 src/elflint.c:3020 +#: src/elflint.c:2881 src/elflint.c:3039 #, c-format msgid "section [%2d] '%s': entry %d has wrong offset of auxiliary data\n" msgstr "" -#: src/elflint.c:2870 +#: src/elflint.c:2889 #, c-format msgid "section [%2d] '%s': entry %d has invalid file reference\n" msgstr "" -#: src/elflint.c:2878 +#: src/elflint.c:2897 #, c-format msgid "section [%2d] '%s': entry %d references unknown dependency\n" msgstr "" -#: src/elflint.c:2890 +#: src/elflint.c:2909 #, c-format msgid "section [%2d] '%s': auxiliary entry %d of entry %d has unknown flag\n" msgstr "" -#: src/elflint.c:2897 +#: src/elflint.c:2916 #, c-format msgid "" "section [%2d] '%s': auxiliary entry %d of entry %d has invalid name " "reference\n" msgstr "" -#: src/elflint.c:2904 +#: src/elflint.c:2923 #, c-format msgid "" "section [%2d] '%s': auxiliary entry %d of entry %d has wrong hash value: %" "#x, expected %#x\n" msgstr "" -#: src/elflint.c:2914 +#: src/elflint.c:2933 #, c-format msgid "" "section [%2d] '%s': auxiliary entry %d of entry %d has duplicate version " "name '%s'\n" msgstr "" -#: src/elflint.c:2925 +#: src/elflint.c:2944 #, c-format msgid "" "section [%2d] '%s': auxiliary entry %d of entry %d has wrong next field\n" msgstr "" -#: src/elflint.c:2941 src/elflint.c:3099 +#: src/elflint.c:2960 src/elflint.c:3118 #, c-format msgid "section [%2d] '%s': entry %d has invalid offset to next entry\n" msgstr "" -#: src/elflint.c:2954 +#: src/elflint.c:2973 #, c-format msgid "more than one version definition section present\n" msgstr "" -#: src/elflint.c:2999 +#: src/elflint.c:3018 #, c-format msgid "section [%2d] '%s': more than one BASE definition\n" msgstr "" -#: src/elflint.c:3003 +#: src/elflint.c:3022 #, c-format msgid "section [%2d] '%s': BASE definition must have index VER_NDX_GLOBAL\n" msgstr "" -#: src/elflint.c:3009 +#: src/elflint.c:3028 #, c-format msgid "section [%2d] '%s': entry %d has unknown flag\n" msgstr "" -#: src/elflint.c:3033 +#: src/elflint.c:3052 #, c-format msgid "section [%2d] '%s': entry %d has invalid name reference\n" msgstr "" -#: src/elflint.c:3040 +#: src/elflint.c:3059 #, c-format msgid "section [%2d] '%s': entry %d has wrong hash value: %#x, expected %#x\n" msgstr "" -#: src/elflint.c:3049 +#: src/elflint.c:3068 #, c-format msgid "section [%2d] '%s': entry %d has duplicate version name '%s'\n" msgstr "" -#: src/elflint.c:3068 +#: src/elflint.c:3087 #, c-format msgid "" "section [%2d] '%s': entry %d has invalid name reference in auxiliary data\n" msgstr "" -#: src/elflint.c:3083 +#: src/elflint.c:3102 #, c-format msgid "section [%2d] '%s': entry %d has wrong next field in auxiliary data\n" msgstr "" -#: src/elflint.c:3105 +#: src/elflint.c:3124 #, c-format msgid "section [%2d] '%s': no BASE definition\n" msgstr "" -#: src/elflint.c:3121 +#: src/elflint.c:3140 #, c-format msgid "section [%2d] '%s': unknown parent version '%s'\n" msgstr "" -#: src/elflint.c:3134 +#: src/elflint.c:3153 #, c-format msgid "section [%2d] '%s': empty object attributes section\n" msgstr "" -#: src/elflint.c:3155 +#: src/elflint.c:3174 #, c-format msgid "section [%2d] '%s': unrecognized attribute format\n" msgstr "" -#: src/elflint.c:3171 +#: src/elflint.c:3190 #, c-format msgid "" "section [%2d] '%s': offset %zu: zero length field in attribute section\n" msgstr "" -#: src/elflint.c:3180 +#: src/elflint.c:3199 #, c-format msgid "section [%2d] '%s': offset %zu: invalid length in attribute section\n" msgstr "" -#: src/elflint.c:3192 +#: src/elflint.c:3211 #, c-format msgid "section [%2d] '%s': offset %zu: unterminated vendor name string\n" msgstr "" -#: src/elflint.c:3209 +#: src/elflint.c:3228 #, c-format msgid "" "section [%2d] '%s': offset %zu: endless ULEB128 in attribute subsection tag\n" msgstr "" -#: src/elflint.c:3218 +#: src/elflint.c:3237 #, c-format msgid "section [%2d] '%s': offset %zu: truncated attribute section\n" msgstr "" -#: src/elflint.c:3227 +#: src/elflint.c:3246 #, c-format msgid "" "section [%2d] '%s': offset %zu: zero length field in attribute subsection\n" msgstr "" -#: src/elflint.c:3240 +#: src/elflint.c:3259 #, c-format msgid "" "section [%2d] '%s': offset %zu: invalid length in attribute subsection\n" msgstr "" -#: src/elflint.c:3251 +#: src/elflint.c:3270 #, c-format msgid "" "section [%2d] '%s': offset %zu: attribute subsection has unexpected tag %u\n" msgstr "" -#: src/elflint.c:3269 +#: src/elflint.c:3288 #, c-format msgid "section [%2d] '%s': offset %zu: endless ULEB128 in attribute tag\n" msgstr "" -#: src/elflint.c:3280 +#: src/elflint.c:3299 #, c-format msgid "section [%2d] '%s': offset %zu: unterminated string in attribute\n" msgstr "" -#: src/elflint.c:3293 +#: src/elflint.c:3312 #, c-format msgid "section [%2d] '%s': offset %zu: unrecognized attribute tag %u\n" msgstr "" -#: src/elflint.c:3297 +#: src/elflint.c:3316 #, c-format msgid "" "section [%2d] '%s': offset %zu: unrecognized %s attribute value %<PRIu64>\n" msgstr "" -#: src/elflint.c:3307 +#: src/elflint.c:3326 #, c-format msgid "section [%2d] '%s': offset %zu: vendor '%s' unknown\n" msgstr "" -#: src/elflint.c:3313 +#: src/elflint.c:3332 #, c-format msgid "" "section [%2d] '%s': offset %zu: extra bytes after last attribute section\n" msgstr "" -#: src/elflint.c:3402 +#: src/elflint.c:3421 #, c-format msgid "cannot get section header of zeroth section\n" msgstr "" -#: src/elflint.c:3406 +#: src/elflint.c:3425 #, c-format msgid "zeroth section has nonzero name\n" msgstr "" -#: src/elflint.c:3408 +#: src/elflint.c:3427 #, c-format msgid "zeroth section has nonzero type\n" msgstr "" -#: src/elflint.c:3410 +#: src/elflint.c:3429 #, c-format msgid "zeroth section has nonzero flags\n" msgstr "" -#: src/elflint.c:3412 +#: src/elflint.c:3431 #, c-format msgid "zeroth section has nonzero address\n" msgstr "" -#: src/elflint.c:3414 +#: src/elflint.c:3433 #, c-format msgid "zeroth section has nonzero offset\n" msgstr "" -#: src/elflint.c:3416 -#, c-format -msgid "zeroth section has nonzero info field\n" -msgstr "" - -#: src/elflint.c:3418 +#: src/elflint.c:3435 #, c-format msgid "zeroth section has nonzero align value\n" msgstr "" -#: src/elflint.c:3420 +#: src/elflint.c:3437 #, c-format msgid "zeroth section has nonzero entry size value\n" msgstr "" -#: src/elflint.c:3423 +#: src/elflint.c:3440 #, c-format msgid "" "zeroth section has nonzero size value while ELF header has nonzero shnum " "value\n" msgstr "" -#: src/elflint.c:3427 +#: src/elflint.c:3444 #, c-format msgid "" "zeroth section has nonzero link value while ELF header does not signal " "overflow in shstrndx\n" msgstr "" -#: src/elflint.c:3444 +#: src/elflint.c:3448 +#, c-format +msgid "" +"zeroth section has nonzero link value while ELF header does not signal " +"overflow in phnum\n" +msgstr "" + +#: src/elflint.c:3465 #, c-format msgid "cannot get section header for section [%2zu] '%s': %s\n" msgstr "" -#: src/elflint.c:3453 +#: src/elflint.c:3474 #, c-format msgid "section [%2zu]: invalid name\n" msgstr "" -#: src/elflint.c:3480 +#: src/elflint.c:3501 #, c-format msgid "section [%2d] '%s' has wrong type: expected %s, is %s\n" msgstr "" -#: src/elflint.c:3496 +#: src/elflint.c:3517 #, c-format msgid "section [%2zu] '%s' has wrong flags: expected %s, is %s\n" msgstr "" -#: src/elflint.c:3513 +#: src/elflint.c:3534 #, c-format msgid "" "section [%2zu] '%s' has wrong flags: expected %s and possibly %s, is %s\n" msgstr "" -#: src/elflint.c:3531 +#: src/elflint.c:3552 #, c-format msgid "section [%2zu] '%s' present in object file\n" msgstr "" -#: src/elflint.c:3537 src/elflint.c:3569 +#: src/elflint.c:3558 src/elflint.c:3590 #, c-format msgid "" "section [%2zu] '%s' has SHF_ALLOC flag set but there is no loadable segment\n" msgstr "" -#: src/elflint.c:3542 src/elflint.c:3574 +#: src/elflint.c:3563 src/elflint.c:3595 #, c-format msgid "" "section [%2zu] '%s' has SHF_ALLOC flag not set but there are loadable " "segments\n" msgstr "" -#: src/elflint.c:3550 +#: src/elflint.c:3571 #, c-format msgid "" "section [%2zu] '%s' is extension section index table in non-object file\n" msgstr "" -#: src/elflint.c:3593 +#: src/elflint.c:3614 #, c-format msgid "section [%2zu] '%s': size not multiple of entry size\n" msgstr "" -#: src/elflint.c:3598 +#: src/elflint.c:3619 #, c-format msgid "cannot get section header\n" msgstr "" -#: src/elflint.c:3608 +#: src/elflint.c:3629 #, c-format msgid "section [%2zu] '%s' has unsupported type %d\n" msgstr "" -#: src/elflint.c:3622 +#: src/elflint.c:3643 #, c-format msgid "" "section [%2zu] '%s' contains invalid processor-specific flag(s) %#<PRIx64>\n" msgstr "" -#: src/elflint.c:3629 +#: src/elflint.c:3650 #, c-format msgid "section [%2zu] '%s' contains unknown flag(s) %#<PRIx64>\n" msgstr "" -#: src/elflint.c:3637 +#: src/elflint.c:3658 #, c-format msgid "section [%2zu] '%s': thread-local data sections address not zero\n" msgstr "" -#: src/elflint.c:3645 +#: src/elflint.c:3666 #, c-format msgid "section [%2zu] '%s': invalid section reference in link value\n" msgstr "" -#: src/elflint.c:3650 +#: src/elflint.c:3671 #, c-format msgid "section [%2zu] '%s': invalid section reference in info value\n" msgstr "" -#: src/elflint.c:3657 +#: src/elflint.c:3678 #, c-format msgid "section [%2zu] '%s': strings flag set without merge flag\n" msgstr "" -#: src/elflint.c:3662 +#: src/elflint.c:3683 #, c-format msgid "section [%2zu] '%s': merge flag set but entry size is zero\n" msgstr "" -#: src/elflint.c:3680 +#: src/elflint.c:3701 #, c-format msgid "section [%2zu] '%s' has unexpected type %d for an executable section\n" msgstr "" -#: src/elflint.c:3689 +#: src/elflint.c:3710 #, c-format msgid "section [%2zu] '%s' is both executable and writable\n" msgstr "" -#: src/elflint.c:3716 +#: src/elflint.c:3737 #, c-format msgid "" "section [%2zu] '%s' not fully contained in segment of program header entry %" "d\n" msgstr "" -#: src/elflint.c:3724 +#: src/elflint.c:3745 #, c-format msgid "" "section [%2zu] '%s' has type NOBITS but is read from the file in segment of " "program header entry %d\n" msgstr "" -#: src/elflint.c:3733 +#: src/elflint.c:3754 #, c-format msgid "" "section [%2zu] '%s' has not type NOBITS but is not read from the file in " "segment of program header entry %d\n" msgstr "" -#: src/elflint.c:3744 +#: src/elflint.c:3765 #, c-format msgid "section [%2zu] '%s' is executable in nonexecutable segment %d\n" msgstr "" -#: src/elflint.c:3754 +#: src/elflint.c:3775 #, c-format msgid "section [%2zu] '%s' is writable in unwritable segment %d\n" msgstr "" -#: src/elflint.c:3764 +#: src/elflint.c:3785 #, c-format msgid "" "section [%2zu] '%s': alloc flag set but section not in any loaded segment\n" msgstr "" -#: src/elflint.c:3770 +#: src/elflint.c:3791 #, c-format msgid "" "section [%2zu] '%s': ELF header says this is the section header string table " "but type is not SHT_TYPE\n" msgstr "" -#: src/elflint.c:3778 +#: src/elflint.c:3799 #, c-format msgid "" "section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n" msgstr "" -#: src/elflint.c:3829 +#: src/elflint.c:3850 #, c-format msgid "more than one version symbol table present\n" msgstr "" -#: src/elflint.c:3852 +#: src/elflint.c:3873 #, c-format msgid "INTERP program header entry but no .interp section\n" msgstr "" -#: src/elflint.c:3863 +#: src/elflint.c:3884 #, c-format msgid "" "loadable segment [%u] is executable but contains no executable sections\n" msgstr "" -#: src/elflint.c:3869 +#: src/elflint.c:3890 #, c-format msgid "loadable segment [%u] is writable but contains no writable sections\n" msgstr "" -#: src/elflint.c:3880 +#: src/elflint.c:3901 #, c-format msgid "" "no .gnu.versym section present but .gnu.versym_d or .gnu.versym_r section " "exist\n" msgstr "" -#: src/elflint.c:3893 +#: src/elflint.c:3914 #, c-format msgid "duplicate version index %d\n" msgstr "" -#: src/elflint.c:3907 +#: src/elflint.c:3928 #, c-format msgid ".gnu.versym section present without .gnu.versym_d or .gnu.versym_r\n" msgstr "" -#: src/elflint.c:3956 +#: src/elflint.c:3977 #, c-format msgid "phdr[%d]: unknown core file note type %<PRIu32> at offset %<PRIu64>\n" msgstr "" -#: src/elflint.c:3960 +#: src/elflint.c:3981 #, c-format msgid "" "section [%2d] '%s': unknown core file note type %<PRIu32> at offset %Zu\n" msgstr "" -#: src/elflint.c:3983 +#: src/elflint.c:4004 #, c-format msgid "phdr[%d]: unknown object file note type %<PRIu32> at offset %Zu\n" msgstr "" -#: src/elflint.c:3987 +#: src/elflint.c:4008 #, c-format msgid "" "section [%2d] '%s': unknown object file note type %<PRIu32> at offset %Zu\n" msgstr "" -#: src/elflint.c:4004 +#: src/elflint.c:4025 #, c-format msgid "phdr[%d]: no note entries defined for the type of file\n" msgstr "" -#: src/elflint.c:4023 +#: src/elflint.c:4044 #, c-format msgid "phdr[%d]: cannot get content of note section: %s\n" msgstr "" -#: src/elflint.c:4026 +#: src/elflint.c:4047 #, c-format msgid "phdr[%d]: extra %<PRIu64> bytes after last note\n" msgstr "" -#: src/elflint.c:4047 +#: src/elflint.c:4068 #, c-format msgid "section [%2d] '%s': no note entries defined for the type of file\n" msgstr "" -#: src/elflint.c:4054 +#: src/elflint.c:4075 #, c-format msgid "section [%2d] '%s': cannot get content of note section\n" msgstr "" -#: src/elflint.c:4057 +#: src/elflint.c:4078 #, c-format msgid "section [%2d] '%s': extra %<PRIu64> bytes after last note\n" msgstr "" -#: src/elflint.c:4075 +#: src/elflint.c:4096 #, c-format msgid "" "only executables, shared objects, and core files can have program headers\n" msgstr "" -#: src/elflint.c:4090 +#: src/elflint.c:4111 #, c-format msgid "cannot get program header entry %d: %s\n" msgstr "" -#: src/elflint.c:4099 +#: src/elflint.c:4120 #, c-format msgid "program header entry %d: unknown program header entry type %#<PRIx64>\n" msgstr "" -#: src/elflint.c:4110 +#: src/elflint.c:4131 #, c-format msgid "more than one INTERP entry in program header\n" msgstr "" -#: src/elflint.c:4118 +#: src/elflint.c:4139 #, c-format msgid "more than one TLS entry in program header\n" msgstr "" -#: src/elflint.c:4125 +#: src/elflint.c:4146 #, c-format msgid "static executable cannot have dynamic sections\n" msgstr "" -#: src/elflint.c:4139 +#: src/elflint.c:4160 #, c-format msgid "dynamic section reference in program header has wrong offset\n" msgstr "" -#: src/elflint.c:4142 +#: src/elflint.c:4163 #, c-format msgid "dynamic section size mismatch in program and section header\n" msgstr "" -#: src/elflint.c:4152 +#: src/elflint.c:4173 #, c-format msgid "more than one GNU_RELRO entry in program header\n" msgstr "" -#: src/elflint.c:4173 +#: src/elflint.c:4194 #, c-format msgid "loadable segment GNU_RELRO applies to is not writable\n" msgstr "" -#: src/elflint.c:4176 +#: src/elflint.c:4197 #, c-format msgid "loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n" msgstr "" -#: src/elflint.c:4184 src/elflint.c:4207 +#: src/elflint.c:4205 src/elflint.c:4228 #, c-format msgid "%s segment not contained in a loaded segment\n" msgstr "" -#: src/elflint.c:4213 +#: src/elflint.c:4234 #, c-format msgid "program header offset in ELF header and PHDR entry do not match" msgstr "" -#: src/elflint.c:4237 +#: src/elflint.c:4258 #, c-format msgid "call frame search table reference in program header has wrong offset\n" msgstr "" -#: src/elflint.c:4240 +#: src/elflint.c:4261 #, c-format msgid "call frame search table size mismatch in program and section header\n" msgstr "" -#: src/elflint.c:4253 +#: src/elflint.c:4274 #, c-format msgid "PT_GNU_EH_FRAME present but no .eh_frame_hdr section\n" msgstr "" -#: src/elflint.c:4261 +#: src/elflint.c:4282 #, c-format msgid "call frame search table must be allocated\n" msgstr "" -#: src/elflint.c:4264 +#: src/elflint.c:4285 #, c-format msgid "section [%2zu] '%s' must be allocated\n" msgstr "" -#: src/elflint.c:4268 +#: src/elflint.c:4289 #, c-format msgid "call frame search table must not be writable\n" msgstr "" -#: src/elflint.c:4271 +#: src/elflint.c:4292 #, c-format msgid "section [%2zu] '%s' must not be writable\n" msgstr "" -#: src/elflint.c:4276 +#: src/elflint.c:4297 #, c-format msgid "call frame search table must not be executable\n" msgstr "" -#: src/elflint.c:4279 +#: src/elflint.c:4300 #, c-format msgid "section [%2zu] '%s' must not be executable\n" msgstr "" -#: src/elflint.c:4290 +#: src/elflint.c:4311 #, c-format msgid "program header entry %d: file size greater than memory size\n" msgstr "" -#: src/elflint.c:4297 +#: src/elflint.c:4318 #, c-format msgid "program header entry %d: alignment not a power of 2\n" msgstr "" -#: src/elflint.c:4300 +#: src/elflint.c:4321 #, c-format msgid "" "program header entry %d: file offset and virtual address not module of " "alignment\n" msgstr "" -#: src/elflint.c:4313 +#: src/elflint.c:4334 #, c-format msgid "" "executable/DSO with .eh_frame_hdr section does not have a PT_GNU_EH_FRAME " "program header entry" msgstr "" -#: src/elflint.c:4347 +#: src/elflint.c:4368 #, c-format msgid "cannot read ELF header: %s\n" msgstr "" -#: src/elflint.c:4373 +#: src/elflint.c:4394 #, c-format msgid "text relocation flag set but not needed\n" msgstr "" @@ -4876,7 +4902,7 @@ msgstr "" msgid "Locate source of text relocations in FILEs (a.out by default)." msgstr "" -#: src/findtextrel.c:236 src/elfcmp.c:578 src/ranlib.c:186 +#: src/findtextrel.c:236 src/elfcmp.c:611 src/ranlib.c:186 #, c-format msgid "cannot create ELF descriptor for '%s': %s" msgstr "" @@ -5002,87 +5028,107 @@ msgstr "" msgid "%s %s diff: ELF header" msgstr "" -#: src/elfcmp.c:248 +#: src/elfcmp.c:198 src/elfcmp.c:201 +#, c-format +msgid "cannot get section count of '%s': %s" +msgstr "" + +#: src/elfcmp.c:206 +#, c-format +msgid "%s %s diff: section count" +msgstr "" + +#: src/elfcmp.c:214 src/elfcmp.c:217 +#, c-format +msgid "cannot get program header count of '%s': %s" +msgstr "" + +#: src/elfcmp.c:222 +#, c-format +msgid "%s %s diff: program header count" +msgstr "" + +#: src/elfcmp.c:281 #, c-format msgid "%s %s differ: section header" msgstr "" -#: src/elfcmp.c:276 src/elfcmp.c:282 +#: src/elfcmp.c:309 src/elfcmp.c:315 #, c-format msgid "cannot get content of section %zu in '%s': %s" msgstr "" -#: src/elfcmp.c:298 src/elfcmp.c:304 +#: src/elfcmp.c:331 src/elfcmp.c:337 #, c-format msgid "cannot get symbol in '%s': %s" msgstr "" -#: src/elfcmp.c:325 +#: src/elfcmp.c:358 #, c-format msgid "%s %s differ: symbol table [%zu]" msgstr "" -#: src/elfcmp.c:328 +#: src/elfcmp.c:361 #, c-format msgid "%s %s differ: symbol table [%zu,%zu]" msgstr "" -#: src/elfcmp.c:376 +#: src/elfcmp.c:409 #, c-format msgid "%s %s differ: section [%zu] '%s' content" msgstr "" -#: src/elfcmp.c:380 +#: src/elfcmp.c:413 #, c-format msgid "%s %s differ: section [%zu,%zu] '%s' content" msgstr "" -#: src/elfcmp.c:396 +#: src/elfcmp.c:429 #, c-format msgid "%s %s differ: unequal amount of important sections" msgstr "" -#: src/elfcmp.c:430 src/elfcmp.c:435 +#: src/elfcmp.c:463 src/elfcmp.c:468 #, c-format msgid "cannot load data of '%s': %s" msgstr "" -#: src/elfcmp.c:454 src/elfcmp.c:460 +#: src/elfcmp.c:487 src/elfcmp.c:493 #, c-format msgid "cannot get program header entry %d of '%s': %s" msgstr "" -#: src/elfcmp.c:466 +#: src/elfcmp.c:499 #, c-format msgid "%s %s differ: program header %d" msgstr "" -#: src/elfcmp.c:491 +#: src/elfcmp.c:524 #, c-format msgid "%s %s differ: gap" msgstr "" -#: src/elfcmp.c:550 +#: src/elfcmp.c:583 #, c-format msgid "Invalid value '%s' for --gaps parameter." msgstr "" -#: src/elfcmp.c:583 +#: src/elfcmp.c:616 #, c-format msgid "cannot create EBL descriptor for '%s'" msgstr "" -#: src/elfcmp.c:601 +#: src/elfcmp.c:634 #, c-format msgid "cannot get section header of section %zu: %s" msgstr "" -#: src/elfcmp.c:611 +#: src/elfcmp.c:644 #, c-format msgid "cannot get content of section %zu: %s" msgstr "" -#: src/elfcmp.c:621 src/elfcmp.c:635 +#: src/elfcmp.c:654 src/elfcmp.c:668 #, c-format msgid "cannot get relocation: %s" msgstr "" diff --git a/elfutils/src/ChangeLog b/elfutils/src/ChangeLog index 5e439104..c4b5b053 100644 --- a/elfutils/src/ChangeLog +++ b/elfutils/src/ChangeLog @@ -1,3 +1,55 @@ +2010-01-07 Roland McGrath <roland@redhat.com> + + * readelf.c (print_ehdr): Handle PN_XNUM. + (phnum): New static variable. + (process_elf_file): Set it with elf_getphdrnum. + (print_phdr): Use phnum instead of EHDR->e_phnum. + (print_dynamic, handle_notes): Likewise. + (handle_relocs_rel, handle_relocs_rela): Likewise. + + * elfcmp.c (main): Use elf_getshdrnum and elf_getphdrnum. + + * elflint.c (phnum): New static variable. + (check_elf_header): Set it, handling PN_XNUM. + Use that in place of EHDR->e_phnum throughout. + (check_symtab, check_reloc_shdr, check_dynamic): Likewise. + (unknown_dependency_p, check_sections, check_program_header): Likewise. + +2010-01-05 Roland McGrath <roland@redhat.com> + + * readelf.c (dwarf_attr_string): Match DW_AT_GNU_vector and + DW_AT_GNU_template_name. + +2010-01-04 Roland McGrath <roland@redhat.com> + + * readelf.c (handle_notes_data): Grab NT_AUXV only for name "CORE". + (handle_core_note): Pass NHDR and NAME to ebl_core_note. + (handle_core_item): Handle .format of '\n' as \n-separated strings. + + * readelf.c (implicit_debug_sections): New variable. + (parse_opt): Set it instead of print_debug_sections for -a. + OR them together for print_debug check. + (print_debug): OR them together for section check. + + * readelf.c (options): Repartition into set implied by -a and others. + Correct -a text to match reality. + + * readelf.c (struct section_argument): Add bool member 'implicit'. + (parse_opt): Set it for -a cases, clear it for -x args. + (for_each_section_argument): Don't complain about a missing section by + name if it's implicit. + +2009-11-16 Roland McGrath <roland@redhat.com> + + * readelf.c (print_string_section): Punt SHT_NOBITS like empty + sections, just as dump_data_section already does. + +2009-09-21 Ulrich Drepper <drepper@redhat.com> + + * elflint.c (special_sections): Allow MERGE and STRINGS flags to be + set for .comment section. + Patch by Mark Wielaard <mjw@redhat.com>. + 2009-09-08 Roland McGrath <roland@redhat.com> * ar.c (main): Fix typo in message format. diff --git a/elfutils/src/Makefile.in b/elfutils/src/Makefile.in index 177ce8c6..3f829e96 100644 --- a/elfutils/src/Makefile.in +++ b/elfutils/src/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/src/elfcmp.c b/elfutils/src/elfcmp.c index 7f871ecf..71a80092 100644 --- a/elfutils/src/elfcmp.c +++ b/elfutils/src/elfcmp.c @@ -1,5 +1,5 @@ /* Compare relevant content of two ELF files. - Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2005. @@ -192,6 +192,39 @@ main (int argc, char *argv[]) goto out; } + size_t shnum1; + size_t shnum2; + if (unlikely (elf_getshdrnum (elf1, &shnum1) != 0)) + error (2, 0, gettext ("cannot get section count of '%s': %s"), + fname1, elf_errmsg (-1)); + if (unlikely (elf_getshdrnum (elf2, &shnum2) != 0)) + error (2, 0, gettext ("cannot get section count of '%s': %s"), + fname2, elf_errmsg (-1)); + if (unlikely (shnum1 != shnum2)) + { + if (! quiet) + error (0, 0, gettext ("%s %s diff: section count"), fname1, fname2); + result = 1; + goto out; + } + + size_t phnum1; + size_t phnum2; + if (unlikely (elf_getphdrnum (elf1, &phnum1) != 0)) + error (2, 0, gettext ("cannot get program header count of '%s': %s"), + fname1, elf_errmsg (-1)); + if (unlikely (elf_getphdrnum (elf2, &phnum2) != 0)) + error (2, 0, gettext ("cannot get program header count of '%s': %s"), + fname2, elf_errmsg (-1)); + if (unlikely (phnum1 != phnum2)) + { + if (! quiet) + error (0, 0, gettext ("%s %s diff: program header count"), + fname1, fname2); + result = 1; + goto out; + } + /* Iterate over all sections. We expect the sections in the two files to match exactly. */ Elf_Scn *scn1 = NULL; @@ -410,7 +443,7 @@ main (int argc, char *argv[]) ehdr_region.next = &phdr_region; phdr_region.from = ehdr1->e_phoff; - phdr_region.to = ehdr1->e_phoff + ehdr1->e_phnum * ehdr1->e_phentsize; + phdr_region.to = ehdr1->e_phoff + phnum1 * ehdr1->e_phentsize; phdr_region.next = regions; regions = &ehdr_region; @@ -445,7 +478,7 @@ main (int argc, char *argv[]) } /* Compare the program header tables. */ - for (int ndx = 0; ndx < ehdr1->e_phnum; ++ndx) + for (unsigned int ndx = 0; ndx < phnum1; ++ndx) { GElf_Phdr phdr1_mem; GElf_Phdr *phdr1 = gelf_getphdr (elf1, ndx, &phdr1_mem); diff --git a/elfutils/src/elflint.c b/elfutils/src/elflint.c index f85d2864..63d8389e 100644 --- a/elfutils/src/elflint.c +++ b/elfutils/src/elflint.c @@ -1,5 +1,5 @@ /* Pedantic checking of ELF files compliance with gABI/psABI spec. - Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Red Hat, Inc. + Copyright (C) 2001-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2001. @@ -343,8 +343,9 @@ static const int valid_e_machine[] = (sizeof (valid_e_machine) / sizeof (valid_e_machine[0])) -/* Number of sections. */ +/* Numbers of sections and program headers. */ static unsigned int shnum; +static unsigned int phnum; static void @@ -464,6 +465,24 @@ invalid number of section header table entries\n")); ERROR (gettext ("invalid section header index\n")); } + phnum = ehdr->e_phnum; + if (ehdr->e_phnum == PN_XNUM) + { + /* Get the header of the zeroth section. The sh_info field + might contain the phnum count. */ + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); + if (shdr != NULL) + { + /* The error will be reported later. */ + if (shdr->sh_info < PN_XNUM) + ERROR (gettext ("\ +invalid number of program header table entries\n")); + else + phnum = shdr->sh_info; + } + } + /* Check the e_flags field. */ if (!ebl_machine_flag_check (ebl, ehdr->e_flags)) ERROR (gettext ("invalid machine flags: %s\n"), @@ -478,13 +497,13 @@ invalid number of section header table entries\n")); if (ehdr->e_phentsize != 0 && ehdr->e_phentsize != sizeof (Elf32_Phdr)) ERROR (gettext ("invalid program header size: %hd\n"), ehdr->e_phentsize); - else if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > size) + else if (ehdr->e_phoff + phnum * ehdr->e_phentsize > size) ERROR (gettext ("invalid program header position or size\n")); if (ehdr->e_shentsize != 0 && ehdr->e_shentsize != sizeof (Elf32_Shdr)) ERROR (gettext ("invalid section header size: %hd\n"), ehdr->e_shentsize); - else if (ehdr->e_shoff + ehdr->e_shnum * ehdr->e_shentsize > size) + else if (ehdr->e_shoff + shnum * ehdr->e_shentsize > size) ERROR (gettext ("invalid section header position or size\n")); } else if (gelf_getclass (ebl->elf) == ELFCLASS64) @@ -495,7 +514,7 @@ invalid number of section header table entries\n")); if (ehdr->e_phentsize != 0 && ehdr->e_phentsize != sizeof (Elf64_Phdr)) ERROR (gettext ("invalid program header size: %hd\n"), ehdr->e_phentsize); - else if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > size) + else if (ehdr->e_phoff + phnum * ehdr->e_phentsize > size) ERROR (gettext ("invalid program header position or size\n")); if (ehdr->e_shentsize != 0 && ehdr->e_shentsize != sizeof (Elf64_Shdr)) @@ -785,7 +804,7 @@ section [%2d] '%s': symbol %zu: referenced section [%2d] '%s' does not have SHF_ if (ehdr->e_type == ET_REL) { /* For object files the symbol value must fall - into the section. */ + into the section. */ if (sym->st_value > destshdr->sh_size) ERROR (gettext ("\ section [%2d] '%s': symbol %zu: st_value out of bounds of referenced section [%2d] '%s'\n"), @@ -802,16 +821,16 @@ section [%2d] '%s': symbol %zu does not fit completely in referenced section [%2 { GElf_Phdr phdr_mem; GElf_Phdr *phdr = NULL; - int pcnt; + unsigned int pcnt; - for (pcnt = 0; pcnt < ehdr->e_phnum; ++pcnt) + for (pcnt = 0; pcnt < phnum; ++pcnt) { phdr = gelf_getphdr (ebl->elf, pcnt, &phdr_mem); if (phdr != NULL && phdr->p_type == PT_TLS) break; } - if (pcnt == ehdr->e_phnum) + if (pcnt == phnum) { if (no_pt_tls++ == 0) ERROR (gettext ("\ @@ -959,7 +978,7 @@ section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol present, but no .got section\n" /* Check that address and size match the dynamic section. We locate the dynamic section via the program header entry. */ - for (int pcnt = 0; pcnt < ehdr->e_phnum; ++pcnt) + for (unsigned int pcnt = 0; pcnt < phnum; ++pcnt) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, pcnt, &phdr_mem); @@ -1216,7 +1235,7 @@ section [%2d] '%s': section entry size does not match ElfXX_Rel\n"), the loaded segments are and b) which are read-only. This will also allow us to determine whether the same reloc section is modifying loaded and not loaded segments. */ - for (int i = 0; i < ehdr->e_phnum; ++i) + for (unsigned int i = 0; i < phnum; ++i) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, i, &phdr_mem); @@ -1703,7 +1722,7 @@ section [%2d] '%s': entry %zu: pointer does not match address of section [%2d] ' case DT_VERNEED: case DT_VERSYM: check_addr: - for (n = 0; n < ehdr->e_phnum; ++n) + for (n = 0; n < phnum; ++n) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, n, &phdr_mem); @@ -1712,7 +1731,7 @@ section [%2d] '%s': entry %zu: pointer does not match address of section [%2d] ' && phdr->p_vaddr + phdr->p_memsz > dyn->d_un.d_ptr) break; } - if (unlikely (n >= ehdr->e_phnum)) + if (unlikely (n >= phnum)) { char buf[50]; ERROR (gettext ("\ @@ -2780,18 +2799,18 @@ section [%2d] '%s': symbol %d: version index %d is for requested version\n"), static int -unknown_dependency_p (Elf *elf, GElf_Ehdr *ehdr, const char *fname) +unknown_dependency_p (Elf *elf, const char *fname) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = NULL; - int i; - for (i = 0; i < ehdr->e_phnum; ++i) + unsigned int i; + for (i = 0; i < phnum; ++i) if ((phdr = gelf_getphdr (elf, i, &phdr_mem)) != NULL && phdr->p_type == PT_DYNAMIC) break; - if (i == ehdr->e_phnum) + if (i == phnum) return 1; assert (phdr != NULL); Elf_Scn *scn = gelf_offscn (elf, phdr->p_offset); @@ -2819,7 +2838,7 @@ unknown_dependency_p (Elf *elf, GElf_Ehdr *ehdr, const char *fname) static unsigned int nverneed; static void -check_verneed (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) +check_verneed (Ebl *ebl, GElf_Shdr *shdr, int idx) { if (++nverneed == 2) ERROR (gettext ("more than one version reference section present\n")); @@ -2874,7 +2893,7 @@ section [%2d] '%s': entry %d has invalid file reference\n"), } /* Check that there is a DT_NEEDED entry for the referenced library. */ - if (unknown_dependency_p (ebl->elf, ehdr, libname)) + if (unknown_dependency_p (ebl->elf, libname)) ERROR (gettext ("\ section [%2d] '%s': entry %d references unknown dependency\n"), idx, section_name (ebl, idx), cnt); @@ -3330,7 +3349,7 @@ static const struct { /* See figure 4-14 in the gABI. */ { ".bss", 5, SHT_NOBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, - { ".comment", 8, SHT_PROGBITS, exact, 0, 0 }, + { ".comment", 8, SHT_PROGBITS, atleast, 0, SHF_MERGE | SHF_STRINGS }, { ".data", 6, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, { ".data1", 7, SHT_PROGBITS, exact, SHF_ALLOC | SHF_WRITE, 0 }, { ".debug_str", 11, SHT_PROGBITS, exact_or_gnuld, SHF_MERGE | SHF_STRINGS, 0 }, @@ -3412,8 +3431,6 @@ check_sections (Ebl *ebl, GElf_Ehdr *ehdr) ERROR (gettext ("zeroth section has nonzero address\n")); if (shdr->sh_offset != 0) ERROR (gettext ("zeroth section has nonzero offset\n")); - if (shdr->sh_info != 0) - ERROR (gettext ("zeroth section has nonzero info field\n")); if (shdr->sh_addralign != 0) ERROR (gettext ("zeroth section has nonzero align value\n")); if (shdr->sh_entsize != 0) @@ -3426,9 +3443,13 @@ zeroth section has nonzero size value while ELF header has nonzero shnum value\n if (shdr->sh_link != 0 && ehdr->e_shstrndx != SHN_XINDEX) ERROR (gettext ("\ zeroth section has nonzero link value while ELF header does not signal overflow in shstrndx\n")); + + if (shdr->sh_info != 0 && ehdr->e_phnum != PN_XNUM) + ERROR (gettext ("\ +zeroth section has nonzero link value while ELF header does not signal overflow in phnum\n")); } - int *segment_flags = xcalloc (ehdr->e_phnum, sizeof segment_flags[0]); + int *segment_flags = xcalloc (phnum, sizeof segment_flags[0]); bool dot_interp_section = false; @@ -3695,11 +3716,11 @@ section [%2zu] '%s' is both executable and writable\n"), { /* Make sure the section is contained in a loaded segment and that the initialization part matches NOBITS sections. */ - int pcnt; + unsigned int pcnt; GElf_Phdr phdr_mem; GElf_Phdr *phdr; - for (pcnt = 0; pcnt < ehdr->e_phnum; ++pcnt) + for (pcnt = 0; pcnt < phnum; ++pcnt) if ((phdr = gelf_getphdr (ebl->elf, pcnt, &phdr_mem)) != NULL && ((phdr->p_type == PT_LOAD && (shdr->sh_flags & SHF_TLS) == 0) @@ -3760,7 +3781,7 @@ section [%2zu] '%s' is writable in unwritable segment %d\n"), break; } - if (pcnt == ehdr->e_phnum) + if (pcnt == phnum) ERROR (gettext ("\ section [%2zu] '%s': alloc flag set but section not in any loaded segment\n"), cnt, section_name (ebl, cnt)); @@ -3831,7 +3852,7 @@ section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n"), break; case SHT_GNU_verneed: - check_verneed (ebl, ehdr, shdr, cnt); + check_verneed (ebl, shdr, cnt); break; case SHT_GNU_verdef: @@ -3852,7 +3873,7 @@ section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n"), ERROR (gettext ("INTERP program header entry but no .interp section\n")); if (!is_debuginfo) - for (int pcnt = 0; pcnt < ehdr->e_phnum; ++pcnt) + for (unsigned int pcnt = 0; pcnt < phnum; ++pcnt) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, pcnt, &phdr_mem); @@ -4079,7 +4100,7 @@ only executables, shared objects, and core files can have program headers\n")); int num_pt_tls = 0; int num_pt_relro = 0; - for (int cnt = 0; cnt < ehdr->e_phnum; ++cnt) + for (unsigned int cnt = 0; cnt < phnum; ++cnt) { GElf_Phdr phdr_mem; GElf_Phdr *phdr; @@ -4154,8 +4175,8 @@ more than one GNU_RELRO entry in program header\n")); else { /* Check that the region is in a writable segment. */ - int inner; - for (inner = 0; inner < ehdr->e_phnum; ++inner) + unsigned int inner; + for (inner = 0; inner < phnum; ++inner) { GElf_Phdr phdr2_mem; GElf_Phdr *phdr2; @@ -4180,7 +4201,7 @@ loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"), } } - if (inner >= ehdr->e_phnum) + if (inner >= phnum) ERROR (gettext ("\ %s segment not contained in a loaded segment\n"), "GNU_RELRO"); } @@ -4188,8 +4209,8 @@ loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"), else if (phdr->p_type == PT_PHDR) { /* Check that the region is in a writable segment. */ - int inner; - for (inner = 0; inner < ehdr->e_phnum; ++inner) + unsigned int inner; + for (inner = 0; inner < phnum; ++inner) { GElf_Phdr phdr2_mem; GElf_Phdr *phdr2; @@ -4203,7 +4224,7 @@ loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"), break; } - if (inner >= ehdr->e_phnum) + if (inner >= phnum) ERROR (gettext ("\ %s segment not contained in a loaded segment\n"), "PHDR"); diff --git a/elfutils/src/ldlex.c b/elfutils/src/ldlex.c index dbbdf07a..e1b5b4e9 100644 --- a/elfutils/src/ldlex.c +++ b/elfutils/src/ldlex.c @@ -1243,7 +1243,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( ldtext, ldleng, 1, ldout ) +#define ECHO do { if (fwrite( ldtext, ldleng, 1, ldout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, diff --git a/elfutils/src/readelf.c b/elfutils/src/readelf.c index 521fe262..44648669 100644 --- a/elfutils/src/readelf.c +++ b/elfutils/src/readelf.c @@ -1,5 +1,5 @@ /* Print information from ELF file in human-readable form. - Copyright (C) 1999-2008, 2009 Red Hat, Inc. + Copyright (C) 1999-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 1999. @@ -69,8 +69,9 @@ ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = { - { NULL, 0, NULL, 0, N_("Output selection:"), 0 }, - { "all", 'a', NULL, 0, N_("Equivalent to: -e -h -l"), 0 }, + { NULL, 0, NULL, 0, N_("ELF output selection:"), 0 }, + { "all", 'a', NULL, 0, + N_("All these plus -p .strtab -p .dynstr -p .comment"), 0 }, { "dynamic", 'd', NULL, 0, N_("Display the dynamic segment"), 0 }, { "file-header", 'h', NULL, 0, N_("Display the ELF file header"), 0 }, { "histogram", 'I', NULL, 0, @@ -78,17 +79,21 @@ static const struct argp_option options[] = { "program-headers", 'l', NULL, 0, N_("Display the program headers"), 0 }, { "segments", 'l', NULL, OPTION_ALIAS | OPTION_HIDDEN, NULL, 0 }, { "relocs", 'r', NULL, 0, N_("Display relocations"), 0 }, - { "section-headers", 'S', NULL, 0, N_("Display the sections' header"), 0 }, + { "section-headers", 'S', NULL, 0, N_("Display the sections' headers"), 0 }, { "sections", 'S', NULL, OPTION_ALIAS | OPTION_HIDDEN, NULL, 0 }, { "symbols", 's', NULL, 0, N_("Display the symbol table"), 0 }, { "version-info", 'V', NULL, 0, N_("Display versioning information"), 0 }, + { "notes", 'n', NULL, 0, N_("Display the ELF notes"), 0 }, + { "arch-specific", 'A', NULL, 0, + N_("Display architecture specific information, if any"), 0 }, + { "exception", 'e', NULL, 0, + N_("Display sections for exception handling"), 0 }, + + { NULL, 0, NULL, 0, N_("Additional output selection:"), 0 }, { "debug-dump", 'w', "SECTION", OPTION_ARG_OPTIONAL, N_("Display DWARF section content. SECTION can be one of abbrev, " "aranges, frame, info, loc, line, ranges, pubnames, str, macinfo, " "or exception"), 0 }, - { "notes", 'n', NULL, 0, N_("Display the core notes"), 0 }, - { "arch-specific", 'A', NULL, 0, - N_("Display architecture specific information (if any)"), 0 }, { "hex-dump", 'x', "SECTION", 0, N_("Dump the uninterpreted contents of SECTION, by number or name"), 0 }, { "strings", 'p', "SECTION", OPTION_ARG_OPTIONAL, @@ -96,8 +101,6 @@ static const struct argp_option options[] = { "string-dump", 'p', NULL, OPTION_ALIAS | OPTION_HIDDEN, NULL, 0 }, { "archive-index", 'c', NULL, 0, N_("Display the symbol index of an archive"), 0 }, - { "exception", 'e', NULL, 0, N_("Display sections for exception handling"), - 0 }, { NULL, 0, NULL, 0, N_("Output control:"), 0 }, { "numeric-addresses", 'N', NULL, 0, @@ -188,7 +191,7 @@ static enum section_e | section_info | section_line | section_loc | section_pubnames | section_str | section_macinfo | section_ranges | section_exception) -} print_debug_sections; +} print_debug_sections, implicit_debug_sections; /* Select hex dumping of sections. */ static struct section_argument *dump_data_sections; @@ -202,10 +205,12 @@ struct section_argument { struct section_argument *next; const char *arg; + bool implicit; }; -/* Number of sections in the file. */ +/* Numbers of sections and program headers in the file. */ static size_t shnum; +static size_t phnum; /* Declarations of local functions. */ @@ -215,7 +220,7 @@ static void print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr); static void print_shdr (Ebl *ebl, GElf_Ehdr *ehdr); static void print_phdr (Ebl *ebl, GElf_Ehdr *ehdr); static void print_scngrp (Ebl *ebl); -static void print_dynamic (Ebl *ebl, GElf_Ehdr *ehdr); +static void print_dynamic (Ebl *ebl); static void print_relocs (Ebl *ebl, GElf_Ehdr *ehdr); static void handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr); @@ -282,11 +287,12 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state __attribute__ ((unused))) { - void add_dump_section (const char *name) + void add_dump_section (const char *name, bool implicit) { struct section_argument *a = xmalloc (sizeof *a); a->arg = name; a->next = NULL; + a->implicit = implicit; struct section_argument ***tailp = key == 'x' ? &dump_data_sections_tail : &string_sections_tail; **tailp = a; @@ -307,10 +313,10 @@ parse_opt (int key, char *arg, print_histogram = true; print_arch = true; print_notes = true; - print_debug_sections |= section_exception; - add_dump_section (".strtab"); - add_dump_section (".dynstr"); - add_dump_section (".comment"); + implicit_debug_sections |= section_exception; + add_dump_section (".strtab", true); + add_dump_section (".dynstr", true); + add_dump_section (".comment", true); any_control_option = true; break; case 'A': @@ -408,7 +414,7 @@ parse_opt (int key, char *arg, } /* Fall through. */ case 'x': - add_dump_section (arg); + add_dump_section (arg, false); any_control_option = true; break; case 'N': @@ -621,6 +627,12 @@ process_elf_file (Dwfl_Module *dwflmod, int fd) gettext ("cannot determine number of sections: %s"), elf_errmsg (-1)); + /* Determine the number of phdrs. */ + if (unlikely (elf_getphdrnum (ebl->elf, &phnum) < 0)) + error (EXIT_FAILURE, 0, + gettext ("cannot determine number of program headers: %s"), + elf_errmsg (-1)); + /* For an ET_REL file, libdwfl has adjusted the in-core shdrs and may have applied relocation to some sections. So we need to get a fresh Elf handle on the file to display those. */ @@ -660,7 +672,7 @@ process_elf_file (Dwfl_Module *dwflmod, int fd) if (print_section_groups) print_scngrp (ebl); if (print_dynamic_table) - print_dynamic (ebl, ehdr); + print_dynamic (ebl); if (print_relocations) print_relocs (pure_ebl, ehdr); if (print_histogram) @@ -679,7 +691,7 @@ process_elf_file (Dwfl_Module *dwflmod, int fd) dump_data (pure_ebl); if (string_sections != NULL) dump_strings (ebl); - if (print_debug_sections != 0) + if ((print_debug_sections | implicit_debug_sections) != 0) print_debug (dwflmod, ebl, ehdr); if (print_notes) handle_notes (pure_ebl, ehdr); @@ -779,8 +791,19 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr) printf (gettext (" Size of program header entries: %" PRId16 " %s\n"), ehdr->e_phentsize, gettext ("(bytes)")); - printf (gettext (" Number of program headers entries: %" PRId16 "\n"), + printf (gettext (" Number of program headers entries: %" PRId16), ehdr->e_phnum); + if (ehdr->e_phnum == PN_XNUM) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (ebl->elf, 0), &shdr_mem); + if (shdr != NULL) + printf (gettext (" (%" PRIu32 " in [0].sh_info)"), + (uint32_t) shdr->sh_info); + else + fputs_unlocked (gettext (" ([0] not available)"), stdout); + } + fputc_unlocked ('\n', stdout); printf (gettext (" Size of section header entries: %" PRId16 " %s\n"), ehdr->e_shentsize, gettext ("(bytes)")); @@ -948,7 +971,7 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) bool has_relro = false; GElf_Addr relro_from = 0; GElf_Addr relro_to = 0; - for (size_t cnt = 0; cnt < ehdr->e_phnum; ++cnt) + for (size_t cnt = 0; cnt < phnum; ++cnt) { char buf[128]; GElf_Phdr mem; @@ -1004,7 +1027,7 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) puts (gettext ("\n Section to Segment mapping:\n Segment Sections...")); - for (size_t cnt = 0; cnt < ehdr->e_phnum; ++cnt) + for (size_t cnt = 0; cnt < phnum; ++cnt) { /* Print the segment number. */ printf (" %2.2zu ", cnt); @@ -1074,7 +1097,7 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) /* Determine the segment this section is part of. */ size_t cnt2; GElf_Phdr *phdr2 = NULL; - for (cnt2 = 0; cnt2 < ehdr->e_phnum; ++cnt2) + for (cnt2 = 0; cnt2 < phnum; ++cnt2) { GElf_Phdr phdr2_mem; phdr2 = gelf_getphdr (ebl->elf, cnt2, &phdr2_mem); @@ -1086,7 +1109,7 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) break; } - if (cnt2 < ehdr->e_phnum) + if (cnt2 < phnum) { if ((phdr2->p_flags & PF_W) == 0 && !in_ro) { @@ -1437,9 +1460,9 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) /* Print the dynamic segment. */ static void -print_dynamic (Ebl *ebl, GElf_Ehdr *ehdr) +print_dynamic (Ebl *ebl) { - for (int i = 0; i < ehdr->e_phnum; ++i) + for (size_t i = 0; i < phnum; ++i) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, i, &phdr_mem); @@ -1581,7 +1604,7 @@ handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) { is_statically_linked = 1; - for (size_t inner = 0; inner < ehdr->e_phnum; ++inner) + for (size_t inner = 0; inner < phnum; ++inner) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, inner, @@ -1754,7 +1777,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr) { is_statically_linked = 1; - for (size_t inner = 0; inner < ehdr->e_phnum; ++inner) + for (size_t inner = 0; inner < phnum; ++inner) { GElf_Phdr phdr_mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, inner, @@ -3441,6 +3464,14 @@ dwarf_attr_string (unsigned int attrnum) result = "body_end"; break; + case DW_AT_GNU_vector: + result = "GNU_vector"; + break; + + case DW_AT_GNU_template_name: + result = "GNU_template_name"; + break; + default: if (attrnum < DW_AT_lo_user) snprintf (buf, sizeof buf, gettext ("unknown attribute %hx"), @@ -6464,8 +6495,9 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) Dwarf *dbg = dwfl_module_getdwarf (dwflmod, &dwbias); if (dbg == NULL) { - error (0, 0, gettext ("cannot get debug context descriptor: %s"), - dwfl_errmsg (-1)); + if (print_debug_sections != 0) + error (0, 0, gettext ("cannot get debug context descriptor: %s"), + dwfl_errmsg (-1)); return; } @@ -6520,7 +6552,8 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) for (n = 0; n < ndebug_sections; ++n) if (strcmp (name, debug_sections[n].name) == 0) { - if (print_debug_sections & debug_sections[n].bitmask) + if ((print_debug_sections | implicit_debug_sections) + & debug_sections[n].bitmask) debug_sections[n].fp (dwflmod, ebl, ehdr, scn, shdr, dbg); break; } @@ -6636,11 +6669,11 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc, convsize = count * size; *repeated_size -= convsize; } - else + else if (item->count != 0 || item->format != '\n') *repeated_size -= size; } - desc = convert (core, item->type, count, data, desc + item->offset, convsize); + convert (core, item->type, count, data, desc + item->offset, convsize); Elf_Type type = item->type; if (type == ELF_T_ADDR) @@ -6786,6 +6819,33 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item, const void *desc, count, "%.*s", (int) count, value.Byte); break; + case '\n': + /* This is a list of strings separated by '\n'. */ + assert (item->count == 0); + assert (repeated_size != NULL); + assert (item->name == NULL); + if (unlikely (item->offset >= *repeated_size)) + break; + + const char *s = desc + item->offset; + size = *repeated_size - item->offset; + *repeated_size = 0; + while (size > 0) + { + const char *eol = memchr (s, '\n', size); + int len = size; + if (eol != NULL) + len = eol - s; + printf ("%*s%.*s\n", ITEM_INDENT, "", len, s); + if (eol == NULL) + break; + size -= eol + 1 - s; + s = eol + 1; + } + + colno = ITEM_WRAP_COLUMN; + break; + default: error (0, 0, "XXX not handling format '%c' for %s", item->format, item->name); @@ -7230,7 +7290,8 @@ handle_auxv_note (Ebl *ebl, Elf *core, GElf_Word descsz, GElf_Off desc_pos) } static void -handle_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const void *desc) +handle_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, + const char *name, const void *desc) { GElf_Word regs_offset; size_t nregloc; @@ -7238,7 +7299,7 @@ handle_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const void *desc) size_t nitems; const Ebl_Core_Item *items; - if (! ebl_core_note (ebl, nhdr->n_type, nhdr->n_descsz, + if (! ebl_core_note (ebl, nhdr, name, ®s_offset, &nregloc, ®locs, &nitems, &items)) return; @@ -7295,11 +7356,14 @@ handle_notes_data (Ebl *ebl, const GElf_Ehdr *ehdr, { if (ehdr->e_type == ET_CORE) { - if (nhdr.n_type == NT_AUXV) + if (nhdr.n_type == NT_AUXV + && (nhdr.n_namesz == 4 /* Broken old Linux kernels. */ + || (nhdr.n_namesz == 5 && name[4] == '\0')) + && !memcmp (name, "CORE", 4)) handle_auxv_note (ebl, ebl->elf, nhdr.n_descsz, start + desc_offset); else - handle_core_note (ebl, &nhdr, desc); + handle_core_note (ebl, &nhdr, name, desc); } else ebl_object_note (ebl, name, nhdr.n_type, nhdr.n_descsz, desc); @@ -7352,7 +7416,7 @@ handle_notes (Ebl *ebl, GElf_Ehdr *ehdr) /* We have to look through the program header to find the note sections. There can be more than one. */ - for (size_t cnt = 0; cnt < ehdr->e_phnum; ++cnt) + for (size_t cnt = 0; cnt < phnum; ++cnt) { GElf_Phdr mem; GElf_Phdr *phdr = gelf_getphdr (ebl->elf, cnt, &mem); @@ -7429,36 +7493,38 @@ dump_data_section (Elf_Scn *scn, const GElf_Shdr *shdr, const char *name) static void print_string_section (Elf_Scn *scn, const GElf_Shdr *shdr, const char *name) { - if (shdr->sh_size == 0) - printf (gettext ("\nSection [%Zu] '%s' is empty.\n"), + if (shdr->sh_size == 0 || shdr->sh_type == SHT_NOBITS) + printf (gettext ("\nSection [%Zu] '%s' has no strings to dump.\n"), elf_ndxscn (scn), name); - - Elf_Data *data = elf_rawdata (scn, NULL); - if (data == NULL) - error (0, 0, gettext ("cannot get data for section [%Zu] '%s': %s"), - elf_ndxscn (scn), name, elf_errmsg (-1)); else { - printf (gettext ("\nString section [%Zu] '%s' contains %" PRIu64 - " bytes at offset %#0" PRIx64 ":\n"), - elf_ndxscn (scn), name, - shdr->sh_size, shdr->sh_offset); - - const char *start = data->d_buf; - const char *const limit = start + data->d_size; - do + Elf_Data *data = elf_rawdata (scn, NULL); + if (data == NULL) + error (0, 0, gettext ("cannot get data for section [%Zu] '%s': %s"), + elf_ndxscn (scn), name, elf_errmsg (-1)); + else { - const char *end = memchr (start, '\0', limit - start); - const size_t pos = start - (const char *) data->d_buf; - if (unlikely (end == NULL)) + printf (gettext ("\nString section [%Zu] '%s' contains %" PRIu64 + " bytes at offset %#0" PRIx64 ":\n"), + elf_ndxscn (scn), name, + shdr->sh_size, shdr->sh_offset); + + const char *start = data->d_buf; + const char *const limit = start + data->d_size; + do { - printf (" [%6Zx]- %.*s\n", - pos, (int) (limit - start), start); - break; - } - printf (" [%6Zx] %s\n", pos, start); - start = end + 1; - } while (start < limit); + const char *end = memchr (start, '\0', limit - start); + const size_t pos = start - (const char *) data->d_buf; + if (unlikely (end == NULL)) + { + printf (" [%6Zx]- %.*s\n", + pos, (int) (limit - start), start); + break; + } + printf (" [%6Zx] %s\n", pos, start); + start = end + 1; + } while (start < limit); + } } } @@ -7512,7 +7578,8 @@ for_each_section_argument (Elf *elf, const struct section_argument *list, if (unlikely (scn == NULL)) { - error (0, 0, gettext ("\nsection '%s' does not exist"), a->arg); + if (!a->implicit) + error (0, 0, gettext ("\nsection '%s' does not exist"), a->arg); continue; } } diff --git a/elfutils/tests/Makefile.in b/elfutils/tests/Makefile.in index 5e47d473..9c3ceec2 100644 --- a/elfutils/tests/Makefile.in +++ b/elfutils/tests/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/elfutils/version.h b/elfutils/version.h index 411aa8aa..2672ea8d 100644 --- a/elfutils/version.h +++ b/elfutils/version.h @@ -50,7 +50,7 @@ #ifndef _ELFUTILS_VERSION_H #define _ELFUTILS_VERSION_H 1 -#define _ELFUTILS_VERSION 143 +#define _ELFUTILS_VERSION 144 #define _ELFUTILS_PREREQ(major, minor) \ (_ELFUTILS_VERSION >= ((major) * 1000 + (minor))) |