From 5a4cef9b6c2899944308fdb8f78559fc0df766cc Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 24 Apr 2009 20:12:58 +0000 Subject: 0.141-1 - Update to 0.141 - libebl: sparc backend fixes (#490585) some more arm backend support - libdwfl: fix dwfl_module_build_id for prelinked DSO case (#489439) fixes in core file support (#494858) dwfl_module_getsym interface improved for non-address symbols - eu-strip: fix infinite loop on strange inputs with -f - eu-addr2line: take -j/--section=NAME option for binutils compatibility (same effect as '(NAME)0x123' syntax already supported) - Resolves: RHBZ #495213, RHBZ #465872, RHBZ #470055, RHBZ #484623 --- .gear/rules | 2 +- elfutils-0.137-fixes.patch | 174 -- elfutils-portability.patch | 496 +++-- elfutils-robustify.patch | 392 ++-- elfutils.spec | 87 +- elfutils/AUTHORS | 2 + elfutils/ChangeLog | 50 + elfutils/Makefile.am | 6 +- elfutils/Makefile.in | 72 +- elfutils/NEWS | 46 + elfutils/README | 6 + elfutils/THANKS | 2 +- elfutils/TODO | 34 +- elfutils/aclocal.m4 | 1 + elfutils/backends/ChangeLog | 45 + elfutils/backends/Makefile.am | 7 +- elfutils/backends/Makefile.in | 20 +- elfutils/backends/arm_attrs.c | 242 +++ elfutils/backends/arm_auxv.c | 46 + elfutils/backends/arm_corenote.c | 73 + elfutils/backends/arm_init.c | 10 +- elfutils/backends/arm_regs.c | 117 ++ elfutils/backends/arm_retval.c | 138 ++ elfutils/backends/arm_symbol.c | 73 +- elfutils/backends/i386_corenote.c | 10 +- elfutils/backends/i386_reloc.def | 3 + elfutils/backends/ia64_symbol.c | 6 +- elfutils/backends/ppc_attrs.c | 12 +- elfutils/backends/sparc_reloc.def | 164 +- elfutils/backends/x86_64_corenote.c | 5 +- elfutils/backends/x86_corenote.c | 47 + elfutils/config.h.in | 10 +- elfutils/config/ChangeLog | 32 + elfutils/config/Makefile.am | 23 +- elfutils/config/Makefile.in | 42 +- elfutils/config/elfutils.spec.in | 39 +- elfutils/config/known-dwarf.awk | 55 + elfutils/config/version.h.in | 58 + elfutils/configure | 441 ++++- elfutils/configure.ac | 84 +- elfutils/elfutils.spec | 41 +- elfutils/lib/ChangeLog | 15 + elfutils/lib/Makefile.in | 5 +- elfutils/lib/eu-config.h | 30 +- elfutils/lib/system.h | 14 +- elfutils/libasm/ChangeLog | 9 + elfutils/libasm/Makefile.am | 9 +- elfutils/libasm/Makefile.in | 9 +- elfutils/libasm/asm_error.c | 112 +- elfutils/libcpu/ChangeLog | 69 + elfutils/libcpu/Makefile.am | 5 +- elfutils/libcpu/Makefile.in | 14 +- elfutils/libcpu/defs/i386 | 53 + elfutils/libcpu/i386_disasm.c | 226 ++- elfutils/libcpu/i386_parse.c | 122 +- elfutils/libcpu/i386_parse.h | 2 +- elfutils/libcpu/i386_parse.y | 54 +- elfutils/libdw/ChangeLog | 76 + elfutils/libdw/Makefile.am | 14 +- elfutils/libdw/Makefile.in | 27 +- elfutils/libdw/dwarf.h | 81 +- elfutils/libdw/dwarf_error.c | 83 +- elfutils/libdw/dwarf_getattrs.c | 33 +- elfutils/libdw/dwarf_getsrclines.c | 6 +- elfutils/libdw/dwarf_haschildren.c | 4 +- elfutils/libdw/dwarf_ranges.c | 11 +- elfutils/libdw/libdw.map | 9 + elfutils/libdw/libdwP.h | 49 +- elfutils/libdw/memory-access.h | 24 +- elfutils/libdwfl/ChangeLog | 191 ++ elfutils/libdwfl/Makefile.am | 14 +- elfutils/libdwfl/Makefile.in | 92 +- elfutils/libdwfl/argp-std.c | 12 +- elfutils/libdwfl/bzip2.c | 4 + elfutils/libdwfl/core-file.c | 14 +- elfutils/libdwfl/derelocate.c | 26 +- elfutils/libdwfl/dwfl_build_id_find_debuginfo.c | 22 +- elfutils/libdwfl/dwfl_build_id_find_elf.c | 19 +- elfutils/libdwfl/dwfl_error.c | 87 +- elfutils/libdwfl/dwfl_getmodules.c | 62 +- elfutils/libdwfl/dwfl_module_build_id.c | 47 +- elfutils/libdwfl/dwfl_module_getdwarf.c | 60 +- elfutils/libdwfl/dwfl_module_getelf.c | 88 + elfutils/libdwfl/dwfl_module_getsym.c | 26 +- elfutils/libdwfl/dwfl_report_elf.c | 20 +- elfutils/libdwfl/dwfl_segment_report_module.c | 30 +- elfutils/libdwfl/find-debuginfo.c | 18 +- elfutils/libdwfl/gzip.c | 299 +++ elfutils/libdwfl/libdwfl.h | 11 +- elfutils/libdwfl/libdwflP.h | 26 +- elfutils/libdwfl/link_map.c | 7 +- elfutils/libdwfl/linux-kernel-modules.c | 59 +- elfutils/libdwfl/linux-proc-maps.c | 3 + elfutils/libdwfl/offline.c | 27 +- elfutils/libdwfl/open.c | 152 ++ elfutils/libdwfl/relocate.c | 20 +- elfutils/libdwfl/segment.c | 44 +- elfutils/libebl/ChangeLog | 15 + elfutils/libebl/Makefile.in | 5 +- elfutils/libebl/eblauxvinfo.c | 6 +- elfutils/libebl/eblcorenotetypename.c | 2 +- elfutils/libebl/eblreloctypename.c | 4 +- elfutils/libebl/eblsymboltypename.c | 4 +- elfutils/libelf/ChangeLog | 123 +- elfutils/libelf/Makefile.am | 4 +- elfutils/libelf/Makefile.in | 7 +- elfutils/libelf/elf.h | 100 +- elfutils/libelf/elf32_checksum.c | 23 +- elfutils/libelf/elf32_getehdr.c | 34 +- elfutils/libelf/elf32_getshdr.c | 7 +- elfutils/libelf/elf32_updatefile.c | 189 +- elfutils/libelf/elf32_updatenull.c | 9 +- elfutils/libelf/elf_begin.c | 43 +- elfutils/libelf/elf_error.c | 83 +- elfutils/libelf/elf_getarhdr.c | 17 +- elfutils/libelf/elf_getdata.c | 29 +- elfutils/libelf/elf_getdata_rawchunk.c | 15 +- elfutils/libelf/elf_next.c | 10 +- elfutils/libelf/elf_rand.c | 6 +- elfutils/libelf/elf_rawfile.c | 8 +- elfutils/libelf/elf_strptr.c | 6 +- elfutils/libelf/libelf.h | 2 +- elfutils/libelf/libelfP.h | 12 +- elfutils/libelf/note_xlate.h | 4 +- elfutils/m4/ChangeLog | 9 + elfutils/m4/Makefile.am | 4 +- elfutils/m4/Makefile.in | 7 +- elfutils/m4/zip.m4 | 18 + elfutils/po/ChangeLog | 6 + elfutils/po/Makevars | 2 +- elfutils/po/POTFILES.in | 20 +- elfutils/po/elfutils.pot | 2366 ++++++++++++++++------- elfutils/src/ChangeLog | 213 ++ elfutils/src/Makefile.am | 8 +- elfutils/src/Makefile.in | 58 +- elfutils/src/addr2line.c | 138 +- elfutils/src/ar.c | 32 +- elfutils/src/elfcmp.c | 43 +- elfutils/src/elflint.c | 125 +- elfutils/src/findtextrel.c | 10 +- elfutils/src/ld.c | 11 +- elfutils/src/nm.c | 52 +- elfutils/src/objdump.c | 192 +- elfutils/src/ranlib.c | 8 +- elfutils/src/readelf.c | 1238 +++++++++++- elfutils/src/size.c | 23 +- elfutils/src/strings.c | 10 +- elfutils/src/strip.c | 13 +- elfutils/src/unstrip.c | 9 +- elfutils/tests/ChangeLog | 55 + elfutils/tests/Makefile.am | 14 +- elfutils/tests/Makefile.in | 219 ++- elfutils/tests/dwfl-bug-getmodules.c | 74 + elfutils/tests/run-dwfl-addr-sect.sh | 9 +- elfutils/tests/run-strings-test.sh | 5 +- elfutils/tests/test-subr.sh | 5 +- elfutils/tests/testfile44.S.bz2 | Bin 16435 -> 18296 bytes elfutils/tests/testfile44.expect.bz2 | Bin 54232 -> 60096 bytes elfutils/tests/testfile45.S.bz2 | Bin 22725 -> 24742 bytes elfutils/tests/testfile45.expect.bz2 | Bin 75086 -> 82002 bytes elfutils/tests/testfile50.bz2 | Bin 0 -> 229 bytes elfutils/version.h | 58 + 162 files changed, 8742 insertions(+), 2937 deletions(-) delete mode 100644 elfutils-0.137-fixes.patch create mode 100644 elfutils/backends/arm_attrs.c create mode 100644 elfutils/backends/arm_auxv.c create mode 100644 elfutils/backends/arm_corenote.c create mode 100644 elfutils/backends/arm_regs.c create mode 100644 elfutils/backends/arm_retval.c create mode 100644 elfutils/backends/x86_corenote.c create mode 100644 elfutils/config/known-dwarf.awk create mode 100644 elfutils/config/version.h.in create mode 100644 elfutils/libdwfl/bzip2.c create mode 100644 elfutils/libdwfl/dwfl_module_getelf.c create mode 100644 elfutils/libdwfl/gzip.c create mode 100644 elfutils/libdwfl/open.c create mode 100644 elfutils/m4/zip.m4 create mode 100644 elfutils/tests/dwfl-bug-getmodules.c create mode 100644 elfutils/tests/testfile50.bz2 create mode 100644 elfutils/version.h diff --git a/.gear/rules b/.gear/rules index e8666b0b..4ae154e9 100644 --- a/.gear/rules +++ b/.gear/rules @@ -1,2 +1,2 @@ copy: *.patch -tar.gz: elfutils name=elfutils-0.137 +tar.bz2: elfutils name=elfutils-0.141 diff --git a/elfutils-0.137-fixes.patch b/elfutils-0.137-fixes.patch deleted file mode 100644 index d357273f..00000000 --- a/elfutils-0.137-fixes.patch +++ /dev/null @@ -1,174 +0,0 @@ ---- elfutils-0.137/libdwfl/ChangeLog -+++ elfutils-0.137/libdwfl/ChangeLog -@@ -1,3 +1,17 @@ -+2008-09-29 Roland McGrath -+ -+ * segment.c (insert): Must realloc DWFL->lookup_module here too. -+ (dwfl_report_segment): Clear DWFL->lookup_module before insert calls. -+ -+2008-08-28 Roland McGrath -+ -+ * segment.c (reify_segments): Fix last change. -+ -+2008-08-27 Roland McGrath -+ -+ * linux-proc-maps.c (read_proc_memory): Return 0 for EINVAL or EPERM -+ failure from pread64. -+ - 2008-08-26 Roland McGrath - - * segment.c (reify_segments): Insert a trailing segment for a module ---- elfutils-0.137/libdwfl/linux-proc-maps.c -+++ elfutils-0.137/libdwfl/linux-proc-maps.c -@@ -267,6 +267,9 @@ read_proc_memory (void *arg, void *data, - { - const int fd = *(const int *) arg; - ssize_t nread = pread64 (fd, data, maxread, (off64_t) address); -+ /* Some kernels don't actually let us do this read, ignore those errors. */ -+ if (nread < 0 && (errno == EINVAL || errno == EPERM)) -+ return 0; - if (nread > 0 && (size_t) nread < minread) - nread = 0; - return nread; ---- elfutils-0.137/libdwfl/segment.c -+++ elfutils-0.137/libdwfl/segment.c -@@ -83,12 +83,26 @@ insert (Dwfl *dwfl, size_t i, GElf_Addr - int *nsegndx = realloc (dwfl->lookup_segndx, sizeof nsegndx[0] * n); - if (unlikely (nsegndx == NULL)) - { -- free (naddr); -+ if (naddr != dwfl->lookup_addr) -+ free (naddr); - return true; - } - dwfl->lookup_alloc = n; - dwfl->lookup_addr = naddr; - dwfl->lookup_segndx = nsegndx; -+ -+ if (dwfl->lookup_module != NULL) -+ { -+ /* Make sure this array is big enough too. */ -+ Dwfl_Module **old = dwfl->lookup_module; -+ dwfl->lookup_module = realloc (dwfl->lookup_module, -+ sizeof dwfl->lookup_module[0] * n); -+ if (unlikely (dwfl->lookup_module == NULL)) -+ { -+ free (old); -+ return true; -+ } -+ } - } - - if (unlikely (i < dwfl->lookup_elts)) -@@ -175,9 +189,17 @@ reify_segments (Dwfl *dwfl) - return true; - ++idx; - } -+ else if (dwfl->lookup_addr[idx] < start) -+ { -+ /* The module starts past the end of this segment. -+ Add a new one. */ -+ if (unlikely (insert (dwfl, idx + 1, start, end, -1))) -+ return true; -+ ++idx; -+ } - -- if (((size_t) idx + 1 == dwfl->lookup_elts -- || end < dwfl->lookup_addr[idx + 1]) -+ if ((size_t) idx + 1 < dwfl->lookup_elts -+ && end < dwfl->lookup_addr[idx + 1] - /* The module ends in the middle of this segment. Split it. */ - && unlikely (insert (dwfl, idx + 1, - end, dwfl->lookup_addr[idx + 1], -1))) -@@ -261,6 +283,12 @@ dwfl_report_segment (Dwfl *dwfl, int ndx - phdr->p_align < dwfl->segment_align)) - dwfl->segment_align = phdr->p_align; - -+ if (unlikely (dwfl->lookup_module != NULL)) -+ { -+ free (dwfl->lookup_module); -+ dwfl->lookup_module = NULL; -+ } -+ - GElf_Addr start = segment_start (dwfl, bias + phdr->p_vaddr); - GElf_Addr end = segment_end (dwfl, bias + phdr->p_vaddr + phdr->p_memsz); - -@@ -289,12 +317,6 @@ dwfl_report_segment (Dwfl *dwfl, int ndx - dwfl->lookup_tail_offset = end - bias - phdr->p_vaddr + phdr->p_offset; - dwfl->lookup_tail_ndx = ndx + 1; - -- if (unlikely (dwfl->lookup_module != NULL)) -- { -- free (dwfl->lookup_module); -- dwfl->lookup_module = NULL; -- } -- - return ndx; - } - INTDEF (dwfl_report_segment) ---- elfutils-0.137/libelf/ChangeLog -+++ elfutils-0.137/libelf/ChangeLog -@@ -1,3 +1,9 @@ -+2008-08-27 Roland McGrath -+ -+ * elf_begin.c (get_shnum): Avoid misaligned reads for matching endian. -+ -+ * libelfP.h [!ALLOW_UNALIGNED] (__libelf_type_align): Fix CLASS index. -+ - 2008-08-25 Roland McGrath - - * Makefile.am (libelf_so_LDLIBS): New variable. ---- elfutils-0.137/libelf/elf_begin.c -+++ elfutils-0.137/libelf/elf_begin.c -@@ -111,7 +111,11 @@ get_shnum (void *map_address, unsigned c - bool is32 = e_ident[EI_CLASS] == ELFCLASS32; - - /* Make the ELF header available. */ -- if (e_ident[EI_DATA] == MY_ELFDATA) -+ if (e_ident[EI_DATA] == MY_ELFDATA -+ && (ALLOW_UNALIGNED -+ || (((size_t) e_ident -+ & ((is32 ? __alignof__ (Elf32_Ehdr) : __alignof__ (Elf64_Ehdr)) -+ - 1)) == 0))) - ehdr.p = e_ident; - else - { -@@ -130,8 +134,11 @@ get_shnum (void *map_address, unsigned c - else - memcpy (&ehdr_mem, e_ident, sizeof (Elf32_Ehdr)); - -- CONVERT (ehdr_mem.e32.e_shnum); -- CONVERT (ehdr_mem.e32.e_shoff); -+ if (e_ident[EI_DATA] != MY_ELFDATA) -+ { -+ CONVERT (ehdr_mem.e32.e_shnum); -+ CONVERT (ehdr_mem.e32.e_shoff); -+ } - } - else - { -@@ -143,8 +150,11 @@ get_shnum (void *map_address, unsigned c - else - memcpy (&ehdr_mem, e_ident, sizeof (Elf64_Ehdr)); - -- CONVERT (ehdr_mem.e64.e_shnum); -- CONVERT (ehdr_mem.e64.e_shoff); -+ if (e_ident[EI_DATA] != MY_ELFDATA) -+ { -+ CONVERT (ehdr_mem.e64.e_shnum); -+ CONVERT (ehdr_mem.e64.e_shoff); -+ } - } - } - ---- elfutils-0.137/libelf/libelfP.h -+++ elfutils-0.137/libelf/libelfP.h -@@ -460,7 +460,7 @@ extern const uint_fast8_t __libelf_type_ - version, binary class, and type. */ - extern const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] attribute_hidden; - # define __libelf_type_align(class, type) \ -- (__libelf_type_aligns[LIBELF_EV_IDX][class][type] ?: 1) -+ (__libelf_type_aligns[LIBELF_EV_IDX][class - 1][type] ?: 1) - #else - # define __libelf_type_align(class, type) 1 - #endif diff --git a/elfutils-portability.patch b/elfutils-portability.patch index e12a63e7..79dc4fa0 100644 --- a/elfutils-portability.patch +++ b/elfutils-portability.patch @@ -1,6 +1,17 @@ --- elfutils/backends/ChangeLog +++ elfutils/backends/ChangeLog -@@ -315,6 +315,11 @@ +@@ -33,6 +33,10 @@ + * ppc_attrs.c (ppc_check_object_attribute): Handle tag + GNU_Power_ABI_Struct_Return. + ++2009-01-23 Roland McGrath ++ ++ * Makefile.am (libebl_%.so): Use $(LD_AS_NEEDED). ++ + 2008-10-04 Ulrich Drepper + + * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and +@@ -360,6 +364,11 @@ * sparc_init.c: Likewise. * x86_64_init.c: Likewise. @@ -12,7 +23,7 @@ 2005-11-19 Roland McGrath * ppc64_reloc.def: REL30 -> ADDR30. -@@ -337,6 +342,9 @@ +@@ -382,6 +391,9 @@ * Makefile.am (uninstall): Don't try to remove $(pkgincludedir). (CLEANFILES): Add libebl_$(m).so. @@ -48,9 +59,18 @@ i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c \ i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c cpu_i386 = ../libcpu/libcpu_i386.a +@@ -115,7 +116,7 @@ libebl_%.so: libebl_%_pic.a libebl_%.map + $(LINK) -shared -o $@ -Wl,--whole-archive,$<\ + $(cpu_$(@:libebl_%.so=%)) -Wl,--no-whole-archive \ + -Wl,--version-script,$(word 2,$^) \ +- -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap) ++ -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap) + $(textrel_check) + + # XXX Should not be needed... --- elfutils/backends/Makefile.in +++ elfutils/backends/Makefile.in -@@ -155,6 +155,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -158,6 +158,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -58,7 +78,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -184,6 +185,7 @@ SHELL = @SHELL@ +@@ -187,6 +188,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ @@ -66,9 +86,9 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -239,9 +241,9 @@ target_alias = @target_alias@ - top_builddir = @top_builddir@ +@@ -245,9 +247,9 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ -@MUDFLAP_FALSE@ -Wextra -Wformat=2 -std=gnu99 +@MUDFLAP_FALSE@ $(WEXTRA) -Wformat=2 -std=gnu99 @@ -78,9 +98,27 @@ INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ -I$(top_srcdir)/lib -I.. +@@ -650,7 +652,7 @@ libebl_%.so: libebl_%_pic.a libebl_%.map + $(LINK) -shared -o $@ -Wl,--whole-archive,$<\ + $(cpu_$(@:libebl_%.so=%)) -Wl,--no-whole-archive \ + -Wl,--version-script,$(word 2,$^) \ +- -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap) ++ -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap) + $(textrel_check) + + # XXX Should not be needed... --- elfutils/ChangeLog +++ elfutils/ChangeLog -@@ -39,6 +39,10 @@ +@@ -9,6 +9,8 @@ + + 2009-01-23 Roland McGrath + ++ * configure.ac: Check for __builtin_popcount. ++ + * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3. + + * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of +@@ -89,6 +91,10 @@ * configure.ac: Add dummy automake conditional to get dependencies for non-generic linker right. See src/Makefile.am. @@ -91,7 +129,7 @@ 2005-11-18 Roland McGrath * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable. -@@ -86,6 +90,17 @@ +@@ -136,6 +142,17 @@ * Makefile.am (all_SUBDIRS): Add libdwfl. * configure.ac: Write libdwfl/Makefile. @@ -99,19 +137,19 @@ + + * configure.ac (WEXTRA): Check for -Wextra and set this substitution. + -+ * configure.ac: Check for struct stat st_?tim members. -+ * src/strip.c (process_file): Use st_?time if st_?tim are not there. ++ * configure.ac: Check for struct stat st_?tim members. ++ * src/strip.c (process_file): Use st_?time if st_?tim are not there. + -+ * configure.ac: Check for futimes function. -+ * src/strip.c (handle_elf) [! HAVE_FUTIMES]: Use utimes instead. -+ (handle_ar) [! HAVE_FUTIMES]: Likewise. ++ * configure.ac: Check for futimes function. ++ * src/strip.c (handle_elf) [! HAVE_FUTIMES]: Use utimes instead. ++ (handle_ar) [! HAVE_FUTIMES]: Likewise. + 2005-05-19 Roland McGrath * configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros. --- elfutils/config/Makefile.in +++ elfutils/config/Makefile.in -@@ -72,6 +72,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -73,6 +73,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -119,7 +157,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -101,6 +102,7 @@ SHELL = @SHELL@ +@@ -102,6 +103,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ @@ -127,25 +165,44 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +--- elfutils/config.h.in ++++ elfutils/config.h.in +@@ -1,5 +1,8 @@ + /* config.h.in. Generated from configure.ac by autoheader. */ + ++/* Have __builtin_popcount. */ ++#undef HAVE_BUILTIN_POPCOUNT ++ + /* $libdir subdirectory containing libebl modules. */ + #undef LIBEBL_SUBDIR + +@@ -52,4 +55,7 @@ + /* Define for large files, on AIX-style hosts. */ + #undef _LARGE_FILES + ++/* Stubbed out if missing compiler support. */ ++#undef __thread ++ + #include --- elfutils/configure +++ elfutils/configure -@@ -676,6 +676,8 @@ YFLAGS - LEX - LEX_OUTPUT_ROOT - LEXLIB -+WEXTRA -+LD_AS_NEEDED - LOCALEDIR - DATADIRNAME +@@ -642,6 +642,8 @@ NATIVE_LD_FALSE NATIVE_LD_TRUE -@@ -3894,6 +3896,88 @@ echo "$as_me: error: gcc with C99 suppor + DATADIRNAME + LOCALEDIR ++LD_AS_NEEDED ++WEXTRA + LEXLIB + LEX_OUTPUT_ROOT + LEX +@@ -4041,6 +4043,152 @@ $as_echo "$as_me: error: gcc with C99 su fi -+{ echo "$as_me:$LINENO: checking for -Wextra option to $CC" >&5 -+echo $ECHO_N "checking for -Wextra option to $CC... $ECHO_C" >&6; } ++{ $as_echo "$as_me:$LINENO: checking for -Wextra option to $CC" >&5 ++$as_echo_n "checking for -Wextra option to $CC... " >&6; } +if test "${ac_cv_cc_wextra+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 ++ $as_echo_n "(cached) " >&6 +else + old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Wextra" @@ -158,20 +215,21 @@ + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac -+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" ++$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_cc_wextra=yes +else -+ echo "$as_me: failed program was:" >&5 ++ $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_cc_wextra=no @@ -180,8 +238,8 @@ +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +CFLAGS="$old_CFLAGS" +fi -+{ echo "$as_me:$LINENO: result: $ac_cv_cc_wextra" >&5 -+echo "${ECHO_T}$ac_cv_cc_wextra" >&6; } ++{ $as_echo "$as_me:$LINENO: result: $ac_cv_cc_wextra" >&5 ++$as_echo "$ac_cv_cc_wextra" >&6; } + +if test "x$ac_cv_cc_wextra" = xyes; then + WEXTRA=-Wextra @@ -190,10 +248,10 @@ +fi + + -+{ echo "$as_me:$LINENO: checking for --as-needed linker option" >&5 -+echo $ECHO_N "checking for --as-needed linker option... $ECHO_C" >&6; } ++{ $as_echo "$as_me:$LINENO: checking for --as-needed linker option" >&5 ++$as_echo_n "checking for --as-needed linker option... " >&6; } +if test "${ac_cv_as_needed+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 ++ $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } +then + ac_cv_as_needed=yes @@ -213,8 +271,8 @@ +fi +rm -f conftest* +fi -+{ echo "$as_me:$LINENO: result: $ac_cv_as_needed" >&5 -+echo "${ECHO_T}$ac_cv_as_needed" >&6; } ++{ $as_echo "$as_me:$LINENO: result: $ac_cv_as_needed" >&5 ++$as_echo "$ac_cv_as_needed" >&6; } +if test "x$ac_cv_as_needed" = xyes; then + LD_AS_NEEDED=-Wl,--as-needed +else @@ -223,42 +281,97 @@ + + + ++{ $as_echo "$as_me:$LINENO: checking for __builtin_popcount" >&5 ++$as_echo_n "checking for __builtin_popcount... " >&6; } ++if test "${ac_cv_popcount+set}" = set; then ++ $as_echo_n "(cached) " >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ + - LOCALEDIR=$datadir ++int ++main () ++{ ++exit (__builtin_popcount (127)); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" ++$as_echo "$ac_try_echo") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest$ac_exeext && { ++ test "$cross_compiling" = yes || ++ $as_test_x conftest$ac_exeext ++ }; then ++ ac_cv_popcount=yes ++else ++ $as_echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_cv_popcount=no ++fi ++ ++rm -rf conftest.dSYM ++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++{ $as_echo "$as_me:$LINENO: result: $ac_cv_popcount" >&5 ++$as_echo "$ac_cv_popcount" >&6; } ++if test "x$ac_cv_popcount" = xyes; then ++ ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_BUILTIN_POPCOUNT 1 ++_ACEOF ++ ++fi ++ ++ + { $as_echo "$as_me:$LINENO: checking for __thread support" >&5 + $as_echo_n "checking for __thread support... " >&6; } + if test "${ac_cv_tls+set}" = set; then +@@ -4106,9 +4254,18 @@ fi + { $as_echo "$as_me:$LINENO: result: $ac_cv_tls" >&5 + $as_echo "$ac_cv_tls" >&6; } + if test "x$ac_cv_tls" != xyes; then +- { { $as_echo "$as_me:$LINENO: error: __thread support required" >&5 +-$as_echo "$as_me: error: __thread support required" >&2;} ++ if test "$use_locks" = yes; then ++ { { $as_echo "$as_me:$LINENO: error: --enable-thread-safety requires __thread support" >&5 ++$as_echo "$as_me: error: --enable-thread-safety requires __thread support" >&2;} + { (exit 1); exit 1; }; } ++else ++ ++cat >>confdefs.h <<\_ACEOF ++#define __thread /* empty: no multi-thread support */ ++_ACEOF ++ ++fi ++ + fi + - cat >>confdefs.h <<_ACEOF -@@ -5646,8 +5730,8 @@ YFLAGS!$YFLAGS$ac_delim - LEX!$LEX$ac_delim - LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim - LEXLIB!$LEXLIB$ac_delim --LOCALEDIR!$LOCALEDIR$ac_delim --DATADIRNAME!$DATADIRNAME$ac_delim -+WEXTRA!$WEXTRA$ac_delim -+LD_AS_NEEDED!$LD_AS_NEEDED$ac_delim - _ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then -@@ -5689,6 +5773,8 @@ _ACEOF - ac_delim='%!_!# ' - for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -+LOCALEDIR!$LOCALEDIR$ac_delim -+DATADIRNAME!$DATADIRNAME$ac_delim - NATIVE_LD_TRUE!$NATIVE_LD_TRUE$ac_delim - NATIVE_LD_FALSE!$NATIVE_LD_FALSE$ac_delim - base_cpu!$base_cpu$ac_delim -@@ -5722,7 +5808,7 @@ LIBOBJS!$LIBOBJS$ac_delim - LTLIBOBJS!$LTLIBOBJS$ac_delim - _ACEOF - -- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 31; then -+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 33; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 --- elfutils/configure.ac +++ elfutils/configure.ac -@@ -74,6 +74,34 @@ CFLAGS="$old_CFLAGS"]) +@@ -74,6 +74,39 @@ CFLAGS="$old_CFLAGS"]) AS_IF([test "x$ac_cv_c99" != xyes], AC_MSG_ERROR([gcc with C99 support required])) @@ -289,13 +402,39 @@ + [LD_AS_NEEDED=-Wl,--as-needed], [LD_AS_NEEDED=]) +AC_SUBST(LD_AS_NEEDED) + ++AC_CACHE_CHECK([for __builtin_popcount], ac_cv_popcount, [dnl ++AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[exit (__builtin_popcount (127));]])], ++ ac_cv_popcount=yes, ac_cv_popcount=no)]) ++AS_IF([test "x$ac_cv_popcount" = xyes], ++ [AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Have __builtin_popcount.])]) + + AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl + # Use the same flags that we use for our DSOs, so the test is representative. + # Some old compiler/linker/libc combinations fail some ways and not others. +@@ -89,7 +122,10 @@ static __thread int a; int foo (int b) { + CFLAGS="$save_CFLAGS" + LDFLAGS="$save_LDFLAGS"]) + AS_IF([test "x$ac_cv_tls" != xyes], +- AC_MSG_ERROR([__thread support required])) ++ [AS_IF([test "$use_locks" = yes], ++ [AC_MSG_ERROR([--enable-thread-safety requires __thread support])], ++ [AC_DEFINE([__thread], [/* empty: no multi-thread support */], ++ [Stubbed out if missing compiler support.])])]) + LOCALEDIR=$datadir AC_SUBST(LOCALEDIR) - AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") --- elfutils/lib/ChangeLog +++ elfutils/lib/ChangeLog -@@ -41,6 +41,11 @@ +@@ -1,5 +1,8 @@ + 2009-01-23 Roland McGrath + ++ * eu-config.h [! HAVE_BUILTIN_POPCOUNT] ++ (__builtin_popcount): New inline function. ++ + * eu-config.h: Add multiple inclusion protection. + + 2009-01-17 Ulrich Drepper +@@ -56,6 +59,11 @@ * Makefile.am (libeu_a_SOURCES): Add it. * system.h: Declare crc32_file. @@ -307,6 +446,25 @@ 2005-04-30 Ulrich Drepper * Makefile.am: Use -ffunction-sections for xmalloc.c. +--- elfutils/lib/eu-config.h ++++ elfutils/lib/eu-config.h +@@ -182,5 +182,16 @@ asm (".section predict_data, \"aw\"; .pr + /* This macro is used by the tests conditionalize for standalone building. */ + #define ELFUTILS_HEADER(name) + ++#ifndef HAVE_BUILTIN_POPCOUNT ++# define __builtin_popcount hakmem_popcount ++static inline unsigned int __attribute__ ((unused)) ++hakmem_popcount (unsigned int x) ++{ ++ /* HAKMEM 169 */ ++ unsigned int n = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111); ++ return ((n + (n >> 3)) & 030707070707) % 63; ++} ++#endif /* HAVE_BUILTIN_POPCOUNT */ ++ + + #endif /* eu-config.h */ --- elfutils/lib/Makefile.am +++ elfutils/lib/Makefile.am @@ -25,12 +25,13 @@ @@ -326,7 +484,7 @@ noinst_LIBRARIES = libeu.a --- elfutils/lib/Makefile.in +++ elfutils/lib/Makefile.in -@@ -93,6 +93,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -94,6 +94,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -334,7 +492,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -122,6 +123,7 @@ SHELL = @SHELL@ +@@ -123,6 +124,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ @@ -342,9 +500,9 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -177,9 +179,9 @@ target_alias = @target_alias@ - top_builddir = @top_builddir@ +@@ -181,9 +183,9 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ -@MUDFLAP_FALSE@ -Wextra $($(*F)_CFLAGS) +@MUDFLAP_FALSE@ $(WEXTRA) $($(*F)_CFLAGS) @@ -356,7 +514,7 @@ libeu_a_SOURCES = xstrndup.c xmalloc.c next_prime.c \ --- elfutils/libasm/ChangeLog +++ elfutils/libasm/ChangeLog -@@ -54,6 +54,11 @@ +@@ -63,6 +63,11 @@ * asm_error.c: Add new error ASM_E_IOERROR. * libasmP.h: Add ASM_E_IOERROR definition. @@ -387,7 +545,7 @@ -I$(top_srcdir)/lib --- elfutils/libasm/Makefile.in +++ elfutils/libasm/Makefile.in -@@ -126,6 +126,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -128,6 +128,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -395,7 +553,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -155,6 +156,7 @@ SHELL = @SHELL@ +@@ -157,6 +158,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 @@ -403,9 +561,9 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -210,9 +212,9 @@ target_alias = @target_alias@ - top_builddir = @top_builddir@ +@@ -215,9 +217,9 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Werror -Wunused \ -@MUDFLAP_FALSE@ -Wextra -Wformat=2 +@MUDFLAP_FALSE@ $(WEXTRA) -Wformat=2 @@ -417,7 +575,17 @@ -I$(top_srcdir)/lib --- elfutils/libcpu/ChangeLog +++ elfutils/libcpu/ChangeLog -@@ -265,6 +265,11 @@ +@@ -5,6 +5,9 @@ + + 2009-01-23 Roland McGrath + ++ * i386_disasm.c (i386_disasm): Add abort after assert-constant for old ++ compilers that don't realize it's noreturn. ++ + * Makefile.am (i386_parse_CFLAGS): Use quotes around command + substitution that can produce leading whitespace. + +@@ -334,6 +337,11 @@ * defs/i386.doc: New file. * defs/x86_64: New file. @@ -429,6 +597,16 @@ 2005-02-15 Ulrich Drepper * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2. +--- elfutils/libcpu/i386_disasm.c ++++ elfutils/libcpu/i386_disasm.c +@@ -791,6 +791,7 @@ i386_disasm (const uint8_t **startp, con + + default: + assert (! "INVALID not handled"); ++ abort (); + } + } + else --- elfutils/libcpu/Makefile.am +++ elfutils/libcpu/Makefile.am @@ -30,7 +30,8 @@ AM_CFLAGS = -fmudflap @@ -438,12 +616,12 @@ -AM_CFLAGS += -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fpic \ +WEXTRA = @WEXTRA@ +AM_CFLAGS += -Wall -Wshadow -Wunused $(WEXTRA) -std=gnu99 -fpic \ + -fdollars-in-identifiers \ $($(*F)_CFLAGS) \ $(if $($(*F)_no_Werror),,-Werror) - INCLUDES = -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../libelf \ --- elfutils/libcpu/Makefile.in +++ elfutils/libcpu/Makefile.in -@@ -109,6 +109,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -110,6 +110,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -451,7 +629,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = lex.$( @@ -508,7 +688,7 @@ --- elfutils/libdw/Makefile.in +++ elfutils/libdw/Makefile.in -@@ -164,6 +164,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -165,6 +165,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -516,7 +696,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -193,6 +194,7 @@ SHELL = @SHELL@ +@@ -194,6 +195,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 @@ -524,9 +704,9 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -248,9 +250,10 @@ target_alias = @target_alias@ - top_builddir = @top_builddir@ +@@ -252,9 +254,10 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Werror -Wshadow \ -@MUDFLAP_FALSE@ -Wunused -Wformat=2 -Wextra -std=gnu99 +@MUDFLAP_FALSE@ -Wunused -Wformat=2 $(WEXTRA) -std=gnu99 @@ -539,7 +719,7 @@ $(COMPILE))) --- elfutils/libdwfl/ChangeLog +++ elfutils/libdwfl/ChangeLog -@@ -885,6 +885,11 @@ +@@ -1076,6 +1076,11 @@ 2005-07-21 Roland McGrath @@ -570,7 +750,7 @@ VERSION = 1 --- elfutils/libdwfl/Makefile.in +++ elfutils/libdwfl/Makefile.in -@@ -131,6 +131,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -156,6 +156,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -578,7 +758,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -160,6 +161,7 @@ SHELL = @SHELL@ +@@ -185,6 +186,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 @@ -586,9 +766,9 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -215,9 +217,9 @@ target_alias = @target_alias@ - top_builddir = @top_builddir@ +@@ -243,9 +245,9 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wshadow -Wunused -Wformat=2 \ -@MUDFLAP_FALSE@ -Wextra -std=gnu99 +@MUDFLAP_FALSE@ $(WEXTRA) -std=gnu99 @@ -600,7 +780,7 @@ --- elfutils/libebl/ChangeLog +++ elfutils/libebl/ChangeLog -@@ -554,6 +554,11 @@ +@@ -569,6 +569,11 @@ * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency tracking works right. @@ -631,7 +811,7 @@ INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ --- elfutils/libebl/Makefile.in +++ elfutils/libebl/Makefile.in -@@ -123,6 +123,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -124,6 +124,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -639,7 +819,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -152,6 +153,7 @@ SHELL = @SHELL@ +@@ -153,6 +154,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 @@ -647,9 +827,9 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -207,9 +209,9 @@ target_alias = @target_alias@ - top_builddir = @top_builddir@ +@@ -211,9 +213,9 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ -@MUDFLAP_FALSE@ -Wextra -Wformat=2 -std=gnu99 +@MUDFLAP_FALSE@ $(WEXTRA) -Wformat=2 -std=gnu99 @@ -661,18 +841,18 @@ --- elfutils/libelf/ChangeLog +++ elfutils/libelf/ChangeLog -@@ -408,6 +408,11 @@ - 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. +@@ -537,6 +537,11 @@ + + * elf.h: Update from glibc. +2005-05-31 Roland McGrath + + * Makefile.am (WEXTRA): New variable, substituted by configure. + (AM_CFLAGS): Use it in place of -Wextra. + - 2005-05-11 Ulrich Drepper + 2005-05-08 Roland McGrath - * elf.h: Update again. + * elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now. --- elfutils/libelf/common.h +++ elfutils/libelf/common.h @@ -160,7 +160,7 @@ libelf_release_all (Elf *elf) @@ -714,7 +894,7 @@ GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) --- elfutils/libelf/Makefile.in +++ elfutils/libelf/Makefile.in -@@ -171,6 +171,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -172,6 +172,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -722,7 +902,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -200,6 +201,7 @@ SHELL = @SHELL@ +@@ -201,6 +202,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 @@ -730,9 +910,9 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -255,10 +257,10 @@ target_alias = @target_alias@ - top_builddir = @top_builddir@ +@@ -259,10 +261,10 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Wshadow -Werror \ -@MUDFLAP_FALSE@ -Wunused -Wextra -Wformat=2 -std=gnu99 \ +@MUDFLAP_FALSE@ -Wunused $(WEXTRA) -Wformat=2 -std=gnu99 \ @@ -745,7 +925,7 @@ GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) --- elfutils/m4/Makefile.in +++ elfutils/m4/Makefile.in -@@ -71,6 +71,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -72,6 +72,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -753,7 +933,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -100,6 +101,7 @@ SHELL = @SHELL@ +@@ -101,6 +102,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ @@ -763,7 +943,7 @@ YACC = @YACC@ --- elfutils/Makefile.in +++ elfutils/Makefile.in -@@ -98,6 +98,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -110,6 +110,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -771,7 +951,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -127,6 +128,7 @@ SHELL = @SHELL@ +@@ -139,6 +140,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ @@ -779,9 +959,33 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +--- elfutils/src/addr2line.c ++++ elfutils/src/addr2line.c +@@ -447,10 +447,10 @@ handle_address (const char *string, Dwfl + bool parsed = false; + int n; + char *name = NULL; +- if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &n) == 2 ++ if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &n) == 2 + && string[n] == '\0') + parsed = adjust_to_section (name, &addr, dwfl); +- else if (sscanf (string, "%m[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2 ++ else if (sscanf (string, "%a[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2 + && string[n] == '\0') + { + /* It was symbol+offset. */ --- elfutils/src/ChangeLog +++ elfutils/src/ChangeLog -@@ -61,6 +61,11 @@ +@@ -91,6 +91,8 @@ + * readelf.c (print_debug_frame_section): Use t instead of j formats + for ptrdiff_t OFFSET. + ++ * addr2line.c (handle_address): Use %a instead of %m for compatibility. ++ + 2009-01-21 Ulrich Drepper + + * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section +@@ -274,6 +276,11 @@ that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really is valid in RELRO. @@ -793,7 +997,7 @@ 2008-02-29 Roland McGrath * readelf.c (print_attributes): Add a cast. -@@ -312,6 +317,8 @@ +@@ -525,6 +532,8 @@ * readelf.c (hex_dump): Fix rounding error in whitespace calculation. @@ -802,7 +1006,7 @@ 2007-10-15 Roland McGrath * make-debug-archive.in: New file. -@@ -751,6 +758,10 @@ +@@ -964,6 +973,10 @@ * elflint.c (valid_e_machine): Add EM_ALPHA. Reported by Christian Aichinger . @@ -813,7 +1017,7 @@ 2006-08-08 Ulrich Drepper * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB. -@@ -827,6 +838,10 @@ +@@ -1040,6 +1053,10 @@ * Makefile.am: Add hacks to create dependency files for non-generic linker. @@ -824,7 +1028,7 @@ 2006-06-12 Ulrich Drepper * ldgeneric.c (ld_generic_generate_sections): Don't create .interp -@@ -1175,6 +1190,11 @@ +@@ -1388,6 +1405,11 @@ * readelf.c (print_debug_loc_section): Fix indentation for larger address size. @@ -838,7 +1042,7 @@ * readelf.c (print_debug_line_section): Print section offset of each --- elfutils/src/findtextrel.c +++ elfutils/src/findtextrel.c -@@ -488,7 +488,11 @@ ptrcompare (const void *p1, const void * +@@ -490,7 +490,11 @@ ptrcompare (const void *p1, const void * static void @@ -867,10 +1071,10 @@ $(if $($(*F)_no_Werror),,-Werror) \ - $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ + $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \ - $(if $($(*F)_no_Wformat),,-Wformat=2) $(CFLAGS_$(*F)) + $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(CFLAGS_$(*F)) INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ -@@ -111,6 +112,9 @@ strings_no_Wformat = yes +@@ -112,6 +113,9 @@ addr2line_no_Wformat = yes # XXX While the file is not finished, don't warn about this ldgeneric_no_Wunused = yes @@ -882,7 +1086,7 @@ size_LDADD = $(libelf) $(libeu) $(libmudflap) --- elfutils/src/Makefile.in +++ elfutils/src/Makefile.in -@@ -201,6 +201,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -202,6 +202,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -890,7 +1094,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -230,6 +231,7 @@ SHELL = @SHELL@ +@@ -231,6 +232,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ @@ -898,24 +1102,24 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -d -@@ -287,13 +289,13 @@ top_srcdir = @top_srcdir@ +@@ -291,13 +293,13 @@ zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ @MUDFLAP_FALSE@ $(native_ld_cflags) $(if \ @MUDFLAP_FALSE@ $($(*F)_no_Werror),,-Werror) $(if \ -@MUDFLAP_FALSE@ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ +@MUDFLAP_FALSE@ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - @MUDFLAP_FALSE@ $($(*F)_no_Wformat),,-Wformat=2) \ + @MUDFLAP_FALSE@ $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ @MUDFLAP_FALSE@ $(CFLAGS_$(*F)) @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Wshadow -std=gnu99 \ @MUDFLAP_TRUE@ $(native_ld_cflags) $(if \ @MUDFLAP_TRUE@ $($(*F)_no_Werror),,-Werror) $(if \ -@MUDFLAP_TRUE@ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ +@MUDFLAP_TRUE@ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - @MUDFLAP_TRUE@ $($(*F)_no_Wformat),,-Wformat=2) $(CFLAGS_$(*F)) + @MUDFLAP_TRUE@ $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ + @MUDFLAP_TRUE@ $(CFLAGS_$(*F)) INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ - -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \ -@@ -337,6 +339,9 @@ size_no_Wformat = yes - strings_no_Wformat = yes +@@ -343,6 +345,9 @@ strings_no_Wformat = yes + addr2line_no_Wformat = yes # XXX While the file is not finished, don't warn about this ldgeneric_no_Wunused = yes + @@ -926,7 +1130,7 @@ size_LDADD = $(libelf) $(libeu) $(libmudflap) --- elfutils/src/readelf.c +++ elfutils/src/readelf.c -@@ -6419,7 +6419,7 @@ dump_archive_index (Elf *elf, const char +@@ -7443,7 +7443,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)) @@ -996,7 +1200,7 @@ } /* Open the file. */ -@@ -1745,7 +1761,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1746,7 +1762,7 @@ handle_elf (int fd, Elf *elf, const char /* If requested, preserve the timestamp. */ if (tvp != NULL) { @@ -1005,7 +1209,7 @@ { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), -@@ -1802,7 +1818,7 @@ handle_ar (int fd, Elf *elf, const char +@@ -1803,7 +1819,7 @@ handle_ar (int fd, Elf *elf, const char if (tvp != NULL) { @@ -1016,7 +1220,7 @@ cannot set access and modification date of '%s'"), fname); --- elfutils/tests/ChangeLog +++ elfutils/tests/ChangeLog -@@ -51,6 +51,8 @@ +@@ -106,6 +106,8 @@ 2008-01-21 Roland McGrath @@ -1025,7 +1229,7 @@ * testfile45.S.bz2: Add tests for cltq, cqto. * testfile45.expect.bz2: Adjust. -@@ -759,6 +761,11 @@ +@@ -814,6 +816,11 @@ * Makefile.am (TESTS): Add run-elflint-test.sh. (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2. @@ -1068,7 +1272,7 @@ endif --- elfutils/tests/Makefile.in +++ elfutils/tests/Makefile.in -@@ -335,6 +335,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +@@ -343,6 +343,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -1076,7 +1280,7 @@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -364,6 +365,7 @@ SHELL = @SHELL@ +@@ -372,6 +373,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ @@ -1084,10 +1288,10 @@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ -@@ -418,10 +420,10 @@ sysconfdir = @sysconfdir@ - target_alias = @target_alias@ +@@ -429,10 +431,10 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ -@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ +@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror $(WEXTRA) -std=gnu99 \ @MUDFLAP_FALSE@ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) diff --git a/elfutils-robustify.patch b/elfutils-robustify.patch index 1c3d3e7e..c238f527 100644 --- a/elfutils-robustify.patch +++ b/elfutils-robustify.patch @@ -1,72 +1,57 @@ -src/ -2005-06-09 Roland McGrath - - * readelf.c (handle_dynamic, handle_symtab): Check for bogus sh_link. - (handle_verneed, handle_verdef, handle_versym, handle_hash): Likewise. - (handle_scngrp): Check for bogus sh_info. - - * strip.c (handle_elf): Check for bogus values in sh_link, sh_info, - st_shndx, e_shstrndx, and SHT_GROUP or SHT_SYMTAB_SHNDX data. - Don't use assert on input values, instead bail with "illformed" error. - -2005-05-17 Jakub Jelinek - -libelf/ - * elf32_getphdr.c (elfw2(LIBELFBITS,getphdr)): Check if program header - table fits into object's bounds. - * elf_getshstrndx.c (elf_getshstrndx): Add elf->start_offset to - elf->map_address. Check if first section header fits into object's - bounds. - * elf32_getshdr.c (elfw2(LIBELFBITS,getshdr)): - Check if section header table fits into object's bounds. - * elf_begin.c (get_shnum): Ensure section headers fits into - object's bounds. - (file_read_elf): Make sure scncnt is small enough to allocate both - ElfXX_Shdr and Elf_Scn array. Make sure section and program header - tables fit into object's bounds. Avoid memory leak on failure. - -src/ - * elflint.c (check_hash): Don't check entries beyond end of section. - (check_note): Don't crash if gelf_rawchunk fails. - (section_name): Return if gelf_getshdr returns NULL. - -2005-05-14 Jakub Jelinek - -libelf/ - * libelfP.h (INVALID_NDX): Define. - * gelf_getdyn.c (gelf_getdyn): Use it. Remove ndx < 0 test if any. - * gelf_getlib.c (gelf_getlib): Likewise. - * gelf_getmove.c (gelf_getmove): Likewise. - * gelf_getrel.c (gelf_getrel): Likewise. - * gelf_getrela.c (gelf_getrela): Likewise. - * gelf_getsym.c (gelf_getsym): Likewise. - * gelf_getsyminfo.c (gelf_getsyminfo): Likewise. - * gelf_getsymshndx.c (gelf_getsymshndx): Likewise. - * gelf_getversym.c (gelf_getversym): Likewise. - * gelf_update_dyn.c (gelf_update_dyn): Likewise. - * gelf_update_lib.c (gelf_update_lib): Likewise. - * gelf_update_move.c (gelf_update_move): Likewise. - * gelf_update_rel.c (gelf_update_rel): Likewise. - * gelf_update_rela.c (gelf_update_rela): Likewise. - * gelf_update_sym.c (gelf_update_sym): Likewise. - * gelf_update_syminfo.c (gelf_update_syminfo): Likewise. - * gelf_update_symshndx.c (gelf_update_symshndx): Likewise. - * gelf_update_versym.c (gelf_update_versym): Likewise. - * elf_newscn.c (elf_newscn): Check for overflow. - * elf32_updatefile.c (__elfw2(LIBELFBITS,updatemmap)): Likewise. - (__elfw2(LIBELFBITS,updatefile)): Likewise. - * elf_begin.c (file_read_elf): Likewise. - * elf32_newphdr.c (elfw2(LIBELFBITS,newphdr)): Likewise. - * elf_getarsym.c (elf_getarsym): Likewise. - * elf32_getshdr.c (elfw2(LIBELFBITS,getshdr)): Likewise. -src/ - * elflint.c (section_name): Return "" instead of - crashing on invalid section name. - (check_symtab, is_rel_dyn, check_rela, check_rel, check_dynamic, - check_symtab_shndx, check_hash, check_versym): Robustify. - ---- elfutils-0.136/libelf/elf32_getphdr.c.robustify -+++ elfutils-0.136/libelf/elf32_getphdr.c +--- elfutils/libelf/ChangeLog ++++ elfutils/libelf/ChangeLog +@@ -529,6 +529,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. + ++2005-05-17 Jakub Jelinek ++ ++ * elf32_getphdr.c (elfw2(LIBELFBITS,getphdr)): Check if program header ++ table fits into object's bounds. ++ * elf_getshstrndx.c (elf_getshstrndx): Add elf->start_offset to ++ elf->map_address. Check if first section header fits into object's ++ bounds. ++ * elf32_getshdr.c (elfw2(LIBELFBITS,getshdr)): ++ Check if section header table fits into object's bounds. ++ * elf_begin.c (get_shnum): Ensure section headers fits into ++ object's bounds. ++ (file_read_elf): Make sure scncnt is small enough to allocate both ++ ElfXX_Shdr and Elf_Scn array. Make sure section and program header ++ tables fit into object's bounds. Avoid memory leak on failure. ++ ++2005-05-14 Jakub Jelinek ++ ++ * libelfP.h (INVALID_NDX): Define. ++ * gelf_getdyn.c (gelf_getdyn): Use it. Remove ndx < 0 test if any. ++ * gelf_getlib.c (gelf_getlib): Likewise. ++ * gelf_getmove.c (gelf_getmove): Likewise. ++ * gelf_getrel.c (gelf_getrel): Likewise. ++ * gelf_getrela.c (gelf_getrela): Likewise. ++ * gelf_getsym.c (gelf_getsym): Likewise. ++ * gelf_getsyminfo.c (gelf_getsyminfo): Likewise. ++ * gelf_getsymshndx.c (gelf_getsymshndx): Likewise. ++ * gelf_getversym.c (gelf_getversym): Likewise. ++ * gelf_update_dyn.c (gelf_update_dyn): Likewise. ++ * gelf_update_lib.c (gelf_update_lib): Likewise. ++ * gelf_update_move.c (gelf_update_move): Likewise. ++ * gelf_update_rel.c (gelf_update_rel): Likewise. ++ * gelf_update_rela.c (gelf_update_rela): Likewise. ++ * gelf_update_sym.c (gelf_update_sym): Likewise. ++ * gelf_update_syminfo.c (gelf_update_syminfo): Likewise. ++ * gelf_update_symshndx.c (gelf_update_symshndx): Likewise. ++ * gelf_update_versym.c (gelf_update_versym): Likewise. ++ * elf_newscn.c (elf_newscn): Check for overflow. ++ * elf32_updatefile.c (__elfw2(LIBELFBITS,updatemmap)): Likewise. ++ (__elfw2(LIBELFBITS,updatefile)): Likewise. ++ * elf_begin.c (file_read_elf): Likewise. ++ * elf32_newphdr.c (elfw2(LIBELFBITS,newphdr)): Likewise. ++ * elf_getarsym.c (elf_getarsym): Likewise. ++ * elf32_getshdr.c (elfw2(LIBELFBITS,getshdr)): Likewise. + 2005-05-11 Ulrich Drepper + + * elf.h: Update again. +--- elfutils/libelf/elf32_getphdr.c ++++ elfutils/libelf/elf32_getphdr.c @@ -105,6 +105,16 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf) if (elf->map_address != NULL) @@ -84,8 +69,8 @@ src/ /* All the data is already mapped. Use it. */ void *file_phdr = ((char *) elf->map_address + elf->start_offset + ehdr->e_phoff); ---- elfutils-0.136/libelf/elf32_getshdr.c.robustify -+++ elfutils-0.136/libelf/elf32_getshdr.c +--- elfutils/libelf/elf32_getshdr.c ++++ elfutils/libelf/elf32_getshdr.c @@ -1,5 +1,5 @@ /* Return section header. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007 Red Hat, Inc. @@ -93,7 +78,7 @@ src/ This file is part of Red Hat elfutils. Written by Ulrich Drepper , 1998. -@@ -81,7 +81,8 @@ load_shdr_rwlock (Elf_Scn *scn) +@@ -81,7 +81,8 @@ load_shdr_wrlock (Elf_Scn *scn) goto out; size_t shnum; @@ -103,7 +88,7 @@ src/ goto out; size_t size = shnum * sizeof (ElfW2(LIBELFBITS,Shdr)); -@@ -98,6 +99,16 @@ load_shdr_rwlock (Elf_Scn *scn) +@@ -98,6 +99,16 @@ load_shdr_wrlock (Elf_Scn *scn) if (elf->map_address != NULL) { @@ -120,8 +105,8 @@ src/ ElfW2(LIBELFBITS,Shdr) *notcvt; /* All the data is already mapped. If we could use it ---- elfutils-0.136/libelf/elf32_newphdr.c.robustify -+++ elfutils-0.136/libelf/elf32_newphdr.c +--- 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 || elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) @@ -135,9 +120,9 @@ src/ /* Allocate a new program header with the appropriate number of elements. */ result = (ElfW2(LIBELFBITS,Phdr) *) ---- elfutils-0.136/libelf/elf32_updatefile.c.robustify -+++ elfutils-0.136/libelf/elf32_updatefile.c -@@ -212,6 +212,9 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf +--- elfutils/libelf/elf32_updatefile.c ++++ elfutils/libelf/elf32_updatefile.c +@@ -220,6 +220,9 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) { @@ -147,7 +132,7 @@ src/ 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 -@@ -582,6 +585,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf +@@ -633,6 +636,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) { @@ -158,9 +143,9 @@ src/ off_t shdr_offset = elf->start_offset + ehdr->e_shoff; #if EV_NUM != 2 xfct_t shdr_fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR]; ---- elfutils-0.136/libelf/elf_begin.c.robustify -+++ elfutils-0.136/libelf/elf_begin.c -@@ -155,7 +155,8 @@ get_shnum (void *map_address, unsigned c +--- elfutils/libelf/elf_begin.c ++++ elfutils/libelf/elf_begin.c +@@ -165,7 +165,8 @@ get_shnum (void *map_address, unsigned c if (unlikely (result == 0) && ehdr.e32->e_shoff != 0) { @@ -170,7 +155,7 @@ src/ /* Cannot read the first section header. */ return 0; -@@ -203,7 +204,8 @@ get_shnum (void *map_address, unsigned c +@@ -213,7 +214,8 @@ get_shnum (void *map_address, unsigned c if (unlikely (result == 0) && ehdr.e64->e_shoff != 0) { @@ -180,7 +165,7 @@ src/ /* Cannot read the first section header. */ return 0; -@@ -275,6 +277,15 @@ file_read_elf (int fildes, void *map_add +@@ -285,6 +287,15 @@ file_read_elf (int fildes, void *map_add /* Could not determine the number of sections. */ return NULL; @@ -196,7 +181,7 @@ src/ /* We can now allocate the memory. */ Elf *elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent, ELF_K_ELF, scncnt * sizeof (Elf_Scn)); -@@ -308,13 +319,31 @@ file_read_elf (int fildes, void *map_add +@@ -318,13 +329,31 @@ file_read_elf (int fildes, void *map_add { /* We can use the mmapped memory. */ elf->state.elf32.ehdr = ehdr; @@ -228,7 +213,7 @@ src/ for (size_t cnt = 0; cnt < scncnt; ++cnt) { -@@ -396,13 +425,26 @@ file_read_elf (int fildes, void *map_add +@@ -406,13 +435,26 @@ file_read_elf (int fildes, void *map_add { /* We can use the mmapped memory. */ elf->state.elf64.ehdr = ehdr; @@ -255,8 +240,8 @@ src/ for (size_t cnt = 0; cnt < scncnt; ++cnt) { ---- elfutils-0.136/libelf/elf_getarsym.c.robustify -+++ elfutils-0.136/libelf/elf_getarsym.c +--- elfutils/libelf/elf_getarsym.c ++++ elfutils/libelf/elf_getarsym.c @@ -179,6 +179,9 @@ elf_getarsym (elf, ptr) size_t index_size = atol (tmpbuf); @@ -267,8 +252,8 @@ src/ || n * sizeof (uint32_t) > index_size) { /* This index table cannot be right since it does not fit into ---- elfutils-0.136/libelf/elf_getshstrndx.c.robustify -+++ elfutils-0.136/libelf/elf_getshstrndx.c +--- elfutils/libelf/elf_getshstrndx.c ++++ elfutils/libelf/elf_getshstrndx.c @@ -125,10 +125,25 @@ elf_getshstrndx (elf, dst) if (elf->map_address != NULL && elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA @@ -325,8 +310,8 @@ src/ else { /* We avoid reading in all the section headers. Just read ---- elfutils-0.136/libelf/elf_newscn.c.robustify -+++ elfutils-0.136/libelf/elf_newscn.c +--- elfutils/libelf/elf_newscn.c ++++ elfutils/libelf/elf_newscn.c @@ -104,10 +104,18 @@ elf_newscn (elf) else { @@ -347,8 +332,8 @@ src/ newp = (Elf_ScnList *) calloc (sizeof (Elf_ScnList) + ((elf->state.elf.scnincr *= 2) * sizeof (Elf_Scn)), 1); ---- elfutils-0.136/libelf/gelf_getdyn.c.robustify -+++ elfutils-0.136/libelf/gelf_getdyn.c +--- elfutils/libelf/gelf_getdyn.c ++++ elfutils/libelf/gelf_getdyn.c @@ -93,7 +93,8 @@ gelf_getdyn (data, ndx, dst) table entries has to be adopted. The user better has provided a buffer where we can store the information. While copying the @@ -369,8 +354,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_getlib.c.robustify -+++ elfutils-0.136/libelf/gelf_getlib.c +--- elfutils/libelf/gelf_getlib.c ++++ elfutils/libelf/gelf_getlib.c @@ -86,7 +86,8 @@ gelf_getlib (data, ndx, dst) /* The data is already in the correct form. Just make sure the index is OK. */ @@ -381,8 +366,8 @@ src/ __libelf_seterrno (ELF_E_INVALID_INDEX); else { ---- elfutils-0.136/libelf/gelf_getmove.c.robustify -+++ elfutils-0.136/libelf/gelf_getmove.c +--- elfutils/libelf/gelf_getmove.c ++++ elfutils/libelf/gelf_getmove.c @@ -83,7 +83,8 @@ gelf_getmove (data, ndx, dst) /* The data is already in the correct form. Just make sure the @@ -393,8 +378,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_getrela.c.robustify -+++ elfutils-0.136/libelf/gelf_getrela.c +--- elfutils/libelf/gelf_getrela.c ++++ elfutils/libelf/gelf_getrela.c @@ -71,12 +71,6 @@ gelf_getrela (data, ndx, dst) if (data_scn == NULL) return NULL; @@ -428,8 +413,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); result = NULL; ---- elfutils-0.136/libelf/gelf_getrel.c.robustify -+++ elfutils-0.136/libelf/gelf_getrel.c +--- elfutils/libelf/gelf_getrel.c ++++ elfutils/libelf/gelf_getrel.c @@ -71,12 +71,6 @@ gelf_getrel (data, ndx, dst) if (data_scn == NULL) return NULL; @@ -463,8 +448,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); result = NULL; ---- elfutils-0.136/libelf/gelf_getsym.c.robustify -+++ elfutils-0.136/libelf/gelf_getsym.c +--- elfutils/libelf/gelf_getsym.c ++++ elfutils/libelf/gelf_getsym.c @@ -90,7 +90,8 @@ gelf_getsym (data, ndx, dst) table entries has to be adopted. The user better has provided a buffer where we can store the information. While copying the @@ -485,8 +470,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_getsyminfo.c.robustify -+++ elfutils-0.136/libelf/gelf_getsyminfo.c +--- elfutils/libelf/gelf_getsyminfo.c ++++ elfutils/libelf/gelf_getsyminfo.c @@ -84,7 +84,8 @@ gelf_getsyminfo (data, ndx, dst) /* The data is already in the correct form. Just make sure the @@ -497,8 +482,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_getsymshndx.c.robustify -+++ elfutils-0.136/libelf/gelf_getsymshndx.c +--- elfutils/libelf/gelf_getsymshndx.c ++++ elfutils/libelf/gelf_getsymshndx.c @@ -90,7 +90,9 @@ gelf_getsymshndx (symdata, shndxdata, nd section index table. */ if (likely (shndxdata_scn != NULL)) @@ -530,8 +515,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_getversym.c.robustify -+++ elfutils-0.136/libelf/gelf_getversym.c +--- elfutils/libelf/gelf_getversym.c ++++ elfutils/libelf/gelf_getversym.c @@ -92,7 +92,8 @@ gelf_getversym (data, ndx, dst) /* The data is already in the correct form. Just make sure the @@ -542,8 +527,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); result = NULL; ---- elfutils-0.136/libelf/gelf_update_dyn.c.robustify -+++ elfutils-0.136/libelf/gelf_update_dyn.c +--- elfutils/libelf/gelf_update_dyn.c ++++ elfutils/libelf/gelf_update_dyn.c @@ -71,12 +71,6 @@ gelf_update_dyn (data, ndx, src) if (data == NULL) return 0; @@ -577,8 +562,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_update_lib.c.robustify -+++ elfutils-0.136/libelf/gelf_update_lib.c +--- elfutils/libelf/gelf_update_lib.c ++++ elfutils/libelf/gelf_update_lib.c @@ -68,12 +68,6 @@ gelf_update_lib (data, ndx, src) if (data == NULL) return 0; @@ -602,8 +587,8 @@ src/ __libelf_seterrno (ELF_E_INVALID_INDEX); else { ---- elfutils-0.136/libelf/gelf_update_move.c.robustify -+++ elfutils-0.136/libelf/gelf_update_move.c +--- elfutils/libelf/gelf_update_move.c ++++ elfutils/libelf/gelf_update_move.c @@ -75,7 +75,7 @@ gelf_update_move (data, ndx, src) assert (sizeof (GElf_Move) == sizeof (Elf64_Move)); @@ -613,8 +598,8 @@ src/ || unlikely ((ndx + 1) * sizeof (GElf_Move) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); ---- elfutils-0.136/libelf/gelf_update_rela.c.robustify -+++ elfutils-0.136/libelf/gelf_update_rela.c +--- elfutils/libelf/gelf_update_rela.c ++++ elfutils/libelf/gelf_update_rela.c @@ -68,12 +68,6 @@ gelf_update_rela (Elf_Data *dst, int ndx if (dst == NULL) return 0; @@ -648,8 +633,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_update_rel.c.robustify -+++ elfutils-0.136/libelf/gelf_update_rel.c +--- elfutils/libelf/gelf_update_rel.c ++++ elfutils/libelf/gelf_update_rel.c @@ -68,12 +68,6 @@ gelf_update_rel (Elf_Data *dst, int ndx, if (dst == NULL) return 0; @@ -683,8 +668,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_update_sym.c.robustify -+++ elfutils-0.136/libelf/gelf_update_sym.c +--- elfutils/libelf/gelf_update_sym.c ++++ elfutils/libelf/gelf_update_sym.c @@ -72,12 +72,6 @@ gelf_update_sym (data, ndx, src) if (data == NULL) return 0; @@ -718,8 +703,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_update_syminfo.c.robustify -+++ elfutils-0.136/libelf/gelf_update_syminfo.c +--- elfutils/libelf/gelf_update_syminfo.c ++++ elfutils/libelf/gelf_update_syminfo.c @@ -72,12 +72,6 @@ gelf_update_syminfo (data, ndx, src) if (data == NULL) return 0; @@ -743,8 +728,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_update_symshndx.c.robustify -+++ elfutils-0.136/libelf/gelf_update_symshndx.c +--- elfutils/libelf/gelf_update_symshndx.c ++++ elfutils/libelf/gelf_update_symshndx.c @@ -77,12 +77,6 @@ gelf_update_symshndx (symdata, shndxdata if (symdata == NULL) return 0; @@ -778,8 +763,8 @@ src/ { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils-0.136/libelf/gelf_update_versym.c.robustify -+++ elfutils-0.136/libelf/gelf_update_versym.c +--- elfutils/libelf/gelf_update_versym.c ++++ elfutils/libelf/gelf_update_versym.c @@ -75,7 +75,7 @@ gelf_update_versym (data, ndx, src) assert (sizeof (GElf_Versym) == sizeof (Elf64_Versym)); @@ -789,8 +774,8 @@ src/ || unlikely ((ndx + 1) * sizeof (GElf_Versym) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); ---- elfutils-0.136/libelf/libelfP.h.robustify -+++ elfutils-0.136/libelf/libelfP.h +--- elfutils/libelf/libelfP.h ++++ elfutils/libelf/libelfP.h @@ -611,4 +611,13 @@ 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) @@ -805,9 +790,48 @@ src/ +#endif + #endif /* libelfP.h */ ---- elfutils-0.136/src/elflint.c.robustify -+++ elfutils-0.136/src/elflint.c -@@ -131,6 +131,9 @@ static uint32_t shstrndx; +--- elfutils/src/ChangeLog ++++ elfutils/src/ChangeLog +@@ -1376,6 +1376,16 @@ + object symbols or symbols with unknown type. + (check_rel): Likewise. + ++2005-06-09 Roland McGrath ++ ++ * readelf.c (handle_dynamic, handle_symtab): Check for bogus sh_link. ++ (handle_verneed, handle_verdef, handle_versym, handle_hash): Likewise. ++ (handle_scngrp): Check for bogus sh_info. ++ ++ * strip.c (handle_elf): Check for bogus values in sh_link, sh_info, ++ st_shndx, e_shstrndx, and SHT_GROUP or SHT_SYMTAB_SHNDX data. ++ Don't use assert on input values, instead bail with "illformed" error. ++ + 2005-06-08 Roland McGrath + + * readelf.c (print_ops): Add consts. +@@ -1421,6 +1431,19 @@ + + * readelf.c (dwarf_tag_string): Add new tags. + ++2005-05-17 Jakub Jelinek ++ ++ * elflint.c (check_hash): Don't check entries beyond end of section. ++ (check_note): Don't crash if gelf_rawchunk fails. ++ (section_name): Return if gelf_getshdr returns NULL. ++ ++2005-05-14 Jakub Jelinek ++ ++ * elflint.c (section_name): Return "" instead of ++ crashing on invalid section name. ++ (check_symtab, is_rel_dyn, check_rela, check_rel, check_dynamic, ++ check_symtab_shndx, check_hash, check_versym): Robustify. ++ + 2005-05-08 Roland McGrath + + * 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; /* Array to count references in section groups. */ static int *scnref; @@ -817,7 +841,7 @@ src/ int main (int argc, char *argv[]) -@@ -320,10 +323,19 @@ section_name (Ebl *ebl, int idx) +@@ -318,10 +321,19 @@ section_name (Ebl *ebl, int idx) { GElf_Shdr shdr_mem; GElf_Shdr *shdr; @@ -838,7 +862,7 @@ src/ } -@@ -345,10 +357,6 @@ static const int valid_e_machine[] = +@@ -343,10 +355,6 @@ static const int valid_e_machine[] = (sizeof (valid_e_machine) / sizeof (valid_e_machine[0])) @@ -849,7 +873,7 @@ src/ static void check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size) { -@@ -613,7 +621,8 @@ section [%2d] '%s': symbol table cannot +@@ -611,7 +619,8 @@ section [%2d] '%s': symbol table cannot } } @@ -859,7 +883,7 @@ src/ ERROR (gettext ("\ section [%2u] '%s': entry size is does not match ElfXX_Sym\n"), idx, section_name (ebl, idx)); -@@ -651,7 +660,7 @@ section [%2d] '%s': XINDEX for zeroth en +@@ -649,7 +658,7 @@ section [%2d] '%s': XINDEX for zeroth en xndxscnidx, section_name (ebl, xndxscnidx)); } @@ -868,7 +892,7 @@ src/ { sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, &xndx); if (sym == NULL) -@@ -671,7 +680,8 @@ section [%2d] '%s': symbol %zu: invalid +@@ -669,7 +678,8 @@ section [%2d] '%s': symbol %zu: invalid else { name = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name); @@ -878,7 +902,7 @@ src/ } if (sym->st_shndx == SHN_XINDEX) -@@ -1001,9 +1011,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e +@@ -999,9 +1009,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e { GElf_Shdr rcshdr_mem; const GElf_Shdr *rcshdr = gelf_getshdr (scn, &rcshdr_mem); @@ -892,7 +916,7 @@ src/ { /* Found the dynamic section. Look through it. */ Elf_Data *d = elf_getdata (scn, NULL); -@@ -1013,7 +1025,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e +@@ -1011,7 +1023,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e { GElf_Dyn dyn_mem; GElf_Dyn *dyn = gelf_getdyn (d, cnt, &dyn_mem); @@ -903,7 +927,7 @@ src/ if (dyn->d_tag == DT_RELCOUNT) { -@@ -1027,7 +1041,9 @@ section [%2d] '%s': DT_RELCOUNT used for +@@ -1025,7 +1039,9 @@ section [%2d] '%s': DT_RELCOUNT used for /* Does the number specified number of relative relocations exceed the total number of relocations? */ @@ -914,7 +938,7 @@ src/ ERROR (gettext ("\ section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"), idx, section_name (ebl, idx), -@@ -1187,7 +1203,8 @@ section [%2d] '%s': no relocations for m +@@ -1185,7 +1201,8 @@ section [%2d] '%s': no relocations for m } } @@ -924,7 +948,7 @@ src/ 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"), -@@ -1410,7 +1427,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G +@@ -1408,7 +1425,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G Elf_Data *symdata = elf_getdata (symscn, NULL); enum load_state state = state_undecided; @@ -934,7 +958,7 @@ src/ { GElf_Rela rela_mem; GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem); -@@ -1460,7 +1478,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE +@@ -1458,7 +1476,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE Elf_Data *symdata = elf_getdata (symscn, NULL); enum load_state state = state_undecided; @@ -944,7 +968,7 @@ src/ { GElf_Rel rel_mem; GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem); -@@ -1563,7 +1582,8 @@ section [%2d] '%s': referenced as string +@@ -1561,7 +1580,8 @@ section [%2d] '%s': referenced as string shdr->sh_link, section_name (ebl, shdr->sh_link), idx, section_name (ebl, idx)); @@ -954,7 +978,7 @@ src/ ERROR (gettext ("\ section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"), idx, section_name (ebl, idx)); -@@ -1573,7 +1593,7 @@ section [%2d] '%s': section entry size d +@@ -1571,7 +1591,7 @@ section [%2d] '%s': section entry size d idx, section_name (ebl, idx)); bool non_null_warned = false; @@ -963,7 +987,7 @@ src/ { GElf_Dyn dyn_mem; GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem); -@@ -1854,6 +1874,8 @@ section [%2d] '%s': entry size does not +@@ -1852,6 +1872,8 @@ section [%2d] '%s': entry size does not idx, section_name (ebl, idx)); if (symshdr != NULL @@ -972,7 +996,7 @@ src/ && (shdr->sh_size / shdr->sh_entsize < symshdr->sh_size / symshdr->sh_entsize)) ERROR (gettext ("\ -@@ -1880,6 +1902,12 @@ section [%2d] '%s': extended section ind +@@ -1878,6 +1900,12 @@ section [%2d] '%s': extended section ind } Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); @@ -985,7 +1009,7 @@ src/ if (*((Elf32_Word *) data->d_buf) != 0) ERROR (gettext ("symbol 0 should have zero extended section index\n")); -@@ -1922,7 +1950,7 @@ section [%2d] '%s': hash table section i +@@ -1920,7 +1948,7 @@ section [%2d] '%s': hash table section i size_t maxidx = nchain; @@ -994,7 +1018,7 @@ src/ { size_t symsize = symshdr->sh_size / symshdr->sh_entsize; -@@ -1933,18 +1961,28 @@ section [%2d] '%s': hash table section i +@@ -1931,18 +1959,28 @@ section [%2d] '%s': hash table section i maxidx = symsize; } @@ -1025,7 +1049,7 @@ src/ } -@@ -1974,18 +2012,28 @@ section [%2d] '%s': hash table section i +@@ -1972,18 +2010,28 @@ section [%2d] '%s': hash table section i maxidx = symsize; } @@ -1057,7 +1081,7 @@ src/ } -@@ -2010,7 +2058,7 @@ section [%2d] '%s': bitmask size not pow +@@ -2008,7 +2056,7 @@ section [%2d] '%s': bitmask size not pow if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)) { ERROR (gettext ("\ @@ -1066,7 +1090,7 @@ src/ idx, section_name (ebl, idx), (long int) shdr->sh_size, (long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))); return; -@@ -2682,8 +2730,9 @@ section [%2d] '%s' refers in sh_link to +@@ -2680,8 +2728,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. */ @@ -1078,9 +1102,9 @@ src/ ERROR (gettext ("\ section [%2d] '%s' has different number of entries than symbol table [%2d] '%s'\n"), idx, section_name (ebl, idx), ---- elfutils-0.136/src/readelf.c.robustify -+++ elfutils-0.136/src/readelf.c -@@ -1111,6 +1111,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G +--- elfutils/src/readelf.c ++++ elfutils/src/readelf.c +@@ -1136,6 +1136,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G Elf32_Word *grpref = (Elf32_Word *) data->d_buf; GElf_Sym sym_mem; @@ -1089,7 +1113,7 @@ src/ printf ((grpref[0] & GRP_COMDAT) ? ngettext ("\ \nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n", -@@ -1123,8 +1125,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G +@@ -1148,8 +1150,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), @@ -1100,7 +1124,7 @@ src/ ?: gettext (""), data->d_size / sizeof (Elf32_Word) - 1); -@@ -1275,7 +1277,8 @@ static void +@@ -1300,7 +1302,8 @@ static void handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { int class = gelf_getclass (ebl->elf); @@ -1110,7 +1134,7 @@ src/ Elf_Data *data; size_t cnt; size_t shstrndx; -@@ -1290,6 +1293,11 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, +@@ -1315,6 +1318,11 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1122,7 +1146,7 @@ src/ printf (ngettext ("\ \nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -1299,9 +1307,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, +@@ -1324,9 +1332,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (int) shdr->sh_link, @@ -1133,7 +1157,7 @@ src/ fputs_unlocked (gettext (" Type Value\n"), stdout); for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) -@@ -1801,6 +1807,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G +@@ -1826,6 +1832,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1147,7 +1171,7 @@ src/ /* Now we can compute the number of entries in the section. */ unsigned int nsyms = data->d_size / (class == ELFCLASS32 ? sizeof (Elf32_Sym) -@@ -1811,15 +1824,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G +@@ -1836,15 +1849,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G nsyms), (unsigned int) elf_ndxscn (scn), elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms); @@ -1164,7 +1188,7 @@ src/ fputs_unlocked (class == ELFCLASS32 ? gettext ("\ -@@ -2055,7 +2065,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, +@@ -2080,7 +2090,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1179,7 +1203,7 @@ src/ printf (ngettext ("\ \nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -2066,9 +2082,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, +@@ -2091,9 +2107,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1190,7 +1214,7 @@ src/ unsigned int offset = 0; for (int cnt = shdr->sh_info; --cnt >= 0; ) -@@ -2121,8 +2135,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G +@@ -2146,8 +2160,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1206,7 +1230,7 @@ src/ printf (ngettext ("\ \nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -2134,9 +2154,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G +@@ -2159,9 +2179,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1217,7 +1241,7 @@ src/ unsigned int offset = 0; for (int cnt = shdr->sh_info; --cnt >= 0; ) -@@ -2398,8 +2416,14 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G +@@ -2423,8 +2441,14 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G filename = NULL; } @@ -1233,7 +1257,7 @@ src/ printf (ngettext ("\ \nVersion symbols section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'", "\ -@@ -2411,9 +2435,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G +@@ -2436,9 +2460,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1244,7 +1268,7 @@ src/ /* 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) -@@ -2465,7 +2487,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, +@@ -2490,7 +2512,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt) ++counts[lengths[cnt]]; @@ -1263,7 +1287,7 @@ src/ 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", "\ -@@ -2478,9 +2510,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, +@@ -2503,9 +2535,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1274,7 +1298,7 @@ src/ if (extrastr != NULL) fputs (extrastr, stdout); -@@ -4039,6 +4069,16 @@ print_debug_aranges_section (Dwfl_Module +@@ -4107,6 +4137,16 @@ print_debug_aranges_section (Dwfl_Module return; } @@ -1289,10 +1313,10 @@ src/ + } + printf (ngettext ("\ - \nDWARF section '%s' at offset %#" PRIx64 " contains %zu entry:\n", + \nDWARF section [%2zu] '%s' at offset %#" PRIx64 " contains %zu entry:\n", "\ ---- elfutils-0.136/src/strip.c.robustify -+++ elfutils-0.136/src/strip.c +--- elfutils/src/strip.c ++++ elfutils/src/strip.c @@ -544,6 +544,11 @@ handle_elf (int fd, Elf *elf, const char goto fail_close; } @@ -1427,7 +1451,7 @@ src/ /* Mark the section as investigated. */ shdr_info[cnt].idx = 2; -@@ -954,7 +978,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -955,7 +979,7 @@ handle_elf (int fd, Elf *elf, const char error (EXIT_FAILURE, 0, gettext ("while generating output file: %s"), elf_errmsg (-1)); @@ -1436,7 +1460,7 @@ src/ /* Add this name to the section header string table. */ shdr_info[cnt].se = ebl_strtabadd (shst, shdr_info[cnt].name, 0); -@@ -991,7 +1015,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -992,7 +1016,7 @@ handle_elf (int fd, Elf *elf, const char error (EXIT_FAILURE, 0, gettext ("while create section header section: %s"), elf_errmsg (-1)); @@ -1445,7 +1469,7 @@ src/ shdr_info[cnt].data = elf_newdata (shdr_info[cnt].newscn); if (shdr_info[cnt].data == NULL) -@@ -1047,7 +1071,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1048,7 +1072,7 @@ handle_elf (int fd, Elf *elf, const char error (EXIT_FAILURE, 0, gettext ("while create section header section: %s"), elf_errmsg (-1)); @@ -1454,7 +1478,7 @@ src/ /* Finalize the string table and fill in the correct indices in the section headers. */ -@@ -1137,20 +1161,20 @@ handle_elf (int fd, Elf *elf, const char +@@ -1138,20 +1162,20 @@ handle_elf (int fd, Elf *elf, const char shndxdata = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn, NULL); @@ -1478,7 +1502,7 @@ src/ >= shdr_info[cnt].data->d_size / elsize); } -@@ -1205,7 +1229,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1206,7 +1230,7 @@ handle_elf (int fd, Elf *elf, const char sec = shdr_info[sym->st_shndx].idx; else { @@ -1487,7 +1511,7 @@ src/ sec = shdr_info[xshndx].idx; } -@@ -1226,7 +1250,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1227,7 +1251,7 @@ handle_elf (int fd, Elf *elf, const char nxshndx = sec; } @@ -1496,7 +1520,7 @@ src/ if ((inner != destidx || nshndx != sym->st_shndx || (shndxdata != NULL && nxshndx != xshndx)) -@@ -1250,7 +1274,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1251,7 +1275,7 @@ handle_elf (int fd, Elf *elf, const char || shdr_info[cnt].debug_data == NULL) /* This is a section symbol for a section which has been removed. */ @@ -1505,7 +1529,7 @@ src/ } if (destidx != inner) -@@ -1437,11 +1461,11 @@ handle_elf (int fd, Elf *elf, const char +@@ -1438,11 +1462,11 @@ handle_elf (int fd, Elf *elf, const char { GElf_Sym sym_mem; GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); @@ -1519,7 +1543,7 @@ src/ size_t hidx = elf_hash (name) % nbucket; if (bucket[hidx] == 0) -@@ -1460,7 +1484,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1461,7 +1485,7 @@ handle_elf (int fd, Elf *elf, const char else { /* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */ @@ -1528,7 +1552,7 @@ src/ == sizeof (Elf64_Xword)); Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf; -@@ -1491,11 +1515,11 @@ handle_elf (int fd, Elf *elf, const char +@@ -1492,11 +1516,11 @@ handle_elf (int fd, Elf *elf, const char { GElf_Sym sym_mem; GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); diff --git a/elfutils.spec b/elfutils.spec index d2d34309..7b51df8e 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,5 +1,5 @@ -%define eu_version 0.137 -%define eu_release 3 +%define eu_version 0.141 +%define eu_release 1 %if %{?_with_compat:1}%{!?_with_compat:0} %define compat 1 @@ -27,15 +27,14 @@ Version: %{eu_version} %if !%{compat} Release: %{eu_release}%{?dist} %else -Release: 0.%{eu_release} +Release: 0.%{eu_release}.1 %endif License: GPLv2 with exceptions Group: Development/Tools URL: https://fedorahosted.org/elfutils/ -Source: http://fedorahosted.org/releases/e/l/elfutils/%{name}-%{version}.tar.gz -Patch1: elfutils-portability.patch -Patch2: elfutils-robustify.patch -Patch3: elfutils-0.137-fixes.patch +Source: http://fedorahosted.org/releases/e/l/elfutils/%{name}-%{version}.tar.bz2 +Patch1: elfutils-robustify.patch +Patch2: elfutils-portability.patch Requires: elfutils-libelf-%{_arch} = %{version}-%{release} Requires: elfutils-libs-%{_arch} = %{version}-%{release} @@ -51,6 +50,19 @@ BuildRequires: glibc-headers >= 2.3.4-11 BuildRequires: gcc >= 3.2 %endif +%define use_zlib 0 +%if 0%{?fedora} >= 5 +%define use_zlib 1 +%endif +%if 0%{?rhel} >= 5 +%define use_zlib 1 +%endif + +%if %{use_zlib} +BuildRequires: zlib-devel >= 1.2.2.3 +BuildRequires: bzip2-devel +%endif + %define _gnu %{nil} %define _program_prefix eu- @@ -143,21 +155,19 @@ for libelf. %prep %setup -q -%if !0%{?scanf_has_m} -sed -i.scanf-m -e 's/%m/%a/' tests/line2addr.c -%endif +%patch1 -p1 -b .robustify %if %{compat} -%patch1 -p1 -b .portability +%patch2 -p1 -b .portability sleep 1 find . \( -name Makefile.in -o -name aclocal.m4 \) -print | xargs touch sleep 1 find . \( -name configure -o -name config.h.in \) -print | xargs touch +%else +%if !0%{?scanf_has_m} +sed -i.scanf-m -e 's/%m/%a/g' src/addr2line.c tests/line2addr.c +%endif %endif - -%patch2 -p1 -b .robustify - -%patch3 -p1 -b .fixes find . -name \*.sh ! -perm -0100 -print | xargs chmod +x @@ -184,9 +194,9 @@ chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/lib*.so* chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/elfutils/lib*.so* # XXX Nuke unpackaged files -{ cd ${RPM_BUILD_ROOT} - rm -f .%{_bindir}/eu-ld -} +(cd ${RPM_BUILD_ROOT} + rm -f .%{_bindir}/eu-ld +) %check make -s check @@ -239,6 +249,7 @@ rm -rf ${RPM_BUILD_ROOT} %{_includedir}/elfutils/libebl.h %{_includedir}/elfutils/libdw.h %{_includedir}/elfutils/libdwfl.h +%{_includedir}/elfutils/version.h %{_libdir}/libebl.a %{_libdir}/libasm.so %{_libdir}/libdw.so @@ -265,6 +276,46 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/libelf.a %changelog +* Thu Apr 23 2009 Roland McGrath - 0.141-1 +- Update to 0.141 + - libebl: sparc backend fixes (#490585) + some more arm backend support + - libdwfl: fix dwfl_module_build_id for prelinked DSO case (#489439) + fixes in core file support (#494858) + dwfl_module_getsym interface improved for non-address symbols + - eu-strip: fix infinite loop on strange inputs with -f + - eu-addr2line: take -j/--section=NAME option for binutils compatibility + (same effect as '(NAME)0x123' syntax already supported) +- Resolves: RHBZ #495213, RHBZ #465872, RHBZ #470055, RHBZ #484623 + +* Tue Feb 24 2009 Fedora Release Engineering - 0.140-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sun Feb 15 2009 Roland McGrath - 0.140-1 +- Update to 0.140 + - libelf: Fix regression in creation of section header. (#484946) + +* Fri Jan 23 2009 Roland McGrath - 0.139-1 +- Update to 0.139 + - libcpu: Add Intel SSE4 disassembler support + - readelf: Implement call frame information and exception handling dumping. + Add -e option. Enable it implicitly for -a. + - elflint: Check PT_GNU_EH_FRAME program header entry. + - libdwfl: Support automatic gzip/bzip2 decompression of ELF files. (#472136) + +* Thu Jan 1 2009 Roland McGrath - 0.138-2 +- Fix libelf regression. + +* Wed Dec 31 2008 Roland McGrath - 0.138-1 +- Update to 0.138 + - Install header file for applications to use in + source version compatibility checks. + - libebl: backend fixes for i386 TLS relocs; backend support for NT_386_IOPERM + - libcpu: disassembler fixes (#469739) + - libdwfl: bug fixes (#465878) + - libelf: bug fixes + - eu-nm: bug fixes for handling corrupt input files (#476136) + * Wed Oct 1 2008 Roland McGrath - 0.137-3 - fix libdwfl regression (#462689) diff --git a/elfutils/AUTHORS b/elfutils/AUTHORS index 29b776f0..ef3c5430 100644 --- a/elfutils/AUTHORS +++ b/elfutils/AUTHORS @@ -1,2 +1,4 @@ For Now: Ulrich Drepper. +Roland McGrath +Petr Machata diff --git a/elfutils/ChangeLog b/elfutils/ChangeLog index 01f61eb3..7b8c4438 100644 --- a/elfutils/ChangeLog +++ b/elfutils/ChangeLog @@ -1,3 +1,53 @@ +2009-04-19 Roland McGrath + + * configure.ac (eu_version): Round down here, not in version.h macros. + +2009-04-17 Roland McGrath + + * configure.ac (eu_version): Compute number 1000 times larger, + let $PACKAGE_VERSION be x.y.z as well as x.y (implied x.y.0). + +2009-01-23 Roland McGrath + + * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3. + + * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of + building with compiler support but no working runtime support. + +2009-01-22 Ulrich Drepper + + * Makefile.am (rpm): The tarball is now bzip2-compressed. + +2009-01-10 Ulrich Drepper + + * configure.ac: Require gcc with TLS support. + Rename USE_TLS to USE_LOCKS. The option is renamed to + --enable-thread-safety. + +2009-01-08 Roland McGrath + + * configure.ac (eu_ZIPLIB): Moved to m4/zip.am. + +2009-01-05 Roland McGrath + + * configure.ac (eu_ZIPLIB): New macro. + Use it to test for -lz, -lbz2, set .am ZLIB, BZLIB, zip_LIBS. + +2008-12-30 Ulrich Drepper + + * configure.ac: We need automake 1.8 now. + +2008-12-24 Roland McGrath + + * configure.ac: Use automake flags dist-bzip2 no-dist-gzip, + distribute only in .tar.bz2 form now. + +2008-12-16 Roland McGrath + + * Makefile.am (pkginclude_HEADERS): New variable, install version.h. + * configure.ac: Create it, substituting @eu_version@ with + PACKAGE_VERSION canonicalized to four digits of decimal. + 2008-08-25 Roland McGrath * configure.ac (--enable-tls): Set AM_CONDITIONAL USE_TLS too. diff --git a/elfutils/Makefile.am b/elfutils/Makefile.am index 9306fe69..4decc55f 100644 --- a/elfutils/Makefile.am +++ b/elfutils/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to create Makefile.in ## Configure input file for elfutils. ## -## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 Red Hat, Inc. +## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2008, 2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -27,6 +27,8 @@ ## ACLOCAL_AMFLAGS = -I m4 +pkginclude_HEADERS = version.h + # Add doc back when we have some real content. SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \ src po tests @@ -44,7 +46,7 @@ distcheck-hook: chmod -R u+w $(distdir) rpm: dist - rpmbuild -ts --sign elfutils-@PACKAGE_VERSION@.tar.gz + rpmbuild -ts --sign elfutils-@PACKAGE_VERSION@.tar.bz2 # Tell version 3.79 and up of GNU make to not build goals in this # directory in parallel. diff --git a/elfutils/Makefile.in b/elfutils/Makefile.in index 8f6008ba..7bf4cb77 100644 --- a/elfutils/Makefile.in +++ b/elfutils/Makefile.in @@ -13,6 +13,7 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -32,20 +33,22 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/config/elfutils.spec.in $(top_srcdir)/configure \ +DIST_COMMON = README $(am__configure_deps) $(pkginclude_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(top_srcdir)/config/elfutils.spec.in \ + $(top_srcdir)/config/version.h.in $(top_srcdir)/configure \ ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS THANKS TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = elfutils.spec +CONFIG_CLEAN_FILES = elfutils.spec version.h SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -55,6 +58,15 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkgincludedir)" +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(pkginclude_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags @@ -67,8 +79,8 @@ am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_ARCHIVES = $(distdir).tar.bz2 distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ @@ -153,6 +165,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -181,7 +194,9 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ ACLOCAL_AMFLAGS = -I m4 +pkginclude_HEADERS = version.h # Add doc back when we have some real content. SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \ @@ -252,6 +267,25 @@ distclean-hdr: -rm -f config.h stamp-h1 elfutils.spec: $(top_builddir)/config.status $(top_srcdir)/config/elfutils.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ +version.h: $(top_builddir)/config.status $(top_srcdir)/config/version.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -442,7 +476,6 @@ distdir: $(DISTFILES) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) - dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) @@ -465,7 +498,7 @@ dist-zip: distdir $(am__remove_distdir) dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then @@ -540,9 +573,12 @@ distcleancheck: distclean exit 1; } >&2 check-am: all-am check: check-recursive -all-am: Makefile config.h +all-am: Makefile $(HEADERS) config.h installdirs: installdirs-recursive installdirs-am: + for dir in "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -586,7 +622,7 @@ info: info-recursive info-am: -install-data-am: +install-data-am: install-pkgincludeHEADERS install-dvi: install-dvi-recursive @@ -622,7 +658,7 @@ ps: ps-recursive ps-am: -uninstall-am: +uninstall-am: uninstall-pkgincludeHEADERS .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-strip @@ -636,18 +672,20 @@ uninstall-am: info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + install-man install-pdf install-pdf-am \ + install-pkgincludeHEADERS install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am \ + uninstall-pkgincludeHEADERS distcheck-hook: chmod -R u+w $(distdir) rpm: dist - rpmbuild -ts --sign elfutils-@PACKAGE_VERSION@.tar.gz + rpmbuild -ts --sign elfutils-@PACKAGE_VERSION@.tar.bz2 # Tell version 3.79 and up of GNU make to not build goals in this # directory in parallel. diff --git a/elfutils/NEWS b/elfutils/NEWS index ad7b004b..c0f60bca 100644 --- a/elfutils/NEWS +++ b/elfutils/NEWS @@ -1,3 +1,49 @@ +Version 0.141: + +libebl: sparc backend fixes; + some more arm backend support + +libdwfl: fix dwfl_module_build_id for prelinked DSO case; + fixes in core file support; + dwfl_module_getsym interface improved for non-address symbols + +strip: fix infinite loop on strange inputs with -f + +addr2line: take -j/--section=NAME option for binutils compatibility + (same effect as '(NAME)0x123' syntax already supported) + +Version 0.140: + +libelf: Fix regression in creation of section header + +libdwfl: Less strict behavior if DWARF reader ist just used to display data + +Version 0.139: + +libcpu: Add Intel SSE4 disassembler support + +readelf: Implement call frame information and exception handling dumping. + Add -e option. Enable it implicitly for -a. + +elflint: Check PT_GNU_EH_FRAME program header entry. + +libdwfl: Support automatic gzip/bzip2 decompression of ELF files. + +Version 0.138: + +Install header file for applications to use in source +version compatibility checks. + +libebl: backend fixes for i386 TLS relocs; backend support for NT_386_IOPERM + +libcpu: disassembler fixes + +libdwfl: bug fixes + +libelf: bug fixes + +nm: bug fixes for handling corrupt input files + Version 0.137: Minor fixes for unreleased 0.136 release. diff --git a/elfutils/README b/elfutils/README index afc94077..33cac74f 100644 --- a/elfutils/README +++ b/elfutils/README @@ -4,3 +4,9 @@ Fundamental design decision: This leaves byte ordering aside. While assuming this the code can be greatly simplified and speed increases. Since no change violating this assumption is in sight this is believed to be a worthwhile optimization. + +- the ABI of the backend modules is not guaranteed. Really, not guarantee + whatsoever. We are enforcing this in the code. The modules and their + users must match. No third-party EBL module are supported or allowed. + The only reason there are separate modules is to not have the code for + all architectures in all the binaries. diff --git a/elfutils/THANKS b/elfutils/THANKS index 3ee88d16..887c067a 100644 --- a/elfutils/THANKS +++ b/elfutils/THANKS @@ -3,4 +3,4 @@ At least the following have submitted valuable patches: Jeff Johnson building. rpm wrestling Alexander Larsson separate debug info Jakub Jelinek bug fixes, testing -Roland McGrath lots of libdw{,fl} hacking +Denys Vlasenko bug fuxes diff --git a/elfutils/TODO b/elfutils/TODO index b2bcf6e9..0012a566 100644 --- a/elfutils/TODO +++ b/elfutils/TODO @@ -1,7 +1,7 @@ ToDo list for elfutils -*-outline-*- ---------------------- -Time-stamp: <2008-02-03 14:15:41 drepper> +Time-stamp: <2009-02-05 22:08:01 drepper> * mkinstalldirs @@ -22,6 +22,13 @@ Time-stamp: <2008-02-03 14:15:41 drepper> archives and only when having the archive handling separately this remains maintainable. +** shdrs in read-only files + + When reading (ELF_C_READ*) then there is no need to malloc Shdr + structure in elfXX_getshdr if file is mmaped and unaligned access + is allowed or the structure is aligned. Use ELF_F_MALLOCED flag + to differentiate. + * libdw @@ -38,6 +45,20 @@ Time-stamp: <2008-02-03 14:15:41 drepper> ** Rename dwarf_getabbrev +* libcpu + +** x86 + +*** Opcodes + + crc32 + extractps + pextrb + pextrd/pextrq + pextrw + pinsrq + popcnt 64-bit reg + * nm: ** add demangler support @@ -89,6 +110,13 @@ Time-stamp: <2008-02-03 14:15:41 drepper> Not implemented at all in the moment except for recognition of the option itself. +** variables with aliases in executables + + When linking an executable with a references against a variable in a + DSO, create symbol table entries for all the aliases of the variable + in the DSO and create a relocation for one of them (a non-weak + definition) + * elflint ** additional checks @@ -104,6 +132,8 @@ Time-stamp: <2008-02-03 14:15:41 drepper> check TLS relocation depencies + Check content of .eh_frame_hdr, .eh_frame, .gcc_except_table + *** for x86 check that R_386_TLS_GD is followed by R_386_PLT32 for __tls_get_addr @@ -156,5 +186,5 @@ Time-stamp: <2008-02-03 14:15:41 drepper> -V Print on standard error the version number of mcs. Local Variables: -eval:(hide-body) +eval:(hide-sublevels 3) End: diff --git a/elfutils/aclocal.m4 b/elfutils/aclocal.m4 index 14987aaa..17c9567a 100644 --- a/elfutils/aclocal.m4 +++ b/elfutils/aclocal.m4 @@ -919,3 +919,4 @@ AC_SUBST([am__untar]) m4_include([m4/nls.m4]) m4_include([m4/po.m4]) m4_include([m4/progtest.m4]) +m4_include([m4/zip.m4]) diff --git a/elfutils/backends/ChangeLog b/elfutils/backends/ChangeLog index 96b64794..c764f9ef 100644 --- a/elfutils/backends/ChangeLog +++ b/elfutils/backends/ChangeLog @@ -1,5 +1,50 @@ +2009-04-16 Roland McGrath + + * arm_regs.c (arm_register_info): Handle VFP registers. + + * i386_corenote.c (EXTRA_NOTES): NT_PRXFPREG -> NT_PRXFPREG + +2009-04-14 Roland McGrath + + * arm_retval.c: New file. + * arm_attrs.c: New file. + * Makefile.am (arm_SRCS): Add them. + * arm_symbol.c (arm_segment_type_name): New function. + (arm_section_type_name): New function. + (arm_machine_flag_check): New function. + * arm_init.c (arm_init): Initialize those hooks. + + * arm_regs.c: New file. + * arm_corenote.c: New file. + * arm_auxv.c: New file. + * Makefile.am (arm_SRCS): Add them. + * arm_init.c (arm_init): Initialize core_note, register_info, + and auxv_info hooks. + + * ia64_symbol.c (ia64_section_type_name): Remove "SHT_" prefixes. + +2009-04-01 Roland McGrath + + * sparc_reloc.def: Update table. + Data from Dave Miller . + +2009-02-15 Roland McGrath + + * ppc_attrs.c (ppc_check_object_attribute): Handle tag + GNU_Power_ABI_Struct_Return. + +2008-10-04 Ulrich Drepper + + * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and + TLS_DESC. + 2008-08-01 Roland McGrath + * x86_corenote.c: New file. + * Makefile.am (noinst_HEADERS): Add it. + * i386_corenote.c: Include it, use EXTRA_NOTES_IOPERM in EXTRA_NOTES. + * x86_64_corenote.c: Likewise. + * linux-core-note.c (prstatus_items): Use 'B' instead of 'b' for sigpend and sighold. diff --git a/elfutils/backends/Makefile.am b/elfutils/backends/Makefile.am index ebf6b09e..6d7eb667 100644 --- a/elfutils/backends/Makefile.am +++ b/elfutils/backends/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2000-2006, 2007, 2008 Red Hat, Inc. +## Copyright (C) 2000-2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -85,7 +85,8 @@ alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \ libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) -arm_SRCS = arm_init.c arm_symbol.c +arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \ + arm_auxv.c arm_attrs.c arm_retval.c libebl_arm_pic_a_SOURCES = $(arm_SRCS) am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) @@ -146,7 +147,7 @@ uninstall: uninstall-am done rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) -noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c +noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def) CLEANFILES = *.gcno *.gcda \ diff --git a/elfutils/backends/Makefile.in b/elfutils/backends/Makefile.in index 5aac0d2e..62bd9e47 100644 --- a/elfutils/backends/Makefile.in +++ b/elfutils/backends/Makefile.in @@ -39,7 +39,8 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -56,7 +57,9 @@ am__objects_1 = alpha_init.$(OBJEXT) alpha_symbol.$(OBJEXT) \ libebl_alpha_pic_a_OBJECTS = $(am_libebl_alpha_pic_a_OBJECTS) libebl_arm_pic_a_AR = $(AR) $(ARFLAGS) libebl_arm_pic_a_LIBADD = -am__objects_2 = arm_init.$(OBJEXT) arm_symbol.$(OBJEXT) +am__objects_2 = arm_init.$(OBJEXT) arm_symbol.$(OBJEXT) \ + arm_regs.$(OBJEXT) arm_corenote.$(OBJEXT) arm_auxv.$(OBJEXT) \ + arm_attrs.$(OBJEXT) arm_retval.$(OBJEXT) libebl_arm_pic_a_OBJECTS = $(am_libebl_arm_pic_a_OBJECTS) libebl_i386_pic_a_AR = $(AR) $(ARFLAGS) libebl_i386_pic_a_LIBADD = @@ -210,6 +213,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -238,6 +242,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ @MUDFLAP_FALSE@ -Wextra -Wformat=2 -std=gnu99 @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ @@ -284,7 +289,9 @@ alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \ libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) -arm_SRCS = arm_init.c arm_symbol.c +arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \ + arm_auxv.c arm_attrs.c arm_retval.c + libebl_arm_pic_a_SOURCES = $(arm_SRCS) am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ @@ -305,7 +312,7 @@ am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c libebl_s390_pic_a_SOURCES = $(s390_SRCS) am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) -noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c +noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def) CLEANFILES = *.gcno *.gcda \ $(foreach m,$(modules),\ @@ -400,7 +407,12 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_regs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_symbol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_attrs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_auxv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_corenote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_init.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_regs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_retval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_symbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_auxv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_corenote.Po@am__quote@ diff --git a/elfutils/backends/arm_attrs.c b/elfutils/backends/arm_attrs.c new file mode 100644 index 00000000..84f4d451 --- /dev/null +++ b/elfutils/backends/arm_attrs.c @@ -0,0 +1,242 @@ +/* Object attribute tags for ARM. + Copyright (C) 2009 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. + + 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 + . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#define BACKEND arm_ +#include "libebl_CPU.h" + +#define KNOWN_VALUES(...) do \ + { \ + static const char *table[] = { __VA_ARGS__ }; \ + if (value < sizeof table / sizeof table[0]) \ + *value_name = table[value]; \ + } while (0) + +bool +arm_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name) + Ebl *ebl __attribute__ ((unused)); + const char *vendor; + int tag; + uint64_t value __attribute__ ((unused)); + const char **tag_name; + const char **value_name; +{ + if (!strcmp (vendor, "aeabi")) + switch (tag) + { + case 4: + *tag_name = "CPU_raw_name"; + return true; + case 5: + *tag_name = "CPU_name"; + return true; + case 6: + *tag_name = "CPU_arch"; + KNOWN_VALUES ("Pre-v4", + "v4", + "v4T", + "v5T", + "v5TE", + "v5TEJ", + "v6", + "v6KZ", + "v6T2", + "v6K", + "v7", + "v6-M", + "v6S-M"); + return true; + case 7: + *tag_name = "CPU_arch_profile"; + switch (value) + { + case 'A': + *value_name = "Application"; + break; + case 'R': + *value_name = "Realtime"; + break; + case 'M': + *value_name = "Microcontroller"; + break; + } + return true; + case 8: + *tag_name = "ARM_ISA_use"; + KNOWN_VALUES ("No", "Yes"); + return true; + case 9: + *tag_name = "THUMB_ISA_use"; + KNOWN_VALUES ("No", "Thumb-1", "Thumb-2"); + return true; + case 10: + *tag_name = "VFP_arch"; + KNOWN_VALUES ("No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16"); + return true; + case 11: + *tag_name = "WMMX_arch"; + KNOWN_VALUES ("No", "WMMXv1", "WMMXv2"); + return true; + case 12: + *tag_name = "Advanced_SIMD_arch"; + KNOWN_VALUES ("No", "NEONv1"); + return true; + case 13: + *tag_name = "PCS_config"; + KNOWN_VALUES ("None", + "Bare platform", + "Linux application", + "Linux DSO", + "PalmOS 2004", + "PalmOS (reserved)", + "SymbianOS 2004", + "SymbianOS (reserved)"); + return true; + case 14: + *tag_name = "ABI_PCS_R9_use"; + KNOWN_VALUES ("V6", "SB", "TLS", "Unused"); + return true; + case 15: + *tag_name = "ABI_PCS_RW_data"; + KNOWN_VALUES ("Absolute", "PC-relative", "SB-relative", "None"); + return true; + case 16: + *tag_name = "ABI_PCS_RO_data"; + KNOWN_VALUES ("Absolute", "PC-relative", "None"); + return true; + case 17: + *tag_name = "ABI_PCS_GOT_use"; + KNOWN_VALUES ("None", "direct", "GOT-indirect"); + return true; + case 18: + *tag_name = "ABI_PCS_wchar_t"; + return true; + case 19: + *tag_name = "ABI_FP_rounding"; + KNOWN_VALUES ("Unused", "Needed"); + return true; + case 20: + *tag_name = "ABI_FP_denormal"; + KNOWN_VALUES ("Unused", "Needed", "Sign only"); + return true; + case 21: + *tag_name = "ABI_FP_exceptions"; + KNOWN_VALUES ("Unused", "Needed"); + return true; + case 22: + *tag_name = "ABI_FP_user_exceptions"; + KNOWN_VALUES ("Unused", "Needed"); + return true; + case 23: + *tag_name = "ABI_FP_number_model"; + KNOWN_VALUES ("Unused", "Finite", "RTABI", "IEEE 754"); + return true; + case 24: + *tag_name = "ABI_align8_needed"; + KNOWN_VALUES ("No", "Yes", "4-byte"); + return true; + case 25: + *tag_name = "ABI_align8_preserved"; + KNOWN_VALUES ("No", "Yes, except leaf SP", "Yes"); + return true; + case 26: + *tag_name = "ABI_enum_size"; + KNOWN_VALUES ("Unused", "small", "int", "forced to int"); + return true; + case 27: + *tag_name = "ABI_HardFP_use"; + KNOWN_VALUES ("as VFP_arch", "SP only", "DP only", "SP and DP"); + return true; + case 28: + *tag_name = "ABI_VFP_args"; + KNOWN_VALUES ("AAPCS", "VFP registers", "custom"); + return true; + case 29: + *tag_name = "ABI_WMMX_args"; + KNOWN_VALUES ("AAPCS", "WMMX registers", "custom"); + return true; + case 30: + *tag_name = "ABI_optimization_goals"; + KNOWN_VALUES ("None", + "Prefer Speed", + "Aggressive Speed", + "Prefer Size", + "Aggressive Size", + "Prefer Debug", + "Aggressive Debug"); + return true; + case 31: + *tag_name = "ABI_FP_optimization_goals"; + KNOWN_VALUES ("None", + "Prefer Speed", + "Aggressive Speed", + "Prefer Size", + "Aggressive Size", + "Prefer Accuracy", + "Aggressive Accuracy"); + return true; + case 34: + *tag_name = "CPU_unaligned_access"; + KNOWN_VALUES ("None", "v6"); + return true; + case 36: + *tag_name = "VFP_HP_extension"; + KNOWN_VALUES ("Not Allowed", "Allowed"); + return true; + case 38: + *tag_name = "ABI_FP_16bit_format"; + KNOWN_VALUES ("None", "IEEE 754", "Alternative Format"); + return true; + case 64: + *tag_name = "nodefaults"; + return true; + case 65: + *tag_name = "also_compatible_with"; + return true; + case 66: + *tag_name = "T2EE_use"; + KNOWN_VALUES ("Not Allowed", "Allowed"); + return true; + case 67: + *tag_name = "conformance"; + return true; + case 68: + *tag_name = "Virtualization_use"; + KNOWN_VALUES ("Not Allowed", "Allowed"); + return true; + case 70: + *tag_name = "MPextension_use"; + KNOWN_VALUES ("Not Allowed", "Allowed"); + return true; + } + + return false; +} diff --git a/elfutils/backends/arm_auxv.c b/elfutils/backends/arm_auxv.c new file mode 100644 index 00000000..728f940d --- /dev/null +++ b/elfutils/backends/arm_auxv.c @@ -0,0 +1,46 @@ +/* ARM-specific auxv handling. + Copyright (C) 2009 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. + + 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 + . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#define BACKEND arm_ +#include "libebl_CPU.h" + +int +EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format) +{ + if (a_type != AT_HWCAP) + return 0; + + *name = "HWCAP"; + *format = "b" + "swp\0" "half\0" "thumb\0" "26bit\0" + "fast-mult\0" "fpa\0" "vfp\0" "edsp\0" + "java\0" "iwmmxt\0" + "\0"; + return 1; +} diff --git a/elfutils/backends/arm_corenote.c b/elfutils/backends/arm_corenote.c new file mode 100644 index 00000000..6f2d3a3e --- /dev/null +++ b/elfutils/backends/arm_corenote.c @@ -0,0 +1,73 @@ +/* ARM specific core note handling. + Copyright (C) 2009 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. + + 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 + . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#define BACKEND arm_ +#include "libebl_CPU.h" + + +static const Ebl_Register_Location prstatus_regs[] = + { + { .offset = 0, .regno = 0, .count = 16, .bits = 32 }, /* r0..r15 */ + { .offset = 16 * 4, .regno = 128, .count = 1, .bits = 32 }, /* cpsr */ + }; +#define PRSTATUS_REGS_SIZE (18 * 4) + +#define PRSTATUS_REGSET_ITEMS \ + { \ + .name = "orig_r0", .type = ELF_T_SWORD, .format = 'd', \ + .offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + (4 * 17), \ + .group = "register" \ + } + +static const Ebl_Register_Location fpregset_regs[] = + { + { .offset = 0, .regno = 96, .count = 8, .bits = 96 }, /* f0..f7 */ + }; +#define FPREGSET_SIZE 140 + +#define ULONG uint32_t +#define PID_T int32_t +#define UID_T uint16_t +#define GID_T uint16_t +#define ALIGN_ULONG 4 +#define ALIGN_PID_T 4 +#define ALIGN_UID_T 2 +#define ALIGN_GID_T 2 +#define TYPE_ULONG ELF_T_WORD +#define TYPE_PID_T ELF_T_SWORD +#define TYPE_UID_T ELF_T_HALF +#define TYPE_GID_T ELF_T_HALF + +#include "linux-core-note.c" diff --git a/elfutils/backends/arm_init.c b/elfutils/backends/arm_init.c index 172af198..15c0ee67 100644 --- a/elfutils/backends/arm_init.c +++ b/elfutils/backends/arm_init.c @@ -1,5 +1,5 @@ /* Initialization of Arm specific backend library. - Copyright (C) 2002, 2005 Red Hat, Inc. + Copyright (C) 2002, 2005, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2002. @@ -50,7 +50,15 @@ arm_init (elf, machine, eh, ehlen) /* We handle it. */ eh->name = "ARM"; arm_init_reloc (eh); + HOOK (eh, segment_type_name); + HOOK (eh, section_type_name); + HOOK (eh, machine_flag_check); HOOK (eh, reloc_simple_type); + HOOK (eh, register_info); + HOOK (eh, core_note); + HOOK (eh, auxv_info); + HOOK (eh, check_object_attribute); + HOOK (eh, return_value_location); return MODVERSION; } diff --git a/elfutils/backends/arm_regs.c b/elfutils/backends/arm_regs.c new file mode 100644 index 00000000..0a9536d4 --- /dev/null +++ b/elfutils/backends/arm_regs.c @@ -0,0 +1,117 @@ +/* Register names and numbers for ARM DWARF. + Copyright (C) 2009 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. + + 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 + . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#define BACKEND arm_ +#include "libebl_CPU.h" + +ssize_t +arm_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 320; + + if (regno < 0 || regno > 320 || namelen < 5) + return -1; + + *prefix = NULL; + *bits = 32; + *type = DW_ATE_signed; + *setname = "integer"; + + switch (regno) + { + case 0 ... 9: + name[0] = 'r'; + name[1] = regno + '0'; + namelen = 2; + break; + + case 10 ... 12: + name[0] = 'r'; + name[1] = '1'; + name[2] = regno % 10 + '0'; + namelen = 3; + break; + + case 13 ... 15: + *type = DW_ATE_address; + name[0] = "slp"[regno - 13]; + name[1] = "prc"[regno - 13]; + namelen = 2; + break; + + case 16 + 0 ... 16 + 7: + regno += 96 - 16; + /* Fall through. */ + case 96 + 0 ... 96 + 7: + *setname = "FPA"; + *type = DW_ATE_float; + *bits = 96; + name[0] = 'f'; + name[1] = regno - 96 + '0'; + namelen = 2; + break; + + case 128: + *type = DW_ATE_unsigned; + return stpcpy (name, "spsr") + 1 - name; + + case 256 + 0 ... 256 + 9: + *setname = "VFP"; + *type = DW_ATE_float; + *bits = 64; + name[0] = 'd'; + name[1] = regno - 256 + '0'; + namelen = 2; + break; + + case 256 + 10 ... 256 + 31: + *setname = "VFP"; + *type = DW_ATE_float; + *bits = 64; + name[0] = 'd'; + name[1] = (regno - 256) / 10 + '0'; + name[2] = (regno - 256) % 10 + '0'; + namelen = 3; + break; + + default: + *setname = NULL; + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/elfutils/backends/arm_retval.c b/elfutils/backends/arm_retval.c new file mode 100644 index 00000000..4ffc6e7c --- /dev/null +++ b/elfutils/backends/arm_retval.c @@ -0,0 +1,138 @@ +/* Function return value location for ARM EABI. + Copyright (C) 2009 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. + + 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 + . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#define BACKEND arm_ +#include "libebl_CPU.h" + + +/* r0, or pair r0, r1, or aggregate up to r0-r3. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 }, + { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 }, + }; +#define nloc_intreg 1 +#define nloc_intregs(n) (2 * (n)) + +/* 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 r0. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg0, .number = 0 } + }; +#define nloc_aggregate 1 + + +int +arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 4; + else + return -1; + } + if (size <= 16) + { + intreg: + *locp = loc_intreg; + return size <= 4 ? nloc_intreg : nloc_intregs ((size + 3) / 4); + } + + aggregate: + *locp = loc_aggregate; + return nloc_aggregate; + + case DW_TAG_structure_type: + 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 + && size > 0 && size <= 4) + goto intreg; + goto aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/elfutils/backends/arm_symbol.c b/elfutils/backends/arm_symbol.c index 6d2f56d3..e08874bb 100644 --- a/elfutils/backends/arm_symbol.c +++ b/elfutils/backends/arm_symbol.c @@ -1,7 +1,6 @@ /* Arm specific symbolic name handling. - Copyright (C) 2002, 2005 Red Hat, Inc. + Copyright (C) 2002-2009 Red Hat, Inc. This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2002. 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 @@ -34,6 +33,76 @@ #define BACKEND arm_ #include "libebl_CPU.h" + +const char * +arm_segment_type_name (int segment, char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (segment) + { + case PT_ARM_EXIDX: + return "ARM_EXIDX"; + } + return NULL; +} + +/* Return symbolic representation of section type. */ +const char * +arm_section_type_name (int type, + char *buf __attribute__ ((unused)), + size_t len __attribute__ ((unused))) +{ + switch (type) + { + case SHT_ARM_EXIDX: + return "ARM_EXIDX"; + case SHT_ARM_PREEMPTMAP: + return "ARM_PREEMPTMAP"; + case SHT_ARM_ATTRIBUTES: + return "ARM_ATTRIBUTES"; + } + + return NULL; +} + +/* Check whether machine flags are valid. */ +bool +arm_machine_flag_check (GElf_Word flags) +{ + switch (flags & EF_ARM_EABIMASK) + { + case EF_ARM_EABI_UNKNOWN: + case EF_ARM_EABI_VER1: + case EF_ARM_EABI_VER2: + case EF_ARM_EABI_VER3: + case EF_ARM_EABI_VER4: + case EF_ARM_EABI_VER5: + break; + default: + return false; + } + + return ((flags &~ (EF_ARM_EABIMASK + | EF_ARM_RELEXEC + | EF_ARM_HASENTRY + | EF_ARM_INTERWORK + | EF_ARM_APCS_26 + | EF_ARM_APCS_FLOAT + | EF_ARM_PIC + | EF_ARM_ALIGN8 + | EF_ARM_NEW_ABI + | EF_ARM_OLD_ABI + | EF_ARM_SOFT_FLOAT + | EF_ARM_VFP_FLOAT + | EF_ARM_MAVERICK_FLOAT + | EF_ARM_SYMSARESORTED + | EF_ARM_DYNSYMSUSESEGIDX + | EF_ARM_MAPSYMSFIRST + | EF_ARM_EABIMASK + | EF_ARM_BE8 + | EF_ARM_LE8)) == 0); +} + /* Check for the simple reloc types. */ Elf_Type arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) diff --git a/elfutils/backends/i386_corenote.c b/elfutils/backends/i386_corenote.c index 02d8ec38..89890252 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, 2008 Red Hat, Inc. + Copyright (C) 2007-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -101,11 +101,10 @@ static const Ebl_Register_Location prxfpreg_regs[] = }; #define EXTRA_NOTES \ - EXTRA_REGSET (NT_PRFPXREG, 512, prxfpreg_regs) \ + EXTRA_REGSET (NT_PRXFPREG, 512, prxfpreg_regs) \ case NT_386_TLS: \ - return tls_info (descsz, regs_offset, nregloc, reglocs, nitems, items); - -#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ + return tls_info (descsz, regs_offset, nregloc, reglocs, nitems, items); \ + EXTRA_NOTES_IOPERM static const Ebl_Core_Item tls_items[] = { @@ -131,4 +130,5 @@ tls_info (GElf_Word descsz, GElf_Word *regs_offset, return 1; } +#include "x86_corenote.c" #include "linux-core-note.c" diff --git a/elfutils/backends/i386_reloc.def b/elfutils/backends/i386_reloc.def index d8116f3d..bc1b835d 100644 --- a/elfutils/backends/i386_reloc.def +++ b/elfutils/backends/i386_reloc.def @@ -61,3 +61,6 @@ RELOC_TYPE (TLS_LE_32, REL) RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN) RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN) RELOC_TYPE (TLS_TPOFF32, EXEC|DYN) +RELOC_TYPE (TLS_GOTDESC, REL) +RELOC_TYPE (TLS_DESC_CALL, REL) +RELOC_TYPE (TLS_DESC, EXEC) diff --git a/elfutils/backends/ia64_symbol.c b/elfutils/backends/ia64_symbol.c index 2609db0f..1edef8b5 100644 --- a/elfutils/backends/ia64_symbol.c +++ b/elfutils/backends/ia64_symbol.c @@ -1,5 +1,5 @@ /* IA-64 specific symbolic name handling. - Copyright (C) 2002, 2003, 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2002-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2002. @@ -102,9 +102,9 @@ ia64_section_type_name (int type, switch (type) { case SHT_IA_64_EXT: - return "SHT_IA_64_EXT"; + return "IA_64_EXT"; case SHT_IA_64_UNWIND: - return "SHT_IA_64_UNWIND"; + return "IA_64_UNWIND"; } return NULL; diff --git a/elfutils/backends/ppc_attrs.c b/elfutils/backends/ppc_attrs.c index 733b8749..985df3f9 100644 --- a/elfutils/backends/ppc_attrs.c +++ b/elfutils/backends/ppc_attrs.c @@ -1,5 +1,5 @@ /* Object attribute tags for PowerPC. - Copyright (C) 2008 Red Hat, Inc. + Copyright (C) 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -66,6 +66,16 @@ ppc_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name) if (value < sizeof vector_kinds / sizeof vector_kinds[0]) *value_name = vector_kinds[value]; return true; + + case 12: + *tag_name = "GNU_Power_ABI_Struct_Return"; + static const char *struct_return_kinds[] = + { + "Any", "r3/r4", "Memory" + }; + if (value < sizeof struct_return_kinds / sizeof struct_return_kinds[0]) + *value_name = struct_return_kinds[value]; + return true; } return false; diff --git a/elfutils/backends/sparc_reloc.def b/elfutils/backends/sparc_reloc.def index de650974..a7ea52a3 100644 --- a/elfutils/backends/sparc_reloc.def +++ b/elfutils/backends/sparc_reloc.def @@ -1,5 +1,5 @@ /* List the relocation types for sparc. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2009 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,82 +25,94 @@ /* NAME, REL|EXEC|DYN */ -RELOC_TYPE (NONE, 0) -RELOC_TYPE (8, 0) -RELOC_TYPE (16, 0) -RELOC_TYPE (32, 0) -RELOC_TYPE (DISP8, 0) -RELOC_TYPE (DISP16, 0) -RELOC_TYPE (DISP32, 0) -RELOC_TYPE (WDISP30, 0) -RELOC_TYPE (WDISP22, 0) -RELOC_TYPE (HI22, 0) -RELOC_TYPE (22, 0) -RELOC_TYPE (13, 0) -RELOC_TYPE (LO10, 0) -RELOC_TYPE (GOT10, 0) -RELOC_TYPE (GOT13, 0) -RELOC_TYPE (GOT22, 0) -RELOC_TYPE (PC10, 0) -RELOC_TYPE (PC22, 0) -RELOC_TYPE (WPLT30, 0) +RELOC_TYPE (NONE, REL) +RELOC_TYPE (8, REL) +RELOC_TYPE (16, REL) +RELOC_TYPE (32, REL|DYN) +RELOC_TYPE (DISP8, REL) +RELOC_TYPE (DISP16, REL) +RELOC_TYPE (DISP32, REL) +RELOC_TYPE (WDISP30, REL) +RELOC_TYPE (WDISP22, REL) +RELOC_TYPE (HI22, REL) +RELOC_TYPE (22, REL) +RELOC_TYPE (13, REL) +RELOC_TYPE (LO10, REL) +RELOC_TYPE (GOT10, REL) +RELOC_TYPE (GOT13, REL) +RELOC_TYPE (GOT22, REL) +RELOC_TYPE (PC10, REL) +RELOC_TYPE (PC22, REL) +RELOC_TYPE (WPLT30, REL) RELOC_TYPE (COPY, EXEC) RELOC_TYPE (GLOB_DAT, EXEC|DYN) RELOC_TYPE (JMP_SLOT, EXEC|DYN) RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (UA32, 0) -RELOC_TYPE (PLT32, 0) -RELOC_TYPE (HIPLT22, 0) -RELOC_TYPE (LOPLT10, 0) -RELOC_TYPE (PCPLT32, 0) -RELOC_TYPE (PCPLT22, 0) -RELOC_TYPE (PCPLT10, 0) -RELOC_TYPE (10, 0) -RELOC_TYPE (11, 0) -RELOC_TYPE (64, 0) -RELOC_TYPE (OLO10, 0) -RELOC_TYPE (HH22, 0) -RELOC_TYPE (HM10, 0) -RELOC_TYPE (LM22, 0) -RELOC_TYPE (PC_HH22, 0) -RELOC_TYPE (PC_HM10, 0) -RELOC_TYPE (PC_LM22, 0) -RELOC_TYPE (WDISP16, 0) -RELOC_TYPE (WDISP19, 0) -RELOC_TYPE (7, 0) -RELOC_TYPE (5, 0) -RELOC_TYPE (6, 0) -RELOC_TYPE (DISP64, 0) -RELOC_TYPE (PLT64, 0) -RELOC_TYPE (HIX22, 0) -RELOC_TYPE (LOX10, 0) -RELOC_TYPE (H44, 0) -RELOC_TYPE (M44, 0) -RELOC_TYPE (L44, 0) -RELOC_TYPE (REGISTER, 0) -RELOC_TYPE (UA64, 0) -RELOC_TYPE (UA16, 0) -RELOC_TYPE (TLS_GD_HI22, 0) -RELOC_TYPE (TLS_GD_LO10, 0) -RELOC_TYPE (TLS_GD_ADD, 0) -RELOC_TYPE (TLS_GD_CALL, 0) -RELOC_TYPE (TLS_LDM_HI22, 0) -RELOC_TYPE (TLS_LDM_LO10, 0) -RELOC_TYPE (TLS_LDM_ADD, 0) -RELOC_TYPE (TLS_LDM_CALL, 0) -RELOC_TYPE (TLS_LDO_HIX22, 0) -RELOC_TYPE (TLS_LDO_LOX10, 0) -RELOC_TYPE (TLS_LDO_ADD, 0) -RELOC_TYPE (TLS_IE_HI22, 0) -RELOC_TYPE (TLS_IE_LO10, 0) -RELOC_TYPE (TLS_IE_LD, 0) -RELOC_TYPE (TLS_IE_LDX, 0) -RELOC_TYPE (TLS_IE_ADD, 0) -RELOC_TYPE (TLS_LE_HIX22, 0) -RELOC_TYPE (TLS_LE_LOX10, 0) -RELOC_TYPE (TLS_DTPMOD32, 0) -RELOC_TYPE (TLS_DTPMOD64, 0) -RELOC_TYPE (TLS_DTPOFF32, 0) -RELOC_TYPE (TLS_DTPOFF64, 0) -RELOC_TYPE (TLS_TPOFF32, 0) -RELOC_TYPE (TLS_TPOFF64, 0) +RELOC_TYPE (UA32, REL) +RELOC_TYPE (PLT32, REL) +RELOC_TYPE (HIPLT22, REL) +RELOC_TYPE (LOPLT10, REL) +RELOC_TYPE (PCPLT32, REL) +RELOC_TYPE (PCPLT22, REL) +RELOC_TYPE (PCPLT10, REL) +RELOC_TYPE (10, REL) +RELOC_TYPE (11, REL) +RELOC_TYPE (64, REL|DYN) +RELOC_TYPE (OLO10, REL) +RELOC_TYPE (HH22, REL) +RELOC_TYPE (HM10, REL) +RELOC_TYPE (LM22, REL) +RELOC_TYPE (PC_HH22, REL) +RELOC_TYPE (PC_HM10, REL) +RELOC_TYPE (PC_LM22, REL) +RELOC_TYPE (WDISP16, REL) +RELOC_TYPE (WDISP19, REL) +RELOC_TYPE (GLOB_JMP, EXEC|DYN) +RELOC_TYPE (7, REL) +RELOC_TYPE (5, REL) +RELOC_TYPE (6, REL) +RELOC_TYPE (DISP64, REL) +RELOC_TYPE (PLT64, REL) +RELOC_TYPE (HIX22, REL) +RELOC_TYPE (LOX10, REL) +RELOC_TYPE (H44, REL) +RELOC_TYPE (M44, REL) +RELOC_TYPE (L44, REL) +RELOC_TYPE (REGISTER, REL) +RELOC_TYPE (UA64, REL) +RELOC_TYPE (UA16, REL) +RELOC_TYPE (TLS_GD_HI22, REL) +RELOC_TYPE (TLS_GD_LO10, REL) +RELOC_TYPE (TLS_GD_ADD, REL) +RELOC_TYPE (TLS_GD_CALL, REL) +RELOC_TYPE (TLS_LDM_HI22, REL) +RELOC_TYPE (TLS_LDM_LO10, REL) +RELOC_TYPE (TLS_LDM_ADD, REL) +RELOC_TYPE (TLS_LDM_CALL, REL) +RELOC_TYPE (TLS_LDO_HIX22, REL) +RELOC_TYPE (TLS_LDO_LOX10, REL) +RELOC_TYPE (TLS_LDO_ADD, REL) +RELOC_TYPE (TLS_IE_HI22, REL) +RELOC_TYPE (TLS_IE_LO10, REL) +RELOC_TYPE (TLS_IE_LD, REL) +RELOC_TYPE (TLS_IE_LDX, REL) +RELOC_TYPE (TLS_IE_ADD, REL) +RELOC_TYPE (TLS_LE_HIX22, REL) +RELOC_TYPE (TLS_LE_LOX10, REL) +RELOC_TYPE (TLS_DTPMOD32, DYN) +RELOC_TYPE (TLS_DTPMOD64, DYN) +RELOC_TYPE (TLS_DTPOFF32, DYN) +RELOC_TYPE (TLS_DTPOFF64, DYN) +RELOC_TYPE (TLS_TPOFF32, DYN) +RELOC_TYPE (TLS_TPOFF64, DYN) +RELOC_TYPE (GOTDATA_HIX22, REL) +RELOC_TYPE (GOTDATA_LOX10, REL) +RELOC_TYPE (GOTDATA_OP_HIX22, DYN) +RELOC_TYPE (GOTDATA_OP_LOX10, DYN) +RELOC_TYPE (GOTDATA_OP, DYN) +RELOC_TYPE (H34, REL) +RELOC_TYPE (SIZE32, REL) +RELOC_TYPE (SIZE64, REL) +RELOC_TYPE (GNU_VTINHERIT, REL) +RELOC_TYPE (GNU_VTENTRY, REL) +RELOC_TYPE (REV32, REL) diff --git a/elfutils/backends/x86_64_corenote.c b/elfutils/backends/x86_64_corenote.c index c2bc72e9..552ac88b 100644 --- a/elfutils/backends/x86_64_corenote.c +++ b/elfutils/backends/x86_64_corenote.c @@ -1,5 +1,5 @@ /* x86-64 specific core note handling. - Copyright (C) 2005, 2007 Red Hat, Inc. + Copyright (C) 2005, 2007, 2008 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,4 +103,7 @@ static const Ebl_Register_Location fpregset_regs[] = }; #define FPREGSET_SIZE 512 +#define EXTRA_NOTES EXTRA_NOTES_IOPERM + +#include "x86_corenote.c" #include "linux-core-note.c" diff --git a/elfutils/backends/x86_corenote.c b/elfutils/backends/x86_corenote.c new file mode 100644 index 00000000..7d550676 --- /dev/null +++ b/elfutils/backends/x86_corenote.c @@ -0,0 +1,47 @@ +/* x86-specific core note handling, pieces common to x86-64 and i386. + Copyright (C) 2005, 2008 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. + + 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 + . */ + +#define EXTRA_NOTES_IOPERM \ + case NT_386_IOPERM: \ + return ioperm_info (descsz, regs_offset, nregloc, reglocs, nitems, items); + +static int +ioperm_info (GElf_Word descsz, GElf_Word *regs_offset, + size_t *nregloc, const Ebl_Register_Location **reglocs, + size_t *nitems, const Ebl_Core_Item **items) +{ + static const Ebl_Core_Item ioperm_item = + { .type = ELF_T_WORD, .format = 'b', .name = "ioperm" }; + + if (descsz % 4 != 0) + return 0; + + *regs_offset = 0; + *nregloc = 0; + *reglocs = NULL; + *nitems = 1; + *items = &ioperm_item; + return 1; +} diff --git a/elfutils/config.h.in b/elfutils/config.h.in index d6645d59..ba71426f 100644 --- a/elfutils/config.h.in +++ b/elfutils/config.h.in @@ -30,8 +30,14 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Defined if thread local storage should be used. */ -#undef USE_TLS +/* Support bzip2 decompression via -lbz2. */ +#undef USE_BZLIB + +/* Defined if libraries should be thread-safe. */ +#undef USE_LOCKS + +/* Support gzip decompression via -lz. */ +#undef USE_ZLIB /* Version number of package */ #undef VERSION diff --git a/elfutils/config/ChangeLog b/elfutils/config/ChangeLog index e580747a..798a2f93 100644 --- a/elfutils/config/ChangeLog +++ b/elfutils/config/ChangeLog @@ -1,3 +1,35 @@ +2009-04-19 Roland McGrath + + * version.h.in: Revert last change. + +2009-04-17 Roland McGrath + + * version.h.in (_ELFUTILS_PREREQ): Multiple major by 1000000 and minor + by 1000; now _ELFUTILS_VERSION is 789000 for version 0.789. + +2009-01-22 Ulrich Drepper + + * elfutils.spec.in: Distribute in + elfutils-libelf-devel. + +2009-01-22 Roland McGrath + + * known-dwarf.awk: Handle DW_FOO_BAR_* sets better. + +2009-01-11 Roland McGrath + + * known-dwarf.awk: New file. + * Makefile.am (EXTRA_DIST): Add it. + +2008-12-24 Roland McGrath + + * Makefile.am ($(srcdir)/elfutils.spec.in): Rewrite awk magic. + Put the target inside [if MAINTAINER_MODE]. + +2008-12-16 Roland McGrath + + * version.h.in: New file. + 2008-01-12 Ulrich Drepper * elfutils.spec.in: Add m4 to build requirements. diff --git a/elfutils/config/Makefile.am b/elfutils/config/Makefile.am index 60e9bfe6..91adeee5 100644 --- a/elfutils/config/Makefile.am +++ b/elfutils/config/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- ## Configure input file for elfutils. ## -## Copyright (C) 2004, 2005 Red Hat, Inc. +## Copyright (C) 2004, 2005, 2008, 2009 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,23 +25,24 @@ ## Network licensing program, please visit www.openinventionnetwork.com ## . ## -EXTRA_DIST = elfutils.spec.in +EXTRA_DIST = elfutils.spec.in known-dwarf.awk +if MAINTAINER_MODE $(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS @tmpname=$$(mktemp $${TMPDIR:-/tmp}/elfutils.XXXXXX); \ date +'* %a %b %e %Y' | tr '[\n]' '[ ]' > $$tmpname; \ getent passwd "$$(whoami)" | \ awk 'BEGIN {FS=":"} { printf $$5; exit 0}' >> $$tmpname; \ echo -n " <$$(whoami)@redhat.com> " >> $$tmpname; \ - sed 's/Version \(.*\):$$/\1-1/;q' $(top_srcdir)/NEWS >> $$tmpname; \ - sed '2,/^Version /p;d' $(top_srcdir)/NEWS | \ - head -n -1 | \ - awk '{ if ($$0 == "") { if (line != "") { printf "- "; fflush(); system("echo \"" line "\" | fold -w 70"); line=""; } } else { line=line $$0; }} END { if (line != "") { printf "- "; system("echo \"" line "\" | fold -w 70")}}' >> $$tmpname; \ - echo >> $$tmpname; \ + awk '\ + $$1 == "Version" && started { exit } \ + $$1 == "Version" { started=1; line=""; sub(/:/,"",$$2); \ + print $$2 "-1"; next } \ + NF > 0 { line = (line != "") ? (line " " $$0) : ("- " $$0) } \ + NF == 0 && line != "" { print line; line="" } \ + END { if (line != "") print line; print "" }' $< \ + | fold -s -w 70 | sed '1!s/^[^-]/ &/' >> $$tmpname; \ sed "/^%changelog/r $$tmpname" $@ > $@.new; \ rm -f $$tmpname; \ mv -f $@.new $@ - -@if [ -d $(srcdir)/CVS ]; then \ - cd $(srcdir); \ - cvs ci -m "Added changelog." $(@F); \ - fi +endif diff --git a/elfutils/config/Makefile.in b/elfutils/config/Makefile.in index 3bc897fd..fd04a6eb 100644 --- a/elfutils/config/Makefile.in +++ b/elfutils/config/Makefile.in @@ -36,7 +36,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog \ config.guess config.sub depcomp install-sh missing ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -127,6 +128,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -155,7 +157,8 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXTRA_DIST = elfutils.spec.in +zip_LIBS = @zip_LIBS@ +EXTRA_DIST = elfutils.spec.in known-dwarf.awk all: all-am .SUFFIXES: @@ -316,24 +319,23 @@ uninstall-am: mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am -$(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS - @tmpname=$$(mktemp $${TMPDIR:-/tmp}/elfutils.XXXXXX); \ - date +'* %a %b %e %Y' | tr '[\n]' '[ ]' > $$tmpname; \ - getent passwd "$$(whoami)" | \ - awk 'BEGIN {FS=":"} { printf $$5; exit 0}' >> $$tmpname; \ - echo -n " <$$(whoami)@redhat.com> " >> $$tmpname; \ - sed 's/Version \(.*\):$$/\1-1/;q' $(top_srcdir)/NEWS >> $$tmpname; \ - sed '2,/^Version /p;d' $(top_srcdir)/NEWS | \ - head -n -1 | \ - awk '{ if ($$0 == "") { if (line != "") { printf "- "; fflush(); system("echo \"" line "\" | fold -w 70"); line=""; } } else { line=line $$0; }} END { if (line != "") { printf "- "; system("echo \"" line "\" | fold -w 70")}}' >> $$tmpname; \ - echo >> $$tmpname; \ - sed "/^%changelog/r $$tmpname" $@ > $@.new; \ - rm -f $$tmpname; \ - mv -f $@.new $@ - -@if [ -d $(srcdir)/CVS ]; then \ - cd $(srcdir); \ - cvs ci -m "Added changelog." $(@F); \ - fi +@MAINTAINER_MODE_TRUE@$(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS +@MAINTAINER_MODE_TRUE@ @tmpname=$$(mktemp $${TMPDIR:-/tmp}/elfutils.XXXXXX); \ +@MAINTAINER_MODE_TRUE@ date +'* %a %b %e %Y' | tr '[\n]' '[ ]' > $$tmpname; \ +@MAINTAINER_MODE_TRUE@ getent passwd "$$(whoami)" | \ +@MAINTAINER_MODE_TRUE@ awk 'BEGIN {FS=":"} { printf $$5; exit 0}' >> $$tmpname; \ +@MAINTAINER_MODE_TRUE@ echo -n " <$$(whoami)@redhat.com> " >> $$tmpname; \ +@MAINTAINER_MODE_TRUE@ awk '\ +@MAINTAINER_MODE_TRUE@ $$1 == "Version" && started { exit } \ +@MAINTAINER_MODE_TRUE@ $$1 == "Version" { started=1; line=""; sub(/:/,"",$$2); \ +@MAINTAINER_MODE_TRUE@ print $$2 "-1"; next } \ +@MAINTAINER_MODE_TRUE@ NF > 0 { line = (line != "") ? (line " " $$0) : ("- " $$0) } \ +@MAINTAINER_MODE_TRUE@ NF == 0 && line != "" { print line; line="" } \ +@MAINTAINER_MODE_TRUE@ END { if (line != "") print line; print "" }' $< \ +@MAINTAINER_MODE_TRUE@ | fold -s -w 70 | sed '1!s/^[^-]/ &/' >> $$tmpname; \ +@MAINTAINER_MODE_TRUE@ sed "/^%changelog/r $$tmpname" $@ > $@.new; \ +@MAINTAINER_MODE_TRUE@ rm -f $$tmpname; \ +@MAINTAINER_MODE_TRUE@ mv -f $@.new $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/elfutils/config/elfutils.spec.in b/elfutils/config/elfutils.spec.in index 78611b2a..04fc34b3 100644 --- a/elfutils/config/elfutils.spec.in +++ b/elfutils/config/elfutils.spec.in @@ -5,7 +5,7 @@ Version: @PACKAGE_VERSION@ Release: 1 License: GPLv2 with exceptions Group: Development/Tools -Source: elfutils-%{version}.tar.gz +Source: elfutils-%{version}.tar.bz2 Obsoletes: libelf libelf-devel Requires: elfutils-libelf = %{version}-%{release} Requires: glibc >= 2.7 @@ -176,12 +176,47 @@ rm -rf ${RPM_BUILD_ROOT} %{_includedir}/libelf.h %{_includedir}/gelf.h %{_includedir}/nlist.h +%{_includedir}/elfutils/version.h %{_libdir}/libelf.so %files libelf-devel-static %{_libdir}/libelf.a %changelog +* Thu Apr 23 2009 Ulrich Drepper 0.141-1 +- libebl: sparc backend fixes; some more arm backend support +- libdwfl: fix dwfl_module_build_id for prelinked DSO case; + fixes in core file support; dwfl_module_getsym interface + improved for non-address symbols +- strip: fix infinite loop on strange inputs with -f +- addr2line: take -j/--section=NAME option for binutils compatibility + (same effect as '(NAME)0x123' syntax already supported) + +* Mon Feb 16 2009 Ulrich Drepper 0.140-1 +- libelf: Fix regression in creation of section header +- libdwfl: Less strict behavior if DWARF reader ist just used to + display data + +* Thu Jan 22 2009 Ulrich Drepper 0.139-1 +- libcpu: Add Intel SSE4 disassembler support +- readelf: Implement call frame information and exception handling + dumping. Add -e option. Enable it implicitly for -a. +- elflint: Check PT_GNU_EH_FRAME program header entry. +- libdwfl: Support automatic gzip/bzip2 decompression of ELF files. + +* Wed Dec 31 2008 Roland McGrath 0.138-1 +- Install header file for applications to use in + source version compatibility checks. +- libebl: backend fixes for i386 TLS relocs; backend support for + NT_386_IOPERM +- libcpu: disassembler fixes +- libdwfl: bug fixes +- libelf: bug fixes +- nm: bug fixes for handling corrupt input files + +* Tue Aug 26 2008 Ulrich Drepper 0.137-1 +- Minor fixes for unreleased 0.136 release. + * Mon Aug 25 2008 Ulrich Drepper 0.136-1 - libdwfl: bug fixes; new segment interfaces; all the libdwfl-based tools now support --core=COREFILE option @@ -211,7 +246,7 @@ rm -rf ${RPM_BUILD_ROOT} - libdw: DW_FORM_ref_addr support; dwarf_formref entry point now depreca ted; bug fixes for oddly-formatted DWARF - libdwfl: bug fixes in offline archive support, symbol table handling; - apply partial relocations for dwfl_module_address_section on + apply partial relocations for dwfl_module_address_section on ET_REL - libebl: powerpc backend support for Altivec registers diff --git a/elfutils/config/known-dwarf.awk b/elfutils/config/known-dwarf.awk new file mode 100644 index 00000000..3089dd27 --- /dev/null +++ b/elfutils/config/known-dwarf.awk @@ -0,0 +1,55 @@ +#!/bin/awk -f + +$1 == "enum" { set = ""; next } + +set == "" && $1 ~ /DW_([A-Z_]+)_([^ ]+)/ { + set = $1; + sub(/^DW_/, "", set); + sub(/_[^[:upper:]_].*$/, "", set); + if (set ~ /LANG_.+/) set = "LANG"; +} + +$1 ~ /DW([_A-Z]+)_([^ ]+)/ { + match($1, ("DW_" set "_([^ ]+)"), fields); + elt = fields[1]; + if (set in DW) + DW[set] = DW[set] "," elt; + else + DW[set] = elt; + if ($NF == "*/" && $4 == "/*") { + c = $5; + for (i = 6; i < NF; ++i) c = c " " $i; + comment[set, elt] = c; + } +} + +END { + print "/* Generated by config/dwarf-known.awk from libdw.h contents. */"; + n = asorti(DW, sets); + for (i = 1; i <= n; ++i) { + set = sets[i]; + if (what && what != set) continue; + split(DW[set], elts, ","); + m = asort(elts); + lo = hi = ""; + if (m == 0) continue; + print "\n#define ALL_KNOWN_DW_" set " \\"; + for (j = 1; j <= m; ++j) { + elt = elts[j]; + if (elt ~ /(lo|low)_user$/) { + lo = elt; + continue; + } + if (elt ~ /(hi|high)_user$/) { + hi = elt; + continue; + } + if (comment[set, elt]) + print " ONE_KNOWN_DW_" set "_DESC (" elt ", DW_" set "_" elt \ + ", \"" comment[set, elt] "\") \\"; + else + print " ONE_KNOWN_DW_" set " (" elt ", DW_" set "_" elt ") \\"; + } + print " /* End of DW_" set "_*. */"; + } +} diff --git a/elfutils/config/version.h.in b/elfutils/config/version.h.in new file mode 100644 index 00000000..82c846e9 --- /dev/null +++ b/elfutils/config/version.h.in @@ -0,0 +1,58 @@ +/* Version information about elfutils development libraries. + Copyright (C) 2008 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 + . */ + +#ifndef _ELFUTILS_VERSION_H +#define _ELFUTILS_VERSION_H 1 + +#define _ELFUTILS_VERSION @eu_version@ + +#define _ELFUTILS_PREREQ(major, minor) \ + (_ELFUTILS_VERSION >= ((major) * 1000 + (minor))) + +#endif /* elfutils/version.h */ diff --git a/elfutils/configure b/elfutils/configure index 487c9a10..4934a5d0 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.61 for Red Hat elfutils 0.137. +# Generated by GNU Autoconf 2.61 for Red Hat elfutils 0.141. # # Report bugs to . # @@ -9,7 +9,7 @@ # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # -# Copyright (C) 1996-2007, 2008 Red Hat, Inc. +# Copyright (C) 1996-2009 Red Hat, Inc. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -576,8 +576,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Red Hat elfutils' PACKAGE_TARNAME='elfutils' -PACKAGE_VERSION='0.137' -PACKAGE_STRING='Red Hat elfutils 0.137' +PACKAGE_VERSION='0.141' +PACKAGE_STRING='Red Hat elfutils 0.141' PACKAGE_BUGREPORT='http://bugzilla.redhat.com/bugzilla/' ac_unique_file="libelf/libelf.h" @@ -652,8 +652,8 @@ host host_cpu host_vendor host_os -USE_TLS_TRUE -USE_TLS_FALSE +USE_LOCKS_TRUE +USE_LOCKS_FALSE CC CFLAGS LDFLAGS @@ -695,6 +695,11 @@ BUILD_STATIC_FALSE TESTS_RPATH_TRUE TESTS_RPATH_FALSE LIBEBL_SUBDIR +ZLIB_TRUE +ZLIB_FALSE +BZLIB_TRUE +BZLIB_FALSE +zip_LIBS HAVE_LIBASM_TRUE HAVE_LIBASM_FALSE STANDALONE_TRUE @@ -707,6 +712,7 @@ GMSGFMT_015 XGETTEXT XGETTEXT_015 MSGMERGE +eu_version LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -1222,7 +1228,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.137 to adapt to many kinds of systems. +\`configure' configures Red Hat elfutils 0.141 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1292,7 +1298,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Red Hat elfutils 0.137:";; + short | recursive ) echo "Configuration of Red Hat elfutils 0.141:";; esac cat <<\_ACEOF @@ -1301,7 +1307,7 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer - --enable-tls enable use of thread local storage + --enable-thread-safety enable thread safety of libraries --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-largefile omit support for large files @@ -1316,6 +1322,12 @@ Optional Features: install libebl_CPU modules in $(libdir)/DIR --disable-nls do not use Native Language Support +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-zlib support gzip compression in libdwfl + --with-bzlib support gbzip compression in libdwfl + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -1394,7 +1406,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Red Hat elfutils configure 0.137 +Red Hat elfutils configure 0.141 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1402,7 +1414,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -Copyright (C) 1996-2007, 2008 Red Hat, Inc. +Copyright (C) 1996-2009 Red Hat, Inc. _ACEOF exit fi @@ -1410,7 +1422,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.137, which was +It was created by Red Hat elfutils $as_me 0.141, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2106,7 +2118,7 @@ fi # Define the identity of the package. PACKAGE='elfutils' - VERSION='0.137' + VERSION='0.141' cat >>confdefs.h <<_ACEOF @@ -2382,24 +2394,24 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -# Check whether --enable-tls was given. -if test "${enable_tls+set}" = set; then - enableval=$enable_tls; use_tls=yes +# Check whether --enable-thread-safety was given. +if test "${enable_thread_safety+set}" = set; then + enableval=$enable_thread_safety; use_tls=locks else - use_tls=no + use_locks=no fi - if test "$use_tls" = yes; then - USE_TLS_TRUE= - USE_TLS_FALSE='#' + if test "$use_locks" = yes; then + USE_LOCKS_TRUE= + USE_LOCKS_FALSE='#' else - USE_TLS_TRUE='#' - USE_TLS_FALSE= + USE_LOCKS_TRUE='#' + USE_LOCKS_FALSE= fi -if test "$use_tls" = yes; then +if test "$use_locks" = yes; then cat >>confdefs.h <<\_ACEOF -#define USE_TLS 1 +#define USE_LOCKS 1 _ACEOF fi @@ -3894,6 +3906,73 @@ echo "$as_me: error: gcc with C99 support required" >&2;} fi +{ echo "$as_me:$LINENO: checking for __thread support" >&5 +echo $ECHO_N "checking for __thread support... $ECHO_C" >&6; } +if test "${ac_cv_tls+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Use the same flags that we use for our DSOs, so the test is representative. +# Some old compiler/linker/libc combinations fail some ways and not others. +save_CFLAGS="$CFLAGS" +save_LDFLAGS="$LDFLAGS" +CFLAGS="-fpic $CFLAGS" +LDFLAGS="-shared -Wl,-z,defs,-z,relro $LDFLAGS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#undef __thread +static __thread int a; int foo (int b) { return a + b; } +int +main () +{ +exit (foo (0)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_tls=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_tls=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +CFLAGS="$save_CFLAGS" +LDFLAGS="$save_LDFLAGS" +fi +{ echo "$as_me:$LINENO: result: $ac_cv_tls" >&5 +echo "${ECHO_T}$ac_cv_tls" >&6; } +if test "x$ac_cv_tls" != xyes; then + { { echo "$as_me:$LINENO: error: __thread support required" >&5 +echo "$as_me: error: __thread support required" >&2;} + { (exit 1); exit 1; }; } +fi + + LOCALEDIR=$datadir cat >>confdefs.h <<_ACEOF @@ -4462,6 +4541,240 @@ _ACEOF +save_LIBS="$LIBS" +LIBS= + +# Check whether --with-[z]lib was given. +if test "${with_zlib+set}" = set; then + withval=$with_zlib; +else + with_zlib=default +fi + +if test $with_zlib != no; then + { echo "$as_me:$LINENO: checking for library containing gzdirect" >&5 +echo $ECHO_N "checking for library containing gzdirect... $ECHO_C" >&6; } +if test "${ac_cv_search_gzdirect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gzdirect (); +int +main () +{ +return gzdirect (); + ; + return 0; +} +_ACEOF +for ac_lib in '' z; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_gzdirect=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_gzdirect+set}" = set; then + break +fi +done +if test "${ac_cv_search_gzdirect+set}" = set; then + : +else + ac_cv_search_gzdirect=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_gzdirect" >&5 +echo "${ECHO_T}$ac_cv_search_gzdirect" >&6; } +ac_res=$ac_cv_search_gzdirect +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + with_zlib=yes +else + test $with_zlib = default || + { { echo "$as_me:$LINENO: error: missing -lz for --with-zlib" >&5 +echo "$as_me: error: missing -lz for --with-zlib" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + if test $with_zlib = yes; then + ZLIB_TRUE= + ZLIB_FALSE='#' +else + ZLIB_TRUE='#' + ZLIB_FALSE= +fi + +if test $with_zlib = yes; then + cat >>confdefs.h <<\_ACEOF +#define USE_ZLIB 1 +_ACEOF + +fi + + + +# Check whether --with-[bz]lib was given. +if test "${with_bzlib+set}" = set; then + withval=$with_bzlib; +else + with_bzlib=default +fi + +if test $with_bzlib != no; then + { echo "$as_me:$LINENO: checking for library containing BZ2_bzdopen" >&5 +echo $ECHO_N "checking for library containing BZ2_bzdopen... $ECHO_C" >&6; } +if test "${ac_cv_search_BZ2_bzdopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char BZ2_bzdopen (); +int +main () +{ +return BZ2_bzdopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' bz2; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_BZ2_bzdopen=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_BZ2_bzdopen+set}" = set; then + break +fi +done +if test "${ac_cv_search_BZ2_bzdopen+set}" = set; then + : +else + ac_cv_search_BZ2_bzdopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_BZ2_bzdopen" >&5 +echo "${ECHO_T}$ac_cv_search_BZ2_bzdopen" >&6; } +ac_res=$ac_cv_search_BZ2_bzdopen +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + with_bzlib=yes +else + test $with_bzlib = default || + { { echo "$as_me:$LINENO: error: missing -lbz2 for --with-bzlib" >&5 +echo "$as_me: error: missing -lbz2 for --with-bzlib" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + if test $with_bzlib = yes; then + BZLIB_TRUE= + BZLIB_FALSE='#' +else + BZLIB_TRUE='#' + BZLIB_FALSE= +fi + +if test $with_bzlib = yes; then + cat >>confdefs.h <<\_ACEOF +#define USE_BZLIB 1 +_ACEOF + +fi + + +zip_LIBS="$LIBS" +LIBS="$save_LIBS" + + ac_config_files="$ac_config_files lib/Makefile" @@ -4810,6 +5123,49 @@ fi +ac_config_files="$ac_config_files version.h:config/version.h.in" + + + +# 1.234 -> 1234 +case "$PACKAGE_VERSION" in +[0-9].*) eu_version="${PACKAGE_VERSION/./}" ;; +*) { { echo "$as_me:$LINENO: error: confused by version number '$PACKAGE_VERSION'" >&5 +echo "$as_me: error: confused by version number '$PACKAGE_VERSION'" >&2;} + { (exit 1); exit 1; }; } ;; +esac +case "$eu_version" in +*.*) + # 1234.567 -> "1234", "567" + eu_extra_version="${eu_version#*.}" + eu_version="${eu_version%%.*}" + case "$eu_extra_version" in + [0-9][0-9][0-9]) ;; + [0-9][0-9]) eu_extra_version="${eu_extra_version}0" ;; + [0-9]) eu_extra_version="${eu_extra_version}00" ;; + *) { { echo "$as_me:$LINENO: error: confused by version number '$PACKAGE_VERSION'" >&5 +echo "$as_me: error: confused by version number '$PACKAGE_VERSION'" >&2;} + { (exit 1); exit 1; }; } ;; + esac + ;; +*) + eu_extra_version=000 + ;; +esac + +case "$eu_version" in + 0[0-9][0-9][0-9]) eu_version="${eu_version#0}$eu_extra_version" ;; +[0-9][0-9][0-9][0-9]) eu_version="${eu_version}$eu_extra_version" ;; +[0-9][0-9][0-9]) eu_version="${eu_version}0$eu_extra_version" ;; +[0-9][0-9]) eu_version="${eu_version}00$eu_extra_version";; +*) { { echo "$as_me:$LINENO: error: confused by version number '$PACKAGE_VERSION'" >&5 +echo "$as_me: error: confused by version number '$PACKAGE_VERSION'" >&2;} + { (exit 1); exit 1; }; } ;; +esac + +# Round up to the next release API (x.y) version. +eu_version=$[($eu_version + 999) / 1000] + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -4913,10 +5269,10 @@ echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi -if test -z "${USE_TLS_TRUE}" && test -z "${USE_TLS_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"USE_TLS\" was never defined. +if test -z "${USE_LOCKS_TRUE}" && test -z "${USE_LOCKS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"USE_LOCKS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"USE_TLS\" was never defined. +echo "$as_me: error: conditional \"USE_LOCKS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi @@ -4983,6 +5339,20 @@ echo "$as_me: error: conditional \"TESTS_RPATH\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${ZLIB_TRUE}" && test -z "${ZLIB_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ZLIB\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ZLIB\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${BZLIB_TRUE}" && test -z "${BZLIB_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"BZLIB\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"BZLIB\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${HAVE_LIBASM_TRUE}" && test -z "${HAVE_LIBASM_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"HAVE_LIBASM\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -5297,7 +5667,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.137, which was +This file was extended by Red Hat elfutils $as_me 0.141, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5350,7 +5720,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -Red Hat elfutils config.status 0.137 +Red Hat elfutils config.status 0.141 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -5489,6 +5859,7 @@ do "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; + "version.h") CONFIG_FILES="$CONFIG_FILES version.h:config/version.h.in" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -5622,8 +5993,8 @@ host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim -USE_TLS_TRUE!$USE_TLS_TRUE$ac_delim -USE_TLS_FALSE!$USE_TLS_FALSE$ac_delim +USE_LOCKS_TRUE!$USE_LOCKS_TRUE$ac_delim +USE_LOCKS_FALSE!$USE_LOCKS_FALSE$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim @@ -5706,6 +6077,11 @@ BUILD_STATIC_FALSE!$BUILD_STATIC_FALSE$ac_delim TESTS_RPATH_TRUE!$TESTS_RPATH_TRUE$ac_delim TESTS_RPATH_FALSE!$TESTS_RPATH_FALSE$ac_delim LIBEBL_SUBDIR!$LIBEBL_SUBDIR$ac_delim +ZLIB_TRUE!$ZLIB_TRUE$ac_delim +ZLIB_FALSE!$ZLIB_FALSE$ac_delim +BZLIB_TRUE!$BZLIB_TRUE$ac_delim +BZLIB_FALSE!$BZLIB_FALSE$ac_delim +zip_LIBS!$zip_LIBS$ac_delim HAVE_LIBASM_TRUE!$HAVE_LIBASM_TRUE$ac_delim HAVE_LIBASM_FALSE!$HAVE_LIBASM_FALSE$ac_delim STANDALONE_TRUE!$STANDALONE_TRUE$ac_delim @@ -5718,11 +6094,12 @@ GMSGFMT_015!$GMSGFMT_015$ac_delim XGETTEXT!$XGETTEXT$ac_delim XGETTEXT_015!$XGETTEXT_015$ac_delim MSGMERGE!$MSGMERGE$ac_delim +eu_version!$eu_version$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 31; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 37; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/elfutils/configure.ac b/elfutils/configure.ac index 2723046e..4931530c 100644 --- a/elfutils/configure.ac +++ b/elfutils/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl Configure input file for elfutils. -*-autoconf-*- dnl -dnl Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. +dnl Copyright (C) 1996-2008, 2009 Red Hat, Inc. dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -16,17 +16,17 @@ 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.137],[http://bugzilla.redhat.com/bugzilla/], +AC_INIT([Red Hat elfutils],[0.141],[http://bugzilla.redhat.com/bugzilla/], [elfutils]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_FILES([config/Makefile]) -AC_COPYRIGHT([Copyright (C) 1996-2007, 2008 Red Hat, Inc.]) +AC_COPYRIGHT([Copyright (C) 1996-2009 Red Hat, Inc.]) AC_PREREQ(2.59) dnl Minimum Autoconf version required. dnl We use GNU make extensions; automake 1.10 defaults to -Wportability. -AM_INIT_AUTOMAKE([gnits 1.7 -Wno-portability]) +AM_INIT_AUTOMAKE([gnits 1.8 -Wno-portability dist-bzip2 no-dist-gzip]) AM_MAINTAINER_MODE dnl Unique ID for this build. @@ -48,13 +48,13 @@ AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in]) AC_CANONICAL_HOST -AC_ARG_ENABLE([tls], -AS_HELP_STRING([--enable-tls], [enable use of thread local storage]), -use_tls=yes, use_tls=no) -AM_CONDITIONAL(USE_TLS, test "$use_tls" = yes) -AS_IF([test "$use_tls" = yes], [AC_DEFINE(USE_TLS)]) +AC_ARG_ENABLE([thread-safety], +AS_HELP_STRING([--enable-thread-safety], [enable thread safety of libraries]), +use_tls=locks, use_locks=no) +AM_CONDITIONAL(USE_LOCKS, test "$use_locks" = yes) +AS_IF([test "$use_locks" = yes], [AC_DEFINE(USE_LOCKS)]) -AH_TEMPLATE([USE_TLS], [Defined if thread local storage should be used.]) +AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.]) dnl Add all the languages for which translations are available. ALL_LINGUAS= @@ -74,6 +74,23 @@ CFLAGS="$old_CFLAGS"]) AS_IF([test "x$ac_cv_c99" != xyes], AC_MSG_ERROR([gcc with C99 support required])) +AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl +# Use the same flags that we use for our DSOs, so the test is representative. +# Some old compiler/linker/libc combinations fail some ways and not others. +save_CFLAGS="$CFLAGS" +save_LDFLAGS="$LDFLAGS" +CFLAGS="-fpic $CFLAGS" +LDFLAGS="-shared -Wl,-z,defs,-z,relro $LDFLAGS" +AC_LINK_IFELSE([dnl +AC_LANG_PROGRAM([[#undef __thread +static __thread int a; int foo (int b) { return a + b; }]], + [[exit (foo (0));]])], + ac_cv_tls=yes, ac_cv_tls=no) +CFLAGS="$save_CFLAGS" +LDFLAGS="$save_LDFLAGS"]) +AS_IF([test "x$ac_cv_tls" != xyes], + AC_MSG_ERROR([__thread support required])) + LOCALEDIR=$datadir AC_SUBST(LOCALEDIR) AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") @@ -182,6 +199,16 @@ AC_SUBST([LIBEBL_SUBDIR]) AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR") AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.]) +dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am +dnl conditional and config.h USE_ZLIB/USE_BZLIB #define. +save_LIBS="$LIBS" +LIBS= +eu_ZIPLIB(z,Z,z,gzdirect,gzip) +eu_ZIPLIB(bz,BZ,bz2,BZ2_bzdopen,bzip2) +zip_LIBS="$LIBS" +LIBS="$save_LIBS" +AC_SUBST([zip_LIBS]) + dnl The directories with content. dnl Documentation. @@ -229,4 +256,41 @@ dnl Appended to the config.h file. dnl We hide all kinds of configuration magic in lib/eu-config.h. AH_BOTTOM([#include ]) +dnl Version compatibility header. +AC_CONFIG_FILES([version.h:config/version.h.in]) +AC_SUBST([eu_version]) + +# 1.234 -> 1234 +case "$PACKAGE_VERSION" in +[[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;; +*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; +esac +case "$eu_version" in +*.*) + # 1234.567 -> "1234", "567" + eu_extra_version="${eu_version#*.}" + eu_version="${eu_version%%.*}" + case "$eu_extra_version" in + [[0-9]][[0-9]][[0-9]]) ;; + [[0-9]][[0-9]]) eu_extra_version="${eu_extra_version}0" ;; + [[0-9]]) eu_extra_version="${eu_extra_version}00" ;; + *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; + esac + ;; +*) + eu_extra_version=000 + ;; +esac + +case "$eu_version" in + 0[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version#0}$eu_extra_version" ;; +[[0-9]][[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}$eu_extra_version" ;; +[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}0$eu_extra_version" ;; +[[0-9]][[0-9]]) eu_version="${eu_version}00$eu_extra_version";; +*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; +esac + +# Round up to the next release API (x.y) version. +[eu_version=$[($eu_version + 999) / 1000]] + AC_OUTPUT diff --git a/elfutils/elfutils.spec b/elfutils/elfutils.spec index 316a38e7..183ab1e9 100644 --- a/elfutils/elfutils.spec +++ b/elfutils/elfutils.spec @@ -1,11 +1,11 @@ # -*- rpm-spec-*- Summary: A collection of utilities and DSOs to handle compiled objects Name: elfutils -Version: 0.137 +Version: 0.141 Release: 1 License: GPLv2 with exceptions Group: Development/Tools -Source: elfutils-%{version}.tar.gz +Source: elfutils-%{version}.tar.bz2 Obsoletes: libelf libelf-devel Requires: elfutils-libelf = %{version}-%{release} Requires: glibc >= 2.7 @@ -176,12 +176,47 @@ rm -rf ${RPM_BUILD_ROOT} %{_includedir}/libelf.h %{_includedir}/gelf.h %{_includedir}/nlist.h +%{_includedir}/elfutils/version.h %{_libdir}/libelf.so %files libelf-devel-static %{_libdir}/libelf.a %changelog +* Thu Apr 23 2009 Ulrich Drepper 0.141-1 +- libebl: sparc backend fixes; some more arm backend support +- libdwfl: fix dwfl_module_build_id for prelinked DSO case; + fixes in core file support; dwfl_module_getsym interface + improved for non-address symbols +- strip: fix infinite loop on strange inputs with -f +- addr2line: take -j/--section=NAME option for binutils compatibility + (same effect as '(NAME)0x123' syntax already supported) + +* Mon Feb 16 2009 Ulrich Drepper 0.140-1 +- libelf: Fix regression in creation of section header +- libdwfl: Less strict behavior if DWARF reader ist just used to + display data + +* Thu Jan 22 2009 Ulrich Drepper 0.139-1 +- libcpu: Add Intel SSE4 disassembler support +- readelf: Implement call frame information and exception handling + dumping. Add -e option. Enable it implicitly for -a. +- elflint: Check PT_GNU_EH_FRAME program header entry. +- libdwfl: Support automatic gzip/bzip2 decompression of ELF files. + +* Wed Dec 31 2008 Roland McGrath 0.138-1 +- Install header file for applications to use in + source version compatibility checks. +- libebl: backend fixes for i386 TLS relocs; backend support for + NT_386_IOPERM +- libcpu: disassembler fixes +- libdwfl: bug fixes +- libelf: bug fixes +- nm: bug fixes for handling corrupt input files + +* Tue Aug 26 2008 Ulrich Drepper 0.137-1 +- Minor fixes for unreleased 0.136 release. + * Mon Aug 25 2008 Ulrich Drepper 0.136-1 - libdwfl: bug fixes; new segment interfaces; all the libdwfl-based tools now support --core=COREFILE option @@ -211,7 +246,7 @@ rm -rf ${RPM_BUILD_ROOT} - libdw: DW_FORM_ref_addr support; dwarf_formref entry point now depreca ted; bug fixes for oddly-formatted DWARF - libdwfl: bug fixes in offline archive support, symbol table handling; - apply partial relocations for dwfl_module_address_section on + apply partial relocations for dwfl_module_address_section on ET_REL - libebl: powerpc backend support for Altivec registers diff --git a/elfutils/lib/ChangeLog b/elfutils/lib/ChangeLog index f4c261ab..06991826 100644 --- a/elfutils/lib/ChangeLog +++ b/elfutils/lib/ChangeLog @@ -1,3 +1,18 @@ +2009-01-23 Roland McGrath + + * eu-config.h: Add multiple inclusion protection. + +2009-01-17 Ulrich Drepper + + * system.h (ARGP_PROGRAM_VERSION_HOOK_DEF): Define. + (ARGP_PROGRAM_BUG_ADDRESS_DEF): Define. + +2009-01-10 Ulrich Drepper + + * eu-config.h: Remove tls_key_t, key_create, getspecific, setspecific, + once_define, and once_execute macros. Use USE_LOCKS instead of + USE_TLS. + 2008-08-25 Roland McGrath * eu-config.h [USE_TLS] (RWLOCK_CALL): New macro. diff --git a/elfutils/lib/Makefile.in b/elfutils/lib/Makefile.in index 62d3e0c2..1d774346 100644 --- a/elfutils/lib/Makefile.in +++ b/elfutils/lib/Makefile.in @@ -38,7 +38,8 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -148,6 +149,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -176,6 +178,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ @MUDFLAP_FALSE@ -Wextra $($(*F)_CFLAGS) @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ diff --git a/elfutils/lib/eu-config.h b/elfutils/lib/eu-config.h index c41cbb0c..32f501ae 100644 --- a/elfutils/lib/eu-config.h +++ b/elfutils/lib/eu-config.h @@ -1,5 +1,5 @@ /* Configuration definitions. - Copyright (C) 2008 Red Hat, Inc. + Copyright (C) 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -46,15 +46,12 @@ Network licensing program, please visit www.openinventionnetwork.com . */ -#ifdef USE_TLS +#ifndef EU_CONFIG_H +#define EU_CONFIG_H 1 + +#ifdef USE_LOCKS # include # include -# define tls_key_t __thread void * -# define key_create(keyp, freefct) (1) -# define getspecific(key) key -# define setspecific(key,val) key = val -# define once_define(class,name) class struct { } name -# define once_execute(name,fct) ((void) &name, (void) (fct)) # define rwlock_define(class,name) class pthread_rwlock_t name # define RWLOCK_CALL(call) \ ({ int _err = pthread_rwlock_ ## call; assert_perror (_err); }) @@ -67,25 +64,13 @@ /* Eventually we will allow multi-threaded applications to use the libraries. Therefore we will add the necessary locking although the macros used expand to nothing for now. */ -# define lock_lock(lock) ((void) (lock)) # define rwlock_define(class,name) class int name # define rwlock_init(lock) ((void) (lock)) # define rwlock_fini(lock) ((void) (lock)) # define rwlock_rdlock(lock) ((void) (lock)) # define rwlock_wrlock(lock) ((void) (lock)) # define rwlock_unlock(lock) ((void) (lock)) -# define tls_key_t void * -# define key_create(keyp, freefct) (1) -# define getspecific(key) key -# define setspecific(key,val) key = val -# define once_define(class,name) class int name -# define once_execute(name,fct) \ - do { \ - if (name == 0) \ - fct (); \ - name = 1; \ - } while (0) -#endif /* USE_TLS */ +#endif /* USE_LOCKS */ /* gettext helper macro. */ #define N_(Str) Str @@ -196,3 +181,6 @@ asm (".section predict_data, \"aw\"; .previous\n" /* This macro is used by the tests conditionalize for standalone building. */ #define ELFUTILS_HEADER(name) + + +#endif /* eu-config.h */ diff --git a/elfutils/lib/system.h b/elfutils/lib/system.h index 23c666ad..10b4734a 100644 --- a/elfutils/lib/system.h +++ b/elfutils/lib/system.h @@ -1,5 +1,5 @@ /* Declarations for common convenience functions. - Copyright (C) 2006 Red Hat, Inc. + Copyright (C) 2006, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -78,4 +78,16 @@ extern int crc32_file (int fd, uint32_t *resp); #define pread_retry(fd, buf, len, off) \ TEMP_FAILURE_RETRY (pread (fd, buf, len, off)) + +/* We need define two variables, argp_program_version_hook and + argp_program_bug_address, in all programs. argp.h declares these + variables as non-const (which is correct in general). But we can + do better, it is not going to change. So we want to move them into + the .rodata section. Define macros to do the trick. */ +#define ARGP_PROGRAM_VERSION_HOOK_DEF \ + void (*const apvh) (FILE *, struct argp_state *) \ + __asm ("argp_program_version_hook") +#define ARGP_PROGRAM_BUG_ADDRESS_DEF \ + const char *const apba__ __asm ("argp_program_bug_address") + #endif /* system.h */ diff --git a/elfutils/libasm/ChangeLog b/elfutils/libasm/ChangeLog index 2894970e..d0d40396 100644 --- a/elfutils/libasm/ChangeLog +++ b/elfutils/libasm/ChangeLog @@ -1,3 +1,12 @@ +2009-01-10 Ulrich Drepper + + * Makefile.am: Use USE_LOCKS instead of USE_TLS. + * asm_error.c: Always use __thread. Remove all !USE_TLS code. + +2008-12-03 Ulrich Drepper + + * Makefile.am [USE_TLS]: Like libasm.so with libpthread. + 2008-01-11 Ulrich Drepper * libasm.h (DisasmGetSymCB_t): Change type of fourth and fifth diff --git a/elfutils/libasm/Makefile.am b/elfutils/libasm/Makefile.am index bd5779e8..7d5e25d1 100644 --- a/elfutils/libasm/Makefile.am +++ b/elfutils/libasm/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2002, 2004, 2005, 2006, 2008 Red Hat, Inc. +## Copyright (C) 2002, 2004, 2005, 2006, 2008, 2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -65,12 +65,17 @@ if !MUDFLAP libasm_pic_a_SOURCES = am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os) +libasm_so_LDLIBS = +if USE_LOCKS +libasm_so_LDLIBS += -lpthread +endif + libasm_so_SOURCES = libasm.so: libasm_pic.a libasm.map $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \ -Wl,--soname,$@.$(VERSION) \ - ../libebl/libebl.a ../libelf/libelf.so + ../libebl/libebl.a ../libelf/libelf.so $(libasm_so_LDLIBS) if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi ln -fs $@ $@.$(VERSION) diff --git a/elfutils/libasm/Makefile.in b/elfutils/libasm/Makefile.in index 9490591d..108a3958 100644 --- a/elfutils/libasm/Makefile.in +++ b/elfutils/libasm/Makefile.in @@ -36,12 +36,14 @@ build_triplet = @build@ host_triplet = @host@ @MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) @MUDFLAP_TRUE@am_libasm_pic_a_OBJECTS = +@MUDFLAP_FALSE@@USE_LOCKS_TRUE@am__append_1 = -lpthread subdir = libasm DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -181,6 +183,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -209,6 +212,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Werror -Wunused \ @MUDFLAP_FALSE@ -Wextra -Wformat=2 @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -std=gnu99 -Wall -Wshadow -Werror \ @@ -240,6 +244,7 @@ libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ @MUDFLAP_FALSE@libasm_pic_a_SOURCES = @MUDFLAP_FALSE@am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os) +@MUDFLAP_FALSE@libasm_so_LDLIBS = $(am__append_1) @MUDFLAP_FALSE@libasm_so_SOURCES = noinst_HEADERS = libasmP.h symbolhash.h EXTRA_DIST = libasm.map @@ -577,7 +582,7 @@ uninstall-am: uninstall-libLIBRARIES uninstall-pkgincludeHEADERS @MUDFLAP_FALSE@ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ @MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \ @MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION) \ -@MUDFLAP_FALSE@ ../libebl/libebl.a ../libelf/libelf.so +@MUDFLAP_FALSE@ ../libebl/libebl.a ../libelf/libelf.so $(libasm_so_LDLIBS) @MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi @MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION) diff --git a/elfutils/libasm/asm_error.c b/elfutils/libasm/asm_error.c index 29c54cb0..4d249e9f 100644 --- a/elfutils/libasm/asm_error.c +++ b/elfutils/libasm/asm_error.c @@ -1,5 +1,5 @@ /* Error handling in libasm. - Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + Copyright (C) 2002, 2004, 2005, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2002. @@ -36,50 +36,13 @@ /* This is the key for the thread specific memory. */ -static tls_key_t key; - -/* The error number. Used in non-threaded programs. */ -static int global_error; -static bool threaded; -/* We need to initialize the thread-specific data. */ -once_define (static, once); - -/* The initialization and destruction functions. */ -static void init (void); -static void free_key_mem (void *mem); +static __thread int global_error; int asm_errno (void) { - int result; - - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - { - /* We have a key. Use it to get the thread-specific buffer. */ - int *buffer = getspecific (key); - if (buffer == NULL) - { - /* No buffer allocated so far. */ - buffer = (int *) malloc (sizeof (int)); - if (buffer == NULL) - /* No more memory available. We use the static buffer. */ - buffer = &global_error; - - setspecific (key, buffer); - - *buffer = 0; - } - - result = *buffer; - *buffer = ASM_E_NOERROR; - return result; - } - - result = global_error; + int result = global_error; global_error = ASM_E_NOERROR; return result; } @@ -89,27 +52,6 @@ void __libasm_seterrno (value) int value; { - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - { - /* We have a key. Use it to get the thread-specific buffer. */ - int *buffer = getspecific (key); - if (buffer == NULL) - { - /* No buffer allocated so far. */ - buffer = malloc (sizeof (int)); - if (buffer == NULL) - /* No more memory available. We use the static buffer. */ - buffer = &global_error; - - setspecific (key, buffer); - } - - *buffer = value; - } - global_error = value; } @@ -133,31 +75,7 @@ const char * asm_errmsg (error) int error; { - int last_error; - - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if ((error == 0 || error == -1) && threaded) - { - /* We have a key. Use it to get the thread-specific buffer. */ - int *buffer = (int *) getspecific (key); - if (buffer == NULL) - { - /* No buffer allocated so far. */ - buffer = (int *) malloc (sizeof (int)); - if (buffer == NULL) - /* No more memory available. We use the static buffer. */ - buffer = &global_error; - - setspecific (key, buffer); - *buffer = 0; - } - - last_error = *buffer; - } - else - last_error = global_error; + int last_error = global_error; if (error < -1) return _("unknown error"); @@ -173,25 +91,3 @@ asm_errmsg (error) return _(msgs[last_error]); } - - -/* Free the thread specific data, this is done if a thread terminates. */ -static void -free_key_mem (void *mem) -{ - free (mem); - setspecific (key, NULL); -} - - -/* Initialize the key for the global variable. */ -static void -init (void) -{ - // XXX Screw you, gcc4, the unused function attribute does not work. - __asm ("" :: "r" (free_key_mem)); - - if (key_create (&key, free_key_mem) == 0) - /* Creating the key succeeded. */ - threaded = true; -} diff --git a/elfutils/libcpu/ChangeLog b/elfutils/libcpu/ChangeLog index ff642de1..738af57a 100644 --- a/elfutils/libcpu/ChangeLog +++ b/elfutils/libcpu/ChangeLog @@ -1,3 +1,72 @@ +2009-04-14 Roland McGrath + + * Makefile.am (AM_CFLAGS): Add -fdollars-in-identifiers; it is not the + default on every machine. + +2009-01-23 Roland McGrath + + * Makefile.am (i386_parse_CFLAGS): Use quotes around command + substitution that can produce leading whitespace. + +2009-01-01 Ulrich Drepper + + * i386_parse.y (instrtable_out): Optimize match_data table by not + emitting 0xff masks for leading bytes. + * i386_disasm.c (i386_disasm): Adjust reader of match_data. + + * i386_disasm.c (i386_disasm): Reset bufcnt when not matched. We + don't expect snprintf to fail. + +2008-12-31 Ulrich Drepper + + * defs/i386: Add dppd, dpps, insertps, movntdqa, mpsadbw, packusdw, + pblendvb, pblendw, pcmpeqq, pcmpestri, pcmpestrm, pcmpistri, pcmpistrm, + pcmpgtq, phminposuw, pinsrb, pinsrd, pmaxsb, pmaxsd, pmaxud, pmaxuw, + pminsb, pminsd, pminud, pminuw, pmovsxbw, pmovsxbd, pmovsxbq, pmovsxwd, + pmovsxwq, pmovsxdq, pmovzxbw, pmovzxbd, pmovzxbq, pmovzxwd, pmovzxwq, + pmovzxdq, pmuldq, pmulld, popcnt, ptest, roundss, roundps, roundpd, + and roundsd opcodes. + + * i386_disasm.c (i386_disasm): Correct resizing of buffer. + + * i386_parse.y (struct argstring): Add off element. + (off_op_str): New global variable. + (print_op_str): Print strings as concatenated strings. Keep track + of index and length. Update ->off element. + (print_op_str_idx): New function. + (instrtable_out): Mark op%d_fct as const. + Emit two tables for the strings: the string itself (op%d_str) and the + index table (op%d_str_idx). + * i386_disasm.c (i386_disasm): Adjust for new op%d_str definition. + + * i386_disasm.c [X86_64] (i386_disasm): Handle rex prefix when + printing only prefix. + + * i386_disasm.c (i386_disasm): Minor optimizations. + + * i386_parse.y (instrtable_out): No need to emit index, the reader can + keep track. + * i386_disasm.c (i386_disasm): The index is not emitted anymore, no + need to skip it. + + * i386_disasm.c (amd3dnow): Mark as const. + + * defs/i386: Add blendvpd and blendvps opcodes. + +2008-12-30 Ulrich Drepper + + * defs/i386: Add blendpd and blendps opcodes. + +2008-12-19 Ulrich Drepper + + * defs/i386: Add entry for AMD 3DNOW. + * i386_disasm.c: Implement AMD 3DNOW disassembly. + +2008-12-17 Ulrich Drepper + + * i386_disasm.c (i386_disasm): If instruction matches prefix, + undoing the prefix match finishes the instruction. + 2008-01-21 Roland McGrath * defs/i386: Fix typo in comment. diff --git a/elfutils/libcpu/Makefile.am b/elfutils/libcpu/Makefile.am index 51817c1e..923556f6 100644 --- a/elfutils/libcpu/Makefile.am +++ b/elfutils/libcpu/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2002, 2004, 2005, 2007, 2008 Red Hat, Inc. +## Copyright (C) 2002, 2004, 2005, 2007, 2008, 2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -31,6 +31,7 @@ else AM_CFLAGS = endif AM_CFLAGS += -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fpic \ + -fdollars-in-identifiers \ $($(*F)_CFLAGS) \ $(if $($(*F)_no_Werror),,-Werror) INCLUDES = -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../libelf \ @@ -70,7 +71,7 @@ libeu = ../lib/libeu.a i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare i386_parse.o: i386_parse.c i386.mnemonics -i386_parse_CFLAGS = -DNMNES=$$(wc -l < i386.mnemonics) +i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`" i386_lex.o: i386_parse.h i386_gendis_LDADD = $(libeu) -lm $(libmudflap) diff --git a/elfutils/libcpu/Makefile.in b/elfutils/libcpu/Makefile.in index 40f08690..d05b1f54 100644 --- a/elfutils/libcpu/Makefile.in +++ b/elfutils/libcpu/Makefile.in @@ -40,7 +40,8 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog i386_lex.c i386_parse.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -164,6 +165,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -192,11 +194,13 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Wshadow -Wunused -Wextra -std=gnu99 \ -@MUDFLAP_FALSE@ -fpic $($(*F)_CFLAGS) $(if \ -@MUDFLAP_FALSE@ $($(*F)_no_Werror),,-Werror) +@MUDFLAP_FALSE@ -fpic -fdollars-in-identifiers $($(*F)_CFLAGS) \ +@MUDFLAP_FALSE@ $(if $($(*F)_no_Werror),,-Werror) @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Wshadow -Wunused -Wextra \ -@MUDFLAP_TRUE@ -std=gnu99 -fpic $($(*F)_CFLAGS) $(if \ +@MUDFLAP_TRUE@ -std=gnu99 -fpic -fdollars-in-identifiers \ +@MUDFLAP_TRUE@ $($(*F)_CFLAGS) $(if \ @MUDFLAP_TRUE@ $($(*F)_no_Werror),,-Werror) INCLUDES = -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../libelf \ -I$(srcdir)/../libebl -I$(srcdir)/../libdw -I$(srcdir)/../libasm @@ -211,7 +215,7 @@ i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y i386_lex_no_Werror = yes libeu = ../lib/libeu.a i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare -i386_parse_CFLAGS = -DNMNES=$$(wc -l < i386.mnemonics) +i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`" i386_gendis_LDADD = $(libeu) -lm $(libmudflap) noinst_HEADERS = memory-access.h i386_parse.h i386_data.h EXTRA_DIST = defs/i386 diff --git a/elfutils/libcpu/defs/i386 b/elfutils/libcpu/defs/i386 index 4abbc261..e0db28dc 100644 --- a/elfutils/libcpu/defs/i386 +++ b/elfutils/libcpu/defs/i386 @@ -437,6 +437,9 @@ ifdef(`i386', ', `10010000:INVALID ')dnl +# ORDER before out +11110011,00001111,10111000,{mod}{reg}{r_m}:popcnt {mod}{r_m},{reg} +# END ORDER 1111011{w},{mod}010{r_m}:not{w} {mod}{r_m}{w} 0000100{w},{mod}{reg}{r_m}:or {reg}{w},{mod}{r_m}{w} 0000101{w},{mod}{reg}{r_m}:or {mod}{r_m}{w},{reg}{w} @@ -911,6 +914,56 @@ ifdef(`i386', 00001111,10101110,11110000:mfence 00001111,10101110,11111000:sfence 00001111,10101110,{mod}111{r_m}:clflush {mod}{r_m} +00001111,00001111,{MOD}{mmxreg}{R_M}:INVALID {MOD}{R_M},{mmxreg} +01100110,00001111,00111010,00001100,{Mod}{xmmreg}{R_m},{imm8}:blendps {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00001101,{Mod}{xmmreg}{R_m},{imm8}:blendpd {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00010100,{Mod}{xmmreg}{R_m}:blendvps %xmm0,{Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00010101,{Mod}{xmmreg}{R_m}:blendvpd %xmm0,{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,01000000,{Mod}{xmmreg}{R_m},{imm8}:dpps {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,01000001,{Mod}{xmmreg}{R_m},{imm8}:dppd {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00100001,{Mod}{xmmreg}{R_m},{imm8}:insertps {imm8},{Mod}{R_m},{xmmreg} +# Mod == 11 is not valid +01100110,00001111,00111000,00101010,{Mod}{xmmreg}{R_m}:movntdqa {Mod}{R_m},{xmmreg} +01100110,00001111,00111010,01000010,{Mod}{xmmreg}{R_m},{imm8}:mpsadbw {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00101011,{Mod}{xmmreg}{R_m}:packusdw {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00010000,{Mod}{xmmreg}{R_m}:pblendvb %xmm0,{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00001110,{Mod}{xmmreg}{R_m},{imm8}:pblendw {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00101001,{Mod}{xmmreg}{R_m}:pcmpeqq {Mod}{R_m},{xmmreg} +01100110,00001111,00111010,01100001,{Mod}{xmmreg}{R_m},{imm8}:pcmpestri {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,01100000,{Mod}{xmmreg}{R_m},{imm8}:pcmpestrm {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,01100011,{Mod}{xmmreg}{R_m},{imm8}:pcmpistri {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,01100010,{Mod}{xmmreg}{R_m},{imm8}:pcmpistrm {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00110111,{Mod}{xmmreg}{R_m}:pcmpgtq {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,01000001,{Mod}{xmmreg}{R_m}:phminposuw {Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00100000,{mod}{xmmreg}{r_m},{imm8}:pinsrb {imm8},{mod}{r_m},{xmmreg} +01100110,00001111,00111010,00100010,{mod}{xmmreg}{r_m},{imm8}:pinsrd {imm8},{mod}{r_m},{xmmreg} +01100110,00001111,00111000,00111100,{Mod}{xmmreg}{R_m}:pmaxsb {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00111101,{Mod}{xmmreg}{R_m}:pmaxsd {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00111111,{Mod}{xmmreg}{R_m}:pmaxud {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00111110,{Mod}{xmmreg}{R_m}:pmaxuw {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00111000,{Mod}{xmmreg}{R_m}:pminsb {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00111001,{Mod}{xmmreg}{R_m}:pminsd {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00111011,{Mod}{xmmreg}{R_m}:pminud {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00111010,{Mod}{xmmreg}{R_m}:pminuw {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00100000,{Mod}{xmmreg}{R_m}:pmovsxbw {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00100001,{Mod}{xmmreg}{R_m}:pmovsxbd {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00100010,{Mod}{xmmreg}{R_m}:pmovsxbq {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00100011,{Mod}{xmmreg}{R_m}:pmovsxwd {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00100100,{Mod}{xmmreg}{R_m}:pmovsxwq {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00100101,{Mod}{xmmreg}{R_m}:pmovsxdq {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00110000,{Mod}{xmmreg}{R_m}:pmovzxbw {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00110001,{Mod}{xmmreg}{R_m}:pmovzxbd {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00110010,{Mod}{xmmreg}{R_m}:pmovzxbq {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00110011,{Mod}{xmmreg}{R_m}:pmovzxwd {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00110100,{Mod}{xmmreg}{R_m}:pmovzxwq {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00110101,{Mod}{xmmreg}{R_m}:pmovzxdq {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00101000,{Mod}{xmmreg}{R_m}:pmuldq {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,01000000,{Mod}{xmmreg}{R_m}:pmulld {Mod}{R_m},{xmmreg} +01100110,00001111,00111000,00010111,{Mod}{xmmreg}{R_m}:ptest {Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00001000,{Mod}{xmmreg}{R_m},{imm8}:roundps {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00001001,{Mod}{xmmreg}{R_m},{imm8}:roundpd {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00001010,{Mod}{xmmreg}{R_m},{imm8}:roundss {imm8},{Mod}{R_m},{xmmreg} +01100110,00001111,00111010,00001011,{Mod}{xmmreg}{R_m},{imm8}:roundsd {imm8},{Mod}{R_m},{xmmreg} # ORDER: dnl Many previous entries depend on this being last. 000{sreg2}111:pop {sreg2} diff --git a/elfutils/libcpu/i386_disasm.c b/elfutils/libcpu/i386_disasm.c index 843fd749..c6bb0a58 100644 --- a/elfutils/libcpu/i386_disasm.c +++ b/elfutils/libcpu/i386_disasm.c @@ -1,5 +1,5 @@ /* Disassembler for x86. - Copyright (C) 2007, 2008 Red Hat, Inc. + Copyright (C) 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2007. @@ -184,6 +184,73 @@ static const char *prefix_str[] = #endif +static const char amd3dnowstr[] = +#define MNE_3DNOW_PAVGUSB 1 + "pavgusb\0" +#define MNE_3DNOW_PFADD (MNE_3DNOW_PAVGUSB + 8) + "pfadd\0" +#define MNE_3DNOW_PFSUB (MNE_3DNOW_PFADD + 6) + "pfsub\0" +#define MNE_3DNOW_PFSUBR (MNE_3DNOW_PFSUB + 6) + "pfsubr\0" +#define MNE_3DNOW_PFACC (MNE_3DNOW_PFSUBR + 7) + "pfacc\0" +#define MNE_3DNOW_PFCMPGE (MNE_3DNOW_PFACC + 6) + "pfcmpge\0" +#define MNE_3DNOW_PFCMPGT (MNE_3DNOW_PFCMPGE + 8) + "pfcmpgt\0" +#define MNE_3DNOW_PFCMPEQ (MNE_3DNOW_PFCMPGT + 8) + "pfcmpeq\0" +#define MNE_3DNOW_PFMIN (MNE_3DNOW_PFCMPEQ + 8) + "pfmin\0" +#define MNE_3DNOW_PFMAX (MNE_3DNOW_PFMIN + 6) + "pfmax\0" +#define MNE_3DNOW_PI2FD (MNE_3DNOW_PFMAX + 6) + "pi2fd\0" +#define MNE_3DNOW_PF2ID (MNE_3DNOW_PI2FD + 6) + "pf2id\0" +#define MNE_3DNOW_PFRCP (MNE_3DNOW_PF2ID + 6) + "pfrcp\0" +#define MNE_3DNOW_PFRSQRT (MNE_3DNOW_PFRCP + 6) + "pfrsqrt\0" +#define MNE_3DNOW_PFMUL (MNE_3DNOW_PFRSQRT + 8) + "pfmul\0" +#define MNE_3DNOW_PFRCPIT1 (MNE_3DNOW_PFMUL + 6) + "pfrcpit1\0" +#define MNE_3DNOW_PFRSQIT1 (MNE_3DNOW_PFRCPIT1 + 9) + "pfrsqit1\0" +#define MNE_3DNOW_PFRCPIT2 (MNE_3DNOW_PFRSQIT1 + 9) + "pfrcpit2\0" +#define MNE_3DNOW_PMULHRW (MNE_3DNOW_PFRCPIT2 + 9) + "pmulhrw"; + +#define AMD3DNOW_LOW_IDX 0x0d +#define AMD3DNOW_HIGH_IDX (sizeof (amd3dnow) + AMD3DNOW_LOW_IDX - 1) +#define AMD3DNOW_IDX(val) ((val) - AMD3DNOW_LOW_IDX) +static const unsigned char amd3dnow[] = + { + [AMD3DNOW_IDX (0xbf)] = MNE_3DNOW_PAVGUSB, + [AMD3DNOW_IDX (0x9e)] = MNE_3DNOW_PFADD, + [AMD3DNOW_IDX (0x9a)] = MNE_3DNOW_PFSUB, + [AMD3DNOW_IDX (0xaa)] = MNE_3DNOW_PFSUBR, + [AMD3DNOW_IDX (0xae)] = MNE_3DNOW_PFACC, + [AMD3DNOW_IDX (0x90)] = MNE_3DNOW_PFCMPGE, + [AMD3DNOW_IDX (0xa0)] = MNE_3DNOW_PFCMPGT, + [AMD3DNOW_IDX (0xb0)] = MNE_3DNOW_PFCMPEQ, + [AMD3DNOW_IDX (0x94)] = MNE_3DNOW_PFMIN, + [AMD3DNOW_IDX (0xa4)] = MNE_3DNOW_PFMAX, + [AMD3DNOW_IDX (0x0d)] = MNE_3DNOW_PI2FD, + [AMD3DNOW_IDX (0x1d)] = MNE_3DNOW_PF2ID, + [AMD3DNOW_IDX (0x96)] = MNE_3DNOW_PFRCP, + [AMD3DNOW_IDX (0x97)] = MNE_3DNOW_PFRSQRT, + [AMD3DNOW_IDX (0xb4)] = MNE_3DNOW_PFMUL, + [AMD3DNOW_IDX (0xa6)] = MNE_3DNOW_PFRCPIT1, + [AMD3DNOW_IDX (0xa7)] = MNE_3DNOW_PFRSQIT1, + [AMD3DNOW_IDX (0xb6)] = MNE_3DNOW_PFRCPIT2, + [AMD3DNOW_IDX (0xb7)] = MNE_3DNOW_PMULHRW + }; + + struct output_data { GElf_Addr addr; @@ -289,6 +356,9 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, prefixes |= ((*data++) & 0xf) | has_rex; #endif + bufcnt = 0; + size_t cnt = 0; + const uint8_t *curr = match_data; const uint8_t *const match_end = match_data + sizeof (match_data); @@ -302,79 +372,61 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, goto do_ret; } - if (0) - { - /* Resize the buffer. */ - char *oldbuf; - enomem: - oldbuf = buf; - if (buf == initbuf) - buf = malloc (2 * bufsize); - else - buf = realloc (buf, 2 * bufsize); - if (buf == NULL) - { - buf = oldbuf; - retval = ENOMEM; - goto do_ret; - } - bufsize *= 2; - - output_data.bufp = buf; - output_data.bufsize = bufsize; - } - bufcnt = 0; - - size_t cnt = 0; + next_match: while (curr < match_end) { - const uint8_t *start = curr; - uint_fast8_t len = *curr++; + uint_fast8_t clen = len >> 4; + len &= 0xf; + const uint8_t *next_curr = curr + clen + (len - clen) * 2; assert (len > 0); - assert (curr + 2 * len + 2 <= match_end); + assert (curr + clen + 2 * (len - clen) <= match_end); const uint8_t *codep = data; - size_t avail = len; int correct_prefix = 0; int opoff = 0; - if (data > begin && codep[-1] == curr[1] && curr[0] == 0xff) + if (data > begin && codep[-1] == *curr && clen > 0) { /* We match a prefix byte. This is exactly one byte and is matched exactly, without a mask. */ - --avail; - --len; - start += 2; + --clen; opoff = 8; - curr += 2; - assert (avail > 0); + ++curr; assert (last_prefix_bit != 0); correct_prefix = last_prefix_bit; } - do + size_t avail = len; + while (clen > 0) { - uint_fast8_t masked = *codep++ & *curr++; - if (masked != *curr++) - break; - + if (*codep++ != *curr++) + goto not; --avail; + --clen; if (codep == end && avail > 0) goto do_ret; } - while (avail > 0); - if (avail != 0) + while (avail > 0) { - not: - curr = start + 1 + 2 * len + 2; - ++cnt; - continue; + uint_fast8_t masked = *codep++ & *curr++; + if (masked != *curr++) + { + not: + curr = next_curr; + ++cnt; + bufcnt = 0; + goto next_match; + } + + --avail; + if (codep == end && avail > 0) + goto do_ret; } if (len > end - data) @@ -387,6 +439,41 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, || (prefixes & correct_prefix) != 0); prefixes ^= correct_prefix; + if (0) + { + /* Resize the buffer. */ + char *oldbuf; + enomem: + oldbuf = buf; + if (buf == initbuf) + buf = malloc (2 * bufsize); + else + buf = realloc (buf, 2 * bufsize); + if (buf == NULL) + { + buf = oldbuf; + retval = ENOMEM; + goto do_ret; + } + bufsize *= 2; + + output_data.bufp = buf; + output_data.bufsize = bufsize; + bufcnt = 0; + + if (data == end) + { + assert (prefixes != 0); + goto print_prefix; + } + + /* gcc is not clever enough to see the following variables + are not used uninitialized. */ + asm ("" + : "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep), + "=mr" (next_curr), "=mr" (len)); + } + size_t prefix_size = 0; // XXXonly print as prefix if valid? @@ -460,6 +547,23 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, case prefix_lock: ADD_STRING ("lock"); break; +#ifdef X86_64 + case 0x40 ... 0x4f: + ADD_STRING ("rex"); + if (byte != 0x40) + { + ADD_CHAR ('.'); + if (byte & 0x8) + ADD_CHAR ('w'); + if (byte & 0x4) + ADD_CHAR ('r'); + if (byte & 0x3) + ADD_CHAR ('x'); + if (byte & 0x1) + ADD_CHAR ('b'); + } + break; +#endif default: /* Cannot happen. */ puts ("unknown prefix"); @@ -625,6 +729,24 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, break; case 0x0f: + if (data[1] == 0x0f) + { + /* AMD 3DNOW. We need one more byte. */ + if (param_start >= end) + goto not; + if (*param_start < AMD3DNOW_LOW_IDX + || *param_start > AMD3DNOW_HIGH_IDX) + goto not; + unsigned int idx + = amd3dnow[AMD3DNOW_IDX (*param_start)]; + if (idx == 0) + goto not; + str = amd3dnowstr + idx - 1; + /* Eat the immediate byte indicating the + operation. */ + ++param_start; + break; + } #ifdef X86_64 if (data[1] == 0xc7) { @@ -765,7 +887,8 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, { /* First parameter. */ if (instrtab[cnt].str1 != 0) - ADD_STRING (op1_str[instrtab[cnt].str1]); + ADD_STRING (op1_str + + op1_str_idx[instrtab[cnt].str1 - 1]); output_data.opoff1 = (instrtab[cnt].off1_1 + OFF1_1_BIAS - opoff); @@ -785,7 +908,8 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, { /* Second parameter. */ if (instrtab[cnt].str2 != 0) - ADD_STRING (op2_str[instrtab[cnt].str2]); + ADD_STRING (op2_str + + op2_str_idx[instrtab[cnt].str2 - 1]); output_data.opoff1 = (instrtab[cnt].off2_1 + OFF2_1_BIAS - opoff); @@ -805,7 +929,8 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, { /* Third parameter. */ if (instrtab[cnt].str3 != 0) - ADD_STRING (op3_str[instrtab[cnt].str3]); + ADD_STRING (op3_str + + op3_str_idx[instrtab[cnt].str3 - 1]); output_data.opoff1 = (instrtab[cnt].off3_1 + OFF3_1_BIAS - opoff); @@ -872,8 +997,7 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, r = snprintf (&buf[bufcnt], bufavail, "# %#" PRIx64, (uint64_t) symaddr); - if (r < 0) - goto not; + assert (r >= 0); if ((size_t) r >= bufavail) goto enomem; bufcnt += r; diff --git a/elfutils/libcpu/i386_parse.c b/elfutils/libcpu/i386_parse.c index c6d955de..31cda742 100644 --- a/elfutils/libcpu/i386_parse.c +++ b/elfutils/libcpu/i386_parse.c @@ -105,7 +105,7 @@ #line 1 "i386_parse.y" /* Parser for i386 CPU description. - Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. + Copyright (C) 2004, 2005, 2007, 2008, 2009 Red Hat, Inc. Written by Ulrich Drepper , 2004. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -142,6 +142,7 @@ #include #include #include +#include #include #include #include @@ -250,6 +251,7 @@ struct argstring { char *str; int idx; + int off; }; @@ -334,7 +336,7 @@ static size_t best_mnemonic_bits; #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 212 "i386_parse.y" +#line 214 "i386_parse.y" { unsigned long int num; char *str; @@ -345,7 +347,7 @@ typedef union YYSTYPE struct argument *arg; } /* Line 187 of yacc.c. */ -#line 349 "i386_parse.c" +#line 351 "i386_parse.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -358,7 +360,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 362 "i386_parse.c" +#line 364 "i386_parse.c" #ifdef short # undef short @@ -651,10 +653,10 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 242, 242, 252, 253, 256, 258, 260, 262, 274, - 277, 278, 281, 364, 367, 383, 386, 396, 403, 411, - 415, 422, 429, 451, 454, 457, 467, 475, 483, 486, - 518, 527, 534 + 0, 244, 244, 254, 255, 258, 260, 262, 264, 276, + 279, 280, 283, 366, 369, 385, 388, 398, 405, 413, + 417, 424, 431, 453, 456, 459, 469, 477, 485, 488, + 520, 529, 536 }; #endif @@ -1581,7 +1583,7 @@ yyreduce: switch (yyn) { case 2: -#line 243 "i386_parse.y" +#line 245 "i386_parse.y" { if (error_message_count != 0) error (EXIT_FAILURE, 0, @@ -1592,22 +1594,22 @@ yyreduce: break; case 5: -#line 257 "i386_parse.y" +#line 259 "i386_parse.y" { new_bitfield ((yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].num)); } break; case 6: -#line 259 "i386_parse.y" +#line 261 "i386_parse.y" { new_bitfield ((yyvsp[(2) - (2)].str), -1); } break; case 7: -#line 261 "i386_parse.y" +#line 263 "i386_parse.y" { new_bitfield ((yyvsp[(2) - (2)].str), -2); } break; case 8: -#line 263 "i386_parse.y" +#line 265 "i386_parse.y" { struct synonym *newp = xmalloc (sizeof (*newp)); newp->from = (yyvsp[(2) - (3)].str); @@ -1622,7 +1624,7 @@ yyreduce: break; case 12: -#line 282 "i386_parse.y" +#line 284 "i386_parse.y" { if ((yyvsp[(3) - (6)].field) != NULL && strcmp ((yyvsp[(3) - (6)].field)->name, "RE") != 0 && strcmp ((yyvsp[(3) - (6)].field)->name, "R") != 0) @@ -1708,7 +1710,7 @@ yyreduce: break; case 14: -#line 368 "i386_parse.y" +#line 370 "i386_parse.y" { struct known_bitfield search; search.name = (yyvsp[(1) - (1)].str); @@ -1726,12 +1728,12 @@ yyreduce: break; case 15: -#line 383 "i386_parse.y" +#line 385 "i386_parse.y" { (yyval.field) = NULL; } break; case 16: -#line 387 "i386_parse.y" +#line 389 "i386_parse.y" { check_bits ((yyvsp[(3) - (3)].bit)); @@ -1744,7 +1746,7 @@ yyreduce: break; case 17: -#line 397 "i386_parse.y" +#line 399 "i386_parse.y" { check_bits ((yyvsp[(1) - (1)].bit)); (yyval.bit) = (yyvsp[(1) - (1)].bit); @@ -1752,7 +1754,7 @@ yyreduce: break; case 18: -#line 404 "i386_parse.y" +#line 406 "i386_parse.y" { struct bitvalue *runp = (yyvsp[(1) - (2)].bit); while (runp->next != NULL) @@ -1763,12 +1765,12 @@ yyreduce: break; case 19: -#line 412 "i386_parse.y" +#line 414 "i386_parse.y" { (yyval.bit) = (yyvsp[(1) - (1)].bit); } break; case 20: -#line 416 "i386_parse.y" +#line 418 "i386_parse.y" { (yyval.bit) = xmalloc (sizeof (struct bitvalue)); (yyval.bit)->type = zeroone; @@ -1778,7 +1780,7 @@ yyreduce: break; case 21: -#line 423 "i386_parse.y" +#line 425 "i386_parse.y" { (yyval.bit) = xmalloc (sizeof (struct bitvalue)); (yyval.bit)->type = zeroone; @@ -1788,7 +1790,7 @@ yyreduce: break; case 22: -#line 430 "i386_parse.y" +#line 432 "i386_parse.y" { (yyval.bit) = xmalloc (sizeof (struct bitvalue)); struct known_bitfield search; @@ -1811,17 +1813,17 @@ yyreduce: break; case 23: -#line 452 "i386_parse.y" +#line 454 "i386_parse.y" { (yyval.arg) = (yyvsp[(2) - (2)].arg); } break; case 24: -#line 454 "i386_parse.y" +#line 456 "i386_parse.y" { (yyval.arg) = NULL; } break; case 25: -#line 458 "i386_parse.y" +#line 460 "i386_parse.y" { struct argument *runp = (yyvsp[(1) - (3)].arg); while (runp->next != NULL) @@ -1834,7 +1836,7 @@ yyreduce: break; case 26: -#line 468 "i386_parse.y" +#line 470 "i386_parse.y" { (yyval.arg) = xmalloc (sizeof (struct argument)); (yyval.arg)->name = combine ((yyvsp[(1) - (1)].name)); @@ -1843,7 +1845,7 @@ yyreduce: break; case 27: -#line 476 "i386_parse.y" +#line 478 "i386_parse.y" { struct argname *runp = (yyvsp[(1) - (2)].name); while (runp->next != NULL) @@ -1854,12 +1856,12 @@ yyreduce: break; case 28: -#line 484 "i386_parse.y" +#line 486 "i386_parse.y" { (yyval.name) = (yyvsp[(1) - (1)].name); } break; case 29: -#line 487 "i386_parse.y" +#line 489 "i386_parse.y" { (yyval.name) = xmalloc (sizeof (struct argname)); (yyval.name)->type = nfield; @@ -1894,7 +1896,7 @@ yyreduce: break; case 30: -#line 519 "i386_parse.y" +#line 521 "i386_parse.y" { (yyval.name) = xmalloc (sizeof (struct argname)); (yyval.name)->type = string; @@ -1906,7 +1908,7 @@ yyreduce: break; case 31: -#line 528 "i386_parse.y" +#line 530 "i386_parse.y" { (yyval.name) = xmalloc (sizeof (struct argname)); (yyval.name)->type = string; @@ -1916,7 +1918,7 @@ yyreduce: break; case 32: -#line 535 "i386_parse.y" +#line 537 "i386_parse.y" { (yyval.name) = xmalloc (sizeof (struct argname)); (yyval.name)->type = string; @@ -1929,7 +1931,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 1933 "i386_parse.c" +#line 1935 "i386_parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2143,7 +2145,7 @@ yyreturn: } -#line 545 "i386_parse.y" +#line 547 "i386_parse.y" static void @@ -2668,18 +2670,32 @@ compare_suf (const void *p1, const void *p2) static int count_op_str; +static int off_op_str; static void print_op_str (const void *nodep, VISIT value, int level __attribute__ ((unused))) { if (value == leaf || value == postorder) { - fprintf (outfile, " \"%s\",\n", (*(struct argstring **) nodep)->str); + const char *str = (*(struct argstring **) nodep)->str; + fprintf (outfile, "%s\n \"%s", + count_op_str == 0 ? "" : "\\0\"", str); (*(struct argstring **) nodep)->idx = ++count_op_str; + (*(struct argstring **) nodep)->off = off_op_str; + off_op_str += strlen (str) + 1; } } +static void +print_op_str_idx (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + printf (" %d,\n", (*(struct argstring **) nodep)->off); +} + + static void print_op_fct (const void *nodep, VISIT value, int level __attribute__ ((unused))) @@ -2751,7 +2767,8 @@ instrtable_out (void) { /* Functions. */ count_op_str = 0; - fprintf (outfile, "static opfct_t op%d_fct[] =\n{\n NULL,\n", i + 1); + fprintf (outfile, "static const opfct_t op%d_fct[] =\n{\n NULL,\n", + i + 1); twalk (fct_names[i], print_op_fct); fputs ("};\n", outfile); @@ -2759,9 +2776,14 @@ instrtable_out (void) if (nbitstr[i] != 0) { count_op_str = 0; - fprintf (outfile, "static const char *op%d_str[] =\n{\n NULL,\n", - i + 1); + off_op_str = 0; + fprintf (outfile, "static const char op%d_str[] =", i + 1); twalk (strs[i], print_op_str); + fputs ("\";\n", outfile); + + fprintf (outfile, "static const uint8_t op%d_str_idx[] = {\n", + i + 1); + twalk (strs[i], print_op_str_idx); fputs ("};\n", outfile); } } @@ -2829,6 +2851,8 @@ instrtable_out (void) /* First count the number of bytes. */ size_t totalbits = 0; size_t zerobits = 0; + bool leading_p = true; + size_t leadingbits = 0; struct bitvalue *b = instr->bytes; while (b != NULL) { @@ -2836,6 +2860,8 @@ instrtable_out (void) { ++totalbits; zerobits = 0; + if (leading_p) + ++leadingbits; } else { @@ -2845,13 +2871,15 @@ instrtable_out (void) zerobits = 0; else zerobits += b->field->bits; + leading_p = false; } b = b->next; } size_t nbytes = (totalbits - zerobits + 7) / 8; assert (nbytes > 0); + size_t leadingbytes = leadingbits / 8; - fprintf (outfile, " %#zx,", nbytes); + fprintf (outfile, " %#zx,", nbytes | (leadingbytes << 4)); /* Now create the mask and byte values. */ uint8_t byte = 0; @@ -2866,7 +2894,15 @@ instrtable_out (void) mask = (mask << 1) | 1; if (++nbits == 8) { - fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", mask, byte); + if (leadingbytes > 0) + { + assert (mask == 0xff); + fprintf (outfile, " %#" PRIx8 ",", byte); + --leadingbytes; + } + else + fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", + mask, byte); byte = mask = nbits = 0; if (--nbytes == 0) break; @@ -2874,6 +2910,8 @@ instrtable_out (void) } else { + assert (leadingbytes == 0); + unsigned long int remaining = b->field->bits; while (nbits + remaining > 8) { @@ -2898,7 +2936,7 @@ instrtable_out (void) b = b->next; } - fprintf (outfile, " %#zx, %#zx,\n", cnt & 0xff, cnt >> 8); + fputc_unlocked ('\n', outfile); } fputs ("};\n", outfile); } diff --git a/elfutils/libcpu/i386_parse.h b/elfutils/libcpu/i386_parse.h index 16f962da..b09bec4c 100644 --- a/elfutils/libcpu/i386_parse.h +++ b/elfutils/libcpu/i386_parse.h @@ -68,7 +68,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 212 "i386_parse.y" +#line 214 "i386_parse.y" { unsigned long int num; char *str; diff --git a/elfutils/libcpu/i386_parse.y b/elfutils/libcpu/i386_parse.y index ceeb12ad..bea0e335 100644 --- a/elfutils/libcpu/i386_parse.y +++ b/elfutils/libcpu/i386_parse.y @@ -1,6 +1,6 @@ %{ /* Parser for i386 CPU description. - Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. + Copyright (C) 2004, 2005, 2007, 2008, 2009 Red Hat, Inc. Written by Ulrich Drepper , 2004. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -145,6 +146,7 @@ struct argstring { char *str; int idx; + int off; }; @@ -1066,18 +1068,32 @@ compare_suf (const void *p1, const void *p2) static int count_op_str; +static int off_op_str; static void print_op_str (const void *nodep, VISIT value, int level __attribute__ ((unused))) { if (value == leaf || value == postorder) { - fprintf (outfile, " \"%s\",\n", (*(struct argstring **) nodep)->str); + const char *str = (*(struct argstring **) nodep)->str; + fprintf (outfile, "%s\n \"%s", + count_op_str == 0 ? "" : "\\0\"", str); (*(struct argstring **) nodep)->idx = ++count_op_str; + (*(struct argstring **) nodep)->off = off_op_str; + off_op_str += strlen (str) + 1; } } +static void +print_op_str_idx (const void *nodep, VISIT value, + int level __attribute__ ((unused))) +{ + if (value == leaf || value == postorder) + printf (" %d,\n", (*(struct argstring **) nodep)->off); +} + + static void print_op_fct (const void *nodep, VISIT value, int level __attribute__ ((unused))) @@ -1149,7 +1165,8 @@ instrtable_out (void) { /* Functions. */ count_op_str = 0; - fprintf (outfile, "static opfct_t op%d_fct[] =\n{\n NULL,\n", i + 1); + fprintf (outfile, "static const opfct_t op%d_fct[] =\n{\n NULL,\n", + i + 1); twalk (fct_names[i], print_op_fct); fputs ("};\n", outfile); @@ -1157,9 +1174,14 @@ instrtable_out (void) if (nbitstr[i] != 0) { count_op_str = 0; - fprintf (outfile, "static const char *op%d_str[] =\n{\n NULL,\n", - i + 1); + off_op_str = 0; + fprintf (outfile, "static const char op%d_str[] =", i + 1); twalk (strs[i], print_op_str); + fputs ("\";\n", outfile); + + fprintf (outfile, "static const uint8_t op%d_str_idx[] = {\n", + i + 1); + twalk (strs[i], print_op_str_idx); fputs ("};\n", outfile); } } @@ -1227,6 +1249,8 @@ instrtable_out (void) /* First count the number of bytes. */ size_t totalbits = 0; size_t zerobits = 0; + bool leading_p = true; + size_t leadingbits = 0; struct bitvalue *b = instr->bytes; while (b != NULL) { @@ -1234,6 +1258,8 @@ instrtable_out (void) { ++totalbits; zerobits = 0; + if (leading_p) + ++leadingbits; } else { @@ -1243,13 +1269,15 @@ instrtable_out (void) zerobits = 0; else zerobits += b->field->bits; + leading_p = false; } b = b->next; } size_t nbytes = (totalbits - zerobits + 7) / 8; assert (nbytes > 0); + size_t leadingbytes = leadingbits / 8; - fprintf (outfile, " %#zx,", nbytes); + fprintf (outfile, " %#zx,", nbytes | (leadingbytes << 4)); /* Now create the mask and byte values. */ uint8_t byte = 0; @@ -1264,7 +1292,15 @@ instrtable_out (void) mask = (mask << 1) | 1; if (++nbits == 8) { - fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", mask, byte); + if (leadingbytes > 0) + { + assert (mask == 0xff); + fprintf (outfile, " %#" PRIx8 ",", byte); + --leadingbytes; + } + else + fprintf (outfile, " %#" PRIx8 ", %#" PRIx8 ",", + mask, byte); byte = mask = nbits = 0; if (--nbytes == 0) break; @@ -1272,6 +1308,8 @@ instrtable_out (void) } else { + assert (leadingbytes == 0); + unsigned long int remaining = b->field->bits; while (nbits + remaining > 8) { @@ -1296,7 +1334,7 @@ instrtable_out (void) b = b->next; } - fprintf (outfile, " %#zx, %#zx,\n", cnt & 0xff, cnt >> 8); + fputc_unlocked ('\n', outfile); } fputs ("};\n", outfile); } diff --git a/elfutils/libdw/ChangeLog b/elfutils/libdw/ChangeLog index 235fac01..93a59673 100644 --- a/elfutils/libdw/ChangeLog +++ b/elfutils/libdw/ChangeLog @@ -1,3 +1,79 @@ +2009-04-15 Roland McGrath + + * dwarf.h (DW_CIE_ID): Removed. + (DW_CIE_ID_32, DW_CIE_ID_64): New constants replace it. + +2009-04-01 Roland McGrath + + * dwarf.h: Add DW_CFA_GNU_negative_offset_extended. + +2009-01-28 Roland McGrath + + * libdwP.h (struct Dwarf_Line_s): Move out of struct Dwarf_Lines_s + defn so C++ doesn't scope the name to not match the Dwarf_Line typedef. + + * libdwP.h (struct Dwarf_Files_s): Replace dbg field with cu field. + +2009-01-26 Roland McGrath + + * dwarf_ranges.c: Return 0 when no ranges or *_pc attrs at all. + +2009-01-25 Roland McGrath + + * dwarf_getattrs.c: Correctly skip attribute values when restarting. + +2009-01-23 Roland McGrath + + * Makefile.am ($(srcdir)/known-dwarf.h): Target renamed back. + Put these rules under if MAINTAINER_MODE. + +2009-01-22 Roland McGrath + + * dwarf.h: Add DW_OP_GNU_encoded_addr. + +2009-01-21 Roland McGrath + + * Makefile.am (CLEANFILES): Renamed to ... + (MOSTLYCLEANFILES): ... here. + (CLEANFILES): New variable, add known-dwarf.h. + +2009-01-17 Roland McGrath + + * Makefile.am (known-dwarf.h): Target renamed, not in $(srcdir). + Make it unconditional. + (BUILT_SOURCES): Updated. + + * dwarf.h: Add description comments for DW_LANG_* values. + + * Makefile.am [MAINTAINER_MODE] + ($(srcdir)/known-dwarf.h): New target. + (BUILT_SOURCES): Add it. + + * dwarf.h: Add DW_OP_GNU_push_tls_address, DW_OP_GNU_uninit. + +2009-01-10 Ulrich Drepper + + * dwarf_error.c: Always use __thread. Remove all !USE_TLS code. + +2009-01-08 Roland McGrath + + * Makefile.am (libdw.so): Don't depend on $(zip_LIBS), just link it in. + +2008-01-06 Roland McGrath + + * libdwP.h (struct Dwarf_Abbrev): Change type of 'has_children' to bool. + Reorder members. + * dwarf_haschildren.c: Return -1 for error case, not 0. + + * Makefile.am (libdw.so): Link in $(zip_LIBS). + +2009-01-06 Ulrich Drepper + + * dwarf.h: Add definition for unwind and call frame information. + + * memory-access.h: Define read_ubyte_unaligned, read_sbyte_unaligned, + read_ubyte_unaligned_inc, and read_sbyte_unaligned_inc. + 2008-08-15 Roland McGrath * libdw.map (ELFUTILS_0.136): New version set, inherits from diff --git a/elfutils/libdw/Makefile.am b/elfutils/libdw/Makefile.am index 69ce526c..e624ac10 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, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. +## Copyright (C) 2002-2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -85,6 +85,14 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ libdw_visit_scopes.c \ dwarf_entry_breakpoints.c +if MAINTAINER_MODE +BUILT_SOURCES = $(srcdir)/known-dwarf.h +MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h +$(srcdir)/known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h + $(AWK) -f $^ > $@.new + mv -f $@.new $@ +endif + if !MUDFLAP libdw_pic_a_SOURCES = am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) @@ -99,7 +107,7 @@ libdw.so: $(srcdir)/libdw.map libdw_pic.a \ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \ -Wl,--version-script,$<,--no-undefined \ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\ - -ldl + -ldl $(zip_LIBS) if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi ln -fs $@ $@.$(VERSION) @@ -130,4 +138,4 @@ noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h EXTRA_DIST = libdw.map -CLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda libdw.so.$(VERSION) +MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda libdw.so.$(VERSION) diff --git a/elfutils/libdw/Makefile.in b/elfutils/libdw/Makefile.in index ae82b446..690b2eec 100644 --- a/elfutils/libdw/Makefile.in +++ b/elfutils/libdw/Makefile.in @@ -43,7 +43,8 @@ DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -219,6 +220,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -247,6 +249,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Werror -Wshadow \ @MUDFLAP_FALSE@ -Wunused -Wformat=2 -Wextra -std=gnu99 @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap $(am__append_1) -Wall -Werror \ @@ -295,14 +298,17 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \ libdw_visit_scopes.c \ dwarf_entry_breakpoints.c +@MAINTAINER_MODE_TRUE@BUILT_SOURCES = $(srcdir)/known-dwarf.h +@MAINTAINER_MODE_TRUE@MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h @MUDFLAP_FALSE@libdw_pic_a_SOURCES = @MUDFLAP_FALSE@am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) @MUDFLAP_FALSE@libdw_so_SOURCES = libdw_a_LIBADD = $(addprefix ../libdwfl/,$(shell $(AR) t ../libdwfl/libdwfl.a)) noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h EXTRA_DIST = libdw.map -CLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda libdw.so.$(VERSION) -all: all-am +MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda libdw.so.$(VERSION) +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .o .obj @@ -602,13 +608,15 @@ distdir: $(DISTFILES) fi; \ done check-am: all-am -check: check-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done -@MUDFLAP_TRUE@install: install-am +@MUDFLAP_TRUE@install: $(BUILT_SOURCES) +@MUDFLAP_TRUE@ $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am @MUDFLAP_TRUE@uninstall: uninstall-am @@ -623,9 +631,9 @@ install-strip: `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -633,6 +641,8 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \ @@ -709,6 +719,9 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES \ ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS \ uninstall-libLIBRARIES uninstall-pkgincludeHEADERS +@MAINTAINER_MODE_TRUE@$(srcdir)/known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h +@MAINTAINER_MODE_TRUE@ $(AWK) -f $^ > $@.new +@MAINTAINER_MODE_TRUE@ mv -f $@.new $@ @MUDFLAP_FALSE@libdw.so: $(srcdir)/libdw.map libdw_pic.a \ @MUDFLAP_FALSE@ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \ @MUDFLAP_FALSE@ ../libelf/libelf.so @@ -718,7 +731,7 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES \ @MUDFLAP_FALSE@ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \ @MUDFLAP_FALSE@ -Wl,--version-script,$<,--no-undefined \ @MUDFLAP_FALSE@ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\ -@MUDFLAP_FALSE@ -ldl +@MUDFLAP_FALSE@ -ldl $(zip_LIBS) @MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi @MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION) diff --git a/elfutils/libdw/dwarf.h b/elfutils/libdw/dwarf.h index f1261c36..0546e3eb 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 Red Hat, Inc. + Copyright (C) 2000,2002,2005,2006,2007,2008,2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -432,6 +432,11 @@ enum DW_OP_call_frame_cfa = 0x9c,/* CFA as determined by CFI. */ DW_OP_bit_piece = 0x9d, /* ULEB128 size and ULEB128 offset in bits. */ + /* GNU extensions. */ + DW_OP_GNU_push_tls_address = 0xe0, + DW_OP_GNU_uninit = 0xf0, + DW_OP_GNU_encoded_addr = 0xf1, + DW_OP_lo_user = 0xe0, /* Implementation-defined range start. */ DW_OP_hi_user = 0xff /* Implementation-defined range end. */ }; @@ -515,25 +520,25 @@ enum /* DWARF language encodings. */ enum { - DW_LANG_C89 = 0x0001, - DW_LANG_C = 0x0002, - DW_LANG_Ada83 = 0x0003, - DW_LANG_C_plus_plus = 0x0004, - DW_LANG_Cobol74 = 0x0005, - DW_LANG_Cobol85 = 0x0006, - DW_LANG_Fortran77 = 0x0007, - DW_LANG_Fortran90 = 0x0008, - DW_LANG_Pascal83 = 0x0009, - DW_LANG_Modula2 = 0x000a, - DW_LANG_Java = 0x000b, - DW_LANG_C99 = 0x000c, - DW_LANG_Ada95 = 0x000d, - DW_LANG_Fortran95 = 0x000e, - DW_LANG_PL1 = 0x000f, - DW_LANG_Objc = 0x0010, - DW_LANG_ObjC_plus_plus = 0x0011, - DW_LANG_UPC = 0x0012, - DW_LANG_D = 0x0013, + DW_LANG_C89 = 0x0001, /* ISO C:1989 */ + DW_LANG_C = 0x0002, /* C */ + DW_LANG_Ada83 = 0x0003, /* ISO Ada:1983 */ + DW_LANG_C_plus_plus = 0x0004, /* ISO C++:1998 */ + DW_LANG_Cobol74 = 0x0005, /* ISO Cobol:1974 */ + DW_LANG_Cobol85 = 0x0006, /* ISO Cobol:1985 */ + DW_LANG_Fortran77 = 0x0007, /* ISO FORTRAN 77 */ + DW_LANG_Fortran90 = 0x0008, /* ISO Fortran 90 */ + DW_LANG_Pascal83 = 0x0009, /* ISO Pascal:1983 */ + DW_LANG_Modula2 = 0x000a, /* ISO Modula-2:1996 */ + DW_LANG_Java = 0x000b, /* Java */ + DW_LANG_C99 = 0x000c, /* ISO C:1999 */ + DW_LANG_Ada95 = 0x000d, /* ISO Ada:1995 */ + DW_LANG_Fortran95 = 0x000e, /* ISO Fortran 95 */ + DW_LANG_PL1 = 0x000f, /* ISO PL/1:1976 */ + DW_LANG_Objc = 0x0010, /* Objective-C */ + DW_LANG_ObjC_plus_plus = 0x0011, /* Objective-C++ */ + DW_LANG_UPC = 0x0012, /* Unified Parallel C */ + DW_LANG_D = 0x0013, /* D */ DW_LANG_lo_user = 0x8000, DW_LANG_Mips_Assembler = 0x8001, @@ -665,9 +670,45 @@ enum DW_CFA_MIPS_advance_loc8 = 0x1d, DW_CFA_GNU_window_save = 0x2d, DW_CFA_GNU_args_size = 0x2e, + DW_CFA_GNU_negative_offset_extended = 0x2f, DW_CFA_high_user = 0x3f }; +/* ID indicating CIE as opposed to FDE in .debug_frame. */ +enum + { + DW_CIE_ID_32 = 0xffffffffU, /* In 32-bit format CIE header. */ + DW_CIE_ID_64 = 0xffffffffffffffffULL /* In 64-bit format CIE header. */ + }; + + +/* Information for GNU unwind information. */ +enum + { + DW_EH_PE_absptr = 0x00, + DW_EH_PE_omit = 0xff, + + /* FDE data encoding. */ + DW_EH_PE_uleb128 = 0x01, + DW_EH_PE_udata2 = 0x02, + DW_EH_PE_udata4 = 0x03, + DW_EH_PE_udata8 = 0x04, + DW_EH_PE_sleb128 = 0x09, + DW_EH_PE_sdata2 = 0x0a, + DW_EH_PE_sdata4 = 0x0b, + DW_EH_PE_sdata8 = 0x0c, + DW_EH_PE_signed = 0x08, + + /* FDE flags. */ + DW_EH_PE_pcrel = 0x10, + DW_EH_PE_textrel = 0x20, + DW_EH_PE_datarel = 0x30, + DW_EH_PE_funcrel = 0x40, + DW_EH_PE_aligned = 0x50, + + DW_EH_PE_indirect = 0x80 + }; + /* DWARF XXX. */ #define DW_ADDR_none 0 diff --git a/elfutils/libdw/dwarf_error.c b/elfutils/libdw/dwarf_error.c index fe916641..86ff8213 100644 --- a/elfutils/libdw/dwarf_error.c +++ b/elfutils/libdw/dwarf_error.c @@ -1,5 +1,5 @@ /* Retrieve ELF descriptor used for DWARF access. - Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2002. @@ -58,46 +58,14 @@ #include "libdwP.h" -#ifdef USE_TLS /* The error number. */ static __thread int global_error; -#else -/* This is the key for the thread specific memory. */ -static tls_key_t key; - -/* The error number. Used in non-threaded programs. */ -static int global_error; -static bool threaded; -/* We need to initialize the thread-specific data. */ -once_define (static, once); - -/* The initialization and destruction functions. */ -static void init (void); -static void free_key_mem (void *mem); -#endif /* TLS */ int dwarf_errno (void) { - int result; - -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - { - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - result = (intptr_t) getspecific (key); - - setspecific (key, (void *) (intptr_t) DWARF_E_NOERROR); - return result; - } -#endif /* TLS */ - - result = global_error; + int result = global_error; global_error = DWARF_E_NOERROR; return result; } @@ -151,16 +119,6 @@ void __libdw_seterrno (value) int value; { -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - setspecific (key, (void *) (intptr_t) value); -#endif /* TLS */ - global_error = (value >= 0 && value < (int) nerrmsgs ? value : DWARF_E_UNKNOWN_ERROR); } @@ -170,19 +128,7 @@ const char * dwarf_errmsg (error) int error; { - int last_error; - -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if ((error == 0 || error == -1) && threaded) - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - last_error = (intptr_t) getspecific (key); - else -#endif /* TLS */ - last_error = global_error; + int last_error = global_error; if (error == 0) return last_error != 0 ? _(errmsgs[last_error]) : NULL; @@ -192,26 +138,3 @@ dwarf_errmsg (error) return _(errmsgs[error == -1 ? last_error : error]); } INTDEF(dwarf_errmsg) - - -#ifndef USE_TLS -/* Free the thread specific data, this is done if a thread terminates. */ -static void -free_key_mem (void *mem __attribute__ ((unused))) -{ - setspecific (key, NULL); -} - - -/* Initialize the key for the global variable. */ -static void -init (void) -{ - // XXX Screw you, gcc4, the unused function attribute does not work. - __asm ("" :: "r" (free_key_mem)); - - if (key_create (&key, free_key_mem) == 0) - /* Creating the key succeeded. */ - threaded = true; -} -#endif /* TLS */ diff --git a/elfutils/libdw/dwarf_getattrs.c b/elfutils/libdw/dwarf_getattrs.c index 42f25ca0..051dc25f 100644 --- a/elfutils/libdw/dwarf_getattrs.c +++ b/elfutils/libdw/dwarf_getattrs.c @@ -1,5 +1,5 @@ /* Get attributes of the DIE. - Copyright (C) 2004, 2005, 2008 Red Hat, Inc. + Copyright (C) 2004, 2005, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2004. @@ -62,6 +62,9 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *), if (die == NULL) return -1l; + if (unlikely (offset == 1)) + return 1; + const unsigned char *die_addr = die->addr; /* Get the abbreviation code. */ @@ -80,7 +83,8 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *), } /* This is where the attributes start. */ - const unsigned char *attrp = die->abbrev->attrp + offset; + const unsigned char *attrp = die->abbrev->attrp; + const unsigned char *const offset_attrp = die->abbrev->attrp + offset; /* Go over the list of attributes. */ Dwarf *dbg = die->cu->dbg; @@ -108,16 +112,21 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *), offset of an attribute. */ return 1l; - /* Fill in the rest. */ - attr.valp = (unsigned char *) die_addr; - attr.cu = die->cu; - - /* Now call the callback function. */ - if (callback (&attr, arg) != DWARF_CB_OK) - /* Return the offset of the start of the attribute, so that - dwarf_getattrs() can be restarted from this point if the - caller so desires. */ - return remembered_attrp - die->abbrev->attrp; + /* If we are not to OFFSET_ATTRP yet, we just have to skip + the values of the intervening attributes. */ + if (remembered_attrp >= offset_attrp) + { + /* Fill in the rest. */ + attr.valp = (unsigned char *) die_addr; + attr.cu = die->cu; + + /* Now call the callback function. */ + if (callback (&attr, arg) != DWARF_CB_OK) + /* Return the offset of the start of the attribute, so that + dwarf_getattrs() can be restarted from this point if the + caller so desires. */ + return remembered_attrp - die->abbrev->attrp; + } /* Skip over the rest of this attribute (if there is any). */ if (attr.form != 0) diff --git a/elfutils/libdw/dwarf_getsrclines.c b/elfutils/libdw/dwarf_getsrclines.c index 9b3c97af..fe0e67d6 100644 --- a/elfutils/libdw/dwarf_getsrclines.c +++ b/elfutils/libdw/dwarf_getsrclines.c @@ -1,5 +1,5 @@ /* Return line number information of CU. - Copyright (C) 2004, 2005, 2007, 2008 Red Hat, Inc. + Copyright (C) 2004-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2004. @@ -634,8 +634,8 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) dirs[i] = dirarray[i]->dir; dirs[ndirlist] = NULL; - /* Remember the debugging descriptor. */ - files->dbg = dbg; + /* Remember the referring CU. */ + files->cu = cu; /* Make the file data structure available through the CU. */ cu->files = files; diff --git a/elfutils/libdw/dwarf_haschildren.c b/elfutils/libdw/dwarf_haschildren.c index fe431955..d9a47ad2 100644 --- a/elfutils/libdw/dwarf_haschildren.c +++ b/elfutils/libdw/dwarf_haschildren.c @@ -1,5 +1,5 @@ /* Return string associated with given attribute. - Copyright (C) 2003, 2005 Red Hat, Inc. + Copyright (C) 2003, 2005, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2003. @@ -77,7 +77,7 @@ dwarf_haschildren (die) if (unlikely (die->abbrev == DWARF_END_ABBREV)) { __libdw_seterrno (DWARF_E_INVALID_DWARF); - return 0; + return -1; } return die->abbrev->has_children; diff --git a/elfutils/libdw/dwarf_ranges.c b/elfutils/libdw/dwarf_ranges.c index 89da0af4..1eef617b 100644 --- a/elfutils/libdw/dwarf_ranges.c +++ b/elfutils/libdw/dwarf_ranges.c @@ -1,5 +1,5 @@ /* Enumerate the PC ranges covered by a DIE. - Copyright (C) 2005, 2007 Red Hat, Inc. + Copyright (C) 2005, 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -78,8 +78,9 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep, /* We have to look for a noncontiguous range. */ const Elf_Data *d = die->cu->dbg->sectiondata[IDX_debug_ranges]; - if (d == NULL) + if (d == NULL && offset != 0) { + no_ranges: __libdw_seterrno (DWARF_E_NO_DEBUG_RANGES); return -1; } @@ -90,13 +91,17 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep, Dwarf_Attribute *attr = INTUSE(dwarf_attr) (die, DW_AT_ranges, &attr_mem); if (attr == NULL) - return -1; + /* No PC attributes in this DIE at all, so an empty range list. */ + return 0; /* Must have the form data4 or data8 which act as an offset. */ Dwarf_Word start_offset; if (INTUSE(dwarf_formudata) (attr, &start_offset) != 0) return -1; + if (d == NULL) + goto no_ranges; + offset = start_offset; assert ((Dwarf_Word) offset == start_offset); diff --git a/elfutils/libdw/libdw.map b/elfutils/libdw/libdw.map index 8e2f6441..eb3abc28 100644 --- a/elfutils/libdw/libdw.map +++ b/elfutils/libdw/libdw.map @@ -185,3 +185,12 @@ ELFUTILS_0.136 { local: *; } ELFUTILS_0.130; + +ELFUTILS_0.138 { + global: + # Replaced ELFUTILS_0.130 version, which has bug-compatibility wrapper. + dwfl_module_build_id; + + local: + *; +} ELFUTILS_0.136; diff --git a/elfutils/libdw/libdwP.h b/elfutils/libdw/libdwP.h index f805295f..1d5a9b27 100644 --- a/elfutils/libdw/libdwP.h +++ b/elfutils/libdw/libdwP.h @@ -1,5 +1,5 @@ /* Internal definitions for libdwarf. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2002-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2002. @@ -194,12 +194,12 @@ struct Dwarf /* Abbreviation representation. */ struct Dwarf_Abbrev { + Dwarf_Off offset; + unsigned char *attrp; + unsigned int attrcnt; unsigned int code; unsigned int tag; - int has_children; - unsigned int attrcnt; - unsigned char *attrp; - Dwarf_Off offset; + bool has_children; }; #include "dwarf_abbrev_hash.h" @@ -208,7 +208,7 @@ struct Dwarf_Abbrev /* Files in line information records. */ struct Dwarf_Files_s { - Dwarf *dbg; + struct Dwarf_CU *cu; unsigned int ndirs; unsigned int nfiles; struct Dwarf_Fileinfo_s @@ -223,26 +223,27 @@ typedef struct Dwarf_Fileinfo_s Dwarf_Fileinfo; /* Representation of a row in the line table. */ -struct Dwarf_Lines_s - { - size_t nlines; - struct Dwarf_Line_s - { - Dwarf_Addr addr; - unsigned int file; - int line; - unsigned short int column; - unsigned int is_stmt:1; - unsigned int basic_block:1; - unsigned int end_sequence:1; - unsigned int prologue_end:1; - unsigned int epilogue_begin:1; - - Dwarf_Files *files; - } info[0]; - }; +struct Dwarf_Line_s +{ + Dwarf_Addr addr; + unsigned int file; + int line; + unsigned short int column; + unsigned int is_stmt:1; + unsigned int basic_block:1; + unsigned int end_sequence:1; + unsigned int prologue_end:1; + unsigned int epilogue_begin:1; + Dwarf_Files *files; +}; + +struct Dwarf_Lines_s +{ + size_t nlines; + struct Dwarf_Line_s info[0]; +}; /* Representation of address ranges. */ struct Dwarf_Aranges_s diff --git a/elfutils/libdw/memory-access.h b/elfutils/libdw/memory-access.h index 52b41b5b..74054f95 100644 --- a/elfutils/libdw/memory-access.h +++ b/elfutils/libdw/memory-access.h @@ -1,5 +1,5 @@ /* Unaligned memory access functionality. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2001. @@ -246,6 +246,17 @@ read_8sbyte_unaligned (Dwarf *dbg, const void *p) #endif /* allow unaligned */ +#define read_ubyte_unaligned(Nbytes, Dbg, Addr) \ + ((Nbytes) == 2 ? read_2ubyte_unaligned (Dbg, Addr) \ + : (Nbytes) == 4 ? read_4ubyte_unaligned (Dbg, Addr) \ + : read_8ubyte_unaligned (Dbg, Addr)) + +#define read_sbyte_unaligned(Nbytes, Dbg, Addr) \ + ((Nbytes) == 2 ? read_2sbyte_unaligned (Dbg, Addr) \ + : (Nbytes) == 4 ? read_4sbyte_unaligned (Dbg, Addr) \ + : read_8sbyte_unaligned (Dbg, Addr)) + + #define read_2ubyte_unaligned_inc(Dbg, Addr) \ ({ uint16_t t_ = read_2ubyte_unaligned (Dbg, Addr); \ Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 2); \ @@ -273,4 +284,15 @@ read_8sbyte_unaligned (Dwarf *dbg, const void *p) Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 8); \ t_; }) + +#define read_ubyte_unaligned_inc(Nbytes, Dbg, Addr) \ + ((Nbytes) == 2 ? read_2ubyte_unaligned_inc (Dbg, Addr) \ + : (Nbytes) == 4 ? read_4ubyte_unaligned_inc (Dbg, Addr) \ + : read_8ubyte_unaligned_inc (Dbg, Addr)) + +#define read_sbyte_unaligned_inc(Nbytes, Dbg, Addr) \ + ((Nbytes) == 2 ? read_2sbyte_unaligned_inc (Dbg, Addr) \ + : (Nbytes) == 4 ? read_4sbyte_unaligned_inc (Dbg, Addr) \ + : read_8sbyte_unaligned_inc (Dbg, Addr)) + #endif /* memory-access.h */ diff --git a/elfutils/libdwfl/ChangeLog b/elfutils/libdwfl/ChangeLog index 9e54a831..8f51ca73 100644 --- a/elfutils/libdwfl/ChangeLog +++ b/elfutils/libdwfl/ChangeLog @@ -1,3 +1,194 @@ +2009-04-23 Ulrich Drepper + + * dwfl_module_build_id.c: Define versioned symbols only if SHARED is + defined. Otherwise just define the latest version. + +2009-04-22 Roland McGrath + + * relocate.c (resolve_symbol): Apply correct bias to st_value found in + a non-ET_REL module. + + * dwfl_module_build_id.c (__libdwfl_find_build_id): Fix last change to + adjust properly for non-ET_REL. + +2009-04-21 Roland McGrath + + * dwfl_module_getsym.c: Apply non-ET_REL bias only if SHF_ALLOC. + + * relocate.c (__libdwfl_relocate_value): Assert that MOD is ET_REL. + * derelocate.c (cache_sections): Call __libdwfl_relocate_value only + for ET_REL. + * dwfl_module_build_id.c (__libdwfl_find_build_id): Likewise. + +2009-04-20 Roland McGrath + + * dwfl_module_getdwarf.c (__libdwfl_getelf): Add internal_function. + +2009-04-19 Roland McGrath + + * dwfl_module_getdwarf.c (find_file): Renamed to ... + (__libdwfl_getelf): ... this. Make it global. + (find_symtab, find_dw): Update callers. + (dwfl_module_getelf): Functions moved ... + * dwfl_module_getelf.c: ... here, new file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + * libdwflP.h: Declare __libdwfl_getelf. + +2009-04-14 Roland McGrath + + * dwfl_segment_report_module.c: Handle DT_STRTAB value being either + absolute (already adjusted in place) or needing load bias adjustment. + + * core-file.c (dwfl_elf_phdr_memory_callback): Fix return value for + gelf_getphdr failure. Fix file size limit checks. + + * dwfl_segment_report_module.c: Fix underflow in DYNSTRSZ check. + +2009-04-08 Roland McGrath + + * dwfl_module_getsym.c: Don't adjust for bias again after + __libdwfl_relocate_value. + + * relocate.c (__libdwfl_relocate_value): Don't adjust a value from + a non-SHF_ALLOC section. + (relocate_getsym): Test st_shndx for SHN_* values, not *SHNDX. + * dwfl_module_getsym.c (dwfl_module_getsym): Likewise. + +2009-03-09 Roland McGrath + + * dwfl_module_build_id.c (__libdwfl_find_build_id): Move SHSTRNDX + variable to outer scope, so we cache it for the loop. + + * relocate.c (__libdwfl_relocate_value): Add MOD->main.bias to sh_addr. + +2009-02-12 Roland McGrath + + * dwfl_module_build_id.c (__libdwfl_find_build_id): Use + __libdwfl_relocate_value to find correct sh_addr value. + +2009-02-10 Roland McGrath + + * dwfl_report_elf.c (__libdwfl_report_elf): Take new arg SANITY. + If false, don't fail for NO_PHDR. + (dwfl_report_elf): Update caller. + * libdwflP.h: Update decl. + * offline.c (process_elf): Call it with false, so we don't refuse + dubiously-formed objects here. + + * link_map.c (consider_executable): Don't assert dwfl_addrsegment + finds our module. We shouldn't crash when we confuse some guesses. + +2009-02-10 Ulrich Drepper + + * open.c (decompress): Avoid crash with empty input file. + +2009-01-27 Roland McGrath + + * dwfl_report_elf.c (__libdwfl_report_elf): Ignore trailing PT_LOAD + with zero vaddr and memsz. + +2009-01-22 Roland McGrath + + * open.c (decompress): Move BUFFER, SIZE decls outside #if. + + * dwfl_segment_report_module.c (addr_segndx): Remove bogus adjustments + after address-matching loop. + + * segment.c (lookup): Fix fencepost in checking for HINT match. + +2009-01-14 Roland McGrath + + * gzip.c [!BZLIB] (mapped_zImage): New function. + (unzip) [!BZLIB]: Grok Linux kernel zImage format. + +2009-01-10 Ulrich Drepper + + * dwfl_error.c: Always use __thread. Remove all !USE_TLS code. + +2009-01-08 Roland McGrath + + * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): + Skip subdirectory named "source". + (dwfl_linux_kernel_find_elf): Likewise. + +2009-01-06 Roland McGrath + + * linux-kernel-modules.c (check_suffix): New function. + Match ".ko", ".ko.gz", and ".ko.bz2" suffixes. + (dwfl_linux_kernel_report_offline): Use it. + (dwfl_linux_kernel_find_elf): Likewise. + +2009-01-05 Roland McGrath + + * argp-std.c (parse_opt): Use __libdw_open_file for core file. + * dwfl_build_id_find_debuginfo.c: Use it to open the file. + * dwfl_build_id_find_elf.c: Likewise. + * dwfl_module_getdwarf.c (open_elf): Likewise. + * dwfl_report_elf.c: Likewise. + * find-debuginfo.c (validate): Likewise. + * offline.c (__libdwfl_report_offline): Likewise. + + * libdwflP.h: Declare __libdw_open_file. + * open.c: New file. + * Makefile.am (libdwfl_a_SOURCES): Add it. + + * gzip.c: New file. + * Makefile.am [ZLIB] (libdwfl_a_SOURCES): Add it. + * bzip2.c: New file. + * Makefile.am [BZLIB] (libdwfl_a_SOURCES): Add it. + * libdwflP.h: Declare __libdw_gunzip, __libdw_bunzip2. + +2008-12-16 Roland McGrath + + * dwfl_module_build_id.c (dwfl_module_build_id): Define with alias and + symver magic to bind to ELFUTILS_0.138. + (_BUG_COMPAT_dwfl_module_build_id): New function, bug compatible + wrapper for ELFUTILS_0.130 version set. + +2008-12-18 Roland McGrath + + * derelocate.c (dwfl_module_relocate_address): Fix last fix: ET_DYN + addresses are taken as relative to MOD->low_addr. + +2008-12-15 Roland McGrath + + * derelocate.c (dwfl_module_relocate_address): Apply main.bias, not + debug.bias. + +2008-12-11 Roland McGrath + + * offline.c (process_archive): Don't call elf_end and close if + returning NULL. Check first elf_begin call and set error code + specially for empty archive. + Fixes RHBZ#465878. + +2008-12-02 Roland McGrath + + * dwfl_getmodules.c (dwfl_getmodules): Typo fix in last change. + +2008-11-26 Roland McGrath + + * dwfl_getmodules.c (dwfl_getmodules): Encode iteration style in + return value, and interpret encoded OFFSET argument. + +2008-10-07 Roland McGrath + + * dwfl_module_build_id.c (check_notes): Fix typo in vaddr calculation. + +2008-09-29 Roland McGrath + + * segment.c (insert): Must realloc DWFL->lookup_module here too. + (dwfl_report_segment): Clear DWFL->lookup_module before insert calls. + +2008-08-28 Roland McGrath + + * segment.c (reify_segments): Fix last change. + +2008-08-27 Roland McGrath + + * linux-proc-maps.c (read_proc_memory): Return 0 for EINVAL or EPERM + failure from pread64. + 2008-08-26 Roland McGrath * segment.c (reify_segments): Insert a trailing segment for a module diff --git a/elfutils/libdwfl/Makefile.am b/elfutils/libdwfl/Makefile.am index db14db2a..ebcb072a 100644 --- a/elfutils/libdwfl/Makefile.am +++ b/elfutils/libdwfl/Makefile.am @@ -2,7 +2,7 @@ ## ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. +## Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -51,8 +51,8 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \ dwfl_module.c dwfl_report_elf.c relocate.c \ dwfl_module_build_id.c dwfl_module_report_build_id.c \ derelocate.c offline.c segment.c \ - dwfl_module_info.c dwfl_getmodules.c \ - dwfl_module_getdwarf.c dwfl_getdwarf.c \ + dwfl_module_info.c dwfl_getmodules.c dwfl_getdwarf.c \ + dwfl_module_getdwarf.c dwfl_module_getelf.c \ dwfl_validate_address.c \ argp-std.c find-debuginfo.c \ dwfl_build_id_find_elf.c \ @@ -73,8 +73,14 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \ dwfl_module_return_value_location.c \ dwfl_module_register_names.c \ dwfl_segment_report_module.c \ - link_map.c core-file.c + link_map.c core-file.c open.c +if ZLIB +libdwfl_a_SOURCES += gzip.c +endif +if BZLIB +libdwfl_a_SOURCES += bzip2.c +endif if MUDFLAP libdwfl = libdwfl.a $(libdw) $(libebl) $(libelf) $(libeu) diff --git a/elfutils/libdwfl/Makefile.in b/elfutils/libdwfl/Makefile.in index c604bf65..701105ff 100644 --- a/elfutils/libdwfl/Makefile.in +++ b/elfutils/libdwfl/Makefile.in @@ -34,13 +34,16 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @MUDFLAP_FALSE@am__append_1 = libdwfl_pic.a +@ZLIB_TRUE@am__append_2 = gzip.c +@BZLIB_TRUE@am__append_3 = bzip2.c @MUDFLAP_TRUE@am_libdwfl_pic_a_OBJECTS = subdir = libdwfl DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -51,16 +54,37 @@ AR = ar ARFLAGS = cru libdwfl_a_AR = $(AR) $(ARFLAGS) libdwfl_a_LIBADD = +am__libdwfl_a_SOURCES_DIST = dwfl_begin.c dwfl_end.c dwfl_error.c \ + dwfl_version.c dwfl_module.c dwfl_report_elf.c relocate.c \ + dwfl_module_build_id.c dwfl_module_report_build_id.c \ + derelocate.c offline.c segment.c dwfl_module_info.c \ + dwfl_getmodules.c dwfl_getdwarf.c dwfl_module_getdwarf.c \ + dwfl_module_getelf.c dwfl_validate_address.c argp-std.c \ + find-debuginfo.c dwfl_build_id_find_elf.c \ + dwfl_build_id_find_debuginfo.c linux-kernel-modules.c \ + linux-proc-maps.c dwfl_addrmodule.c dwfl_addrdwarf.c cu.c \ + dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ + dwfl_module_addrdie.c dwfl_addrdie.c lines.c dwfl_lineinfo.c \ + dwfl_line_comp_dir.c dwfl_linemodule.c dwfl_linecu.c \ + dwfl_getsrclines.c dwfl_onesrcline.c dwfl_module_getsrc.c \ + dwfl_getsrc.c dwfl_module_getsrc_file.c libdwfl_crc32.c \ + libdwfl_crc32_file.c elf-from-memory.c dwfl_module_getsym.c \ + dwfl_module_addrname.c dwfl_module_addrsym.c \ + dwfl_module_return_value_location.c \ + dwfl_module_register_names.c dwfl_segment_report_module.c \ + link_map.c core-file.c open.c gzip.c bzip2.c +@ZLIB_TRUE@am__objects_1 = gzip.$(OBJEXT) +@BZLIB_TRUE@am__objects_2 = bzip2.$(OBJEXT) am_libdwfl_a_OBJECTS = dwfl_begin.$(OBJEXT) dwfl_end.$(OBJEXT) \ dwfl_error.$(OBJEXT) dwfl_version.$(OBJEXT) \ dwfl_module.$(OBJEXT) dwfl_report_elf.$(OBJEXT) \ relocate.$(OBJEXT) dwfl_module_build_id.$(OBJEXT) \ dwfl_module_report_build_id.$(OBJEXT) derelocate.$(OBJEXT) \ offline.$(OBJEXT) segment.$(OBJEXT) dwfl_module_info.$(OBJEXT) \ - dwfl_getmodules.$(OBJEXT) dwfl_module_getdwarf.$(OBJEXT) \ - dwfl_getdwarf.$(OBJEXT) dwfl_validate_address.$(OBJEXT) \ - argp-std.$(OBJEXT) find-debuginfo.$(OBJEXT) \ - dwfl_build_id_find_elf.$(OBJEXT) \ + dwfl_getmodules.$(OBJEXT) dwfl_getdwarf.$(OBJEXT) \ + dwfl_module_getdwarf.$(OBJEXT) dwfl_module_getelf.$(OBJEXT) \ + dwfl_validate_address.$(OBJEXT) argp-std.$(OBJEXT) \ + find-debuginfo.$(OBJEXT) dwfl_build_id_find_elf.$(OBJEXT) \ dwfl_build_id_find_debuginfo.$(OBJEXT) \ linux-kernel-modules.$(OBJEXT) linux-proc-maps.$(OBJEXT) \ dwfl_addrmodule.$(OBJEXT) dwfl_addrdwarf.$(OBJEXT) \ @@ -78,7 +102,8 @@ am_libdwfl_a_OBJECTS = dwfl_begin.$(OBJEXT) dwfl_end.$(OBJEXT) \ dwfl_module_return_value_location.$(OBJEXT) \ dwfl_module_register_names.$(OBJEXT) \ dwfl_segment_report_module.$(OBJEXT) link_map.$(OBJEXT) \ - core-file.$(OBJEXT) + core-file.$(OBJEXT) open.$(OBJEXT) $(am__objects_1) \ + $(am__objects_2) libdwfl_a_OBJECTS = $(am_libdwfl_a_OBJECTS) libdwfl_pic_a_AR = $(AR) $(ARFLAGS) libdwfl_pic_a_LIBADD = @@ -91,7 +116,7 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libdwfl_a_SOURCES) $(libdwfl_pic_a_SOURCES) -DIST_SOURCES = $(libdwfl_a_SOURCES) $(libdwfl_pic_a_SOURCES) +DIST_SOURCES = $(am__libdwfl_a_SOURCES_DIST) $(libdwfl_pic_a_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -186,6 +211,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -214,6 +240,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wshadow -Wunused -Wformat=2 \ @MUDFLAP_FALSE@ -Wextra -std=gnu99 @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Werror -Wshadow -Wunused \ @@ -226,34 +253,25 @@ COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ noinst_LIBRARIES = libdwfl.a $(am__append_1) pkginclude_HEADERS = libdwfl.h -libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \ - dwfl_module.c dwfl_report_elf.c relocate.c \ - dwfl_module_build_id.c dwfl_module_report_build_id.c \ - derelocate.c offline.c segment.c \ - dwfl_module_info.c dwfl_getmodules.c \ - dwfl_module_getdwarf.c dwfl_getdwarf.c \ - dwfl_validate_address.c \ - argp-std.c find-debuginfo.c \ - dwfl_build_id_find_elf.c \ - dwfl_build_id_find_debuginfo.c \ - linux-kernel-modules.c linux-proc-maps.c \ - dwfl_addrmodule.c dwfl_addrdwarf.c \ - cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ - dwfl_module_addrdie.c dwfl_addrdie.c \ - lines.c dwfl_lineinfo.c dwfl_line_comp_dir.c \ - dwfl_linemodule.c dwfl_linecu.c \ - dwfl_getsrclines.c dwfl_onesrcline.c \ - dwfl_module_getsrc.c dwfl_getsrc.c \ - dwfl_module_getsrc_file.c \ - libdwfl_crc32.c libdwfl_crc32_file.c \ - elf-from-memory.c \ - dwfl_module_getsym.c \ - dwfl_module_addrname.c dwfl_module_addrsym.c \ - dwfl_module_return_value_location.c \ - dwfl_module_register_names.c \ - dwfl_segment_report_module.c \ - link_map.c core-file.c - +libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c \ + dwfl_version.c dwfl_module.c dwfl_report_elf.c relocate.c \ + dwfl_module_build_id.c dwfl_module_report_build_id.c \ + derelocate.c offline.c segment.c dwfl_module_info.c \ + dwfl_getmodules.c dwfl_getdwarf.c dwfl_module_getdwarf.c \ + dwfl_module_getelf.c dwfl_validate_address.c argp-std.c \ + find-debuginfo.c dwfl_build_id_find_elf.c \ + dwfl_build_id_find_debuginfo.c linux-kernel-modules.c \ + linux-proc-maps.c dwfl_addrmodule.c dwfl_addrdwarf.c cu.c \ + dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ + dwfl_module_addrdie.c dwfl_addrdie.c lines.c dwfl_lineinfo.c \ + dwfl_line_comp_dir.c dwfl_linemodule.c dwfl_linecu.c \ + dwfl_getsrclines.c dwfl_onesrcline.c dwfl_module_getsrc.c \ + dwfl_getsrc.c dwfl_module_getsrc_file.c libdwfl_crc32.c \ + libdwfl_crc32_file.c elf-from-memory.c dwfl_module_getsym.c \ + dwfl_module_addrname.c dwfl_module_addrsym.c \ + dwfl_module_return_value_location.c \ + dwfl_module_register_names.c dwfl_segment_report_module.c \ + link_map.c core-file.c open.c $(am__append_2) $(am__append_3) @MUDFLAP_FALSE@libdwfl = $(libdw) @MUDFLAP_TRUE@libdwfl = libdwfl.a $(libdw) $(libebl) $(libelf) $(libeu) @MUDFLAP_FALSE@libdw = ../libdw/libdw.so @@ -319,6 +337,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argp-std.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bzip2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core-file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/derelocate.Po@am__quote@ @@ -345,6 +364,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_addrsym.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_build_id.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getdwarf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getelf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsrc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsrc_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_module_getsym.Po@am__quote@ @@ -361,6 +381,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl_version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-from-memory.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find-debuginfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gzip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdwfl_crc32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdwfl_crc32_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lines.Po@am__quote@ @@ -368,6 +389,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-kernel-modules.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-proc-maps.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/offline.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relocate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/segment.Po@am__quote@ diff --git a/elfutils/libdwfl/argp-std.c b/elfutils/libdwfl/argp-std.c index 0a0f7ebf..ce2e20a4 100644 --- a/elfutils/libdwfl/argp-std.c +++ b/elfutils/libdwfl/argp-std.c @@ -1,5 +1,5 @@ /* Standard argp argument parsers for tools using libdwfl. - Copyright (C) 2005, 2007, 2008 Red Hat, Inc. + Copyright (C) 2005, 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -215,14 +215,14 @@ parse_opt (int key, char *arg, struct argp_state *state) if (fd < 0) goto nofile; - Elf *core = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); - if (core == NULL) + Elf *core; + Dwfl_Error error = __libdw_open_file (&fd, &core, true, false); + if (error != DWFL_E_NOERROR) { - close (fd); argp_failure (state, EXIT_FAILURE, 0, _("cannot read ELF core file: %s"), - elf_errmsg (-1)); - return EIO; + INTUSE(dwfl_errmsg) (error)); + return error == DWFL_E_ERRNO ? errno : EIO; } GElf_Ehdr ehdr; diff --git a/elfutils/libdwfl/bzip2.c b/elfutils/libdwfl/bzip2.c new file mode 100644 index 00000000..8ad4ee5a --- /dev/null +++ b/elfutils/libdwfl/bzip2.c @@ -0,0 +1,4 @@ +/* bzlib is almost just like zlib. */ + +#define BZLIB +#include "gzip.c" diff --git a/elfutils/libdwfl/core-file.c b/elfutils/libdwfl/core-file.c index bc881eb9..77f208cc 100644 --- a/elfutils/libdwfl/core-file.c +++ b/elfutils/libdwfl/core-file.c @@ -1,5 +1,5 @@ /* Core file handling. - Copyright (C) 2008 Red Hat, Inc. + Copyright (C) 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -278,7 +278,7 @@ dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx, do if (unlikely (gelf_getphdr (elf, ndx++, &phdr) == NULL)) - return true; + return false; while (phdr.p_type != PT_LOAD || ((phdr.p_vaddr + phdr.p_memsz + align - 1) & -align) <= vaddr); @@ -320,8 +320,14 @@ dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx, if (elf->map_address != NULL) (void) more (elf->maximum_size - start); - if (unlikely (end - start > elf->maximum_size)) - end = start + elf->maximum_size; + /* Make sure we don't look past the end of the actual file, + even if the headers tell us to. */ + if (unlikely (end > elf->maximum_size)) + end = elf->maximum_size; + + /* If the file is too small, there is nothing at all to get. */ + if (unlikely (start >= end)) + return false; if (elf->map_address != NULL) { diff --git a/elfutils/libdwfl/derelocate.c b/elfutils/libdwfl/derelocate.c index 402bc06f..c300f84b 100644 --- a/elfutils/libdwfl/derelocate.c +++ b/elfutils/libdwfl/derelocate.c @@ -1,5 +1,5 @@ /* Recover relocatibility for addresses computed from debug information. - Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2005-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -110,7 +110,8 @@ cache_sections (Dwfl_Module *mod) if (shdr == NULL) goto elf_error; - if ((shdr->sh_flags & SHF_ALLOC) && shdr->sh_addr == 0) + if ((shdr->sh_flags & SHF_ALLOC) && shdr->sh_addr == 0 + && mod->e_type == ET_REL) { /* This section might not yet have been looked at. */ if (__libdwfl_relocate_value (mod, mod->main.elf, &shstrndx, @@ -238,6 +239,7 @@ dwfl_module_relocations (Dwfl_Module *mod) return 1; case ET_EXEC: + assert (mod->main.bias == 0); assert (mod->debug.bias == 0); break; } @@ -353,16 +355,26 @@ find_section (Dwfl_Module *mod, Dwarf_Addr *addr) int dwfl_module_relocate_address (Dwfl_Module *mod, Dwarf_Addr *addr) { - if (check_module (mod)) + if (unlikely (check_module (mod))) return -1; - if (mod->e_type != ET_REL) + switch (mod->e_type) { - *addr -= mod->debug.bias; - return 0; + case ET_REL: + return find_section (mod, addr); + + case ET_DYN: + /* All relative to first and only relocation base: module start. */ + *addr -= mod->low_addr; + break; + + default: + /* Already absolute, dwfl_module_relocations returned zero. We + shouldn't really have been called, but it's a harmless no-op. */ + break; } - return find_section (mod, addr); + return 0; } INTDEF (dwfl_module_relocate_address) diff --git a/elfutils/libdwfl/dwfl_build_id_find_debuginfo.c b/elfutils/libdwfl/dwfl_build_id_find_debuginfo.c index 97def072..e51b65b1 100644 --- a/elfutils/libdwfl/dwfl_build_id_find_debuginfo.c +++ b/elfutils/libdwfl/dwfl_build_id_find_debuginfo.c @@ -1,5 +1,5 @@ /* Find the debuginfo file for a module from its build ID. - Copyright (C) 2007 Red Hat, Inc. + Copyright (C) 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -71,10 +71,16 @@ dwfl_build_id_find_debuginfo (Dwfl_Module *mod, /* We need to open an Elf handle on the file so we can check its build ID note for validation. Backdoor the handle into the module data structure since we had to open it early anyway. */ - mod->debug.elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); - if (likely (__libdwfl_find_build_id (mod, false, mod->debug.elf) == 2)) - /* Also backdoor the gratuitous flag. */ - mod->debug.valid = true; + Dwfl_Error error = __libdw_open_file (&fd, &mod->debug.elf, true, false); + if (error != DWFL_E_NOERROR) + __libdwfl_seterrno (error); + else if (likely (__libdwfl_find_build_id (mod, false, + mod->debug.elf) == 2)) + { + /* Also backdoor the gratuitous flag. */ + mod->debug.valid = true; + return fd; + } else { /* A mismatch! */ @@ -82,10 +88,10 @@ dwfl_build_id_find_debuginfo (Dwfl_Module *mod, mod->debug.elf = NULL; close (fd); fd = -1; - free (*debuginfo_file_name); - *debuginfo_file_name = NULL; - errno = 0; } + free (*debuginfo_file_name); + *debuginfo_file_name = NULL; + errno = 0; } return fd; } diff --git a/elfutils/libdwfl/dwfl_build_id_find_elf.c b/elfutils/libdwfl/dwfl_build_id_find_elf.c index 1a226dfd..fcc6f1e5 100644 --- a/elfutils/libdwfl/dwfl_build_id_find_elf.c +++ b/elfutils/libdwfl/dwfl_build_id_find_elf.c @@ -1,5 +1,5 @@ /* Find an ELF file for a module from its build ID. - Copyright (C) 2007, 2008 Red Hat, Inc. + Copyright (C) 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -140,10 +140,15 @@ dwfl_build_id_find_elf (Dwfl_Module *mod, int fd = __libdwfl_open_by_build_id (mod, false, file_name); if (fd >= 0) { - *elfp = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); - if (__libdwfl_find_build_id (mod, false, *elfp) == 2) - /* This is a backdoor signal to short-circuit the ID refresh. */ - mod->main.valid = true; + Dwfl_Error error = __libdw_open_file (&fd, elfp, true, false); + if (error != DWFL_E_NOERROR) + __libdwfl_seterrno (error); + else if (__libdwfl_find_build_id (mod, false, *elfp) == 2) + { + /* This is a backdoor signal to short-circuit the ID refresh. */ + mod->main.valid = true; + return fd; + } else { /* This file does not contain the ID it should! */ @@ -151,9 +156,9 @@ dwfl_build_id_find_elf (Dwfl_Module *mod, *elfp = NULL; close (fd); fd = -1; - free (*file_name); - *file_name = NULL; } + free (*file_name); + *file_name = NULL; } return fd; } diff --git a/elfutils/libdwfl/dwfl_error.c b/elfutils/libdwfl/dwfl_error.c index 414fbaf4..df2765af 100644 --- a/elfutils/libdwfl/dwfl_error.c +++ b/elfutils/libdwfl/dwfl_error.c @@ -1,5 +1,5 @@ /* Error handling in libdwfl. - Copyright (C) 2005, 2006 Red Hat, Inc. + Copyright (C) 2005, 2006, 2009 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,46 +61,14 @@ #include "libdwflP.h" -#ifdef USE_TLS /* The error number. */ static __thread int global_error; -#else -/* This is the key for the thread specific memory. */ -static tls_key_t key; - -/* The error number. Used in non-threaded programs. */ -static int global_error; -static bool threaded; -/* We need to initialize the thread-specific data. */ -once_define (static, once); - -/* The initialization and destruction functions. */ -static void init (void); -static void free_key_mem (void *mem); -#endif /* TLS */ int dwfl_errno (void) { - int result; - -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - { - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - result = (intptr_t) getspecific (key); - - setspecific (key, (void *) (intptr_t) DWFL_E_NOERROR); - return result; - } -#endif /* TLS */ - - result = global_error; + int result = global_error; global_error = DWFL_E_NOERROR; return result; } @@ -172,19 +140,7 @@ void internal_function __libdwfl_seterrno (Dwfl_Error error) { - int value = canonicalize (error); - -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - setspecific (key, (void *) (intptr_t) value); -#endif /* TLS */ - - global_error = value; + global_error = canonicalize (error); } @@ -194,19 +150,7 @@ dwfl_errmsg (error) { if (error == 0 || error == -1) { - int last_error; - -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - last_error = (intptr_t) getspecific (key); - else -#endif /* TLS */ - last_error = global_error; + int last_error = global_error; if (error == 0 && last_error == 0) return NULL; @@ -233,26 +177,3 @@ dwfl_errmsg (error) ? error : DWFL_E_UNKNOWN_ERROR]]); } INTDEF (dwfl_errmsg) - - -#ifndef USE_TLS -/* Free the thread specific data, this is done if a thread terminates. */ -static void -free_key_mem (void *mem __attribute__ ((unused))) -{ - setspecific (key, NULL); -} - - -/* Initialize the key for the global variable. */ -static void -init (void) -{ - // XXX Screw you, gcc4, the unused function attribute does not work. - __asm ("" :: "r" (free_key_mem)); - - if (key_create (&key, free_key_mem) == 0) - /* Creating the key succeeded. */ - threaded = true; -} -#endif /* TLS */ diff --git a/elfutils/libdwfl/dwfl_getmodules.c b/elfutils/libdwfl/dwfl_getmodules.c index f205b899..7c6ab971 100644 --- a/elfutils/libdwfl/dwfl_getmodules.c +++ b/elfutils/libdwfl/dwfl_getmodules.c @@ -59,49 +59,55 @@ dwfl_getmodules (Dwfl *dwfl, if (dwfl == NULL) return -1; + /* We iterate through the linked list when it's all we have. + But continuing from an offset is slow that way. So when + DWFL->lookup_module is populated, we can instead keep our + place by jumping directly into the array. Since the actions + of a callback could cause it to get populated, we must + choose the style of place-holder when we return an offset, + and we encode the choice in the low bits of that value. */ + Dwfl_Module *m = dwfl->modulelist; - if (unlikely (dwfl->lookup_module == NULL)) + if ((offset & 3) == 1) { + offset >>= 2; for (ptrdiff_t pos = 0; pos < offset; ++pos) if (m == NULL) return -1; else m = m->next; - while (m != NULL) - { - ++offset; - if ((*callback) (MODCB_ARGS (m), arg) != DWARF_CB_OK) - return offset; - m = m->next; - } } - else + else if (((offset & 3) == 2) && likely (dwfl->lookup_module != NULL)) { - if (offset > 0) - { - if ((size_t) offset - 1 == dwfl->lookup_elts) - return 0; + offset >>= 2; - if (unlikely ((size_t) offset - 1 > dwfl->lookup_elts)) - return -1; + if ((size_t) offset - 1 == dwfl->lookup_elts) + return 0; - m = dwfl->lookup_module[offset - 1]; - if (unlikely (m == NULL)) - return -1; - } + if (unlikely ((size_t) offset - 1 > dwfl->lookup_elts)) + return -1; - while (m != NULL) - { - int ok = (*callback) (MODCB_ARGS (m), arg); - m = m->next; - if (ok != DWARF_CB_OK) - return (m == NULL - ? (ptrdiff_t) dwfl->lookup_elts + 1 - : m->segment + 1); - } + m = dwfl->lookup_module[offset - 1]; + if (unlikely (m == NULL)) + return -1; + } + else if (offset != 0) + { + __libdwfl_seterrno (DWFL_E_BADSTROFF); + return -1; } + while (m != NULL) + { + int ok = (*callback) (MODCB_ARGS (m), arg); + ++offset; + m = m->next; + if (ok != DWARF_CB_OK) + return ((dwfl->lookup_module == NULL) ? ((offset << 2) | 1) + : (((m == NULL ? (ptrdiff_t) dwfl->lookup_elts + 1 + : m->segment + 1) << 2) | 2)); + } return 0; } INTDEF (dwfl_getmodules) diff --git a/elfutils/libdwfl/dwfl_module_build_id.c b/elfutils/libdwfl/dwfl_module_build_id.c index 903b79c5..d7bbb3ca 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 Red Hat, Inc. + Copyright (C) 2007, 2008, 2009 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 @@ check_notes (Dwfl_Module *mod, bool set, Elf_Data *data, GElf_Addr data_vaddr) "GNU", sizeof "GNU")) return found_build_id (mod, set, data->d_buf + desc_pos, nhdr.n_descsz, - data_vaddr == NO_VADDR ? 0 : data_vaddr + pos); + data_vaddr == NO_VADDR ? 0 + : data_vaddr + desc_pos); return 0; } @@ -96,6 +97,7 @@ int internal_function __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf) { + size_t shstrndx = SHN_UNDEF; int result = 0; Elf_Scn *scn = elf_nextscn (elf, NULL); @@ -129,9 +131,18 @@ __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf) GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); if (likely (shdr != NULL) && shdr->sh_type == SHT_NOTE) - result = check_notes (mod, set, elf_getdata (scn, NULL), - (shdr->sh_flags & SHF_ALLOC) - ? shdr->sh_addr + mod->main.bias : NO_VADDR); + { + /* Determine the right sh_addr in this module. */ + GElf_Addr vaddr = 0; + if (!(shdr->sh_flags & SHF_ALLOC)) + vaddr = NO_VADDR; + else if (mod->e_type != ET_REL) + vaddr = shdr->sh_addr + mod->main.bias; + else if (__libdwfl_relocate_value (mod, elf, &shstrndx, + elf_ndxscn (scn), &vaddr)) + vaddr = NO_VADDR; + result = check_notes (mod, set, elf_getdata (scn, NULL), vaddr); + } } while (result == 0 && (scn = elf_nextscn (elf, scn)) != NULL); @@ -139,8 +150,8 @@ __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf) } int -dwfl_module_build_id (Dwfl_Module *mod, - const unsigned char **bits, GElf_Addr *vaddr) +__dwfl_module_build_id (Dwfl_Module *mod, + const unsigned char **bits, GElf_Addr *vaddr) { if (mod == NULL) return -1; @@ -163,4 +174,24 @@ dwfl_module_build_id (Dwfl_Module *mod, *vaddr = mod->build_id_vaddr; return mod->build_id_len; } -INTDEF (dwfl_module_build_id) +#ifdef SHARED +extern __typeof__ (dwfl_module_build_id) INTUSE(dwfl_module_build_id) + __attribute__ ((alias ("__dwfl_module_build_id"))); +asm (".symver " + "__dwfl_module_build_id, dwfl_module_build_id@@ELFUTILS_0.138"); + +int +_BUG_COMPAT_dwfl_module_build_id (Dwfl_Module *mod, + const unsigned char **bits, GElf_Addr *vaddr) +{ + int result = INTUSE(dwfl_module_build_id) (mod, bits, vaddr); + if (result > 0) + *vaddr += (result + 3) & -4; + return result; +} +asm (".symver " + "_BUG_COMPAT_dwfl_module_build_id, dwfl_module_build_id@ELFUTILS_0.130"); +#else +extern __typeof__ (dwfl_module_build_id) dwfl_module_build_id + __attribute__ ((alias ("__dwfl_module_build_id"))); +#endif diff --git a/elfutils/libdwfl/dwfl_module_getdwarf.c b/elfutils/libdwfl/dwfl_module_getdwarf.c index 652383be..06cb4917 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 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -69,10 +69,11 @@ open_elf (Dwfl_Module *mod, struct dwfl_file *file) if (file->fd < 0) return CBFAIL; - file->elf = elf_begin (file->fd, ELF_C_READ_MMAP_PRIVATE, NULL); + Dwfl_Error error = __libdw_open_file (&file->fd, &file->elf, true, false); + if (error != DWFL_E_NOERROR) + return error; } - - if (unlikely (elf_kind (file->elf) != ELF_K_ELF)) + else if (unlikely (elf_kind (file->elf) != ELF_K_ELF)) { close (file->fd); file->fd = -1; @@ -119,8 +120,9 @@ open_elf (Dwfl_Module *mod, struct dwfl_file *file) /* Find the main ELF file for this module and open libelf on it. When we return success, MOD->main.elf and MOD->main.bias are set up. */ -static void -find_file (Dwfl_Module *mod) +void +internal_function +__libdwfl_getelf (Dwfl_Module *mod) { if (mod->main.elf != NULL /* Already done. */ || mod->elferr != DWFL_E_NOERROR) /* Cached failure. */ @@ -495,7 +497,7 @@ find_symtab (Dwfl_Module *mod) || mod->symerr != DWFL_E_NOERROR) /* Cached previous failure. */ return; - find_file (mod); + __libdwfl_getelf (mod); mod->symerr = mod->elferr; if (mod->symerr != DWFL_E_NOERROR) return; @@ -591,7 +593,7 @@ __libdwfl_module_getebl (Dwfl_Module *mod) { if (mod->ebl == NULL) { - find_file (mod); + __libdwfl_getelf (mod); if (mod->elferr != DWFL_E_NOERROR) return mod->elferr; @@ -659,7 +661,7 @@ find_dw (Dwfl_Module *mod) || mod->dwerr != DWFL_E_NOERROR) /* Cached previous failure. */ return; - find_file (mod); + __libdwfl_getelf (mod); mod->dwerr = mod->elferr; if (mod->dwerr != DWFL_E_NOERROR) return; @@ -700,46 +702,6 @@ find_dw (Dwfl_Module *mod) mod->dwerr = __libdwfl_canon_error (mod->dwerr); } - -Elf * -dwfl_module_getelf (Dwfl_Module *mod, GElf_Addr *loadbase) -{ - if (mod == NULL) - return NULL; - - find_file (mod); - if (mod->elferr == DWFL_E_NOERROR) - { - if (mod->e_type == ET_REL && ! mod->main.relocated) - { - /* Before letting them get at the Elf handle, - apply all the relocations we know how to. */ - - mod->main.relocated = true; - if (likely (__libdwfl_module_getebl (mod) == DWFL_E_NOERROR)) - { - (void) __libdwfl_relocate (mod, mod->main.elf, false); - - if (mod->debug.elf == mod->main.elf) - mod->debug.relocated = true; - else if (mod->debug.elf != NULL && ! mod->debug.relocated) - { - mod->debug.relocated = true; - (void) __libdwfl_relocate (mod, mod->debug.elf, false); - } - } - } - - *loadbase = mod->main.bias; - return mod->main.elf; - } - - __libdwfl_seterrno (mod->elferr); - return NULL; -} -INTDEF (dwfl_module_getelf) - - Dwarf * dwfl_module_getdwarf (Dwfl_Module *mod, Dwarf_Addr *bias) { diff --git a/elfutils/libdwfl/dwfl_module_getelf.c b/elfutils/libdwfl/dwfl_module_getelf.c new file mode 100644 index 00000000..6414a9d3 --- /dev/null +++ b/elfutils/libdwfl/dwfl_module_getelf.c @@ -0,0 +1,88 @@ +/* Find debugging and symbol information for a module in libdwfl. + Copyright (C) 2009 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 + . */ + +#include "libdwflP.h" + +Elf * +dwfl_module_getelf (Dwfl_Module *mod, GElf_Addr *loadbase) +{ + if (mod == NULL) + return NULL; + + __libdwfl_getelf (mod); + if (mod->elferr == DWFL_E_NOERROR) + { + if (mod->e_type == ET_REL && ! mod->main.relocated) + { + /* Before letting them get at the Elf handle, + apply all the relocations we know how to. */ + + mod->main.relocated = true; + if (likely (__libdwfl_module_getebl (mod) == DWFL_E_NOERROR)) + { + (void) __libdwfl_relocate (mod, mod->main.elf, false); + + if (mod->debug.elf == mod->main.elf) + mod->debug.relocated = true; + else if (mod->debug.elf != NULL && ! mod->debug.relocated) + { + mod->debug.relocated = true; + (void) __libdwfl_relocate (mod, mod->debug.elf, false); + } + } + } + + *loadbase = mod->main.bias; + return mod->main.elf; + } + + __libdwfl_seterrno (mod->elferr); + return NULL; +} +INTDEF (dwfl_module_getelf) diff --git a/elfutils/libdwfl/dwfl_module_getsym.c b/elfutils/libdwfl/dwfl_module_getsym.c index 5f289ccb..f78e6ec0 100644 --- a/elfutils/libdwfl/dwfl_module_getsym.c +++ b/elfutils/libdwfl/dwfl_module_getsym.c @@ -1,5 +1,5 @@ /* Find debugging and symbol information for a module in libdwfl. - Copyright (C) 2006,2007 Red Hat, Inc. + Copyright (C) 2006,2007,2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -74,12 +74,25 @@ dwfl_module_getsym (Dwfl_Module *mod, int ndx, if (sym->st_shndx != SHN_XINDEX) shndx = sym->st_shndx; + /* Figure out whether this symbol points into an SHF_ALLOC section. */ + bool alloc = true; + if ((shndxp != NULL || mod->e_type != ET_REL) + && (sym->st_shndx == SHN_XINDEX + || (sym->st_shndx < SHN_LORESERVE && sym->st_shndx != SHN_UNDEF))) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (elf_getscn (mod->symfile->elf, shndx), + &shdr_mem); + alloc = unlikely (shdr == NULL) || (shdr->sh_flags & SHF_ALLOC); + } + if (shndxp != NULL) - *shndxp = shndx; + /* Yield -1 in case of a non-SHF_ALLOC section. */ + *shndxp = alloc ? shndx : (GElf_Word) -1; - switch (shndx) + switch (sym->st_shndx) { - case SHN_ABS: + case SHN_ABS: /* XXX sometimes should use bias?? */ case SHN_UNDEF: case SHN_COMMON: break; @@ -99,8 +112,9 @@ dwfl_module_getsym (Dwfl_Module *mod, int ndx, return NULL; } } - /* Apply the bias to the symbol value. */ - sym->st_value += mod->symfile->bias; + else if (alloc) + /* Apply the bias to the symbol value. */ + sym->st_value += mod->symfile->bias; break; } diff --git a/elfutils/libdwfl/dwfl_report_elf.c b/elfutils/libdwfl/dwfl_report_elf.c index 0e5d09bc..a58d3029 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 Red Hat, Inc. + Copyright (C) 2005, 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -62,7 +62,7 @@ Dwfl_Module * internal_function __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, - int fd, Elf *elf, GElf_Addr base) + int fd, Elf *elf, GElf_Addr base, bool sanity) { GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem); if (ehdr == NULL) @@ -208,14 +208,15 @@ __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, GElf_Phdr phdr_mem, *ph = gelf_getphdr (elf, i, &phdr_mem); if (unlikely (ph == NULL)) goto elf_error; - if (ph->p_type == PT_LOAD) + if (ph->p_type == PT_LOAD + && ph->p_vaddr + ph->p_memsz > 0) { end = base + (ph->p_vaddr + ph->p_memsz); break; } } - if (end == 0) + if (end == 0 && sanity) { __libdwfl_seterrno (DWFL_E_NO_PHDR); return NULL; @@ -274,9 +275,16 @@ dwfl_report_elf (Dwfl *dwfl, const char *name, } } - Elf *elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + Elf *elf; + Dwfl_Error error = __libdw_open_file (&fd, &elf, closefd, false); + if (error != DWFL_E_NOERROR) + { + __libdwfl_seterrno (error); + return NULL; + } + Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name, - fd, elf, base); + fd, elf, base, true); if (mod == NULL) { elf_end (elf); diff --git a/elfutils/libdwfl/dwfl_segment_report_module.c b/elfutils/libdwfl/dwfl_segment_report_module.c index 50ed140e..10787bdc 100644 --- a/elfutils/libdwfl/dwfl_segment_report_module.c +++ b/elfutils/libdwfl/dwfl_segment_report_module.c @@ -1,5 +1,5 @@ /* Sniff out modules from ELF headers visible in memory segments. - Copyright (C) 2008 Red Hat, Inc. + Copyright (C) 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -87,13 +87,6 @@ addr_segndx (Dwfl *dwfl, size_t segment, GElf_Addr addr) while (segment < dwfl->lookup_elts - 1 && dwfl->lookup_addr[segment] < addr); - while (dwfl->lookup_segndx[segment] < 0 - && segment < dwfl->lookup_elts - 1) - ++segment; - - if (dwfl->lookup_segndx[segment] >= 0) - ndx = dwfl->lookup_segndx[segment]; - return ndx; } @@ -526,13 +519,28 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, size_t soname_size = 0; if (dynstrsz != 0 && dynstr_vaddr != 0) { - /* We know the bounds of the .dynstr section. */ - dynstr_vaddr += bias; + /* We know the bounds of the .dynstr section. + + The DYNSTR_VADDR pointer comes from the .dynamic section + (DT_STRTAB, detected above). Ordinarily the dynamic linker + will have adjusted this pointer in place so it's now an + absolute address. But sometimes .dynamic is read-only (in + vDSOs and odd architectures), and sometimes the adjustment + just hasn't happened yet in the memory image we looked at. + So treat DYNSTR_VADDR as an absolute address if it falls + within the module bounds, or try applying the phdr bias + when that adjusts it to fall within the module bounds. */ + + if ((dynstr_vaddr < module_start || dynstr_vaddr >= module_end) + && dynstr_vaddr + bias >= module_start + && dynstr_vaddr + bias < module_end) + dynstr_vaddr += bias; + if (unlikely (dynstr_vaddr + dynstrsz > module_end)) dynstrsz = 0; /* Try to get the DT_SONAME string. */ - if (soname_stroff != 0 && soname_stroff < dynstrsz - 1 + if (soname_stroff != 0 && soname_stroff + 1 < dynstrsz && ! read_portion (&soname, &soname_size, dynstr_vaddr + soname_stroff, 0)) name = soname; diff --git a/elfutils/libdwfl/find-debuginfo.c b/elfutils/libdwfl/find-debuginfo.c index a01293e8..9e817398 100644 --- a/elfutils/libdwfl/find-debuginfo.c +++ b/elfutils/libdwfl/find-debuginfo.c @@ -1,5 +1,5 @@ /* Standard find_debuginfo callback for libdwfl. - Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -99,16 +99,22 @@ validate (Dwfl_Module *mod, int fd, bool check, GElf_Word debuglink_crc) /* We need to open an Elf handle on the file so we can check its build ID note for validation. Backdoor the handle into the module data structure since we had to open it early anyway. */ - mod->debug.elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); - if (likely (__libdwfl_find_build_id (mod, false, mod->debug.elf) == 2)) - /* Also backdoor the gratuitous flag. */ - mod->debug.valid = true; + + mod->debug.valid = false; + Dwfl_Error error = __libdw_open_file (&fd, &mod->debug.elf, false, false); + if (error != DWFL_E_NOERROR) + __libdwfl_seterrno (error); + else if (likely (__libdwfl_find_build_id (mod, false, + mod->debug.elf) == 2)) + /* Also backdoor the gratuitous flag. */ + mod->debug.valid = true; else { /* A mismatch! */ elf_end (mod->debug.elf); mod->debug.elf = NULL; - mod->debug.valid = false; + close (fd); + fd = -1; } return mod->debug.valid; diff --git a/elfutils/libdwfl/gzip.c b/elfutils/libdwfl/gzip.c new file mode 100644 index 00000000..66445254 --- /dev/null +++ b/elfutils/libdwfl/gzip.c @@ -0,0 +1,299 @@ +/* Decompression support for libdwfl: zlib (gzip) and/or bzlib (bzip2). + Copyright (C) 2009 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 + . */ + +#include "libdwflP.h" + +#include + +#ifdef BZLIB +# define inflate_groks_header true +# define mapped_zImage(...) false +# include +# define unzip __libdw_bunzip2 +# define DWFL_E_ZLIB DWFL_E_BZLIB +# define MAGIC "BZh" +# define Z(what) BZ_##what +# define z_stream bz_stream +# define inflateInit(z) BZ2_bzDecompressInit (z, 0, 0) +# define inflate(z, f) BZ2_bzDecompress (z) +# define inflateEnd(z) BZ2_bzDecompressEnd (z) +# define gzFile BZFILE * +# define gzdopen BZ2_bzdopen +# define gzread BZ2_bzread +# define gzclose BZ2_bzclose +# define gzerror BZ2_bzerror +#else +# define inflate_groks_header false +# include +# define unzip __libdw_gunzip +# define MAGIC "\037\213" +# define Z(what) Z_##what + +/* We can also handle Linux kernel zImage format in a very hackish way. + If it looks like one, we actually just scan the image for the gzip + magic bytes to figure out where the gzip image starts. */ + +# define LINUX_MAGIC_OFFSET 514 +# define LINUX_MAGIC "HdrS" + +static bool +mapped_zImage (off64_t *start_offset, void **mapped, size_t *mapped_size) +{ + const size_t pos = LINUX_MAGIC_OFFSET + sizeof LINUX_MAGIC; + if (*mapped_size > pos + && !memcmp (*mapped + LINUX_MAGIC_OFFSET, + LINUX_MAGIC, sizeof LINUX_MAGIC - 1)) + { + void *p = memmem (*mapped + pos, *mapped_size - pos, + MAGIC, sizeof MAGIC - 1); + if (p != NULL) + { + *start_offset += p - *mapped; + *mapped_size = *mapped + *mapped_size - p, + *mapped = p; + return true; + } + } + return false; +} +#endif + +/* If this is not a compressed image, return DWFL_E_BADELF. + If we uncompressed it into *WHOLE, *WHOLE_SIZE, return DWFL_E_NOERROR. + Otherwise return an error for bad compressed data or I/O failure. */ + +Dwfl_Error internal_function +unzip (int fd, off64_t start_offset, + void *mapped, size_t mapped_size, + void **whole, size_t *whole_size) +{ + void *buffer = NULL; + size_t size = 0; + inline bool bigger_buffer (size_t start) + { + size_t more = size ? size * 2 : start; + char *b = realloc (buffer, more); + while (unlikely (b == NULL) && more >= size + 1024) + b = realloc (buffer, more -= 1024); + if (unlikely (b == NULL)) + return false; + buffer = b; + size = more; + return true; + } + inline void smaller_buffer (size_t end) + { + buffer = realloc (buffer, end) ?: buffer; + size = end; + } + + inline Dwfl_Error zlib_fail (int result) + { + Dwfl_Error failure = DWFL_E_ZLIB; + switch (result) + { + case Z (MEM_ERROR): + failure = DWFL_E_NOMEM; + break; + } + free (buffer); + *whole = NULL; + return failure; + } + + /* If the file is already mapped in, look at the header. */ + if (mapped != NULL + && (mapped_size <= sizeof MAGIC + || memcmp (mapped, MAGIC, sizeof MAGIC - 1)) + && !mapped_zImage (&start_offset, &mapped, &mapped_size)) + /* Not a compressed file. */ + return DWFL_E_BADELF; + + if (mapped != NULL && inflate_groks_header) + { + /* This style actually only works with bzlib. + The stupid zlib interface has nothing to grok the + gzip file headers except the slow gzFile interface. */ + + z_stream z = { .next_in = mapped, .avail_in = mapped_size }; + int result = inflateInit (&z); + if (result != Z (OK)) + return zlib_fail (result); + + do + { + ptrdiff_t pos = (void *) z.next_out - buffer; + if (!bigger_buffer (z.avail_in)) + { + result = Z (MEM_ERROR); + break; + } + z.next_out = buffer + pos; + z.avail_out = size - pos; + } + while ((result = inflate (&z, Z_SYNC_FLUSH)) == Z (OK)); + +#ifdef BZLIB + uint64_t total_out = (((uint64_t) z.total_out_hi32 << 32) + | z.total_out_lo32); + smaller_buffer (total_out); +#else + smaller_buffer (z.total_out); +#endif + + inflateEnd (&z); + + if (result != Z (STREAM_END)) + return zlib_fail (result); + } + else + { + /* Let the decompression library read the file directly. */ + + gzFile zf; + Dwfl_Error open_stream (void) + { + int d = dup (fd); + if (unlikely (d < 0)) + return DWFL_E_BADELF; + if (start_offset != 0) + { + off64_t off = lseek (d, start_offset, SEEK_SET); + if (off != start_offset) + { + close (d); + return DWFL_E_BADELF; + } + } + zf = gzdopen (d, "r"); + if (unlikely (zf == NULL)) + { + close (d); + return zlib_fail (Z (MEM_ERROR)); + } + + /* From here on, zlib will close D. */ + + return DWFL_E_NOERROR; + } + + Dwfl_Error result = open_stream (); + +#ifndef BZLIB + if (result == DWFL_E_NOERROR && gzdirect (zf)) + { + bool found = false; + char buf[sizeof LINUX_MAGIC - 1]; + gzseek (zf, start_offset + LINUX_MAGIC_OFFSET, SEEK_SET); + int n = gzread (zf, buf, sizeof buf); + if (n == sizeof buf + && !memcmp (buf, LINUX_MAGIC, sizeof LINUX_MAGIC - 1)) + while (gzread (zf, buf, sizeof MAGIC - 1) == sizeof MAGIC - 1) + if (!memcmp (buf, MAGIC, sizeof MAGIC - 1)) + { + start_offset = gztell (zf) - 2; + found = true; + break; + } + gzclose (zf); + if (found) + { + result = open_stream (); + if (result == DWFL_E_NOERROR && unlikely (gzdirect (zf))) + { + gzclose (zf); + result = DWFL_E_BADELF; + } + } + else + result = DWFL_E_BADELF; + } +#endif + + if (result != DWFL_E_NOERROR) + return result; + + ptrdiff_t pos = 0; + while (1) + { + if (!bigger_buffer (1024)) + { + gzclose (zf); + return zlib_fail (Z (MEM_ERROR)); + } + int n = gzread (zf, buffer + pos, size - pos); + if (n < 0) + { + int code; + gzerror (zf, &code); +#ifdef BZLIB + if (code == BZ_DATA_ERROR_MAGIC) + { + gzclose (zf); + free (buffer); + return DWFL_E_BADELF; + } +#endif + gzclose (zf); + return zlib_fail (code); + } + if (n == 0) + break; + pos += n; + } + + gzclose (zf); + smaller_buffer (pos); + } + + *whole = buffer; + *whole_size = size; + + return DWFL_E_NOERROR; +} diff --git a/elfutils/libdwfl/libdwfl.h b/elfutils/libdwfl/libdwfl.h index b6ae7765..91d43802 100644 --- a/elfutils/libdwfl/libdwfl.h +++ b/elfutils/libdwfl/libdwfl.h @@ -1,5 +1,5 @@ /* Interfaces for libdwfl. - Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2005-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -423,10 +423,11 @@ extern int dwfl_module_getsymtab (Dwfl_Module *mod); /* Fetch one entry from the module's symbol table. On errors, returns NULL. If successful, fills in *SYM and returns the string for st_name. - This works like gelf_getsym except that st_value is always adjusted - to an absolute value based on the module's location. If SHNDXP is - non-null, it's set with the section index (whether from st_shndx or - extended index table). */ + This works like gelf_getsym except that st_value is always adjusted to + an absolute value based on the module's location, when the symbol is in + an SHF_ALLOC section. If SHNDXP is non-null, it's set with the section + index (whether from st_shndx or extended index table); in case of a + symbol in a non-allocated section, *SHNDXP is instead set to -1. */ extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx, GElf_Sym *sym, GElf_Word *shndxp) __nonnull_attribute__ (3); diff --git a/elfutils/libdwfl/libdwflP.h b/elfutils/libdwfl/libdwflP.h index 6ba5c96e..be2ad828 100644 --- a/elfutils/libdwfl/libdwflP.h +++ b/elfutils/libdwfl/libdwflP.h @@ -1,5 +1,5 @@ /* Internal definitions for libdwfl. - Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -74,6 +74,8 @@ DWFL_ERROR (LIBELF, N_("See elf_errno")) \ DWFL_ERROR (LIBDW, N_("See dwarf_errno")) \ DWFL_ERROR (LIBEBL, N_("See ebl_errno (XXX missing)")) \ + DWFL_ERROR (ZLIB, N_("gzip decompression failed")) \ + DWFL_ERROR (BZLIB, N_("bzip2 decompression failed")) \ DWFL_ERROR (UNKNOWN_MACHINE, N_("no support library found for machine")) \ DWFL_ERROR (NOREL, N_("Callbacks missing for ET_REL file")) \ DWFL_ERROR (BADRELTYPE, N_("Unsupported relocation type")) \ @@ -239,6 +241,8 @@ struct dwfl_arange extern void __libdwfl_module_free (Dwfl_Module *mod) internal_function; +/* Find the main ELF file, update MOD->elferr and/or MOD->main.elf. */ +extern void __libdwfl_getelf (Dwfl_Module *mod) internal_function; /* Process relocations in debugging sections in an ET_REL file. FILE must be opened with ELF_C_READ_MMAP_PRIVATE or ELF_C_READ, @@ -304,7 +308,7 @@ extern int __libdwfl_crc32_file (int fd, uint32_t *resp) attribute_hidden; Consumes ELF on success, not on failure. */ extern Dwfl_Module *__libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd, - Elf *elf, GElf_Addr base) + Elf *elf, GElf_Addr base, bool sanity) internal_function; /* Meat of dwfl_report_offline. */ @@ -315,6 +319,23 @@ extern Dwfl_Module *__libdwfl_report_offline (Dwfl *dwfl, const char *name, const char *)) internal_function; +/* Decompression wrappers: decompress whole file into memory. */ +extern Dwfl_Error __libdw_gunzip (int fd, off64_t start_offset, + void *mapped, size_t mapped_size, + void **whole, size_t *whole_size) + internal_function; +extern Dwfl_Error __libdw_bunzip2 (int fd, off64_t start_offset, + void *mapped, size_t mapped_size, + void **whole, size_t *whole_size) + internal_function; + +/* Open Elf handle on *FDP. This handles decompression and checks + elf_kind. Succeed only for ELF_K_ELF, or also ELF_K_AR if ARCHIVE_OK. + Returns DWFL_E_NOERROR and sets *ELFP on success, resets *FDP to -1 if + it's no longer used. Resets *FDP on failure too iff CLOSE_ON_FAIL. */ +extern Dwfl_Error __libdw_open_file (int *fdp, Elf **elfp, + bool close_on_fail, bool archive_ok) + internal_function; /* These are working nicely for --core, but are not ready to be exported interfaces quite yet. */ @@ -363,6 +384,7 @@ extern int dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size, extern int dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const GElf_Ehdr *ehdr); + /* Avoid PLT entries. */ INTDECL (dwfl_begin) INTDECL (dwfl_errmsg) diff --git a/elfutils/libdwfl/link_map.c b/elfutils/libdwfl/link_map.c index e9890384..2d4d75f1 100644 --- a/elfutils/libdwfl/link_map.c +++ b/elfutils/libdwfl/link_map.c @@ -1,5 +1,5 @@ /* Report modules by examining dynamic linker data structures. - Copyright (C) 2008 Red Hat, Inc. + Copyright (C) 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -561,9 +561,7 @@ consider_executable (Dwfl_Module *mod, GElf_Addr at_phdr, GElf_Addr at_entry, void *buffer = NULL; size_t buffer_available = addrsize (ehdr.e_ident[EI_CLASS]); - Dwfl_Module *m; - int segndx = INTUSE(dwfl_addrsegment) (mod->dwfl, d_val_vaddr, &m); - assert (m == mod); + int segndx = INTUSE(dwfl_addrsegment) (mod->dwfl, d_val_vaddr, NULL); if ((*memory_callback) (mod->dwfl, segndx, &buffer, &buffer_available, @@ -587,7 +585,6 @@ consider_executable (Dwfl_Module *mod, GElf_Addr at_phdr, GElf_Addr at_entry, (*memory_callback) (mod->dwfl, -1, &buffer, &buffer_available, 0, 0, memory_callback_arg); - if (*elfclass == ELFCLASSNONE) *elfclass = ehdr.e_ident[EI_CLASS]; else if (*elfclass != ehdr.e_ident[EI_CLASS]) diff --git a/elfutils/libdwfl/linux-kernel-modules.c b/elfutils/libdwfl/linux-kernel-modules.c index 5bbb384a..e07073cd 100644 --- a/elfutils/libdwfl/linux-kernel-modules.c +++ b/elfutils/libdwfl/linux-kernel-modules.c @@ -1,5 +1,5 @@ /* Standard libdwfl callbacks for debugging the running Linux kernel. - Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2005-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -254,6 +254,29 @@ report_kernel_archive (Dwfl *dwfl, const char **release, return result; } +static size_t +check_suffix (const FTSENT *f, size_t namelen) +{ +#define TRY(sfx) \ + if ((namelen ? f->fts_namelen == namelen + sizeof sfx - 1 \ + : f->fts_namelen >= sizeof sfx) \ + && !memcmp (f->fts_name + f->fts_namelen - (sizeof sfx - 1), \ + sfx, sizeof sfx)) \ + return sizeof sfx - 1 + + TRY (".ko"); +#if USE_ZLIB + TRY (".ko.gz"); +#endif +#if USE_BZLIB + TRY (".ko.bz2"); +#endif + + return 0; + +#undef TRY +} + /* Report a kernel and all its modules found on disk, for offline use. If RELEASE starts with '/', it names a directory to look in; if not, it names a directory to find under /lib/modules/; @@ -296,14 +319,23 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release, FTSENT *f; while ((f = fts_read (fts)) != NULL) { + /* Skip a "source" subtree, which tends to be large. + This insane hard-coding of names is what depmod does too. */ + if (f->fts_namelen == sizeof "source" - 1 + && !strcmp (f->fts_name, "source")) + { + fts_set (fts, f, FTS_SKIP); + continue; + } + switch (f->fts_info) { case FTS_F: case FTS_SL: - case FTS_NSOK: + case FTS_NSOK:; /* See if this file name matches "*.ko". */ - if (f->fts_namelen > 3 - && !memcmp (f->fts_name + f->fts_namelen - 3, ".ko", 4)) + const size_t suffix = check_suffix (f, 0); + if (suffix) { /* We have a .ko file to report. Following the algorithm by which the kernel makefiles set KBUILD_MODNAME, we @@ -313,13 +345,13 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release, names. To handle that, we would have to look at the __this_module.name contents in the module's text. */ - char name[f->fts_namelen - 3 + 1]; + char name[f->fts_namelen - suffix + 1]; for (size_t i = 0; i < f->fts_namelen - 3U; ++i) if (f->fts_name[i] == '-' || f->fts_name[i] == ',') name[i] = '_'; else name[i] = f->fts_name[i]; - name[f->fts_namelen - 3] = '\0'; + name[f->fts_namelen - suffix] = '\0'; if (predicate != NULL) { @@ -334,8 +366,7 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release, continue; } - if (dwfl_report_offline (dwfl, name, - f->fts_path, -1) == NULL) + if (dwfl_report_offline (dwfl, name, f->fts_path, -1) == NULL) { result = -1; break; @@ -660,6 +691,15 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod, int error = ENOENT; while ((f = fts_read (fts)) != NULL) { + /* Skip a "source" subtree, which tends to be large. + This insane hard-coding of names is what depmod does too. */ + if (f->fts_namelen == sizeof "source" - 1 + && !strcmp (f->fts_name, "source")) + { + fts_set (fts, f, FTS_SKIP); + continue; + } + error = ENOENT; switch (f->fts_info) { @@ -667,8 +707,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod, case FTS_SL: case FTS_NSOK: /* See if this file name is "MODULE_NAME.ko". */ - if (f->fts_namelen == namelen + 3 - && !memcmp (f->fts_name + namelen, ".ko", 4) + if (check_suffix (f, namelen) && (!memcmp (f->fts_name, module_name, namelen) || !memcmp (f->fts_name, alternate_name, namelen))) { diff --git a/elfutils/libdwfl/linux-proc-maps.c b/elfutils/libdwfl/linux-proc-maps.c index b4bb6cfc..2206f63c 100644 --- a/elfutils/libdwfl/linux-proc-maps.c +++ b/elfutils/libdwfl/linux-proc-maps.c @@ -267,6 +267,9 @@ read_proc_memory (void *arg, void *data, GElf_Addr address, { const int fd = *(const int *) arg; ssize_t nread = pread64 (fd, data, maxread, (off64_t) address); + /* Some kernels don't actually let us do this read, ignore those errors. */ + if (nread < 0 && (errno == EINVAL || errno == EPERM)) + return 0; if (nread > 0 && (size_t) nread < minread) nread = 0; return nread; diff --git a/elfutils/libdwfl/offline.c b/elfutils/libdwfl/offline.c index ff7b793a..34aa9f84 100644 --- a/elfutils/libdwfl/offline.c +++ b/elfutils/libdwfl/offline.c @@ -1,5 +1,5 @@ /* Recover relocatibility for addresses computed from debug information. - Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -148,7 +148,7 @@ process_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd, Elf *elf) { Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name, fd, elf, - dwfl->offline_next_address); + dwfl->offline_next_address, false); if (mod != NULL) { /* If this is an ET_EXEC file with fixed addresses, the address range @@ -259,16 +259,23 @@ process_archive (Dwfl *dwfl, const char *name, const char *file_name, int fd, { Dwfl_Module *mod = NULL; + Elf *member = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, archive); + if (unlikely (member == NULL)) /* Empty archive. */ + { + __libdwfl_seterrno (DWFL_E_BADELF); + return NULL; + } + while (process_archive_member (dwfl, name, file_name, predicate, - fd, elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, - archive), &mod) != ELF_C_NULL) - ; + fd, member, &mod) != ELF_C_NULL) + member = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, archive); /* We can drop the archive Elf handle even if we're still using members in live modules. When the last module's elf_end on a member returns zero, that module will close FD. If no modules survived the predicate, we are all done with the file right here. */ - if (elf_end (archive) == 0) + if (mod != NULL /* If no modules, caller will clean up. */ + && elf_end (archive) == 0) close (fd); return mod; @@ -281,7 +288,13 @@ __libdwfl_report_offline (Dwfl *dwfl, const char *name, int (*predicate) (const char *module, const char *file)) { - Elf *elf = elf_begin (fd, ELF_C_READ_MMAP_PRIVATE, NULL); + Elf *elf; + Dwfl_Error error = __libdw_open_file (&fd, &elf, closefd, true); + if (error != DWFL_E_NOERROR) + { + __libdwfl_seterrno (error); + return NULL; + } Dwfl_Module *mod = process_file (dwfl, name, file_name, fd, elf, predicate); if (mod == NULL) { diff --git a/elfutils/libdwfl/open.c b/elfutils/libdwfl/open.c new file mode 100644 index 00000000..0ab2a9d2 --- /dev/null +++ b/elfutils/libdwfl/open.c @@ -0,0 +1,152 @@ +/* Decompression support for libdwfl: zlib (gzip) and/or bzlib (bzip2). + Copyright (C) 2009 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 + . */ + +#include "../libelf/libelfP.h" +#undef _ +#include "libdwflP.h" + +#include + +#if !USE_ZLIB +# define __libdw_gunzip(...) false +#endif + +#if !USE_BZLIB +# define __libdw_bunzip2(...) false +#endif + +/* Always consumes *ELF, never consumes FD. + Replaces *ELF on success. */ +static Dwfl_Error +decompress (int fd __attribute__ ((unused)), Elf **elf) +{ + Dwfl_Error error = DWFL_E_BADELF; + void *buffer = NULL; + size_t size = 0; + +#if USE_ZLIB || USE_BZLIB + const off64_t offset = (*elf)->start_offset; + void *const mapped = ((*elf)->map_address == NULL ? NULL + : (*elf)->map_address + (*elf)->start_offset); + const size_t mapped_size = (*elf)->maximum_size; + if (mapped_size == 0) + return error; + + error = __libdw_gunzip (fd, offset, mapped, mapped_size, &buffer, &size); + if (error == DWFL_E_BADELF) + error = __libdw_bunzip2 (fd, offset, mapped, mapped_size, &buffer, &size); +#endif + + elf_end (*elf); + *elf = NULL; + + if (error == DWFL_E_NOERROR) + { + if (unlikely (size == 0)) + { + error = DWFL_E_BADELF; + free (buffer); + } + else + { + *elf = elf_memory (buffer, size); + if (*elf == NULL) + { + error = DWFL_E_LIBELF; + free (buffer); + } + else + (*elf)->flags |= ELF_F_MALLOCED; + } + } + + return error; +} + +Dwfl_Error internal_function +__libdw_open_file (int *fdp, Elf **elfp, bool close_on_fail, bool archive_ok) +{ + bool close_fd = false; + Dwfl_Error error = DWFL_E_NOERROR; + + Elf *elf = elf_begin (*fdp, ELF_C_READ_MMAP_PRIVATE, NULL); + Elf_Kind kind = elf_kind (elf); + if (unlikely (kind == ELF_K_NONE)) + { + if (unlikely (elf == NULL)) + error = DWFL_E_LIBELF; + else + { + error = decompress (*fdp, &elf); + if (error == DWFL_E_NOERROR) + { + close_fd = true; + kind = elf_kind (elf); + } + } + } + + if (error == DWFL_E_NOERROR + && kind != ELF_K_ELF + && !(archive_ok && kind == ELF_K_AR)) + { + elf_end (elf); + elf = NULL; + error = DWFL_E_BADELF; + } + + if (error == DWFL_E_NOERROR ? close_fd : close_on_fail) + { + close (*fdp); + *fdp = -1; + } + + *elfp = elf; + return error; +} diff --git a/elfutils/libdwfl/relocate.c b/elfutils/libdwfl/relocate.c index abacc041..2c0f3010 100644 --- a/elfutils/libdwfl/relocate.c +++ b/elfutils/libdwfl/relocate.c @@ -1,5 +1,5 @@ /* Relocate debug information. - Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2005-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -59,6 +59,8 @@ internal_function __libdwfl_relocate_value (Dwfl_Module *mod, Elf *elf, size_t *shstrndx, Elf32_Word shndx, GElf_Addr *value) { + assert (mod->e_type == ET_REL); + Elf_Scn *refscn = elf_getscn (elf, shndx); GElf_Shdr refshdr_mem, *refshdr = gelf_getshdr (refscn, &refshdr_mem); if (refshdr == NULL) @@ -95,8 +97,10 @@ __libdwfl_relocate_value (Dwfl_Module *mod, Elf *elf, size_t *shstrndx, return DWFL_E_LIBELF; } - /* Apply the adjustment. */ - *value += refshdr->sh_addr; + if (refshdr->sh_flags & SHF_ALLOC) + /* Apply the adjustment. */ + *value += refshdr->sh_addr + mod->main.bias; + return DWFL_E_NOERROR; } @@ -183,7 +187,7 @@ relocate_getsym (Dwfl_Module *mod, if (sym->st_shndx != SHN_XINDEX) *shndx = sym->st_shndx; - switch (*shndx) + switch (sym->st_shndx) { case SHN_ABS: case SHN_UNDEF: @@ -263,9 +267,15 @@ resolve_symbol (Dwfl_Module *referer, struct reloc_symtab_cache *symtab, continue; /* We found it! */ - if (shndx == SHN_ABS) + if (shndx == SHN_ABS) /* XXX maybe should apply bias? */ return DWFL_E_NOERROR; + if (m->e_type != ET_REL) + { + sym->st_value += m->symfile->bias; + return DWFL_E_NOERROR; + } + /* In an ET_REL file, the symbol table values are relative to the section, not to the module's load base. */ size_t symshstrndx = SHN_UNDEF; diff --git a/elfutils/libdwfl/segment.c b/elfutils/libdwfl/segment.c index 78220e3b..36c850f0 100644 --- a/elfutils/libdwfl/segment.c +++ b/elfutils/libdwfl/segment.c @@ -1,5 +1,5 @@ /* Manage address space lookup table for libdwfl. - Copyright (C) 2008 Red Hat, Inc. + Copyright (C) 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -83,12 +83,26 @@ insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr end, int segndx) int *nsegndx = realloc (dwfl->lookup_segndx, sizeof nsegndx[0] * n); if (unlikely (nsegndx == NULL)) { - free (naddr); + if (naddr != dwfl->lookup_addr) + free (naddr); return true; } dwfl->lookup_alloc = n; dwfl->lookup_addr = naddr; dwfl->lookup_segndx = nsegndx; + + if (dwfl->lookup_module != NULL) + { + /* Make sure this array is big enough too. */ + Dwfl_Module **old = dwfl->lookup_module; + dwfl->lookup_module = realloc (dwfl->lookup_module, + sizeof dwfl->lookup_module[0] * n); + if (unlikely (dwfl->lookup_module == NULL)) + { + free (old); + return true; + } + } } if (unlikely (i < dwfl->lookup_elts)) @@ -128,7 +142,7 @@ lookup (Dwfl *dwfl, GElf_Addr address, int hint) if (hint >= 0 && address >= dwfl->lookup_addr[hint] && ((size_t) hint + 1 == dwfl->lookup_elts - || address <= dwfl->lookup_addr[hint + 1])) + || address < dwfl->lookup_addr[hint + 1])) return hint; /* Do binary search on the array indexed by module load address. */ @@ -175,9 +189,17 @@ reify_segments (Dwfl *dwfl) return true; ++idx; } + else if (dwfl->lookup_addr[idx] < start) + { + /* The module starts past the end of this segment. + Add a new one. */ + if (unlikely (insert (dwfl, idx + 1, start, end, -1))) + return true; + ++idx; + } - if (((size_t) idx + 1 == dwfl->lookup_elts - || end < dwfl->lookup_addr[idx + 1]) + if ((size_t) idx + 1 < dwfl->lookup_elts + && end < dwfl->lookup_addr[idx + 1] /* The module ends in the middle of this segment. Split it. */ && unlikely (insert (dwfl, idx + 1, end, dwfl->lookup_addr[idx + 1], -1))) @@ -261,6 +283,12 @@ dwfl_report_segment (Dwfl *dwfl, int ndx, const GElf_Phdr *phdr, GElf_Addr bias, phdr->p_align < dwfl->segment_align)) dwfl->segment_align = phdr->p_align; + if (unlikely (dwfl->lookup_module != NULL)) + { + free (dwfl->lookup_module); + dwfl->lookup_module = NULL; + } + GElf_Addr start = segment_start (dwfl, bias + phdr->p_vaddr); GElf_Addr end = segment_end (dwfl, bias + phdr->p_vaddr + phdr->p_memsz); @@ -289,12 +317,6 @@ dwfl_report_segment (Dwfl *dwfl, int ndx, const GElf_Phdr *phdr, GElf_Addr bias, dwfl->lookup_tail_offset = end - bias - phdr->p_vaddr + phdr->p_offset; dwfl->lookup_tail_ndx = ndx + 1; - if (unlikely (dwfl->lookup_module != NULL)) - { - free (dwfl->lookup_module); - dwfl->lookup_module = NULL; - } - return ndx; } INTDEF (dwfl_report_segment) diff --git a/elfutils/libebl/ChangeLog b/elfutils/libebl/ChangeLog index 57ac2c8c..83319c70 100644 --- a/elfutils/libebl/ChangeLog +++ b/elfutils/libebl/ChangeLog @@ -1,3 +1,18 @@ +2009-04-01 Roland McGrath + + * eblsymboltypename.c (ebl_symbol_type_name): Add STT_GNU_IFUNC. + + * eblauxvinfo.c (AUXV_TYPES): Add RANDOM and BASE_PLATFORM. + +2009-02-01 Ulrich Drepper + + * eblreloctypename.c (ebl_reloc_type_name): Return "" + instead of "???" for invalid relocations. + +2008-08-01 Roland McGrath + + * eblcorenotetypename.c: Handle NT_386_IOPERM. + 2008-07-28 Roland McGrath * eblauxvinfo.c (AUXV_TYPES): Add EXECFN. diff --git a/elfutils/libebl/Makefile.in b/elfutils/libebl/Makefile.in index 829a9f78..f06ed82b 100644 --- a/elfutils/libebl/Makefile.in +++ b/elfutils/libebl/Makefile.in @@ -38,7 +38,8 @@ DIST_COMMON = $(noinst_HEADERS) $(pkginclude_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -178,6 +179,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -206,6 +208,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ @MUDFLAP_FALSE@ -Wextra -Wformat=2 -std=gnu99 @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ diff --git a/elfutils/libebl/eblauxvinfo.c b/elfutils/libebl/eblauxvinfo.c index af65c47b..6e02403f 100644 --- a/elfutils/libebl/eblauxvinfo.c +++ b/elfutils/libebl/eblauxvinfo.c @@ -1,5 +1,5 @@ /* Describe known auxv types. - Copyright (C) 2007, 2008 Red Hat, Inc. + Copyright (C) 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -78,6 +78,7 @@ TYPE (EGID, "u") \ TYPE (CLKTCK, "u") \ TYPE (PLATFORM, "s") \ + TYPE (BASE_PLATFORM, "s") \ TYPE (HWCAP, "x") \ TYPE (FPUCW, "x") \ TYPE (DCACHEBSIZE, "d") \ @@ -90,7 +91,8 @@ TYPE (L1I_CACHESHAPE, "d") \ TYPE (L1D_CACHESHAPE, "d") \ TYPE (L2_CACHESHAPE, "d") \ - TYPE (L3_CACHESHAPE, "d") + TYPE (L3_CACHESHAPE, "d") \ + TYPE (RANDOM, "p") static const struct { diff --git a/elfutils/libebl/eblcorenotetypename.c b/elfutils/libebl/eblcorenotetypename.c index d01932fc..9376cf57 100644 --- a/elfutils/libebl/eblcorenotetypename.c +++ b/elfutils/libebl/eblcorenotetypename.c @@ -56,7 +56,6 @@ #include #include - const char * ebl_core_note_type_name (ebl, type, buf, len) Ebl *ebl; @@ -101,6 +100,7 @@ ebl_core_note_type_name (ebl, type, buf, len) KNOWNSTYPE (PPC_VMX); KNOWNSTYPE (PPC_SPE); KNOWNSTYPE (386_TLS); + KNOWNSTYPE (386_IOPERM); #undef KNOWNSTYPE default: diff --git a/elfutils/libebl/eblreloctypename.c b/elfutils/libebl/eblreloctypename.c index c715b064..3f2c7d9c 100644 --- a/elfutils/libebl/eblreloctypename.c +++ b/elfutils/libebl/eblreloctypename.c @@ -1,5 +1,5 @@ /* Return relocation type name. - Copyright (C) 2001, 2002 Red Hat, Inc. + Copyright (C) 2001, 2002, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2001. @@ -68,7 +68,7 @@ ebl_reloc_type_name (ebl, reloc, buf, len) res = ebl != NULL ? ebl->reloc_type_name (reloc, buf, len) : NULL; if (res == NULL) /* There are no generic relocation type names. */ - res = "???"; + res = ""; return res; } diff --git a/elfutils/libebl/eblsymboltypename.c b/elfutils/libebl/eblsymboltypename.c index c7cb2cba..6aae13ee 100644 --- a/elfutils/libebl/eblsymboltypename.c +++ b/elfutils/libebl/eblsymboltypename.c @@ -1,5 +1,5 @@ /* Return symbol type name. - Copyright (C) 2001, 2002 Red Hat, Inc. + Copyright (C) 2001, 2002, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2001. @@ -86,6 +86,8 @@ ebl_symbol_type_name (ebl, symbol, buf, len) { if (symbol >= STT_LOPROC && symbol <= STT_HIPROC) snprintf (buf, len, "LOPROC+%d", symbol - STT_LOPROC); + else if (symbol == STT_GNU_IFUNC) + return "GNU_IFUNC"; else if (symbol >= STT_LOOS && symbol <= STT_HIOS) snprintf (buf, len, "LOOS+%d", symbol - STT_LOOS); else diff --git a/elfutils/libelf/ChangeLog b/elfutils/libelf/ChangeLog index d258de8d..bfc3ee5f 100644 --- a/elfutils/libelf/ChangeLog +++ b/elfutils/libelf/ChangeLog @@ -1,3 +1,124 @@ +2009-04-14 Roland McGrath + + * elf.h: Update from glibc. + +2009-04-01 Roland McGrath + + * elf.h: Update from glibc. + +2009-02-10 Ulrich Drepper + + * elf32_updatefile.c (updatefile): For the zeroth section we still + have to copy the section header. + +2009-02-01 Ulrich Drepper + + * elf_strptr.c: Add comment re possible problem. + +2009-01-26 Ulrich Drepper + + * elf32_updatenull.c (updatenull_wrlock): Fix comment of + ELF_F_LAYOUT behaviour re section header table. + +2009-01-22 Ulrich Drepper + + * elf32_updatefile.c (__elfXX_updatemmap): Fill the gap between + sections even if only the section at the start of the gap has been + changed. + (__elfXX_updatefile): Likewise. + +2009-01-21 Ulrich Drepper + + * elf32_updatefile.c (__elfXX_updatemmap): Skip most of the loop to + handle sections for NOBITS sections. + (elfXX_updatefile): Likewise. + + * elf32_updatefile.c (__elfXX_updatemmap): When skipping non-NOBITS + sections we haven't loaded, update last_position based on scn_start, + not based on old value. Don't run the loop for the dummy section 0. + (elfXX_updatefile): Don't run the loop for the dummy section 0. + +2009-01-10 Ulrich Drepper + + * libelfP.h (_): We only have one translation domain, elfutils. + + * Makefile.am: Use USE_LOCKS instead of USE_TLS. + * elf_error.c: Always use __thread. Remove all !USE_TLS code. + +2009-01-04 Roland McGrath + + * note_xlate.h (elf_cvt_note): Don't examine a size too small to + container a note header. + +2008-12-11 Roland McGrath + + * elf32_updatefile.c (__elfw2(LIBELFBITS,updatemmap)): Handle + placement offset going backwards, for out-of-order or overlapping + (bogus) sh_offset layouts. It's a dumb use, but should not crash. + (__elfw2(LIBELFBITS,updatefile)): Likewise. + Fixes RHBZ#476136. + + * libelf.h (Elf_Data): Whitespace fix. + +2008-12-10 Roland McGrath + + * elf_getarhdr.c (elf_getarhdr): Fix missing rename in last change. + +2008-10-22 Petr Machata + + * elf_rawfile.c (elf_rawfile): Lock around elf-> references. + +2008-10-21 Petr Machata + + * libelfP.h: Rename getehdr_rdlock to getehdr_wrlock. + * elf32_getehdr.c (getehdr_rdlock): Move the code to new function + getehdr_impl and make it a wrapper. Rename to getehdr_wrlock. + (getehdr_impl): Guard elf->class init with wrlock. + (getehdr): Also make it a wrapper of getehdr_impl. + * elf32_updatenull.c (updatenull_wrlock): Call getehdr_wrlock. + +2008-10-20 Petr Machata + + * elf_getdata_rawchunk.c (elf_getdata_rawchunk): Lock around the + code that reads mutable elf state. Relock to write lock to chain + the new chunk on the elf rawchunks list. + +2008-10-20 Petr Machata + + * elf32_checksum.c (checksum): Place a lock around the code that + processes data. Make it wrlock if the code needs to xlate the + data before processing. + +2008-10-16 Petr Machata + + * elf_begin.c + (__libelf_next_arhdr): Rename to __libelf_next_arhdr_wrlock. + (dup_elf): Adjust the call. + (elf_begin): New local function lock_dup_elf. Relocks the elf if + necessary before calling dup. Call this instead of dup_elf. + * elf_getarhdr.c + (elf_getarhdr): Lock before calling __libelf_next_arhdr_wrlock. + * elf_next.c (elf_next): Likewise. + * elf_rand.c (elf_rand): Likewise. + +2008-10-14 Petr Machata + + * elf_getdata.c (__elf_getdata_rdlock): Lock before converting. + +2008-11-26 Roland McGrath + + * elf.h: Update from glibc. + +2008-10-06 Roland McGrath + + * elf_getarhdr.c (elf_getarhdr): Return NULL when passed NULL. + +2008-08-27 Roland McGrath + + * elf_begin.c (get_shnum): Avoid misaligned reads for matching endian. + + * libelfP.h [!ALLOW_UNALIGNED] (__libelf_type_align): Fix CLASS index. + 2008-08-25 Roland McGrath * Makefile.am (libelf_so_LDLIBS): New variable. @@ -32,7 +153,7 @@ * elf32_getshdr.c (__elfNN_getshdr_internal): Drop. - (load_shdr_rwlock, scn_valid): New functions, contain bits of + (load_shdr_wrlock, scn_valid): New functions, contain bits of behaviour from __elfNN_getshdr_internal. (__elfNN_getshdr_rdlock, __elfNN_getshdr_wrlock): Replacements for dropped _internal functions above. diff --git a/elfutils/libelf/Makefile.am b/elfutils/libelf/Makefile.am index 2458ecbd..84b01a86 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 Red Hat, Inc. +## Copyright (C) 1996-2006, 2007, 2008, 2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -106,7 +106,7 @@ libelf_pic_a_SOURCES = am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os) libelf_so_LDLIBS = -if USE_TLS +if USE_LOCKS libelf_so_LDLIBS += -lpthread endif diff --git a/elfutils/libelf/Makefile.in b/elfutils/libelf/Makefile.in index deb0aeb4..9ecacbdd 100644 --- a/elfutils/libelf/Makefile.in +++ b/elfutils/libelf/Makefile.in @@ -37,14 +37,15 @@ host_triplet = @host@ @BUILD_STATIC_TRUE@am__append_1 = -fpic @MUDFLAP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) @MUDFLAP_TRUE@am_libelf_pic_a_OBJECTS = -@MUDFLAP_FALSE@@USE_TLS_TRUE@am__append_2 = -lpthread +@MUDFLAP_FALSE@@USE_LOCKS_TRUE@am__append_2 = -lpthread subdir = libelf DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \ $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -226,6 +227,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -254,6 +256,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Wshadow -Werror \ @MUDFLAP_FALSE@ -Wunused -Wextra -Wformat=2 -std=gnu99 \ @MUDFLAP_FALSE@ $($(*F)_CFLAGS) diff --git a/elfutils/libelf/elf.h b/elfutils/libelf/elf.h index a4134462..062ef00f 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 + Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -459,6 +459,7 @@ typedef struct #define STT_TLS 6 /* Symbol is thread-local data object*/ #define STT_NUM 7 /* Number of defined types. */ #define STT_LOOS 10 /* Start of OS-specific */ +#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */ #define STT_HIOS 12 /* End of OS-specific */ #define STT_LOPROC 13 /* Start of processor-specific */ #define STT_HIPROC 15 /* End of processor-specific */ @@ -608,7 +609,9 @@ typedef struct #define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */ #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ +#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ +#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ /* Legal values for the note segment descriptor types for object files. */ @@ -970,6 +973,10 @@ typedef struct #define AT_SECURE 23 /* Boolean, was exec setuid-like? */ +#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/ + +#define AT_RANDOM 25 /* Address of 16 random bytes. */ + #define AT_EXECFN 31 /* Filename of executable. */ /* Pointer to the global system page used for system calls and other @@ -1239,6 +1246,7 @@ typedef struct #define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */ #define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */ #define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */ +#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */ #define R_SPARC_7 43 /* Direct 7 bit */ #define R_SPARC_5 44 /* Direct 5 bit */ #define R_SPARC_6 45 /* Direct 6 bit */ @@ -1276,8 +1284,19 @@ typedef struct #define R_SPARC_TLS_DTPOFF64 77 #define R_SPARC_TLS_TPOFF32 78 #define R_SPARC_TLS_TPOFF64 79 +#define R_SPARC_GOTDATA_HIX22 80 +#define R_SPARC_GOTDATA_LOX10 81 +#define R_SPARC_GOTDATA_OP_HIX22 82 +#define R_SPARC_GOTDATA_OP_LOX10 83 +#define R_SPARC_GOTDATA_OP 84 +#define R_SPARC_H34 85 +#define R_SPARC_SIZE32 86 +#define R_SPARC_SIZE64 87 +#define R_SPARC_GNU_VTINHERIT 250 +#define R_SPARC_GNU_VTENTRY 251 +#define R_SPARC_REV32 252 /* Keep this the last entry. */ -#define R_SPARC_NUM 80 +#define R_SPARC_NUM 253 /* For Sparc64, legal values for d_tag of Elf64_Dyn. */ @@ -1397,6 +1416,7 @@ typedef struct #define STO_MIPS_INTERNAL 0x1 #define STO_MIPS_HIDDEN 0x2 #define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_PLT 0x8 #define STO_MIPS_SC_ALIGN_UNUSED 0xff /* MIPS specific values for `st_info'. */ @@ -1543,8 +1563,10 @@ typedef struct #define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */ #define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */ #define R_MIPS_GLOB_DAT 51 +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 /* Keep this the last entry. */ -#define R_MIPS_NUM 52 +#define R_MIPS_NUM 128 /* Legal values for p_type field of Elf32_Phdr. */ @@ -1610,7 +1632,13 @@ typedef struct #define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */ #define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */ #define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */ -#define DT_MIPS_NUM 0x32 +/* The address of .got.plt in an executable using the new non-PIC ABI. */ +#define DT_MIPS_PLTGOT 0x70000032 +/* The base of the PLT in an executable using the new non-PIC ABI if that + PLT is writable. For a non-writable PLT, this is omitted or has a zero + value. */ +#define DT_MIPS_RWPLT 0x70000034 +#define DT_MIPS_NUM 0x35 /* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */ @@ -2177,42 +2205,62 @@ typedef Elf32_Addr Elf32_Conflict; /* ARM specific declarations */ /* Processor specific flags for the ELF header e_flags field. */ -#define EF_ARM_RELEXEC 0x01 -#define EF_ARM_HASENTRY 0x02 -#define EF_ARM_INTERWORK 0x04 -#define EF_ARM_APCS_26 0x08 -#define EF_ARM_APCS_FLOAT 0x10 -#define EF_ARM_PIC 0x20 -#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ -#define EF_ARM_NEW_ABI 0x80 -#define EF_ARM_OLD_ABI 0x100 +#define EF_ARM_RELEXEC 0x01 +#define EF_ARM_HASENTRY 0x02 +#define EF_ARM_INTERWORK 0x04 +#define EF_ARM_APCS_26 0x08 +#define EF_ARM_APCS_FLOAT 0x10 +#define EF_ARM_PIC 0x20 +#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */ +#define EF_ARM_NEW_ABI 0x80 +#define EF_ARM_OLD_ABI 0x100 +#define EF_ARM_SOFT_FLOAT 0x200 +#define EF_ARM_VFP_FLOAT 0x400 +#define EF_ARM_MAVERICK_FLOAT 0x800 + /* Other constants defined in the ARM ELF spec. version B-01. */ /* NB. These conflict with values defined above. */ #define EF_ARM_SYMSARESORTED 0x04 -#define EF_ARM_DYNSYMSUSESEGIDX 0x08 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08 #define EF_ARM_MAPSYMSFIRST 0x10 #define EF_ARM_EABIMASK 0XFF000000 -#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) -#define EF_ARM_EABI_UNKNOWN 0x00000000 -#define EF_ARM_EABI_VER1 0x01000000 -#define EF_ARM_EABI_VER2 0x02000000 +/* Constants defined in AAELF. */ +#define EF_ARM_BE8 0x00800000 +#define EF_ARM_LE8 0x00400000 + +#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) +#define EF_ARM_EABI_UNKNOWN 0x00000000 +#define EF_ARM_EABI_VER1 0x01000000 +#define EF_ARM_EABI_VER2 0x02000000 +#define EF_ARM_EABI_VER3 0x03000000 +#define EF_ARM_EABI_VER4 0x04000000 +#define EF_ARM_EABI_VER5 0x05000000 -/* Additional symbol types for Thumb */ -#define STT_ARM_TFUNC 0xd +/* Additional symbol types for Thumb. */ +#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */ +#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */ /* ARM-specific values for sh_flags */ -#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ -#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined - in the input to a link step */ +#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ +#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined + in the input to a link step. */ /* ARM-specific program header flags */ -#define PF_ARM_SB 0x10000000 /* Segment contains the location - addressed by the static base */ +#define PF_ARM_SB 0x10000000 /* Segment contains the location + addressed by the static base. */ +#define PF_ARM_PI 0x20000000 /* Position-independent segment. */ +#define PF_ARM_ABS 0x40000000 /* Absolute segment. */ /* Processor specific values for the Phdr p_type field. */ -#define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */ +#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */ + +/* Processor specific values for the Shdr sh_type field. */ +#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */ +#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */ +#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */ + /* ARM relocs. */ diff --git a/elfutils/libelf/elf32_checksum.c b/elfutils/libelf/elf32_checksum.c index 0e4ab9f7..32b4a02d 100644 --- a/elfutils/libelf/elf32_checksum.c +++ b/elfutils/libelf/elf32_checksum.c @@ -105,6 +105,14 @@ elfw2(LIBELFBITS,checksum) (elf) || (ident[EI_DATA] == ELFDATA2MSB && __BYTE_ORDER == __BIG_ENDIAN)); + /* If we don't have native byte order, we will likely need to + convert the data with xlate functions. We do it upfront instead + of relocking mid-iteration. */ + if (!likely (same_byte_order)) + rwlock_wrlock (elf->lock); + else + rwlock_rdlock (elf->lock); + /* Iterate over all sections to find those which are not strippable. */ scn = NULL; while ((scn = INTUSE(elf_nextscn) (elf, scn)) != NULL) @@ -118,7 +126,8 @@ elfw2(LIBELFBITS,checksum) (elf) if (shdr == NULL) { __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); - return -1l; + result = -1l; + goto out; } if (SECTION_STRIP_P (shdr, @@ -162,17 +171,25 @@ elfw2(LIBELFBITS,checksum) (elf) /* Convert the data to file byte order. */ if (INTUSE(elfw2(LIBELFBITS,xlatetof)) (data, data, ident[EI_DATA]) == NULL) - return -1l; + { + result = -1l; + goto out; + } result = process_block (result, data); /* And convert it back. */ if (INTUSE(elfw2(LIBELFBITS,xlatetom)) (data, data, ident[EI_DATA]) == NULL) - return -1l; + { + result = -1l; + goto out; + } } } + out: + rwlock_unlock (elf->lock); return result; } INTDEF(elfw2(LIBELFBITS,checksum)) diff --git a/elfutils/libelf/elf32_getehdr.c b/elfutils/libelf/elf32_getehdr.c index d62e255b..8009133b 100644 --- a/elfutils/libelf/elf32_getehdr.c +++ b/elfutils/libelf/elf32_getehdr.c @@ -62,12 +62,11 @@ #endif -ElfW2(LIBELFBITS,Ehdr) * -__elfw2(LIBELFBITS,getehdr_rdlock) (elf) +static ElfW2(LIBELFBITS,Ehdr) * +getehdr_impl (elf, wrlock) Elf *elf; + int wrlock; { - ElfW2(LIBELFBITS,Ehdr) *result; - if (elf == NULL) return NULL; @@ -77,19 +76,32 @@ __elfw2(LIBELFBITS,getehdr_rdlock) (elf) return NULL; } + again: if (elf->class == 0) - elf->class = ELFW(ELFCLASS,LIBELFBITS); + { + if (!wrlock) + { + rwlock_unlock (elf->lock); + rwlock_wrlock (elf->lock); + wrlock = 1; + goto again; + } + elf->class = ELFW(ELFCLASS,LIBELFBITS); + } else if (unlikely (elf->class != ELFW(ELFCLASS,LIBELFBITS))) { __libelf_seterrno (ELF_E_INVALID_CLASS); - result = NULL; - goto out; + return NULL; } - result = elf->state.ELFW(elf,LIBELFBITS).ehdr; + return elf->state.ELFW(elf,LIBELFBITS).ehdr; +} - out: - return result; +ElfW2(LIBELFBITS,Ehdr) * +__elfw2(LIBELFBITS,getehdr_wrlock) (elf) + Elf *elf; +{ + return getehdr_impl (elf, 1); } ElfW2(LIBELFBITS,Ehdr) * @@ -101,7 +113,7 @@ elfw2(LIBELFBITS,getehdr) (elf) return NULL; rwlock_rdlock (elf->lock); - result = __elfw2(LIBELFBITS,getehdr_rdlock) (elf); + result = getehdr_impl (elf, 0); rwlock_unlock (elf->lock); return result; diff --git a/elfutils/libelf/elf32_getshdr.c b/elfutils/libelf/elf32_getshdr.c index b36e5437..91f5b3a1 100644 --- a/elfutils/libelf/elf32_getshdr.c +++ b/elfutils/libelf/elf32_getshdr.c @@ -67,7 +67,7 @@ static ElfW2(LIBELFBITS,Shdr) * -load_shdr_rwlock (Elf_Scn *scn) +load_shdr_wrlock (Elf_Scn *scn) { ElfW2(LIBELFBITS,Shdr) *result; @@ -243,7 +243,6 @@ ElfW2(LIBELFBITS,Shdr) * __elfw2(LIBELFBITS,getshdr_rdlock) (scn) Elf_Scn *scn; { - /* XXX: no read locking here, figure out why is it not necessary. */ ElfW2(LIBELFBITS,Shdr) *result; if (!scn_valid (scn)) @@ -256,7 +255,7 @@ __elfw2(LIBELFBITS,getshdr_rdlock) (scn) rwlock_wrlock (scn->elf->lock); result = scn->shdr.ELFW(e,LIBELFBITS); if (result == NULL) - result = load_shdr_rwlock (scn); + result = load_shdr_wrlock (scn); } return result; @@ -273,7 +272,7 @@ __elfw2(LIBELFBITS,getshdr_wrlock) (scn) result = scn->shdr.ELFW(e,LIBELFBITS); if (result == NULL) - result = load_shdr_rwlock (scn); + result = load_shdr_wrlock (scn); return result; } diff --git a/elfutils/libelf/elf32_updatefile.c b/elfutils/libelf/elf32_updatefile.c index e94de831..a4d83a1c 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 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2000. @@ -126,11 +126,10 @@ int internal_function __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) { - ElfW2(LIBELFBITS,Ehdr) *ehdr; - char *last_position; + bool previous_scn_changed = false; /* We need the ELF header several times. */ - ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; + ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; /* Write out the ELF header. */ if ((elf->state.ELFW(elf,LIBELFBITS).ehdr_flags | elf->flags) & ELF_F_DIRTY) @@ -160,6 +159,10 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) sizeof (ElfW2(LIBELFBITS,Ehdr))); elf->state.ELFW(elf,LIBELFBITS).ehdr_flags &= ~ELF_F_DIRTY; + + /* We start writing sections after the ELF header only if there is + no program header. */ + previous_scn_changed = elf->state.ELFW(elf,LIBELFBITS).phdr == NULL; } /* Write out the program header table. */ @@ -200,14 +203,19 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum); elf->state.ELFW(elf,LIBELFBITS).phdr_flags &= ~ELF_F_DIRTY; + + /* We modified the program header. Maybe this created a gap so + we have to write fill bytes, if necessary. */ + previous_scn_changed = true; } /* From now on we have to keep track of the last position to eventually fill the gaps with the prescribed fill byte. */ - 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)); + 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)); /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) @@ -283,45 +291,64 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) for (size_t cnt = 0; cnt < shnum; ++cnt) { Elf_Scn *scn = scns[cnt]; + if (scn->index == 0) + { + /* The dummy section header entry. It should not be + possible to mark this "section" as dirty. */ + assert ((scn->flags & ELF_F_DIRTY) == 0); + continue; + } ElfW2(LIBELFBITS,Shdr) *shdr = scn->shdr.ELFW(e,LIBELFBITS); + if (shdr->sh_type == SHT_NOBITS) + goto next; char *scn_start = ((char *) elf->map_address + elf->start_offset + shdr->sh_offset); Elf_Data_List *dl = &scn->data_list; + bool scn_changed = false; - if (shdr->sh_type != SHT_NOBITS && scn->data_list_rear != NULL) - do + void fill_mmap (size_t offset) + { + size_t written = 0; + + if (last_position < shdr_start) { - if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY) - { - if (scn_start + dl->data.d.d_off != last_position) - { - if (scn_start + dl->data.d.d_off > last_position) - { - /* This code assumes that the data blocks for - a section are ordered by offset. */ - size_t written = 0; + written = MIN (scn_start + offset - last_position, + shdr_start - last_position); - if (last_position < shdr_start) - { - written = MIN (scn_start + dl->data.d.d_off - - last_position, - shdr_start - last_position); + memset (last_position, __libelf_fill_byte, written); + } - memset (last_position, __libelf_fill_byte, - written); - } + if (last_position + written != scn_start + offset + && shdr_end < scn_start + offset) + memset (shdr_end, __libelf_fill_byte, + scn_start + offset - shdr_end); + } - if (last_position + written - != scn_start + dl->data.d.d_off - && shdr_end < scn_start + dl->data.d.d_off) - memset (shdr_end, __libelf_fill_byte, - scn_start + dl->data.d.d_off - shdr_end); + if (scn->data_list_rear != NULL) + do + { + assert (dl->data.d.d_off >= 0); + assert ((GElf_Off) dl->data.d.d_off <= shdr->sh_size); + assert (dl->data.d.d_size <= (shdr->sh_size + - (GElf_Off) dl->data.d.d_off)); + + /* If there is a gap, fill it. */ + if (scn_start + dl->data.d.d_off > last_position + && ((previous_scn_changed && dl->data.d.d_off == 0) + || ((scn->flags | dl->flags | elf->flags) + & ELF_F_DIRTY) != 0)) + fill_mmap (dl->data.d.d_off); - last_position = scn_start + dl->data.d.d_off; - } - } + if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY) + { + /* Let it go backward if the sections use a bogus + layout with overlaps. We'll overwrite the stupid + user's section data with the latest one, rather than + crashing. */ + + last_position = scn_start + dl->data.d.d_off; if (unlikely (change_bo)) { @@ -343,19 +370,34 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum) last_position = mempcpy (last_position, dl->data.d.d_buf, dl->data.d.d_size); + + scn_changed = true; } else last_position += dl->data.d.d_size; + assert (scn_start + dl->data.d.d_off + dl->data.d.d_size + == last_position); + dl->flags &= ~ELF_F_DIRTY; dl = dl->next; } while (dl != NULL); - else if (shdr->sh_type != SHT_NOBITS && scn->index != 0) - /* We have to trust the existing section header information. */ - last_position += shdr->sh_size; + else + { + /* If the previous section (or the ELF/program + header) changed we might have to fill the gap. */ + if (scn_start > last_position && previous_scn_changed) + fill_mmap (0); + + /* We have to trust the existing section header information. */ + last_position = scn_start + shdr->sh_size; + } + + previous_scn_changed = scn_changed; + next: scn->flags &= ~ELF_F_DIRTY; } @@ -460,6 +502,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) { char fillbuf[FILLBUFSIZE]; size_t filled = 0; + bool previous_scn_changed = false; /* We need the ELF header several times. */ ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; @@ -503,6 +546,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) } elf->state.ELFW(elf,LIBELFBITS).ehdr_flags &= ~ELF_F_DIRTY; + + /* We start writing sections after the ELF header only if there is + no program header. */ + previous_scn_changed = elf->state.ELFW(elf,LIBELFBITS).phdr == NULL; } /* If the type sizes should be different at some time we have to @@ -568,6 +615,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) free (tmp_phdr); elf->state.ELFW(elf,LIBELFBITS).phdr_flags &= ~ELF_F_DIRTY; + + /* We modified the program header. Maybe this created a gap so + we have to write fill bytes, if necessary. */ + previous_scn_changed = true; } /* From now on we have to keep track of the last position to eventually @@ -606,33 +657,49 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) for (size_t cnt = 0; cnt < shnum; ++cnt) { Elf_Scn *scn = scns[cnt]; + if (scn->index == 0) + { + /* The dummy section header entry. It should not be + possible to mark this "section" as dirty. */ + assert ((scn->flags & ELF_F_DIRTY) == 0); + goto next; + } ElfW2(LIBELFBITS,Shdr) *shdr = scn->shdr.ELFW(e,LIBELFBITS); + if (shdr->sh_type == SHT_NOBITS) + goto next; off_t scn_start = elf->start_offset + shdr->sh_offset; Elf_Data_List *dl = &scn->data_list; + bool scn_changed = false; - if (shdr->sh_type != SHT_NOBITS && scn->data_list_rear != NULL - && scn->index != 0) + if (scn->data_list_rear != NULL) do { + /* If there is a gap, fill it. */ + if (scn_start + dl->data.d.d_off > last_offset + && ((previous_scn_changed && dl->data.d.d_off == 0) + || ((scn->flags | dl->flags | elf->flags) + & ELF_F_DIRTY) != 0)) + { + if (unlikely (fill (elf->fildes, last_offset, + (scn_start + dl->data.d.d_off) + - last_offset, fillbuf, + &filled) != 0)) + return 1; + } + if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY) { char tmpbuf[MAX_TMPBUF]; void *buf = dl->data.d.d_buf; - if (scn_start + dl->data.d.d_off != last_offset) - { - assert (last_offset < scn_start + dl->data.d.d_off); + /* Let it go backward if the sections use a bogus + layout with overlaps. We'll overwrite the stupid + user's section data with the latest one, rather than + crashing. */ - if (unlikely (fill (elf->fildes, last_offset, - (scn_start + dl->data.d.d_off) - - last_offset, fillbuf, - &filled) != 0)) - return 1; - - last_offset = scn_start + dl->data.d.d_off; - } + last_offset = scn_start + dl->data.d.d_off; if (unlikely (change_bo)) { @@ -673,6 +740,8 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) if (buf != dl->data.d.d_buf && buf != tmpbuf) free (buf); + + scn_changed = true; } last_offset += dl->data.d.d_size; @@ -682,9 +751,23 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum) dl = dl->next; } while (dl != NULL); - else if (shdr->sh_type != SHT_NOBITS && scn->index != 0) - last_offset = scn_start + shdr->sh_size; + else + { + /* If the previous section (or the ELF/program + header) changed we might have to fill the gap. */ + if (scn_start > last_offset && previous_scn_changed) + { + if (unlikely (fill (elf->fildes, last_offset, + scn_start - last_offset, fillbuf, + &filled) != 0)) + return 1; + } + + last_offset = scn_start + shdr->sh_size; + } + previous_scn_changed = scn_changed; + next: /* Collect the section header table information. */ if (unlikely (change_bo)) (*shdr_fctp) (&shdr_data[scn->index], diff --git a/elfutils/libelf/elf32_updatenull.c b/elfutils/libelf/elf32_updatenull.c index ae8696e7..5ce8bbc9 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 Red Hat, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2000. @@ -139,7 +139,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) int changed = 0; int ehdr_flags = 0; - ehdr = __elfw2(LIBELFBITS,getehdr_rdlock) (elf); + ehdr = __elfw2(LIBELFBITS,getehdr_wrlock) (elf); /* Set the default values. */ if (ELFW(default_ehdr,LIBELFBITS) (elf, ehdr, shnum, change_bop) != 0) @@ -401,8 +401,9 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) /* Store section information. */ 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. */ + /* The user is supposed to fill out e_shoff. Use it and + e_shnum (or sh_size of the dummy, first section header) + to determine the maximum extend. */ size = MAX ((GElf_Word) size, (ehdr->e_shoff + (elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum)))); diff --git a/elfutils/libelf/elf_begin.c b/elfutils/libelf/elf_begin.c index b95b06bf..04670a45 100644 --- a/elfutils/libelf/elf_begin.c +++ b/elfutils/libelf/elf_begin.c @@ -111,7 +111,11 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, bool is32 = e_ident[EI_CLASS] == ELFCLASS32; /* Make the ELF header available. */ - if (e_ident[EI_DATA] == MY_ELFDATA) + if (e_ident[EI_DATA] == MY_ELFDATA + && (ALLOW_UNALIGNED + || (((size_t) e_ident + & ((is32 ? __alignof__ (Elf32_Ehdr) : __alignof__ (Elf64_Ehdr)) + - 1)) == 0))) ehdr.p = e_ident; else { @@ -130,8 +134,11 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, else memcpy (&ehdr_mem, e_ident, sizeof (Elf32_Ehdr)); - CONVERT (ehdr_mem.e32.e_shnum); - CONVERT (ehdr_mem.e32.e_shoff); + if (e_ident[EI_DATA] != MY_ELFDATA) + { + CONVERT (ehdr_mem.e32.e_shnum); + CONVERT (ehdr_mem.e32.e_shoff); + } } else { @@ -143,8 +150,11 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, else memcpy (&ehdr_mem, e_ident, sizeof (Elf64_Ehdr)); - CONVERT (ehdr_mem.e64.e_shnum); - CONVERT (ehdr_mem.e64.e_shoff); + if (e_ident[EI_DATA] != MY_ELFDATA) + { + CONVERT (ehdr_mem.e64.e_shnum); + CONVERT (ehdr_mem.e64.e_shoff); + } } } @@ -740,7 +750,7 @@ read_long_names (Elf *elf) /* Read the next archive header. */ int internal_function -__libelf_next_arhdr (elf) +__libelf_next_arhdr_wrlock (elf) Elf *elf; { struct ar_hdr *ar_hdr; @@ -939,7 +949,7 @@ dup_elf (int fildes, Elf_Cmd cmd, Elf *ref) pointing to. First read the header of the next member if this has not happened already. */ if (ref->state.ar.elf_ar_hdr.ar_name == NULL - && __libelf_next_arhdr (ref) != 0) + && __libelf_next_arhdr_wrlock (ref) != 0) /* Something went wrong. Maybe there is no member left. */ return NULL; @@ -1013,6 +1023,19 @@ elf_begin (fildes, cmd, ref) return NULL; } + Elf *lock_dup_elf () + { + /* We need wrlock to dup an archive. */ + if (ref->kind == ELF_K_AR) + { + rwlock_unlock (ref->lock); + rwlock_wrlock (ref->lock); + } + + /* Duplicate the descriptor. */ + return dup_elf (fildes, cmd, ref); + } + switch (cmd) { case ELF_C_NULL: @@ -1033,8 +1056,7 @@ elf_begin (fildes, cmd, ref) case ELF_C_READ: case ELF_C_READ_MMAP: if (ref != NULL) - /* Duplicate the descriptor. */ - retval = dup_elf (fildes, cmd, ref); + retval = lock_dup_elf (); else /* Create descriptor for existing file. */ retval = read_file (fildes, 0, ~((size_t) 0), cmd, NULL); @@ -1055,8 +1077,7 @@ elf_begin (fildes, cmd, ref) retval = NULL; } else - /* Duplicate this descriptor. */ - retval = dup_elf (fildes, cmd, ref); + retval = lock_dup_elf (); } else /* Create descriptor for existing file. */ diff --git a/elfutils/libelf/elf_error.c b/elfutils/libelf/elf_error.c index 5e00372a..dc587828 100644 --- a/elfutils/libelf/elf_error.c +++ b/elfutils/libelf/elf_error.c @@ -1,5 +1,5 @@ /* Error handling in libelf. - Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc. + Copyright (C) 1998,1999,2000,2002,2003,2004,2005,2006,2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 1998. @@ -61,46 +61,14 @@ #include "libelfP.h" -#ifdef USE_TLS /* The error number. */ static __thread int global_error; -#else -/* This is the key for the thread specific memory. */ -static tls_key_t key; - -/* The error number. Used in non-threaded programs. */ -static int global_error; -static bool threaded; -/* We need to initialize the thread-specific data. */ -once_define (static, once); - -/* The initialization and destruction functions. */ -static void init (void); -static void free_key_mem (void *mem); -#endif /* TLS */ int elf_errno (void) { - int result; - -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - { - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - result = (intptr_t) getspecific (key); - - setspecific (key, (void *) (intptr_t) ELF_E_NOERROR); - return result; - } -#endif /* TLS */ - - result = global_error; + int result = global_error; global_error = ELF_E_NOERROR; return result; } @@ -339,16 +307,6 @@ void __libelf_seterrno (value) int value; { -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if (threaded) - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - setspecific (key, (void *) (intptr_t) value); -#endif /* TLS */ - global_error = value >= 0 && value < nmsgidx ? value : ELF_E_UNKNOWN_ERROR; } @@ -357,19 +315,7 @@ const char * elf_errmsg (error) int error; { - int last_error; - -#ifndef USE_TLS - /* If we have not yet initialized the buffer do it now. */ - once_execute (once, init); - - if ((error == 0 || error == -1) && threaded) - /* We do not allocate memory for the data. It is only a word. - We can store it in place of the pointer. */ - last_error = (intptr_t) getspecific (key); - else -#endif /* TLS */ - last_error = global_error; + int last_error = global_error; if (error == 0) { @@ -382,26 +328,3 @@ elf_errmsg (error) assert (msgidx[error == -1 ? last_error : error] < sizeof (msgstr)); return _(msgstr + msgidx[error == -1 ? last_error : error]); } - - -#ifndef USE_TLS -/* Free the thread specific data, this is done if a thread terminates. */ -static void -free_key_mem (void *mem __attribute__ ((unused))) -{ - setspecific (key, NULL); -} - - -/* Initialize the key for the global variable. */ -static void -init (void) -{ - // XXX Screw you, gcc4, the unused function attribute does not work. - __asm ("" :: "r" (free_key_mem)); - - if (key_create (&key, free_key_mem) == 0) - /* Creating the key succeeded. */ - threaded = true; -} -#endif /* TLS */ diff --git a/elfutils/libelf/elf_getarhdr.c b/elfutils/libelf/elf_getarhdr.c index deeb56db..61e4e0a2 100644 --- a/elfutils/libelf/elf_getarhdr.c +++ b/elfutils/libelf/elf_getarhdr.c @@ -1,5 +1,5 @@ /* Read header of next archive member. - Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 1998. @@ -63,6 +63,9 @@ Elf_Arhdr * elf_getarhdr (elf) Elf *elf; { + if (elf == NULL) + return NULL; + Elf *parent = elf->parent; /* Calling this function is not ok for any file type but archives. */ @@ -74,10 +77,16 @@ elf_getarhdr (elf) /* Make sure we have read the archive header. */ if (parent->state.ar.elf_ar_hdr.ar_name == NULL - && __libelf_next_arhdr (parent) != 0) - /* Something went wrong. Maybe there is no member left. */ - return NULL; + && __libelf_next_arhdr_wrlock (parent) != 0) + { + rwlock_wrlock (parent->lock); + int st = __libelf_next_arhdr_wrlock (parent); + rwlock_unlock (parent->lock); + if (st != 0) + /* Something went wrong. Maybe there is no member left. */ + return NULL; + } /* We can be sure the parent is an archive. */ assert (parent->kind == ELF_K_AR); diff --git a/elfutils/libelf/elf_getdata.c b/elfutils/libelf/elf_getdata.c index 216905a6..e083b033 100644 --- a/elfutils/libelf/elf_getdata.c +++ b/elfutils/libelf/elf_getdata.c @@ -364,6 +364,7 @@ __elf_getdata_rdlock (scn, data) { Elf_Data *result = NULL; Elf *elf; + int locked = 0; if (scn == NULL) return NULL; @@ -431,6 +432,7 @@ __elf_getdata_rdlock (scn, data) modified, therefore start the tests again. */ rwlock_unlock (elf->lock); rwlock_wrlock (elf->lock); + locked = 1; /* Read the data from the file. There is always a file (or memory region) associated with this descriptor since @@ -446,14 +448,24 @@ __elf_getdata_rdlock (scn, data) if (scn->data_list_rear == NULL) { if (scn->rawdata.d.d_buf != NULL && scn->rawdata.d.d_size > 0) - /* Convert according to the version and the type. */ - convert_data (scn, __libelf_version, elf->class, - (elf->class == ELFCLASS32 - || (offsetof (struct Elf, state.elf32.ehdr) - == offsetof (struct Elf, state.elf64.ehdr)) - ? elf->state.elf32.ehdr->e_ident[EI_DATA] - : elf->state.elf64.ehdr->e_ident[EI_DATA]), - scn->rawdata.d.d_size, scn->rawdata.d.d_type); + { + if (!locked) + { + rwlock_unlock (elf->lock); + rwlock_wrlock (elf->lock); + if (scn->data_list_rear != NULL) + goto pass; + } + + /* Convert according to the version and the type. */ + convert_data (scn, __libelf_version, elf->class, + (elf->class == ELFCLASS32 + || (offsetof (struct Elf, state.elf32.ehdr) + == offsetof (struct Elf, state.elf64.ehdr)) + ? elf->state.elf32.ehdr->e_ident[EI_DATA] + : elf->state.elf64.ehdr->e_ident[EI_DATA]), + scn->rawdata.d.d_size, scn->rawdata.d.d_type); + } else /* This is an empty or NOBITS section. There is no buffer but the size information etc is important. */ @@ -464,6 +476,7 @@ __elf_getdata_rdlock (scn, data) /* If no data is present we cannot return any. */ if (scn->data_list_rear != NULL) + pass: /* Return the first data element in the list. */ result = &scn->data_list.data.d; diff --git a/elfutils/libelf/elf_getdata_rawchunk.c b/elfutils/libelf/elf_getdata_rawchunk.c index bea0f3f6..5af0f7f3 100644 --- a/elfutils/libelf/elf_getdata_rawchunk.c +++ b/elfutils/libelf/elf_getdata_rawchunk.c @@ -95,6 +95,9 @@ elf_getdata_rawchunk (elf, offset, size, type) /* Get the raw bytes from the file. */ void *rawchunk; int flags = 0; + Elf_Data *result = NULL; + + rwlock_rdlock (elf->lock); /* If the file is mmap'ed we can use it directly. */ if (elf->map_address != NULL) @@ -107,7 +110,7 @@ elf_getdata_rawchunk (elf, offset, size, type) { nomem: __libelf_seterrno (ELF_E_NOMEM); - return NULL; + goto out; } /* Read the file content. */ @@ -118,7 +121,7 @@ elf_getdata_rawchunk (elf, offset, size, type) /* Something went wrong. */ free (rawchunk); __libelf_seterrno (ELF_E_READ_ERROR); - return NULL; + goto out; } flags = ELF_F_MALLOCED; @@ -181,8 +184,14 @@ elf_getdata_rawchunk (elf, offset, size, type) chunk->data.d.d_align = align; chunk->data.d.d_version = __libelf_version; + rwlock_unlock (elf->lock); + rwlock_wrlock (elf->lock); + chunk->next = elf->state.elf.rawchunks; elf->state.elf.rawchunks = chunk; + result = &chunk->data.d; - return &chunk->data.d; + out: + rwlock_unlock (elf->lock); + return result; } diff --git a/elfutils/libelf/elf_next.c b/elfutils/libelf/elf_next.c index ec80fadf..fbfb2721 100644 --- a/elfutils/libelf/elf_next.c +++ b/elfutils/libelf/elf_next.c @@ -64,6 +64,7 @@ elf_next (elf) Elf *elf; { Elf *parent; + Elf_Cmd ret; /* Be gratious, the specs demand it. */ if (elf == NULL || elf->parent == NULL) @@ -73,14 +74,17 @@ elf_next (elf) parent = elf->parent; assert (parent->kind == ELF_K_AR); + rwlock_wrlock (parent->lock); + /* Now advance the offset. */ parent->state.ar.offset += (sizeof (struct ar_hdr) + ((parent->state.ar.elf_ar_hdr.ar_size + 1) & ~1l)); /* Get the next archive header. */ - if (__libelf_next_arhdr (parent) != 0) - return ELF_C_NULL; + ret = __libelf_next_arhdr_wrlock (parent) != 0 ? ELF_C_NULL : elf->cmd; + + rwlock_unlock (parent->lock); - return elf->cmd; + return ret; } diff --git a/elfutils/libelf/elf_rand.c b/elfutils/libelf/elf_rand.c index 9ba631ff..a766d38f 100644 --- a/elfutils/libelf/elf_rand.c +++ b/elfutils/libelf/elf_rand.c @@ -67,16 +67,20 @@ elf_rand (elf, offset) if (elf == NULL || elf->kind != ELF_K_AR) return 0; + rwlock_wrlock (elf->lock); + /* Save the old offset and set the offset. */ elf->state.ar.offset = elf->start_offset + offset; /* Get the next archive header. */ - if (__libelf_next_arhdr (elf) != 0) + if (__libelf_next_arhdr_wrlock (elf) != 0) { /* Mark the archive header as unusable. */ elf->state.ar.elf_ar_hdr.ar_name = NULL; return 0; } + rwlock_unlock (elf->lock); + return offset; } diff --git a/elfutils/libelf/elf_rawfile.c b/elfutils/libelf/elf_rawfile.c index a1c6a1d2..a62a3549 100644 --- a/elfutils/libelf/elf_rawfile.c +++ b/elfutils/libelf/elf_rawfile.c @@ -63,6 +63,8 @@ elf_rawfile (elf, ptr) Elf *elf; size_t *ptr; { + char *result; + if (elf == NULL) { /* No valid descriptor. */ @@ -77,8 +79,12 @@ elf_rawfile (elf, ptr) if (elf->map_address == NULL && __libelf_readall (elf) == NULL) goto error_out; + rwlock_rdlock (elf->lock); if (ptr != NULL) *ptr = elf->maximum_size; - return (char *) elf->map_address + elf->start_offset; + result = (char *) elf->map_address + elf->start_offset; + rwlock_unlock (elf->lock); + + return result; } diff --git a/elfutils/libelf/elf_strptr.c b/elfutils/libelf/elf_strptr.c index 35a0e9b6..7b837b09 100644 --- a/elfutils/libelf/elf_strptr.c +++ b/elfutils/libelf/elf_strptr.c @@ -1,5 +1,5 @@ /* Return string pointer from string section. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2008 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Contributed by Ulrich Drepper , 1998. @@ -151,6 +151,10 @@ elf_strptr (elf, idx, offset) } if (likely (strscn->rawdata_base != NULL)) + // XXX Is this correct if a file is read and then new data is added + // XXX to the string section? Likely needs to check offset against + // XXX size of rawdata_base buffer and then iterate over rest of the + // XXX list. result = &strscn->rawdata_base[offset]; else { diff --git a/elfutils/libelf/libelf.h b/elfutils/libelf/libelf.h index 54271228..dea0d838 100644 --- a/elfutils/libelf/libelf.h +++ b/elfutils/libelf/libelf.h @@ -95,7 +95,7 @@ typedef struct Elf_Type d_type; /* Type of this piece of data. */ unsigned int d_version; /* ELF version. */ size_t d_size; /* Size in bytes. */ - loff_t d_off; /* Offset into section. */ + loff_t d_off; /* Offset into section. */ size_t d_align; /* Alignment in section. */ } Elf_Data; diff --git a/elfutils/libelf/libelfP.h b/elfutils/libelf/libelfP.h index 1dc331fc..818f42ac 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 Red Hat, Inc. + Copyright (C) 1998-2003, 2005, 2006, 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Contributed by Ulrich Drepper , 1998. @@ -64,7 +64,7 @@ #include /* gettext helper macros. */ -#define _(Str) dgettext ("libelf", Str) +#define _(Str) dgettext ("elfutils", Str) /* Helper Macros to write 32 bit and 64 bit functions. */ @@ -460,7 +460,7 @@ extern int __libelf_version_initialized attribute_hidden; version, binary class, and type. */ extern const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] attribute_hidden; # define __libelf_type_align(class, type) \ - (__libelf_type_aligns[LIBELF_EV_IDX][class][type] ?: 1) + (__libelf_type_aligns[LIBELF_EV_IDX][class - 1][type] ?: 1) #else # define __libelf_type_align(class, type) 1 #endif @@ -486,7 +486,7 @@ extern Elf *__libelf_read_mmaped_file (int fildes, void *map_address, extern void __libelf_seterrno (int value) internal_function; /* Get the next archive header. */ -extern int __libelf_next_arhdr (Elf *elf) internal_function; +extern int __libelf_next_arhdr_wrlock (Elf *elf) internal_function; /* Read all of the file associated with the descriptor. */ extern char *__libelf_readall (Elf *elf) internal_function; @@ -520,8 +520,8 @@ extern int __elf64_updatefile (Elf *elf, int change_bo, size_t shnum) extern int __elf_end_internal (Elf *__elf) attribute_hidden; extern Elf *__elf_begin_internal (int __fildes, Elf_Cmd __cmd, Elf *__ref) attribute_hidden; -extern Elf32_Ehdr *__elf32_getehdr_rdlock (Elf *__elf) internal_function; -extern Elf64_Ehdr *__elf64_getehdr_rdlock (Elf *__elf) internal_function; +extern Elf32_Ehdr *__elf32_getehdr_wrlock (Elf *__elf) internal_function; +extern Elf64_Ehdr *__elf64_getehdr_wrlock (Elf *__elf) internal_function; extern Elf32_Ehdr *__elf32_newehdr_internal (Elf *__elf) attribute_hidden; extern Elf64_Ehdr *__elf64_newehdr_internal (Elf *__elf) attribute_hidden; extern Elf32_Phdr *__elf32_getphdr_internal (Elf *__elf) attribute_hidden; diff --git a/elfutils/libelf/note_xlate.h b/elfutils/libelf/note_xlate.h index 6e8b78c6..a72fe868 100644 --- a/elfutils/libelf/note_xlate.h +++ b/elfutils/libelf/note_xlate.h @@ -1,5 +1,5 @@ /* Conversion functions for notes. - Copyright (C) 2007 Red Hat, Inc. + Copyright (C) 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -52,7 +52,7 @@ elf_cvt_note (void *dest, const void *src, size_t len, int encode) { assert (sizeof (Elf32_Nhdr) == sizeof (Elf64_Nhdr)); - while (len > 0) + while (len >= sizeof (Elf32_Nhdr)) { (1 ? Elf32_cvt_Nhdr : Elf64_cvt_Nhdr) (dest, src, sizeof (Elf32_Nhdr), encode); diff --git a/elfutils/m4/ChangeLog b/elfutils/m4/ChangeLog index e285a0e4..25675634 100644 --- a/elfutils/m4/ChangeLog +++ b/elfutils/m4/ChangeLog @@ -1,3 +1,12 @@ +2009-02-01 Roland McGrath + + * zip.m4: Fix --with/--without argument handling. + +2009-01-08 Roland McGrath + + * zip.am: New file. + * Makefile.am (EXTRA_DIST): Add it. + 2007-06-05 Ulrich Drepper * gettext.m4: Update from gettext 0.16.1. diff --git a/elfutils/m4/Makefile.am b/elfutils/m4/Makefile.am index dd955e68..156010c7 100644 --- a/elfutils/m4/Makefile.am +++ b/elfutils/m4/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- ## -## Copyright (C) 2000, 2001, 2002, 2004, 2005 Red Hat, Inc. +## Copyright (C) 2000-2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -26,4 +26,4 @@ ## ##m4-files-begin -EXTRA_DIST = codeset.m4 gettext.m4 iconv.m4 lcmessage.m4 progtest.m4 +EXTRA_DIST = codeset.m4 gettext.m4 iconv.m4 lcmessage.m4 progtest.m4 zip.m4 diff --git a/elfutils/m4/Makefile.in b/elfutils/m4/Makefile.in index 41f8188c..fc259c9a 100644 --- a/elfutils/m4/Makefile.in +++ b/elfutils/m4/Makefile.in @@ -35,7 +35,8 @@ subdir = m4 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -126,6 +127,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -154,7 +156,8 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXTRA_DIST = codeset.m4 gettext.m4 iconv.m4 lcmessage.m4 progtest.m4 +zip_LIBS = @zip_LIBS@ +EXTRA_DIST = codeset.m4 gettext.m4 iconv.m4 lcmessage.m4 progtest.m4 zip.m4 all: all-am .SUFFIXES: diff --git a/elfutils/m4/zip.m4 b/elfutils/m4/zip.m4 new file mode 100644 index 00000000..19fa4926 --- /dev/null +++ b/elfutils/m4/zip.m4 @@ -0,0 +1,18 @@ +dnl -*- Autoconf -*- test for either zlib or bzlib. +dnl Defines --with-$1lib argument, $2LIB automake conditional, +dnl and sets AC_DEFINE(USE_$2LIB) and LIBS. + +AC_DEFUN([eu_ZIPLIB], [dnl +AC_ARG_WITH([[$1]lib], +AC_HELP_STRING([--with-[$1]lib], [support g[$1]ip compression in libdwfl]),, + [with_[$1]lib=default]) +if test $with_[$1]lib != no; then + AC_SEARCH_LIBS([$4], [$3], [with_[$1]lib=yes], + [test $with_[$1]lib = default || + AC_MSG_ERROR([missing -l[$3] for --with-[$1]lib])]) +fi +AM_CONDITIONAL([$2]LIB, test $with_[$1]lib = yes) +if test $with_[$1]lib = yes; then + AC_DEFINE(USE_[$2]LIB) +fi +AH_TEMPLATE(USE_[$2]LIB, [Support $5 decompression via -l$3.])]) diff --git a/elfutils/po/ChangeLog b/elfutils/po/ChangeLog index bbb72fad..1e103201 100644 --- a/elfutils/po/ChangeLog +++ b/elfutils/po/ChangeLog @@ -1,3 +1,9 @@ +2009-01-23 Ulrich Drepper + + * Makevars (XGETTEXT_OPTIONS): Add --flag option for argp_error. + + * POTFILES.in: Add more files with translatable strings. + 2007-06-05 Ulrich Drepper * Makefile.in.in: Update from gettext 0.16.1. diff --git a/elfutils/po/Makevars b/elfutils/po/Makevars index b8ea7022..8a8ebc60 100644 --- a/elfutils/po/Makevars +++ b/elfutils/po/Makevars @@ -9,7 +9,7 @@ top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --flag=error:3:c-format \ - --flag=ERROR:1:c-format + --flag=ERROR:1:c-format --flag=argp_error:2:c-format # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding diff --git a/elfutils/po/POTFILES.in b/elfutils/po/POTFILES.in index e3a192be..5ac4cdea 100644 --- a/elfutils/po/POTFILES.in +++ b/elfutils/po/POTFILES.in @@ -1,5 +1,5 @@ # List of files which containing translatable strings. -# Copyright (C) 2000, 2005 Red Hat, Inc. +# Copyright (C) 2000, 2005, 2009 Red Hat, Inc. # Files from the compatibility library lib/xmalloc.c @@ -10,14 +10,30 @@ lib/xstrndup.c libelf/elf_error.c libasm/asm_error.c libdw/dwarf_error.c +libdwfl/argp-std.c +libebl/eblbackendname.c +libebl/eblcorenotetypename.c +libebl/ebldynamictagname.c +libebl/eblobjecttypename.c +libebl/eblobjnote.c +libebl/eblobjnotetypename.c +libebl/eblosabiname.c +libebl/eblsectionname.c +libebl/eblsectiontypename.c +libebl/eblsegmenttypename.c +libebl/eblsymbolbindingname.c +libebl/eblsymboltypename.c # Program sources +src/ar.c +src/arlib.c src/nm.c src/readelf.c src/size.c src/strip.c src/ld.c src/ldgeneric.c +src/i386_ld.c src/ldscript.y src/elflint.c src/addr2line.c @@ -25,3 +41,5 @@ src/findtextrel.c src/elfcmp.c src/ranlib.c src/strings.c +src/unstrip.c +src/objdump.c diff --git a/elfutils/po/elfutils.pot b/elfutils/po/elfutils.pot index c4b159c1..077b6079 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: 2008-08-25 19:48-0700\n" +"POT-Creation-Date: 2009-04-23 08:19-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,331 +17,698 @@ 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:2678 -#: src/readelf.c:3013 +#: lib/xmalloc.c:51 lib/xmalloc.c:65 lib/xmalloc.c:79 src/readelf.c:2703 +#: src/readelf.c:3041 src/unstrip.c:2086 src/unstrip.c:2294 #, c-format msgid "memory exhausted" msgstr "" -#: libelf/elf_error.c:113 libasm/asm_error.c:120 libdw/dwarf_error.c:111 +#: libelf/elf_error.c:81 libasm/asm_error.c:62 libdw/dwarf_error.c:79 msgid "no error" msgstr "" -#: libelf/elf_error.c:116 libasm/asm_error.c:163 libdw/dwarf_error.c:112 +#: libelf/elf_error.c:84 libasm/asm_error.c:81 libdw/dwarf_error.c:80 msgid "unknown error" msgstr "" -#: libelf/elf_error.c:120 +#: libelf/elf_error.c:88 msgid "unknown version" msgstr "" -#: libelf/elf_error.c:124 +#: libelf/elf_error.c:92 msgid "unknown type" msgstr "" -#: libelf/elf_error.c:128 +#: libelf/elf_error.c:96 msgid "invalid `Elf' handle" msgstr "" -#: libelf/elf_error.c:132 +#: libelf/elf_error.c:100 msgid "invalid size of source operand" msgstr "" -#: libelf/elf_error.c:136 +#: libelf/elf_error.c:104 msgid "invalid size of destination operand" msgstr "" -#: libelf/elf_error.c:140 +#: libelf/elf_error.c:108 src/readelf.c:4592 +#, c-format msgid "invalid encoding" msgstr "" -#: libelf/elf_error.c:144 libasm/asm_error.c:121 libdw/dwarf_error.c:120 +#: libelf/elf_error.c:112 libasm/asm_error.c:63 libdw/dwarf_error.c:88 msgid "out of memory" msgstr "" -#: libelf/elf_error.c:148 +#: libelf/elf_error.c:116 msgid "invalid file descriptor" msgstr "" -#: libelf/elf_error.c:152 +#: libelf/elf_error.c:120 msgid "invalid operation" msgstr "" -#: libelf/elf_error.c:156 +#: libelf/elf_error.c:124 msgid "ELF version not set" msgstr "" -#: libelf/elf_error.c:160 libelf/elf_error.c:208 libdw/dwarf_error.c:122 +#: libelf/elf_error.c:128 libelf/elf_error.c:176 libdw/dwarf_error.c:90 msgid "invalid command" msgstr "" -#: libelf/elf_error.c:164 libelf/elf_error.c:224 +#: libelf/elf_error.c:132 libelf/elf_error.c:192 msgid "offset out of range" msgstr "" -#: libelf/elf_error.c:168 +#: libelf/elf_error.c:136 msgid "invalid fmag field in archive header" msgstr "" -#: libelf/elf_error.c:172 +#: libelf/elf_error.c:140 msgid "invalid archive file" msgstr "" -#: libelf/elf_error.c:176 +#: libelf/elf_error.c:144 msgid "descriptor is not for an archive" msgstr "" -#: libelf/elf_error.c:180 +#: libelf/elf_error.c:148 msgid "no index available" msgstr "" -#: libelf/elf_error.c:184 +#: libelf/elf_error.c:152 msgid "cannot read data from file" msgstr "" -#: libelf/elf_error.c:188 +#: libelf/elf_error.c:156 msgid "cannot write data to file" msgstr "" -#: libelf/elf_error.c:192 +#: libelf/elf_error.c:160 msgid "invalid binary class" msgstr "" -#: libelf/elf_error.c:196 +#: libelf/elf_error.c:164 msgid "invalid section index" msgstr "" -#: libelf/elf_error.c:200 +#: libelf/elf_error.c:168 msgid "invalid operand" msgstr "" -#: libelf/elf_error.c:204 +#: libelf/elf_error.c:172 msgid "invalid section" msgstr "" -#: libelf/elf_error.c:212 +#: libelf/elf_error.c:180 msgid "executable header not created first" msgstr "" -#: libelf/elf_error.c:216 +#: libelf/elf_error.c:184 msgid "file descriptor disabled" msgstr "" -#: libelf/elf_error.c:220 +#: libelf/elf_error.c:188 msgid "archive/member fildes mismatch" msgstr "" -#: libelf/elf_error.c:228 +#: libelf/elf_error.c:196 msgid "cannot manipulate null section" msgstr "" -#: libelf/elf_error.c:232 +#: libelf/elf_error.c:200 msgid "data/scn mismatch" msgstr "" -#: libelf/elf_error.c:236 +#: libelf/elf_error.c:204 msgid "invalid section header" msgstr "" -#: libelf/elf_error.c:240 +#: libelf/elf_error.c:208 src/readelf.c:6062 src/readelf.c:6163 +#, c-format msgid "invalid data" msgstr "" -#: libelf/elf_error.c:244 +#: libelf/elf_error.c:212 msgid "unknown data encoding" msgstr "" -#: libelf/elf_error.c:248 +#: libelf/elf_error.c:216 msgid "section `sh_size' too small for data" msgstr "" -#: libelf/elf_error.c:252 +#: libelf/elf_error.c:220 msgid "invalid section alignment" msgstr "" -#: libelf/elf_error.c:256 +#: libelf/elf_error.c:224 msgid "invalid section entry size" msgstr "" -#: libelf/elf_error.c:260 +#: libelf/elf_error.c:228 msgid "update() for write on read-only file" msgstr "" -#: libelf/elf_error.c:264 +#: libelf/elf_error.c:232 msgid "no such file" msgstr "" -#: libelf/elf_error.c:268 +#: libelf/elf_error.c:236 msgid "only relocatable files can contain section groups" msgstr "" -#: libelf/elf_error.c:273 +#: libelf/elf_error.c:241 msgid "" "program header only allowed in executables, shared objects, and core files" msgstr "" -#: libelf/elf_error.c:280 +#: libelf/elf_error.c:248 msgid "file has no program header" msgstr "" -#: libelf/elf_error.c:285 libdw/dwarf_error.c:144 +#: libelf/elf_error.c:253 libdw/dwarf_error.c:112 msgid "invalid offset" msgstr "" -#: libasm/asm_error.c:122 src/ldgeneric.c:2687 +#: libasm/asm_error.c:64 src/ldgeneric.c:2687 #, c-format msgid "cannot create output file" msgstr "" -#: libasm/asm_error.c:123 +#: libasm/asm_error.c:65 msgid "invalid parameter" msgstr "" -#: libasm/asm_error.c:124 +#: libasm/asm_error.c:66 msgid "cannot change mode of output file" msgstr "" -#: libasm/asm_error.c:125 src/ldgeneric.c:7001 +#: libasm/asm_error.c:67 src/ldgeneric.c:7001 #, c-format msgid "cannot rename output file" msgstr "" -#: libasm/asm_error.c:126 +#: libasm/asm_error.c:68 msgid "duplicate symbol" msgstr "" -#: libasm/asm_error.c:127 +#: libasm/asm_error.c:69 msgid "invalid section type for operation" msgstr "" -#: libasm/asm_error.c:128 +#: libasm/asm_error.c:70 msgid "error during output of data" msgstr "" -#: libasm/asm_error.c:129 +#: libasm/asm_error.c:71 msgid "no backend support available" msgstr "" -#: libdw/dwarf_error.c:113 +#: libdw/dwarf_error.c:81 msgid "invalid access" msgstr "" -#: libdw/dwarf_error.c:114 +#: libdw/dwarf_error.c:82 msgid "no regular file" msgstr "" -#: libdw/dwarf_error.c:115 +#: libdw/dwarf_error.c:83 msgid "I/O error" msgstr "" -#: libdw/dwarf_error.c:116 +#: libdw/dwarf_error.c:84 msgid "invalid ELF file" msgstr "" -#: libdw/dwarf_error.c:117 +#: libdw/dwarf_error.c:85 msgid "no DWARF information" msgstr "" -#: libdw/dwarf_error.c:118 +#: libdw/dwarf_error.c:86 msgid "no ELF file" msgstr "" -#: libdw/dwarf_error.c:119 +#: libdw/dwarf_error.c:87 msgid "cannot get ELF header" msgstr "" -#: libdw/dwarf_error.c:121 +#: libdw/dwarf_error.c:89 msgid "not implemented" msgstr "" -#: libdw/dwarf_error.c:123 +#: libdw/dwarf_error.c:91 msgid "invalid version" msgstr "" -#: libdw/dwarf_error.c:124 +#: libdw/dwarf_error.c:92 msgid "invalid file" msgstr "" -#: libdw/dwarf_error.c:125 +#: libdw/dwarf_error.c:93 msgid "no entries found" msgstr "" -#: libdw/dwarf_error.c:126 +#: libdw/dwarf_error.c:94 msgid "invalid DWARF" msgstr "" -#: libdw/dwarf_error.c:127 +#: libdw/dwarf_error.c:95 msgid "no string data" msgstr "" -#: libdw/dwarf_error.c:128 +#: libdw/dwarf_error.c:96 msgid "no address value" msgstr "" -#: libdw/dwarf_error.c:129 +#: libdw/dwarf_error.c:97 msgid "no constant value" msgstr "" -#: libdw/dwarf_error.c:130 +#: libdw/dwarf_error.c:98 msgid "no reference value" msgstr "" -#: libdw/dwarf_error.c:131 +#: libdw/dwarf_error.c:99 msgid "invalid reference value" msgstr "" -#: libdw/dwarf_error.c:132 +#: libdw/dwarf_error.c:100 msgid ".debug_line section missing" msgstr "" -#: libdw/dwarf_error.c:133 +#: libdw/dwarf_error.c:101 msgid "invalid .debug_line section" msgstr "" -#: libdw/dwarf_error.c:134 +#: libdw/dwarf_error.c:102 msgid "debug information too big" msgstr "" -#: libdw/dwarf_error.c:135 +#: libdw/dwarf_error.c:103 msgid "invalid DWARF version" msgstr "" -#: libdw/dwarf_error.c:136 +#: libdw/dwarf_error.c:104 msgid "invalid directory index" msgstr "" -#: libdw/dwarf_error.c:137 +#: libdw/dwarf_error.c:105 msgid "address out of range" msgstr "" -#: libdw/dwarf_error.c:138 +#: libdw/dwarf_error.c:106 msgid "no location list value" msgstr "" -#: libdw/dwarf_error.c:139 +#: libdw/dwarf_error.c:107 msgid "no block data" msgstr "" -#: libdw/dwarf_error.c:140 +#: libdw/dwarf_error.c:108 msgid "invalid line index" msgstr "" -#: libdw/dwarf_error.c:141 +#: libdw/dwarf_error.c:109 msgid "invalid address range index" msgstr "" -#: libdw/dwarf_error.c:142 +#: libdw/dwarf_error.c:110 msgid "no matching address range" msgstr "" -#: libdw/dwarf_error.c:143 +#: libdw/dwarf_error.c:111 msgid "no flag value" msgstr "" -#: libdw/dwarf_error.c:145 +#: libdw/dwarf_error.c:113 msgid ".debug_ranges section missing" msgstr "" +#: libdwfl/argp-std.c:67 src/unstrip.c:2236 +msgid "Input selection options:" +msgstr "" + +#: libdwfl/argp-std.c:68 +msgid "Find addresses in FILE" +msgstr "" + +#: libdwfl/argp-std.c:70 +msgid "Find addresses from signatures found in COREFILE" +msgstr "" + +#: libdwfl/argp-std.c:72 +msgid "Find addresses in files mapped into process PID" +msgstr "" + +#: libdwfl/argp-std.c:74 +msgid "" +"Find addresses in files mapped as read from FILE in Linux /proc/PID/maps " +"format" +msgstr "" + +#: libdwfl/argp-std.c:76 +msgid "Find addresses in the running kernel" +msgstr "" + +#: libdwfl/argp-std.c:78 +msgid "Kernel with all modules" +msgstr "" + +#: libdwfl/argp-std.c:80 +msgid "Search path for separate debuginfo files" +msgstr "" + +#: libdwfl/argp-std.c:163 +msgid "only one of -e, -p, -k, -K, or --core allowed" +msgstr "" + +#: libdwfl/argp-std.c:223 +#, c-format +msgid "cannot read ELF core file: %s" +msgstr "" + +#: libdwfl/argp-std.c:243 +msgid "No modules recognized in core file" +msgstr "" + +#: libdwfl/argp-std.c:255 +msgid "cannot load kernel symbols" +msgstr "" + +#: libdwfl/argp-std.c:259 +msgid "cannot find kernel modules" +msgstr "" + +#: libdwfl/argp-std.c:273 +msgid "cannot find kernel or modules" +msgstr "" + +#: libebl/eblbackendname.c:63 +msgid "No backend" +msgstr "" + +#: libebl/eblcorenotetypename.c:107 libebl/eblobjecttypename.c:78 +#: libebl/eblobjnotetypename.c:85 libebl/eblosabiname.c:98 +#: libebl/eblsectionname.c:110 libebl/eblsectiontypename.c:140 +#: libebl/eblsegmenttypename.c:104 +msgid "" +msgstr "" + +#: libebl/ebldynamictagname.c:126 +#, c-format +msgid ": %#" +msgstr "" + +#: libebl/eblobjnote.c:76 +#, c-format +msgid " Build ID: " +msgstr "" + +#: libebl/eblobjnote.c:129 +#, c-format +msgid " OS: %s, ABI: " +msgstr "" + +#: libebl/eblosabiname.c:95 +msgid "Stand alone" +msgstr "" + +#: libebl/eblsymbolbindingname.c:86 libebl/eblsymboltypename.c:94 +#, c-format +msgid ": %d" +msgstr "" + +#: src/ar.c:76 +msgid "Commands:" +msgstr "" + +#: src/ar.c:77 +msgid "Delete files from archive." +msgstr "" + +#: src/ar.c:78 +msgid "Move files in archive." +msgstr "" + +#: src/ar.c:79 +msgid "Print files in archive." +msgstr "" + +#: src/ar.c:80 +msgid "Quick append files to archive." +msgstr "" + +#: src/ar.c:82 +msgid "Replace existing or insert new file into archive." +msgstr "" + +#: src/ar.c:83 +msgid "Display content of archive." +msgstr "" + +#: src/ar.c:84 +msgid "Extract files from archive." +msgstr "" + +#: src/ar.c:86 +msgid "Command Modifiers:" +msgstr "" + +#: src/ar.c:87 +msgid "Preserve original dates." +msgstr "" + +#: src/ar.c:88 +msgid "Use instance [COUNT] of name." +msgstr "" + +#: src/ar.c:90 +msgid "Do not replace existing files with extracted files." +msgstr "" + +#: src/ar.c:91 +msgid "Allow filename to be truncated if necessary." +msgstr "" + +#: src/ar.c:93 +msgid "Provide verbose output." +msgstr "" + +#: src/ar.c:94 +msgid "Force regeneration of symbol table." +msgstr "" + +#: src/ar.c:95 +msgid "Insert file after [MEMBER]." +msgstr "" + +#: src/ar.c:96 +msgid "Insert file before [MEMBER]." +msgstr "" + +#: src/ar.c:97 +msgid "Same as -b." +msgstr "" + +#: src/ar.c:98 +msgid "Suppress message when library has to be created." +msgstr "" + +#: src/ar.c:100 +msgid "Use full path for file matching." +msgstr "" + +#: src/ar.c:101 +msgid "Update only older files in archive." +msgstr "" + +#: src/ar.c:107 +msgid "Create, modify, and extract from archives." +msgstr "" + +#: src/ar.c:110 +msgid "[MEMBER] [COUNT] ARCHIVE [FILE...]" +msgstr "" + +#: src/ar.c:192 +#, c-format +msgid "'a', 'b', and 'i' are only allowed with the 'm' and 'r' options" +msgstr "" + +#: src/ar.c:197 +#, c-format +msgid "MEMBER parameter required for 'a', 'b', and 'i' modifiers" +msgstr "" + +#: src/ar.c:213 +#, c-format +msgid "'N' is only meaningful with the 'x' and 'd' options" +msgstr "" + +#: src/ar.c:218 +#, c-format +msgid "COUNT parameter required" +msgstr "" + +#: src/ar.c:230 +#, c-format +msgid "invalid COUNT parameter %s" +msgstr "" + +#: src/ar.c:237 +#, c-format +msgid "'%' is only meaningful with the 'x' option" +msgstr "" + +#: src/ar.c:243 +#, c-format +msgid "archive name required" +msgstr "" + +#: src/ar.c:289 src/nm.c:253 src/readelf.c:432 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/objdump.c:181 +#, c-format +msgid "" +"Copyright (C) %s Red Hat, Inc.\n" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" + +#: src/ar.c:294 src/nm.c:258 src/readelf.c:437 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/objdump.c:186 +#, c-format +msgid "Written by %s.\n" +msgstr "" + +#: src/ar.c:314 +#, c-format +msgid "More than one operation specified" +msgstr "" + +#: src/ar.c:404 +#, c-format +msgid "cannot open archive '%s'" +msgstr "" + +#: src/ar.c:414 +#, c-format +msgid "cannot open archive '%s': %s" +msgstr "" + +#: src/ar.c:418 +#, c-format +msgid "%s: not an archive file" +msgstr "" + +#: src/ar.c:422 +#, c-format +msgid "cannot stat archive '%s'" +msgstr "" + +#: src/ar.c:434 +#, c-format +msgid "no entry %s in archive\n" +msgstr "" + +#: src/ar.c:474 src/ar.c:918 src/ar.c:1118 +#, c-format +msgid "cannot create hash table" +msgstr "" + +#: src/ar.c:481 src/ar.c:925 src/ar.c:1127 +#, c-format +msgid "cannot insert into hash table" +msgstr "" + +#: src/ar.c:489 src/ranlib.c:176 +#, c-format +msgid "cannot stat '%s'" +msgstr "" + +#: src/ar.c:585 +#, c-format +msgid "cannot read content of %s: %s" +msgstr "" + +#: src/ar.c:629 +#, c-format +msgid "cannot open %.*s" +msgstr "" + +#: src/ar.c:651 +#, c-format +msgid "failed to write %s" +msgstr "" + +#: src/ar.c:663 +#, c-format +msgid "cannot change mode of %s" +msgstr "" + +#: src/ar.c:679 +#, c-format +msgid "cannot change modification time of %s" +msgstr "" + +#: src/ar.c:726 +#, c-format +msgid "cannot rename temporary file to %.*s" +msgstr "" + +#: src/ar.c:762 src/ar.c:1010 src/ar.c:1408 src/ranlib.c:250 +#, c-format +msgid "cannot create new file" +msgstr "" + +#: src/ar.c:1209 +#, c-format +msgid "position member %s not found" +msgstr "" + +#: src/ar.c:1219 +#, c-format +msgid "%s: no entry %s in archive!\n" +msgstr "" + +#: src/ar.c:1248 src/ldgeneric.c:519 src/objdump.c:257 +#, c-format +msgid "cannot open %s" +msgstr "" + +#: src/ar.c:1253 +#, c-format +msgid "cannot stat %s" +msgstr "" + +#: src/ar.c:1259 +#, c-format +msgid "%s is no regular file" +msgstr "" + +#: src/ar.c:1272 +#, c-format +msgid "cannot get ELF descriptor for %s: %s\n" +msgstr "" + +#: src/ar.c:1291 +#, c-format +msgid "cannot read %s: %s" +msgstr "" + +#: src/arlib.c:215 +#, c-format +msgid "the archive '%s' is too large" +msgstr "" + +#: src/arlib.c:228 +#, c-format +msgid "cannot read ELF header of %s(%s): %s" +msgstr "" + #: src/nm.c:74 src/readelf.c:72 src/strip.c:72 msgid "Output selection:" msgstr "" @@ -404,7 +771,7 @@ msgstr "" msgid "Print size of defined symbols" msgstr "" -#: src/nm.c:98 src/size.c:80 src/strip.c:77 +#: src/nm.c:98 src/size.c:80 src/strip.c:77 src/unstrip.c:80 msgid "Output options:" msgstr "" @@ -420,7 +787,7 @@ msgstr "" msgid "Reverse the sense of the sort" msgstr "" -#: src/nm.c:103 src/addr2line.c:71 src/findtextrel.c:73 src/elfcmp.c:74 +#: src/nm.c:103 src/addr2line.c:75 src/findtextrel.c:75 src/elfcmp.c:75 #: src/strings.c:83 msgid "Miscellaneous:" msgstr "" @@ -429,46 +796,31 @@ msgstr "" msgid "List symbols from FILEs (a.out by default)." msgstr "" -#: src/nm.c:111 src/size.c:92 src/strip.c:96 src/findtextrel.c:82 -#: src/strings.c:92 +#: src/nm.c:111 src/size.c:92 src/strip.c:96 src/findtextrel.c:84 +#: src/strings.c:92 src/objdump.c:80 msgid "[FILE...]" msgstr "" -#: src/nm.c:136 src/size.c:117 src/strip.c:120 +#: src/nm.c:136 src/size.c:117 src/strip.c:120 src/objdump.c:105 #, c-format msgid "%s: INTERNAL ERROR %d (%s-%s): %s" msgstr "" -#: src/nm.c:253 src/readelf.c:416 src/size.c:219 src/strip.c:203 src/ld.c:957 -#: src/elflint.c:240 src/addr2line.c:178 src/findtextrel.c:168 -#: src/elfcmp.c:521 src/ranlib.c:136 src/strings.c:227 -#, c-format -msgid "" -"Copyright (C) %s Red Hat, Inc.\n" -"This is free software; see the source for copying conditions. There is NO\n" -"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" -msgstr "" - -#: src/nm.c:258 src/readelf.c:421 src/size.c:224 src/strip.c:208 src/ld.c:962 -#: src/elflint.c:245 src/addr2line.c:183 src/findtextrel.c:173 -#: src/elfcmp.c:526 src/ranlib.c:141 src/strings.c:232 -#, c-format -msgid "Written by %s.\n" -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:227 -#: src/elfcmp.c:573 src/ranlib.c:169 src/strings.c:183 +#: 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/unstrip.c:1928 #, c-format msgid "cannot open '%s'" msgstr "" -#: src/nm.c:380 src/nm.c:392 src/size.c:317 src/size.c:400 src/strip.c:1814 +#: src/nm.c:380 src/nm.c:392 src/size.c:317 src/size.c:326 src/size.c:337 +#: src/strip.c:1815 #, c-format msgid "while closing '%s'" msgstr "" -#: src/nm.c:402 src/strip.c:358 +#: src/nm.c:402 src/strip.c:358 src/objdump.c:296 #, c-format msgid "%s: File format not recognized" msgstr "" @@ -494,7 +846,7 @@ msgstr "" msgid "cannot reset archive offset to beginning" msgstr "" -#: src/nm.c:488 +#: src/nm.c:488 src/objdump.c:344 #, c-format msgid "%s%s%s: file format not recognized" msgstr "" @@ -504,17 +856,17 @@ msgstr "" msgid "cannot create search tree" msgstr "" -#: src/nm.c:728 src/nm.c:978 src/readelf.c:829 src/readelf.c:968 -#: src/readelf.c:1109 src/readelf.c:1291 src/readelf.c:1489 src/readelf.c:1634 -#: src/readelf.c:1802 src/readelf.c:2056 src/readelf.c:2122 src/readelf.c:2200 -#: src/readelf.c:2697 src/readelf.c:2733 src/readelf.c:2795 src/readelf.c:5293 -#: src/readelf.c:6154 src/readelf.c:6299 src/readelf.c:6368 src/size.c:418 -#: src/size.c:492 src/strip.c:482 +#: src/nm.c:740 src/nm.c:1002 src/readelf.c:850 src/readelf.c:993 +#: src/readelf.c:1134 src/readelf.c:1316 src/readelf.c:1514 src/readelf.c:1659 +#: src/readelf.c:1827 src/readelf.c:2081 src/readelf.c:2147 src/readelf.c:2225 +#: src/readelf.c:2722 src/readelf.c:2758 src/readelf.c:2820 src/readelf.c:6312 +#: src/readelf.c:7178 src/readelf.c:7323 src/readelf.c:7392 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" msgstr "" -#: src/nm.c:748 +#: src/nm.c:766 #, c-format msgid "" "\n" @@ -523,7 +875,7 @@ msgid "" "\n" msgstr "" -#: src/nm.c:750 +#: src/nm.c:768 #, c-format msgid "" "\n" @@ -532,35 +884,35 @@ msgid "" "\n" msgstr "" -#: src/nm.c:753 +#: src/nm.c:771 #, c-format msgid "" "%*s%-*s %-*s Class Type %-*s %*s Section\n" "\n" msgstr "" -#: src/nm.c:988 +#: src/nm.c:1012 #, c-format msgid "%s: entry size in section `%s' is not what we expect" msgstr "" -#: src/nm.c:992 +#: src/nm.c:1016 #, c-format msgid "%s: size of section `%s' is not multiple of entry size" msgstr "" -#: src/nm.c:1229 +#: src/nm.c:1255 #, c-format msgid "%s%s%s%s: Invalid operation" msgstr "" -#: src/nm.c:1286 +#: src/nm.c:1312 #, c-format msgid "%s%s%s: no symbols" msgstr "" #: src/readelf.c:73 -msgid "Equivalent to: -h -l" +msgid "Equivalent to: -e -h -l" msgstr "" #: src/readelf.c:74 @@ -598,7 +950,7 @@ msgstr "" #: src/readelf.c:86 msgid "" "Display DWARF section content. SECTION can be one of abbrev, aranges, " -"frame, info, loc, line, ranges, pubnames, str, or macinfo." +"frame, info, loc, line, ranges, pubnames, str, macinfo, or exception" msgstr "" #: src/readelf.c:89 @@ -621,309 +973,317 @@ msgstr "" msgid "Display the symbol index of an archive" msgstr "" -#: src/readelf.c:100 +#: src/readelf.c:99 +msgid "Display sections for exception handling" +msgstr "" + +#: src/readelf.c:102 msgid "Output control:" msgstr "" -#: src/readelf.c:106 +#: src/readelf.c:108 msgid "Print information from ELF file in human-readable form." msgstr "" -#: src/readelf.c:110 src/elflint.c:86 +#: src/readelf.c:112 src/elflint.c:85 msgid "FILE..." msgstr "" -#: src/readelf.c:256 src/elflint.c:159 +#: src/readelf.c:259 src/elflint.c:158 #, c-format msgid "cannot open input file" msgstr "" -#: src/readelf.c:363 +#: src/readelf.c:387 #, c-format msgid "Unknown DWARF debug section `%s'.\n" msgstr "" -#: src/readelf.c:392 src/elflint.c:223 +#: src/readelf.c:408 src/elflint.c:222 msgid "Missing file name.\n" msgstr "" -#: src/readelf.c:397 +#: src/readelf.c:413 src/objdump.c:236 msgid "No operation specified.\n" msgstr "" -#: src/readelf.c:432 +#: src/readelf.c:448 #, c-format msgid "cannot generate Elf descriptor: %s" msgstr "" -#: src/readelf.c:444 +#: src/readelf.c:460 #, c-format msgid "'%s' is not an archive, cannot print archive index" msgstr "" -#: src/readelf.c:449 +#: src/readelf.c:465 #, c-format msgid "error while closing Elf descriptor: %s" msgstr "" -#: src/readelf.c:539 +#: src/readelf.c:557 #, c-format msgid "cannot stat input file" msgstr "" -#: src/readelf.c:541 +#: src/readelf.c:559 #, c-format msgid "input file is empty" msgstr "" -#: src/readelf.c:543 +#: src/readelf.c:561 #, c-format msgid "failed reading '%s': %s" msgstr "" -#: src/readelf.c:575 +#: src/readelf.c:596 #, c-format msgid "cannot read ELF header: %s" msgstr "" -#: src/readelf.c:583 +#: src/readelf.c:604 #, c-format msgid "cannot create EBL handle" msgstr "" -#: src/readelf.c:590 src/strip.c:542 src/ldgeneric.c:661 src/ldgeneric.c:1122 +#: src/readelf.c:611 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:676 +#: src/readelf.c:697 msgid "NONE (None)" msgstr "" -#: src/readelf.c:677 +#: src/readelf.c:698 msgid "REL (Relocatable file)" msgstr "" -#: src/readelf.c:678 +#: src/readelf.c:699 msgid "EXEC (Executable file)" msgstr "" -#: src/readelf.c:679 +#: src/readelf.c:700 msgid "DYN (Shared object file)" msgstr "" -#: src/readelf.c:680 +#: src/readelf.c:701 msgid "CORE (Core file)" msgstr "" -#: src/readelf.c:685 +#: src/readelf.c:706 #, c-format msgid "OS Specific: (%x)\n" msgstr "" -#: src/readelf.c:687 +#: src/readelf.c:708 #, c-format msgid "Processor Specific: (%x)\n" msgstr "" -#: src/readelf.c:697 +#: src/readelf.c:718 msgid "" "ELF Header:\n" " Magic: " msgstr "" -#: src/readelf.c:701 +#: src/readelf.c:722 #, c-format msgid "" "\n" " Class: %s\n" msgstr "" -#: src/readelf.c:706 +#: src/readelf.c:727 #, c-format msgid " Data: %s\n" msgstr "" -#: src/readelf.c:712 +#: src/readelf.c:733 #, c-format msgid " Ident Version: %hhd %s\n" msgstr "" -#: src/readelf.c:714 src/readelf.c:731 +#: src/readelf.c:735 src/readelf.c:752 msgid "(current)" msgstr "" -#: src/readelf.c:718 +#: src/readelf.c:739 #, c-format msgid " OS/ABI: %s\n" msgstr "" -#: src/readelf.c:721 +#: src/readelf.c:742 #, c-format msgid " ABI Version: %hhd\n" msgstr "" -#: src/readelf.c:724 +#: src/readelf.c:745 msgid " Type: " msgstr "" -#: src/readelf.c:727 +#: src/readelf.c:748 #, c-format msgid " Machine: %s\n" msgstr "" -#: src/readelf.c:729 +#: src/readelf.c:750 #, c-format msgid " Version: %d %s\n" msgstr "" -#: src/readelf.c:733 +#: src/readelf.c:754 #, c-format msgid " Entry point address: %#\n" msgstr "" -#: src/readelf.c:736 +#: src/readelf.c:757 #, c-format msgid " Start of program headers: % %s\n" msgstr "" -#: src/readelf.c:737 src/readelf.c:740 +#: src/readelf.c:758 src/readelf.c:761 msgid "(bytes into file)" msgstr "" -#: src/readelf.c:739 +#: src/readelf.c:760 #, c-format msgid " Start of section headers: % %s\n" msgstr "" -#: src/readelf.c:742 +#: src/readelf.c:763 #, c-format msgid " Flags: %s\n" msgstr "" -#: src/readelf.c:745 +#: src/readelf.c:766 #, c-format msgid " Size of this header: % %s\n" msgstr "" -#: src/readelf.c:746 src/readelf.c:749 src/readelf.c:755 +#: src/readelf.c:767 src/readelf.c:770 src/readelf.c:776 msgid "(bytes)" msgstr "" -#: src/readelf.c:748 +#: src/readelf.c:769 #, c-format msgid " Size of program header entries: % %s\n" msgstr "" -#: src/readelf.c:751 +#: src/readelf.c:772 #, c-format msgid " Number of program headers entries: %\n" msgstr "" -#: src/readelf.c:754 +#: src/readelf.c:775 #, c-format msgid " Size of section header entries: % %s\n" msgstr "" -#: src/readelf.c:757 +#: src/readelf.c:778 #, c-format msgid " Number of section headers entries: %" msgstr "" -#: src/readelf.c:764 +#: src/readelf.c:785 #, c-format msgid " (% in [0].sh_size)" msgstr "" -#: src/readelf.c:767 src/readelf.c:781 +#: src/readelf.c:788 src/readelf.c:802 msgid " ([0] not available)" msgstr "" -#: src/readelf.c:777 +#: src/readelf.c:798 #, c-format msgid " (% in [0].sh_link)" msgstr "" -#: src/readelf.c:785 +#: src/readelf.c:806 #, c-format msgid "" " Section header string table index: XINDEX%s\n" "\n" msgstr "" -#: src/readelf.c:789 +#: src/readelf.c:810 #, c-format msgid "" " Section header string table index: %\n" "\n" msgstr "" -#: src/readelf.c:821 +#: src/readelf.c:842 #, c-format msgid "" "There are %d section headers, starting at offset %#:\n" "\n" msgstr "" -#: src/readelf.c:831 +#: src/readelf.c:852 msgid "Section Headers:" msgstr "" -#: src/readelf.c:834 +#: src/readelf.c:855 msgid "" "[Nr] Name Type Addr Off Size ES Flags Lk " "Inf Al" msgstr "" -#: src/readelf.c:836 +#: src/readelf.c:857 msgid "" "[Nr] Name Type Addr Off Size ES " "Flags Lk Inf Al" msgstr "" -#: src/readelf.c:843 src/readelf.c:992 +#: src/readelf.c:864 src/readelf.c:1017 #, c-format msgid "cannot get section: %s" msgstr "" -#: src/readelf.c:850 src/readelf.c:1000 src/readelf.c:6319 +#: src/readelf.c:871 src/readelf.c:1025 src/readelf.c:7343 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 +#: src/unstrip.c:1777 #, c-format msgid "cannot get section header: %s" msgstr "" -#: src/readelf.c:908 +#: src/readelf.c:929 msgid "Program Headers:" msgstr "" -#: src/readelf.c:910 +#: src/readelf.c:931 msgid "" " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align" msgstr "" -#: src/readelf.c:913 +#: src/readelf.c:934 msgid "" " Type Offset VirtAddr PhysAddr FileSiz " "MemSiz Flg Align" msgstr "" -#: src/readelf.c:953 +#: src/readelf.c:974 #, c-format msgid "\t[Requesting program interpreter: %s]\n" msgstr "" -#: src/readelf.c:970 +#: src/readelf.c:995 msgid "" "\n" " Section to Segment mapping:\n" " Segment Sections..." msgstr "" -#: src/readelf.c:981 +#: src/readelf.c:1006 src/unstrip.c:1823 src/unstrip.c:1862 src/unstrip.c:1869 #, c-format msgid "cannot get program header: %s" msgstr "" -#: src/readelf.c:1115 +#: src/readelf.c:1140 #, c-format msgid "" "\n" @@ -934,7 +1294,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1120 +#: src/readelf.c:1145 #, c-format msgid "" "\n" @@ -945,15 +1305,15 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1128 +#: src/readelf.c:1153 msgid "" msgstr "" -#: src/readelf.c:1142 +#: src/readelf.c:1167 msgid "" msgstr "" -#: src/readelf.c:1293 +#: src/readelf.c:1318 #, c-format msgid "" "\n" @@ -966,56 +1326,56 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1305 +#: src/readelf.c:1330 msgid " Type Value\n" msgstr "" -#: src/readelf.c:1329 +#: src/readelf.c:1354 #, c-format msgid "Shared library: [%s]\n" msgstr "" -#: src/readelf.c:1334 +#: src/readelf.c:1359 #, c-format msgid "Library soname: [%s]\n" msgstr "" -#: src/readelf.c:1339 +#: src/readelf.c:1364 #, c-format msgid "Library rpath: [%s]\n" msgstr "" -#: src/readelf.c:1344 +#: src/readelf.c:1369 #, c-format msgid "Library runpath: [%s]\n" msgstr "" -#: src/readelf.c:1364 +#: src/readelf.c:1389 #, c-format msgid "% (bytes)\n" msgstr "" -#: src/readelf.c:1474 src/readelf.c:1619 +#: src/readelf.c:1499 src/readelf.c:1644 #, c-format msgid "" "\n" "Invalid symbol table at offset %#0\n" msgstr "" -#: src/readelf.c:1492 +#: src/readelf.c:1517 src/readelf.c:1661 #, c-format msgid "" "\n" -"Relocation section [%2u] '%s' for section [%2u] '%s' at offset %#0 " +"Relocation section [%2zu] '%s' for section [%2u] '%s' at offset %#0 " "contains %d entry:\n" msgid_plural "" "\n" -"Relocation section [%2u] '%s' for section [%2u] '%s' at offset %#0 " +"Relocation section [%2zu] '%s' for section [%2u] '%s' at offset %#0 " "contains %d entries:\n" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1507 +#: src/readelf.c:1532 #, c-format msgid "" "\n" @@ -1026,49 +1386,36 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1517 +#: src/readelf.c:1542 msgid " Offset Type Value Name\n" msgstr "" -#: src/readelf.c:1519 +#: src/readelf.c:1544 msgid " Offset Type Value Name\n" msgstr "" -#: src/readelf.c:1543 src/readelf.c:1555 src/readelf.c:1573 src/readelf.c:1585 -#: src/readelf.c:1675 src/readelf.c:1688 src/readelf.c:1707 src/readelf.c:1720 +#: src/readelf.c:1568 src/readelf.c:1580 src/readelf.c:1598 src/readelf.c:1610 +#: src/readelf.c:1700 src/readelf.c:1713 src/readelf.c:1732 src/readelf.c:1745 msgid "" msgstr "" -#: src/readelf.c:1544 src/readelf.c:1676 +#: src/readelf.c:1569 src/readelf.c:1701 src/objdump.c:379 msgid "INVALID SYMBOL" msgstr "" -#: src/readelf.c:1574 src/readelf.c:1708 +#: src/readelf.c:1599 src/readelf.c:1733 src/objdump.c:394 msgid "INVALID SECTION" msgstr "" -#: src/readelf.c:1636 -#, c-format -msgid "" -"\n" -"Relocation section [%2zu] '%s' for section [%2u] '%s' at offset %#0 " -"contains %d entry:\n" -msgid_plural "" -"\n" -"Relocation section [%2zu] '%s' for section [%2u] '%s' at offset %#0 " -"contains %d entries:\n" -msgstr[0] "" -msgstr[1] "" - -#: src/readelf.c:1648 +#: src/readelf.c:1673 msgid " Offset Type Value Addend Name\n" msgstr "" -#: src/readelf.c:1650 +#: src/readelf.c:1675 msgid " Offset Type Value Addend Name\n" msgstr "" -#: src/readelf.c:1809 +#: src/readelf.c:1834 #, c-format msgid "" "\n" @@ -1079,40 +1426,40 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:1815 +#: src/readelf.c:1840 #, 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:1825 +#: src/readelf.c:1850 msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: src/readelf.c:1827 +#: src/readelf.c:1852 msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: src/readelf.c:1847 +#: src/readelf.c:1872 #, c-format msgid "%5u: %0* %6 %-7s %-6s %-9s %6s %s" msgstr "" -#: src/readelf.c:1935 +#: src/readelf.c:1960 #, c-format msgid "bad dynamic symbol" msgstr "" -#: src/readelf.c:2017 +#: src/readelf.c:2042 msgid "none" msgstr "" -#: src/readelf.c:2034 +#: src/readelf.c:2059 msgid "| " msgstr "" -#: src/readelf.c:2059 +#: src/readelf.c:2084 #, c-format msgid "" "\n" @@ -1125,17 +1472,17 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2082 +#: src/readelf.c:2107 #, c-format msgid " %#06x: Version: %hu File: %s Cnt: %hu\n" msgstr "" -#: src/readelf.c:2095 +#: src/readelf.c:2120 #, c-format msgid " %#06x: Name: %s Flags: %s Version: %hu\n" msgstr "" -#: src/readelf.c:2126 +#: src/readelf.c:2151 #, c-format msgid "" "\n" @@ -1148,17 +1495,17 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2156 +#: src/readelf.c:2181 #, c-format msgid " %#06x: Version: %hd Flags: %s Index: %hd Cnt: %hd Name: %s\n" msgstr "" -#: src/readelf.c:2171 +#: src/readelf.c:2196 #, c-format msgid " %#06x: Parent %d: %s\n" msgstr "" -#: src/readelf.c:2403 +#: src/readelf.c:2428 #, c-format msgid "" "\n" @@ -1171,15 +1518,15 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2433 +#: src/readelf.c:2458 msgid " 0 *local* " msgstr "" -#: src/readelf.c:2438 +#: src/readelf.c:2463 msgid " 1 *global* " msgstr "" -#: src/readelf.c:2469 +#: src/readelf.c:2494 #, c-format msgid "" "\n" @@ -1194,41 +1541,41 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2492 +#: src/readelf.c:2517 #, c-format msgid " Length Number % of total Coverage\n" msgstr "" -#: src/readelf.c:2494 +#: src/readelf.c:2519 #, c-format msgid " 0 %6 %5.1f%%\n" msgstr "" -#: src/readelf.c:2501 +#: src/readelf.c:2526 #, c-format msgid "%7d %6 %5.1f%% %5.1f%%\n" msgstr "" -#: src/readelf.c:2514 +#: src/readelf.c:2539 #, c-format msgid "" " Average number of tests: successful lookup: %f\n" " unsuccessful lookup: %f\n" msgstr "" -#: src/readelf.c:2532 src/readelf.c:2574 src/readelf.c:2615 +#: src/readelf.c:2557 src/readelf.c:2599 src/readelf.c:2640 #, c-format msgid "cannot get data for section %d: %s" msgstr "" -#: src/readelf.c:2669 +#: src/readelf.c:2694 #, c-format msgid "" " Symbol Bias: %u\n" " Bitmask Size: %zu bytes %%% bits set 2nd hash shift: %u\n" msgstr "" -#: src/readelf.c:2743 +#: src/readelf.c:2768 #, c-format msgid "" "\n" @@ -1239,13 +1586,13 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:2757 +#: src/readelf.c:2782 msgid "" " Library Time Stamp Checksum Version " "Flags" msgstr "" -#: src/readelf.c:2805 +#: src/readelf.c:2832 #, c-format msgid "" "\n" @@ -1253,242 +1600,299 @@ msgid "" "#0:\n" msgstr "" -#: src/readelf.c:2821 +#: src/readelf.c:2848 msgid " Owner Size\n" msgstr "" -#: src/readelf.c:2847 +#: src/readelf.c:2874 #, c-format msgid " %-13s %4\n" msgstr "" -#: src/readelf.c:2878 +#: src/readelf.c:2906 #, c-format msgid " %-4u %12\n" msgstr "" -#: src/readelf.c:2883 +#: src/readelf.c:2911 #, c-format msgid " File: %11\n" msgstr "" -#: src/readelf.c:2918 +#: src/readelf.c:2946 #, c-format msgid " %s: %, %s\n" msgstr "" -#: src/readelf.c:2921 +#: src/readelf.c:2949 #, c-format msgid " %s: %\n" msgstr "" -#: src/readelf.c:2924 +#: src/readelf.c:2952 #, c-format msgid " %s: %s\n" msgstr "" -#: src/readelf.c:2931 +#: src/readelf.c:2959 #, c-format msgid " %u: %\n" msgstr "" -#: src/readelf.c:2934 +#: src/readelf.c:2962 #, c-format msgid " %u: %s\n" msgstr "" -#: src/readelf.c:2969 +#: src/readelf.c:2997 #, c-format msgid "%s+%# <%s+%#>" msgstr "" -#: src/readelf.c:2972 +#: src/readelf.c:3000 #, c-format msgid "%s+%#0* <%s+%#>" msgstr "" -#: src/readelf.c:2977 +#: src/readelf.c:3005 #, c-format msgid "%# <%s+%#>" msgstr "" -#: src/readelf.c:2980 +#: src/readelf.c:3008 #, c-format msgid "%#0* <%s+%#>" msgstr "" -#: src/readelf.c:2986 +#: src/readelf.c:3014 #, c-format msgid "%s+%# <%s>" msgstr "" -#: src/readelf.c:2989 +#: src/readelf.c:3017 #, c-format msgid "%s+%#0* <%s>" msgstr "" -#: src/readelf.c:2993 +#: src/readelf.c:3021 #, c-format msgid "%# <%s>" msgstr "" -#: src/readelf.c:2996 +#: src/readelf.c:3024 #, c-format msgid "%#0* <%s>" msgstr "" -#: src/readelf.c:3001 +#: src/readelf.c:3029 #, c-format msgid "%s+%#" msgstr "" -#: src/readelf.c:3004 +#: src/readelf.c:3032 #, c-format msgid "%s+%#0*" msgstr "" -#: src/readelf.c:3112 +#: src/readelf.c:3140 #, c-format msgid "unknown tag %hx" msgstr "" -#: src/readelf.c:3114 +#: src/readelf.c:3142 #, c-format msgid "unknown user tag %hx" msgstr "" -#: src/readelf.c:3324 +#: src/readelf.c:3352 #, c-format msgid "unknown attribute %hx" msgstr "" -#: src/readelf.c:3327 +#: src/readelf.c:3355 #, c-format msgid "unknown user attribute %hx" msgstr "" -#: src/readelf.c:3373 +#: src/readelf.c:3401 #, c-format msgid "unknown form %" msgstr "" -#: src/readelf.c:3961 +#: src/readelf.c:4017 +#, c-format +msgid "%*s[%4] %s \n" +msgstr "" + +#: src/readelf.c:4030 #, c-format msgid "" "\n" -"DWARF section '%s' at offset %#:\n" +"DWARF section [%2zu] '%s' at offset %#:\n" " [ Code]\n" msgstr "" -#: src/readelf.c:3968 +#: src/readelf.c:4037 #, c-format msgid "" "\n" "Abbreviation section at offset %:\n" msgstr "" -#: src/readelf.c:3981 +#: src/readelf.c:4050 #, c-format msgid " *** error while reading abbreviation: %s\n" msgstr "" -#: src/readelf.c:3997 +#: src/readelf.c:4066 #, c-format msgid " [%5u] offset: %, children: %s, tag: %s\n" msgstr "" -#: src/readelf.c:4000 +#: src/readelf.c:4069 msgid "yes" msgstr "" -#: src/readelf.c:4000 +#: src/readelf.c:4069 msgid "no" msgstr "" -#: src/readelf.c:4037 +#: src/readelf.c:4105 #, c-format msgid "cannot get .debug_aranges content: %s" msgstr "" -#: src/readelf.c:4042 +#: src/readelf.c:4110 #, c-format msgid "" "\n" -"DWARF section '%s' at offset %# contains %zu entry:\n" +"DWARF section [%2zu] '%s' at offset %# contains %zu entry:\n" msgid_plural "" "\n" -"DWARF section '%s' at offset %# contains %zu entries:\n" +"DWARF section [%2zu] '%s' at offset %# contains %zu entries:\n" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:4072 +#: src/readelf.c:4140 #, c-format msgid " [%*zu] ???\n" msgstr "" -#: src/readelf.c:4074 +#: src/readelf.c:4142 #, c-format msgid "" " [%*zu] start: %0#*, length: %5, CU DIE offset: %6\n" msgstr "" -#: src/readelf.c:4093 +#: src/readelf.c:4161 #, c-format msgid "cannot get .debug_ranges content: %s" msgstr "" -#: src/readelf.c:4098 src/readelf.c:4511 src/readelf.c:4959 src/readelf.c:5054 -#: src/readelf.c:5227 +#: src/readelf.c:4166 src/readelf.c:4623 src/readelf.c:5272 src/readelf.c:5717 +#: src/readelf.c:5812 src/readelf.c:5984 #, c-format msgid "" "\n" -"DWARF section '%s' at offset %#:\n" +"DWARF section [%2zu] '%s' at offset %#:\n" msgstr "" -#: src/readelf.c:4112 src/readelf.c:4973 +#: src/readelf.c:4180 src/readelf.c:5731 #, c-format msgid " [%6tx] \n" msgstr "" -#: src/readelf.c:4134 src/readelf.c:4995 +#: src/readelf.c:4202 src/readelf.c:5753 #, c-format msgid " [%6tx] base address %s\n" msgstr "" -#: src/readelf.c:4145 +#: src/readelf.c:4213 #, c-format msgid " [%6tx] %s..%s\n" msgstr "" -#: src/readelf.c:4147 +#: src/readelf.c:4215 #, c-format msgid " %s..%s\n" msgstr "" -#: src/readelf.c:4187 +#: src/readelf.c:4612 src/readelf.c:6050 src/readelf.c:6152 +#, c-format +msgid "cannot get %s content: %s" +msgstr "" + +#: src/readelf.c:4619 +#, c-format +msgid "" +"\n" +"Call frame information section [%2zu] '%s' at offset %#:\n" +msgstr "" + +#: src/readelf.c:4646 src/readelf.c:5306 +#, c-format +msgid "invalid data in section [%zu] '%s'" +msgstr "" + +#: src/readelf.c:4668 +#, c-format +msgid "" +"\n" +" [%6tx] Zero terminator\n" +msgstr "" + +#: src/readelf.c:4746 +msgid "FDE address encoding: " +msgstr "" + +#: src/readelf.c:4752 +msgid "LSDA pointer encoding: " +msgstr "" + +#: src/readelf.c:4797 +#, c-format +msgid "invalid augmentation encoding" +msgstr "" + +#: src/readelf.c:4868 +#, c-format +msgid " (offset: %#)" +msgstr "" + +#: src/readelf.c:4875 +#, c-format +msgid " (end offset: %#)" +msgstr "" + +#: src/readelf.c:4902 +#, c-format +msgid " %-26sLSDA pointer: %#\n" +msgstr "" + +#: src/readelf.c:4948 #, c-format msgid "cannot get attribute code: %s" msgstr "" -#: src/readelf.c:4195 +#: src/readelf.c:4956 #, c-format msgid "cannot get attribute form: %s" msgstr "" -#: src/readelf.c:4208 +#: src/readelf.c:4969 #, c-format msgid "cannot get attribute value: %s" msgstr "" -#: src/readelf.c:4390 +#: src/readelf.c:5151 #, c-format msgid "" "\n" -"DWARF section '%s' at offset %#:\n" +"DWARF section [%2zu] '%s' at offset %#:\n" " [Offset]\n" msgstr "" -#: src/readelf.c:4415 +#: src/readelf.c:5176 #, c-format msgid "" " Compilation unit at offset %:\n" @@ -1496,49 +1900,44 @@ msgid "" ", Offset size: %\n" msgstr "" -#: src/readelf.c:4433 +#: src/readelf.c:5194 #, c-format msgid "cannot get DIE at offset % in section '%s': %s" msgstr "" -#: src/readelf.c:4444 +#: src/readelf.c:5205 #, c-format msgid "cannot get DIE offset: %s" msgstr "" -#: src/readelf.c:4452 +#: src/readelf.c:5213 #, c-format msgid "cannot get tag of DIE at offset % in section '%s': %s" msgstr "" -#: src/readelf.c:4481 +#: src/readelf.c:5242 #, c-format msgid "cannot get next DIE: %s\n" msgstr "" -#: src/readelf.c:4488 +#: src/readelf.c:5249 #, c-format msgid "cannot get next DIE: %s" msgstr "" -#: src/readelf.c:4523 +#: src/readelf.c:5284 #, c-format msgid "cannot get line data section data: %s" msgstr "" -#: src/readelf.c:4536 +#: src/readelf.c:5297 #, c-format msgid "" "\n" "Table at offset %Zu:\n" msgstr "" -#: src/readelf.c:4545 -#, c-format -msgid "invalid data in section [%zu] '%s'" -msgstr "" - -#: src/readelf.c:4588 +#: src/readelf.c:5349 #, c-format msgid "" "\n" @@ -1554,293 +1953,347 @@ msgid "" "Opcodes:\n" msgstr "" -#: src/readelf.c:4607 +#: src/readelf.c:5368 #, c-format msgid "invalid data at offset %tu in section [%zu] '%s'" msgstr "" -#: src/readelf.c:4622 +#: src/readelf.c:5383 #, c-format msgid " [%*] %hhu argument\n" msgid_plural " [%*] %hhu arguments\n" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:4630 +#: src/readelf.c:5391 msgid "" "\n" "Directory table:" msgstr "" -#: src/readelf.c:4646 +#: src/readelf.c:5407 msgid "" "\n" "File name table:\n" " Entry Dir Time Size Name" msgstr "" -#: src/readelf.c:4675 +#: src/readelf.c:5436 msgid "" "\n" "Line number statements:" msgstr "" -#: src/readelf.c:4736 +#: src/readelf.c:5497 #, c-format msgid " special opcode %u: address+%u = %s, line%+d = %zu\n" msgstr "" -#: src/readelf.c:4756 +#: src/readelf.c:5517 #, c-format msgid " extended opcode %u: " msgstr "" -#: src/readelf.c:4761 +#: src/readelf.c:5522 msgid "end of sequence" msgstr "" -#: src/readelf.c:4776 +#: src/readelf.c:5537 #, c-format msgid "set address to %s\n" msgstr "" -#: src/readelf.c:4797 +#: src/readelf.c:5558 #, c-format msgid "define new file: dir=%u, mtime=%, length=%, name=%s\n" msgstr "" -#: src/readelf.c:4806 +#: src/readelf.c:5567 msgid "unknown opcode" msgstr "" -#: src/readelf.c:4818 +#: src/readelf.c:5579 msgid " copy" msgstr "" -#: src/readelf.c:4828 +#: src/readelf.c:5589 #, c-format msgid "advance address by %u to %s\n" msgstr "" -#: src/readelf.c:4839 +#: src/readelf.c:5600 #, c-format msgid " advance line by constant %d to %\n" msgstr "" -#: src/readelf.c:4847 +#: src/readelf.c:5608 #, c-format msgid " set file to %\n" msgstr "" -#: src/readelf.c:4857 +#: src/readelf.c:5618 #, c-format msgid " set column to %\n" msgstr "" -#: src/readelf.c:4864 +#: src/readelf.c:5625 #, c-format msgid " set '%s' to %\n" msgstr "" -#: src/readelf.c:4870 +#: src/readelf.c:5631 msgid " set basic block flag" msgstr "" -#: src/readelf.c:4880 +#: src/readelf.c:5641 #, c-format msgid "advance address by constant %u to %s\n" msgstr "" -#: src/readelf.c:4896 +#: src/readelf.c:5657 #, c-format msgid "advance address by fixed value %u to %s\n" msgstr "" -#: src/readelf.c:4905 +#: src/readelf.c:5666 msgid " set prologue end flag" msgstr "" -#: src/readelf.c:4910 +#: src/readelf.c:5671 msgid " set epilogue begin flag" msgstr "" -#: src/readelf.c:4919 +#: src/readelf.c:5680 #, c-format msgid " unknown opcode with % parameter:" msgid_plural " unknown opcode with % parameters:" msgstr[0] "" msgstr[1] "" -#: src/readelf.c:4954 +#: src/readelf.c:5712 #, c-format msgid "cannot get .debug_loc content: %s" msgstr "" -#: src/readelf.c:5009 +#: src/readelf.c:5767 #, c-format msgid " [%6tx] %s..%s" msgstr "" -#: src/readelf.c:5011 +#: src/readelf.c:5769 #, c-format msgid " %s..%s" msgstr "" -#: src/readelf.c:5064 +#: src/readelf.c:5822 #, c-format msgid "cannot get macro information section data: %s" msgstr "" -#: src/readelf.c:5143 +#: src/readelf.c:5901 #, c-format msgid "%*s*** non-terminated string at end of section" msgstr "" -#: src/readelf.c:5211 +#: src/readelf.c:5969 #, c-format msgid " [%5d] DIE offset: %6, CU DIE offset: %6, name: %s\n" msgstr "" -#: src/readelf.c:5252 +#: src/readelf.c:6008 #, c-format msgid "" "\n" -"DWARF section '%s' at offset %#:\n" +"DWARF section [%2zu] '%s' at offset %#:\n" " %*s String\n" msgstr "" -#: src/readelf.c:5265 +#: src/readelf.c:6022 #, c-format msgid " *** error while reading strings: %s\n" msgstr "" -#: src/readelf.c:5284 +#: src/readelf.c:6042 +#, c-format +msgid "" +"\n" +"Call frame search table section [%2zu] '.eh_frame_hdr':\n" +msgstr "" + +#: src/readelf.c:6144 +#, c-format +msgid "" +"\n" +"Exception handling table section [%2zu] '.gcc_except_table':\n" +msgstr "" + +#: src/readelf.c:6167 +#, c-format +msgid " LPStart encoding: %#x " +msgstr "" + +#: src/readelf.c:6179 +#, c-format +msgid " TType encoding: %#x " +msgstr "" + +#: src/readelf.c:6193 +#, c-format +msgid " Call site encoding: %#x " +msgstr "" + +#: src/readelf.c:6206 +msgid "" +"\n" +" Call site table:" +msgstr "" + +#: src/readelf.c:6220 +#, c-format +msgid "" +" [%4u] Call site start: %#\n" +" Call site length: %\n" +" Landing pad: %#\n" +" Action: %u\n" +msgstr "" + +#: src/readelf.c:6280 +#, c-format +msgid "invalid TType encoding" +msgstr "" + +#: src/readelf.c:6303 #, c-format msgid "cannot get debug context descriptor: %s" msgstr "" -#: src/readelf.c:5414 src/readelf.c:5992 +#: src/readelf.c:6438 src/readelf.c:7016 #, c-format msgid "cannot convert core note data: %s" msgstr "" -#: src/readelf.c:5719 +#: src/readelf.c:6743 #, c-format msgid "" "\n" "%*s... ..." msgstr "" -#: src/readelf.c:5761 +#: src/readelf.c:6785 #, c-format msgid "unable to handle register number %d" msgstr "" -#: src/readelf.c:5908 src/readelf.c:5932 +#: src/readelf.c:6932 +#, c-format +msgid "cannot get register info: %s" +msgstr "" + +#: src/readelf.c:6956 #, c-format msgid "cannot register info: %s" msgstr "" -#: src/readelf.c:6090 +#: src/readelf.c:7114 msgid " Owner Data size Type\n" msgstr "" -#: src/readelf.c:6108 +#: src/readelf.c:7132 #, c-format msgid " %-13.*s %9 %s\n" msgstr "" -#: src/readelf.c:6139 +#: src/readelf.c:7163 #, c-format msgid "cannot get content of note section: %s" msgstr "" -#: src/readelf.c:6166 +#: src/readelf.c:7190 #, c-format msgid "" "\n" "Note section [%2zu] '%s' of % bytes at offset %#0:\n" msgstr "" -#: src/readelf.c:6189 +#: src/readelf.c:7213 #, c-format msgid "" "\n" "Note segment of % bytes at offset %#0:\n" msgstr "" -#: src/readelf.c:6235 +#: src/readelf.c:7259 #, c-format msgid "" "\n" "Section [%Zu] '%s' has no data to dump.\n" msgstr "" -#: src/readelf.c:6241 src/readelf.c:6263 +#: src/readelf.c:7265 src/readelf.c:7287 #, c-format msgid "cannot get data for section [%Zu] '%s': %s" msgstr "" -#: src/readelf.c:6245 +#: src/readelf.c:7269 #, c-format msgid "" "\n" "Hex dump of section [%Zu] '%s', % bytes at offset %#0:\n" msgstr "" -#: src/readelf.c:6258 +#: src/readelf.c:7282 #, c-format msgid "" "\n" "Section [%Zu] '%s' is empty.\n" msgstr "" -#: src/readelf.c:6267 +#: src/readelf.c:7291 #, c-format msgid "" "\n" "String section [%Zu] '%s' contains % bytes at offset %#0:\n" msgstr "" -#: src/readelf.c:6314 +#: src/readelf.c:7338 #, c-format msgid "" "\n" "section [%lu] does not exist" msgstr "" -#: src/readelf.c:6340 +#: src/readelf.c:7364 #, c-format msgid "" "\n" "section '%s' does not exist" msgstr "" -#: src/readelf.c:6401 +#: src/readelf.c:7425 #, c-format msgid "cannot get symbol index of archive '%s': %s" msgstr "" -#: src/readelf.c:6404 +#: src/readelf.c:7428 #, c-format msgid "" "\n" "Archive '%s' has no symbol index\n" msgstr "" -#: src/readelf.c:6408 +#: src/readelf.c:7432 #, c-format msgid "" "\n" "Index of archive '%s' has %Zu entries:\n" msgstr "" -#: src/readelf.c:6426 +#: src/readelf.c:7450 #, c-format msgid "cannot extract member at offset %Zu in '%s': %s" msgstr "" -#: src/readelf.c:6431 +#: src/readelf.c:7455 #, c-format msgid "Archive member '%s' contains:\n" msgstr "" @@ -1897,17 +2350,17 @@ msgstr "" msgid "Invalid radix: %s" msgstr "" -#: src/size.c:329 +#: src/size.c:339 #, c-format msgid "%s: file format not recognized" msgstr "" -#: src/size.c:439 src/size.c:582 +#: src/size.c:446 src/size.c:589 #, c-format msgid " (ex %s)" msgstr "" -#: src/size.c:607 +#: src/size.c:614 msgid "(TOTALS)\n" msgstr "" @@ -1958,12 +2411,13 @@ msgstr "" msgid "-F option specified twice" msgstr "" -#: src/strip.c:239 +#: src/strip.c:239 src/unstrip.c:124 #, c-format msgid "-o option specified twice" msgstr "" #: src/strip.c:259 +#, c-format msgid "-R option supports only .comment section" msgstr "" @@ -1997,62 +2451,62 @@ msgstr "" msgid "illformed file '%s'" msgstr "" -#: src/strip.c:867 src/strip.c:954 +#: src/strip.c:868 src/strip.c:955 #, c-format msgid "while generating output file: %s" msgstr "" -#: src/strip.c:927 src/strip.c:1666 +#: src/strip.c:928 src/strip.c:1667 #, c-format msgid "%s: error while creating ELF header: %s" msgstr "" -#: src/strip.c:941 +#: src/strip.c:942 #, c-format msgid "while preparing output for '%s'" msgstr "" -#: src/strip.c:992 src/strip.c:1048 +#: src/strip.c:993 src/strip.c:1049 #, c-format msgid "while create section header section: %s" msgstr "" -#: src/strip.c:998 +#: src/strip.c:999 #, c-format msgid "cannot allocate section data: %s" msgstr "" -#: src/strip.c:1057 +#: src/strip.c:1058 #, c-format msgid "while create section header string table: %s" msgstr "" -#: src/strip.c:1591 src/strip.c:1688 +#: src/strip.c:1592 src/strip.c:1689 #, c-format msgid "while writing '%s': %s" msgstr "" -#: src/strip.c:1602 +#: src/strip.c:1603 #, c-format msgid "while creating '%s'" msgstr "" -#: src/strip.c:1614 +#: src/strip.c:1615 #, c-format msgid "while computing checksum for debug information" msgstr "" -#: src/strip.c:1674 +#: src/strip.c:1675 #, c-format msgid "%s: error while reading the file: %s" msgstr "" -#: src/strip.c:1720 src/strip.c:1727 +#: src/strip.c:1721 src/strip.c:1728 #, c-format msgid "error while finishing '%s': %s" msgstr "" -#: src/strip.c:1750 src/strip.c:1807 +#: src/strip.c:1751 src/strip.c:1808 #, c-format msgid "cannot set access and modification date of '%s'" msgstr "" @@ -2383,12 +2837,12 @@ msgstr "" msgid "try again with an appropriate '-m' parameter" msgstr "" -#: src/ld.c:1445 +#: src/ld.c:1446 #, c-format msgid "cannot read version script '%s'" msgstr "" -#: src/ld.c:1511 src/ld.c:1550 +#: src/ld.c:1512 src/ld.c:1551 #, c-format msgid "duplicate definition of '%s' in linker script" msgstr "" @@ -2423,11 +2877,6 @@ msgstr "" msgid "%s (for DT_NEEDED %s)\n" msgstr "" -#: src/ldgeneric.c:519 -#, c-format -msgid "cannot open %s" -msgstr "" - #: src/ldgeneric.c:573 #, c-format msgid "Warning: type of `%s' changed from %s in %s to %s in %s" @@ -2664,7 +3113,7 @@ msgstr "" msgid "cannot get header of 0th section: %s" msgstr "" -#: src/ldgeneric.c:6941 +#: src/ldgeneric.c:6941 src/unstrip.c:1807 #, c-format msgid "cannot update ELF header: %s" msgstr "" @@ -2701,6 +3150,31 @@ msgstr "" msgid "no machine specific '%s' implementation" msgstr "" +#: src/i386_ld.c:210 +#, c-format +msgid "cannot allocate PLT section: %s" +msgstr "" + +#: src/i386_ld.c:232 +#, c-format +msgid "cannot allocate PLTREL section: %s" +msgstr "" + +#: src/i386_ld.c:253 +#, c-format +msgid "cannot allocate GOT section: %s" +msgstr "" + +#: src/i386_ld.c:274 +#, c-format +msgid "cannot allocate GOTPLT section: %s" +msgstr "" + +#: src/i386_ld.c:661 +#, c-format +msgid "initial-executable TLS relocation cannot be used " +msgstr "" + #: src/ldscript.y:178 msgid "mode for segment invalid\n" msgstr "" @@ -2730,1805 +3204,1861 @@ msgstr "" msgid "default visibility set as local and global" msgstr "" -#: src/elflint.c:72 +#: src/elflint.c:71 msgid "Be extremely strict, flag level 2 features." msgstr "" -#: src/elflint.c:73 +#: src/elflint.c:72 msgid "Do not print anything if successful" msgstr "" -#: src/elflint.c:74 +#: src/elflint.c:73 msgid "Binary is a separate debuginfo file" msgstr "" -#: src/elflint.c:76 +#: src/elflint.c:75 msgid "" "Binary has been created with GNU ld and is therefore known to be broken in " "certain ways" msgstr "" -#: src/elflint.c:82 +#: src/elflint.c:81 msgid "Pedantic checking of ELF files compliance with gABI/psABI spec." msgstr "" -#: src/elflint.c:166 +#: src/elflint.c:165 #, c-format msgid "cannot generate Elf descriptor: %s\n" msgstr "" -#: src/elflint.c:185 +#: src/elflint.c:184 #, c-format msgid "error while closing Elf descriptor: %s\n" msgstr "" -#: src/elflint.c:189 +#: src/elflint.c:188 msgid "No errors" msgstr "" -#: src/elflint.c:303 +#: src/elflint.c:301 #, c-format msgid " error while freeing sub-ELF descriptor: %s\n" msgstr "" -#: src/elflint.c:311 +#: src/elflint.c:309 #, c-format msgid "Not an ELF file - it has the wrong magic bytes at the start\n" msgstr "" -#: src/elflint.c:370 +#: src/elflint.c:368 #, c-format msgid "e_ident[%d] == %d is no known class\n" msgstr "" -#: src/elflint.c:375 +#: src/elflint.c:373 #, c-format msgid "e_ident[%d] == %d is no known data encoding\n" msgstr "" -#: src/elflint.c:379 +#: src/elflint.c:377 #, c-format msgid "unknown ELF header version number e_ident[%d] == %d\n" msgstr "" -#: src/elflint.c:384 +#: src/elflint.c:382 #, c-format msgid "unsupported OS ABI e_ident[%d] == '%s'\n" msgstr "" -#: src/elflint.c:390 +#: src/elflint.c:388 #, c-format msgid "unsupport ABI version e_ident[%d] == %d\n" msgstr "" -#: src/elflint.c:395 +#: src/elflint.c:393 #, c-format msgid "e_ident[%zu] is not zero\n" msgstr "" -#: src/elflint.c:400 +#: src/elflint.c:398 #, c-format msgid "unknown object file type %d\n" msgstr "" -#: src/elflint.c:407 +#: src/elflint.c:405 #, c-format msgid "unknown machine type %d\n" msgstr "" -#: src/elflint.c:411 +#: src/elflint.c:409 #, c-format msgid "unknown object file version\n" msgstr "" -#: src/elflint.c:417 +#: src/elflint.c:415 #, c-format msgid "invalid program header offset\n" msgstr "" -#: src/elflint.c:419 +#: src/elflint.c:417 #, c-format msgid "executables and DSOs cannot have zero program header offset\n" msgstr "" -#: src/elflint.c:423 +#: src/elflint.c:421 #, c-format msgid "invalid number of program header entries\n" msgstr "" -#: src/elflint.c:431 +#: src/elflint.c:429 #, c-format msgid "invalid section header table offset\n" msgstr "" -#: src/elflint.c:434 +#: src/elflint.c:432 #, c-format msgid "section header table must be present\n" msgstr "" -#: src/elflint.c:448 +#: src/elflint.c:446 #, c-format msgid "invalid number of section header table entries\n" msgstr "" -#: src/elflint.c:465 +#: src/elflint.c:463 #, c-format msgid "invalid section header index\n" msgstr "" -#: src/elflint.c:470 +#: src/elflint.c:468 #, c-format msgid "invalid machine flags: %s\n" msgstr "" -#: src/elflint.c:477 src/elflint.c:494 +#: src/elflint.c:475 src/elflint.c:492 #, c-format msgid "invalid ELF header size: %hd\n" msgstr "" -#: src/elflint.c:480 src/elflint.c:497 +#: src/elflint.c:478 src/elflint.c:495 #, c-format msgid "invalid program header size: %hd\n" msgstr "" -#: src/elflint.c:483 src/elflint.c:500 +#: src/elflint.c:481 src/elflint.c:498 #, c-format msgid "invalid program header position or size\n" msgstr "" -#: src/elflint.c:486 src/elflint.c:503 +#: src/elflint.c:484 src/elflint.c:501 #, c-format msgid "invalid section header size: %hd\n" msgstr "" -#: src/elflint.c:489 src/elflint.c:506 +#: src/elflint.c:487 src/elflint.c:504 #, c-format msgid "invalid section header position or size\n" msgstr "" -#: src/elflint.c:550 +#: src/elflint.c:548 #, c-format msgid "" "section [%2d] '%s': section with SHF_GROUP flag set not part of a section " "group\n" msgstr "" -#: src/elflint.c:554 +#: src/elflint.c:552 #, c-format msgid "" "section [%2d] '%s': section group [%2zu] '%s' does not preceed group member\n" msgstr "" -#: src/elflint.c:570 src/elflint.c:1395 src/elflint.c:1445 src/elflint.c:1554 -#: src/elflint.c:2148 src/elflint.c:2662 src/elflint.c:2823 src/elflint.c:2953 -#: src/elflint.c:3125 src/elflint.c:4005 +#: src/elflint.c:568 src/elflint.c:1393 src/elflint.c:1443 src/elflint.c:1552 +#: src/elflint.c:2146 src/elflint.c:2660 src/elflint.c:2821 src/elflint.c:2951 +#: src/elflint.c:3123 src/elflint.c:4020 #, c-format msgid "section [%2d] '%s': cannot get section data\n" msgstr "" -#: src/elflint.c:583 src/elflint.c:1561 +#: src/elflint.c:581 src/elflint.c:1559 #, 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:606 +#: src/elflint.c:604 #, c-format msgid "" "section [%2d] '%s': symbol table cannot have more than one extended index " "section\n" msgstr "" -#: src/elflint.c:617 +#: src/elflint.c:615 #, c-format msgid "section [%2u] '%s': entry size is does not match ElfXX_Sym\n" msgstr "" -#: src/elflint.c:626 +#: src/elflint.c:624 #, c-format msgid "section [%2d] '%s': cannot get symbol %d: %s\n" msgstr "" -#: src/elflint.c:631 src/elflint.c:634 src/elflint.c:637 src/elflint.c:640 -#: src/elflint.c:643 src/elflint.c:646 +#: src/elflint.c:629 src/elflint.c:632 src/elflint.c:635 src/elflint.c:638 +#: src/elflint.c:641 src/elflint.c:644 #, c-format msgid "section [%2d] '%s': '%s' in zeroth entry not zero\n" msgstr "" -#: src/elflint.c:649 +#: src/elflint.c:647 #, c-format msgid "section [%2d] '%s': XINDEX for zeroth entry not zero\n" msgstr "" -#: src/elflint.c:659 +#: src/elflint.c:657 #, c-format msgid "section [%2d] '%s': cannot get symbol %zu: %s\n" msgstr "" -#: src/elflint.c:668 +#: src/elflint.c:666 #, c-format msgid "section [%2d] '%s': symbol %zu: invalid name value\n" msgstr "" -#: src/elflint.c:681 +#: src/elflint.c:679 #, c-format msgid "" "section [%2d] '%s': symbol %zu: too large section index but no extended " "section index section\n" msgstr "" -#: src/elflint.c:687 +#: src/elflint.c:685 #, c-format msgid "" "section [%2d] '%s': symbol %zu: XINDEX used for index which would fit in " "st_shndx (%)\n" msgstr "" -#: src/elflint.c:699 +#: src/elflint.c:697 #, c-format msgid "section [%2d] '%s': symbol %zu: invalid section index\n" msgstr "" -#: src/elflint.c:707 +#: src/elflint.c:705 #, c-format msgid "section [%2d] '%s': symbol %zu: unknown type\n" msgstr "" -#: src/elflint.c:711 +#: src/elflint.c:709 #, c-format msgid "section [%2d] '%s': symbol %zu: unknown symbol binding\n" msgstr "" -#: src/elflint.c:719 +#: src/elflint.c:717 #, c-format msgid "" "section [%2d] '%s': symbol %zu: COMMON only allowed in relocatable files\n" msgstr "" -#: src/elflint.c:723 +#: src/elflint.c:721 #, c-format msgid "section [%2d] '%s': symbol %zu: local COMMON symbols are nonsense\n" msgstr "" -#: src/elflint.c:727 +#: src/elflint.c:725 #, c-format msgid "" "section [%2d] '%s': symbol %zu: function in COMMON section is nonsense\n" msgstr "" -#: src/elflint.c:759 +#: src/elflint.c:757 #, c-format msgid "section [%2d] '%s': symbol %zu: st_value out of bounds\n" msgstr "" -#: src/elflint.c:765 src/elflint.c:790 src/elflint.c:833 +#: src/elflint.c:763 src/elflint.c:788 src/elflint.c:831 #, c-format msgid "" "section [%2d] '%s': symbol %zu does not fit completely in referenced section " "[%2d] '%s'\n" msgstr "" -#: src/elflint.c:774 +#: src/elflint.c:772 #, c-format msgid "" "section [%2d] '%s': symbol %zu: referenced section [%2d] '%s' does not have " "SHF_TLS flag set\n" msgstr "" -#: src/elflint.c:784 src/elflint.c:826 +#: src/elflint.c:782 src/elflint.c:824 #, c-format msgid "" "section [%2d] '%s': symbol %zu: st_value out of bounds of referenced section " "[%2d] '%s'\n" msgstr "" -#: src/elflint.c:811 +#: src/elflint.c:809 #, c-format msgid "" "section [%2d] '%s': symbol %zu: TLS symbol but no TLS program header entry\n" msgstr "" -#: src/elflint.c:819 +#: src/elflint.c:817 #, c-format msgid "" "section [%2d] '%s': symbol %zu: st_value short of referenced section [%2d] '%" "s'\n" msgstr "" -#: src/elflint.c:846 +#: src/elflint.c:844 #, c-format msgid "" "section [%2d] '%s': symbol %zu: local symbol outside range described in " "sh_info\n" msgstr "" -#: src/elflint.c:853 +#: src/elflint.c:851 #, c-format msgid "" "section [%2d] '%s': symbol %zu: non-local symbol outside range described in " "sh_info\n" msgstr "" -#: src/elflint.c:860 +#: src/elflint.c:858 #, c-format msgid "section [%2d] '%s': symbol %zu: non-local section symbol\n" msgstr "" -#: src/elflint.c:910 +#: src/elflint.c:908 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol refers to bad section [%" "2d]\n" msgstr "" -#: src/elflint.c:917 +#: src/elflint.c:915 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol refers to section [%2d] '%" "s'\n" msgstr "" -#: src/elflint.c:933 +#: src/elflint.c:931 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol value %# does not " "match %s section address %#\n" msgstr "" -#: src/elflint.c:940 +#: src/elflint.c:938 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol size % does not " "match %s section size %\n" msgstr "" -#: src/elflint.c:948 +#: src/elflint.c:946 #, c-format msgid "" "section [%2d] '%s': _GLOBAL_OFFSET_TABLE_ symbol present, but no .got " "section\n" msgstr "" -#: src/elflint.c:964 +#: src/elflint.c:962 #, c-format msgid "" "section [%2d] '%s': _DYNAMIC_ symbol value %# does not match dynamic " "segment address %#\n" msgstr "" -#: src/elflint.c:971 +#: src/elflint.c:969 #, c-format msgid "" "section [%2d] '%s': _DYNAMIC symbol size % does not match dynamic " "segment size %\n" msgstr "" -#: src/elflint.c:1022 +#: src/elflint.c:1020 #, c-format msgid "section [%2d] '%s': DT_RELCOUNT used for this RELA section\n" msgstr "" -#: src/elflint.c:1031 src/elflint.c:1083 +#: src/elflint.c:1029 src/elflint.c:1081 #, c-format msgid "section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n" msgstr "" -#: src/elflint.c:1056 src/elflint.c:1108 +#: src/elflint.c:1054 src/elflint.c:1106 #, c-format msgid "" "section [%2d] '%s': relative relocations after index %d as specified by " "DT_RELCOUNT\n" msgstr "" -#: src/elflint.c:1062 src/elflint.c:1114 +#: src/elflint.c:1060 src/elflint.c:1112 #, c-format msgid "" "section [%2d] '%s': non-relative relocation at index %zu; DT_RELCOUNT " "specified %d relative relocations\n" msgstr "" -#: src/elflint.c:1074 +#: src/elflint.c:1072 #, c-format msgid "section [%2d] '%s': DT_RELACOUNT used for this REL section\n" msgstr "" -#: src/elflint.c:1156 +#: src/elflint.c:1154 #, c-format msgid "section [%2d] '%s': invalid destination section index\n" msgstr "" -#: src/elflint.c:1169 +#: src/elflint.c:1167 #, c-format msgid "section [%2d] '%s': invalid destination section type\n" msgstr "" -#: src/elflint.c:1177 +#: src/elflint.c:1175 #, c-format msgid "section [%2d] '%s': sh_info should be zero\n" msgstr "" -#: src/elflint.c:1184 +#: src/elflint.c:1182 #, c-format msgid "section [%2d] '%s': no relocations for merge-able sections possible\n" msgstr "" -#: src/elflint.c:1191 +#: src/elflint.c:1189 #, c-format msgid "section [%2d] '%s': section entry size does not match ElfXX_Rela\n" msgstr "" -#: src/elflint.c:1251 +#: src/elflint.c:1249 #, c-format msgid "text relocation flag set but there is no read-only segment\n" msgstr "" -#: src/elflint.c:1278 +#: src/elflint.c:1276 #, c-format msgid "section [%2d] '%s': relocation %zu: invalid type\n" msgstr "" -#: src/elflint.c:1286 +#: src/elflint.c:1284 #, c-format msgid "" "section [%2d] '%s': relocation %zu: relocation type invalid for the file " "type\n" msgstr "" -#: src/elflint.c:1294 +#: src/elflint.c:1292 #, c-format msgid "section [%2d] '%s': relocation %zu: invalid symbol index\n" msgstr "" -#: src/elflint.c:1312 +#: src/elflint.c:1310 #, c-format msgid "" "section [%2d] '%s': relocation %zu: only symbol '_GLOBAL_OFFSET_TABLE_' can " "be used with %s\n" msgstr "" -#: src/elflint.c:1329 +#: src/elflint.c:1327 #, c-format msgid "section [%2d] '%s': relocation %zu: offset out of bounds\n" msgstr "" -#: src/elflint.c:1344 +#: src/elflint.c:1342 #, c-format msgid "" "section [%2d] '%s': relocation %zu: copy relocation against symbol of type %" "s\n" msgstr "" -#: src/elflint.c:1365 +#: src/elflint.c:1363 #, c-format msgid "" "section [%2d] '%s': relocation %zu: read-only section modified but text " "relocation flag not set\n" msgstr "" -#: src/elflint.c:1380 +#: src/elflint.c:1378 #, c-format msgid "section [%2d] '%s': relocations are against loaded and unloaded data\n" msgstr "" -#: src/elflint.c:1419 src/elflint.c:1469 +#: src/elflint.c:1417 src/elflint.c:1467 #, c-format msgid "section [%2d] '%s': cannot get relocation %zu: %s\n" msgstr "" -#: src/elflint.c:1549 +#: src/elflint.c:1547 #, c-format msgid "more than one dynamic section present\n" msgstr "" -#: src/elflint.c:1567 +#: src/elflint.c:1565 #, c-format msgid "section [%2d] '%s': section entry size does not match ElfXX_Dyn\n" msgstr "" -#: src/elflint.c:1572 src/elflint.c:1864 +#: src/elflint.c:1570 src/elflint.c:1862 #, c-format msgid "section [%2d] '%s': sh_info not zero\n" msgstr "" -#: src/elflint.c:1582 +#: src/elflint.c:1580 #, c-format msgid "section [%2d] '%s': cannot get dynamic section entry %zu: %s\n" msgstr "" -#: src/elflint.c:1590 +#: src/elflint.c:1588 #, c-format msgid "section [%2d] '%s': non-DT_NULL entries follow DT_NULL entry\n" msgstr "" -#: src/elflint.c:1597 +#: src/elflint.c:1595 #, c-format msgid "section [%2d] '%s': entry %zu: unknown tag\n" msgstr "" -#: src/elflint.c:1608 +#: src/elflint.c:1606 #, c-format msgid "section [%2d] '%s': entry %zu: more than one entry with tag %s\n" msgstr "" -#: src/elflint.c:1618 +#: src/elflint.c:1616 #, c-format msgid "section [%2d] '%s': entry %zu: level 2 tag %s used\n" msgstr "" -#: src/elflint.c:1636 +#: src/elflint.c:1634 #, c-format msgid "" "section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n" msgstr "" -#: src/elflint.c:1658 +#: src/elflint.c:1656 #, 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:1701 +#: src/elflint.c:1699 #, c-format msgid "" "section [%2d] '%s': entry %zu: %s value must point into loaded segment\n" msgstr "" -#: src/elflint.c:1716 +#: src/elflint.c:1714 #, c-format msgid "" "section [%2d] '%s': entry %zu: %s value must be valid offset in section [%" "2d] '%s'\n" msgstr "" -#: src/elflint.c:1736 src/elflint.c:1764 +#: src/elflint.c:1734 src/elflint.c:1762 #, c-format msgid "section [%2d] '%s': contains %s entry but not %s\n" msgstr "" -#: src/elflint.c:1748 +#: src/elflint.c:1746 #, c-format msgid "section [%2d] '%s': mandatory tag %s not present\n" msgstr "" -#: src/elflint.c:1757 +#: src/elflint.c:1755 #, c-format msgid "section [%2d] '%s': no hash section present\n" msgstr "" -#: src/elflint.c:1772 src/elflint.c:1779 +#: src/elflint.c:1770 src/elflint.c:1777 #, c-format msgid "section [%2d] '%s': not all of %s, %s, and %s are present\n" msgstr "" -#: src/elflint.c:1789 src/elflint.c:1793 +#: src/elflint.c:1787 src/elflint.c:1791 #, c-format msgid "section [%2d] '%s': %s tag missing in DSO marked during prelinking\n" msgstr "" -#: src/elflint.c:1799 +#: src/elflint.c:1797 #, c-format msgid "section [%2d] '%s': non-DSO file marked as dependency during prelink\n" msgstr "" -#: src/elflint.c:1810 src/elflint.c:1814 src/elflint.c:1818 src/elflint.c:1822 +#: src/elflint.c:1808 src/elflint.c:1812 src/elflint.c:1816 src/elflint.c:1820 #, c-format msgid "section [%2d] '%s': %s tag missing in prelinked executable\n" msgstr "" -#: src/elflint.c:1834 +#: src/elflint.c:1832 #, c-format msgid "" "section [%2d] '%s': only relocatable files can have extended section index\n" msgstr "" -#: src/elflint.c:1844 +#: src/elflint.c:1842 #, c-format msgid "" "section [%2d] '%s': extended section index section not for symbol table\n" msgstr "" -#: src/elflint.c:1849 +#: src/elflint.c:1847 #, c-format msgid "cannot get data for symbol section\n" msgstr "" -#: src/elflint.c:1852 +#: src/elflint.c:1850 #, c-format msgid "section [%2d] '%s': entry size does not match Elf32_Word\n" msgstr "" -#: src/elflint.c:1859 +#: src/elflint.c:1857 #, c-format msgid "section [%2d] '%s': extended index table too small for symbol table\n" msgstr "" -#: src/elflint.c:1874 +#: src/elflint.c:1872 #, c-format msgid "" "section [%2d] '%s': extended section index in section [%2zu] '%s' refers to " "same symbol table\n" msgstr "" -#: src/elflint.c:1885 +#: src/elflint.c:1883 #, c-format msgid "symbol 0 should have zero extended section index\n" msgstr "" -#: src/elflint.c:1897 +#: src/elflint.c:1895 #, c-format msgid "cannot get data for symbol %zu\n" msgstr "" -#: src/elflint.c:1902 +#: src/elflint.c:1900 #, c-format msgid "extended section index is % but symbol index is not XINDEX\n" msgstr "" -#: src/elflint.c:1918 src/elflint.c:1959 +#: src/elflint.c:1916 src/elflint.c:1957 #, c-format msgid "" "section [%2d] '%s': hash table section is too small (is %ld, expected %ld)\n" msgstr "" -#: src/elflint.c:1930 src/elflint.c:1971 +#: src/elflint.c:1928 src/elflint.c:1969 #, c-format msgid "section [%2d] '%s': chain array too large\n" msgstr "" -#: src/elflint.c:1939 src/elflint.c:1980 +#: src/elflint.c:1937 src/elflint.c:1978 #, c-format msgid "section [%2d] '%s': hash bucket reference %zu out of bounds\n" msgstr "" -#: src/elflint.c:1945 +#: src/elflint.c:1943 #, c-format msgid "section [%2d] '%s': hash chain reference %zu out of bounds\n" msgstr "" -#: src/elflint.c:1986 +#: src/elflint.c:1984 #, c-format msgid "section [%2d] '%s': hash chain reference % out of bounds\n" msgstr "" -#: src/elflint.c:2001 +#: src/elflint.c:1999 #, c-format msgid "section [%2d] '%s': bitmask size not power of 2: %u\n" msgstr "" -#: src/elflint.c:2012 +#: src/elflint.c:2010 #, c-format msgid "" "section [%2d] '%s': hash table section is too small (is %ld, expected at " "least%ld)\n" msgstr "" -#: src/elflint.c:2020 +#: src/elflint.c:2018 #, c-format msgid "section [%2d] '%s': 2nd hash function shift too big: %u\n" msgstr "" -#: src/elflint.c:2052 +#: src/elflint.c:2050 #, c-format msgid "" "section [%2d] '%s': hash chain for bucket %zu lower than symbol index bias\n" msgstr "" -#: src/elflint.c:2073 +#: src/elflint.c:2071 #, c-format msgid "" "section [%2d] '%s': symbol %u referenced in chain for bucket %zu is " "undefined\n" msgstr "" -#: src/elflint.c:2084 +#: src/elflint.c:2082 #, c-format msgid "" "section [%2d] '%s': hash value for symbol %u in chain for bucket %zu wrong\n" msgstr "" -#: src/elflint.c:2115 +#: src/elflint.c:2113 #, c-format msgid "section [%2d] '%s': hash chain for bucket %zu out of bounds\n" msgstr "" -#: src/elflint.c:2120 +#: src/elflint.c:2118 #, c-format msgid "" "section [%2d] '%s': symbol reference in chain for bucket %zu out of bounds\n" msgstr "" -#: src/elflint.c:2126 +#: src/elflint.c:2124 #, c-format msgid "section [%2d] '%s': bitmask does not match names in the hash table\n" msgstr "" -#: src/elflint.c:2139 +#: src/elflint.c:2137 #, c-format msgid "section [%2d] '%s': relocatable files cannot have hash tables\n" msgstr "" -#: src/elflint.c:2157 +#: src/elflint.c:2155 #, c-format msgid "section [%2d] '%s': hash table not for dynamic symbol table\n" msgstr "" -#: src/elflint.c:2165 +#: src/elflint.c:2163 #, c-format msgid "section [%2d] '%s': hash table entry size incorrect\n" msgstr "" -#: src/elflint.c:2170 +#: src/elflint.c:2168 #, c-format msgid "section [%2d] '%s': not marked to be allocated\n" msgstr "" -#: src/elflint.c:2175 +#: src/elflint.c:2173 #, c-format msgid "" "section [%2d] '%s': hash table has not even room for initial administrative " "entries\n" msgstr "" -#: src/elflint.c:2223 +#: src/elflint.c:2221 #, c-format msgid "sh_link in hash sections [%2zu] '%s' and [%2zu] '%s' not identical\n" msgstr "" -#: src/elflint.c:2301 src/elflint.c:2305 +#: src/elflint.c:2299 src/elflint.c:2303 #, c-format msgid "section [%2zu] '%s': reference to symbol index 0\n" msgstr "" -#: src/elflint.c:2312 +#: src/elflint.c:2310 #, 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:2324 +#: src/elflint.c:2322 #, 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:2340 +#: src/elflint.c:2338 #, c-format msgid "section [%2d] '%s': nonzero sh_%s for NULL section\n" msgstr "" -#: src/elflint.c:2360 +#: src/elflint.c:2358 #, c-format msgid "" "section [%2d] '%s': section groups only allowed in relocatable object files\n" msgstr "" -#: src/elflint.c:2371 +#: src/elflint.c:2369 #, c-format msgid "section [%2d] '%s': cannot get symbol table: %s\n" msgstr "" -#: src/elflint.c:2376 +#: src/elflint.c:2374 #, c-format msgid "section [%2d] '%s': section reference in sh_link is no symbol table\n" msgstr "" -#: src/elflint.c:2382 +#: src/elflint.c:2380 #, c-format msgid "section [%2d] '%s': invalid symbol index in sh_info\n" msgstr "" -#: src/elflint.c:2387 +#: src/elflint.c:2385 #, c-format msgid "section [%2d] '%s': sh_flags not zero\n" msgstr "" -#: src/elflint.c:2394 +#: src/elflint.c:2392 #, c-format msgid "section [%2d] '%s': cannot get symbol for signature\n" msgstr "" -#: src/elflint.c:2399 +#: src/elflint.c:2397 #, c-format msgid "section [%2d] '%s': signature symbol canot be empty string\n" msgstr "" -#: src/elflint.c:2405 +#: src/elflint.c:2403 #, c-format msgid "section [%2d] '%s': sh_flags not set correctly\n" msgstr "" -#: src/elflint.c:2411 +#: src/elflint.c:2409 #, c-format msgid "section [%2d] '%s': cannot get data: %s\n" msgstr "" -#: src/elflint.c:2420 +#: src/elflint.c:2418 #, c-format msgid "section [%2d] '%s': section size not multiple of sizeof(Elf32_Word)\n" msgstr "" -#: src/elflint.c:2425 +#: src/elflint.c:2423 #, c-format msgid "section [%2d] '%s': section group without flags word\n" msgstr "" -#: src/elflint.c:2431 +#: src/elflint.c:2429 #, c-format msgid "section [%2d] '%s': section group without member\n" msgstr "" -#: src/elflint.c:2435 +#: src/elflint.c:2433 #, c-format msgid "section [%2d] '%s': section group with only one member\n" msgstr "" -#: src/elflint.c:2446 +#: src/elflint.c:2444 #, c-format msgid "section [%2d] '%s': unknown section group flags\n" msgstr "" -#: src/elflint.c:2458 +#: src/elflint.c:2456 #, c-format msgid "section [%2d] '%s': section index %Zu out of range\n" msgstr "" -#: src/elflint.c:2467 +#: src/elflint.c:2465 #, c-format msgid "section [%2d] '%s': cannot get section header for element %zu: %s\n" msgstr "" -#: src/elflint.c:2474 +#: src/elflint.c:2472 #, c-format msgid "section [%2d] '%s': section group contains another group [%2d] '%s'\n" msgstr "" -#: src/elflint.c:2480 +#: src/elflint.c:2478 #, c-format msgid "" "section [%2d] '%s': element %Zu references section [%2d] '%s' without " "SHF_GROUP flag set\n" msgstr "" -#: src/elflint.c:2487 +#: src/elflint.c:2485 #, c-format msgid "section [%2d] '%s' is contained in more than one section group\n" msgstr "" -#: src/elflint.c:2676 +#: src/elflint.c:2674 #, 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:2687 +#: src/elflint.c:2685 #, c-format msgid "" "section [%2d] '%s' has different number of entries than symbol table [%2d] '%" "s'\n" msgstr "" -#: src/elflint.c:2703 +#: src/elflint.c:2701 #, c-format msgid "section [%2d] '%s': symbol %d: cannot read version data\n" msgstr "" -#: src/elflint.c:2719 +#: src/elflint.c:2717 #, c-format msgid "section [%2d] '%s': symbol %d: local symbol with global scope\n" msgstr "" -#: src/elflint.c:2727 +#: src/elflint.c:2725 #, c-format msgid "section [%2d] '%s': symbol %d: local symbol with version\n" msgstr "" -#: src/elflint.c:2741 +#: src/elflint.c:2739 #, c-format msgid "section [%2d] '%s': symbol %d: invalid version index %d\n" msgstr "" -#: src/elflint.c:2746 +#: src/elflint.c:2744 #, c-format msgid "" "section [%2d] '%s': symbol %d: version index %d is for defined version\n" msgstr "" -#: src/elflint.c:2756 +#: src/elflint.c:2754 #, c-format msgid "" "section [%2d] '%s': symbol %d: version index %d is for requested version\n" msgstr "" -#: src/elflint.c:2808 +#: src/elflint.c:2806 #, c-format msgid "more than one version reference section present\n" msgstr "" -#: src/elflint.c:2816 src/elflint.c:2945 +#: src/elflint.c:2814 src/elflint.c:2943 #, c-format msgid "section [%2d] '%s': sh_link does not link to string table\n" msgstr "" -#: src/elflint.c:2839 src/elflint.c:2997 +#: src/elflint.c:2837 src/elflint.c:2995 #, c-format msgid "section [%2d] '%s': entry %d has wrong version %d\n" msgstr "" -#: src/elflint.c:2845 src/elflint.c:3003 +#: src/elflint.c:2843 src/elflint.c:3001 #, c-format msgid "section [%2d] '%s': entry %d has wrong offset of auxiliary data\n" msgstr "" -#: src/elflint.c:2853 +#: src/elflint.c:2851 #, c-format msgid "section [%2d] '%s': entry %d has invalid file reference\n" msgstr "" -#: src/elflint.c:2861 +#: src/elflint.c:2859 #, c-format msgid "section [%2d] '%s': entry %d references unknown dependency\n" msgstr "" -#: src/elflint.c:2873 +#: src/elflint.c:2871 #, c-format msgid "section [%2d] '%s': auxiliary entry %d of entry %d has unknown flag\n" msgstr "" -#: src/elflint.c:2880 +#: src/elflint.c:2878 #, c-format msgid "" "section [%2d] '%s': auxiliary entry %d of entry %d has invalid name " "reference\n" msgstr "" -#: src/elflint.c:2887 +#: src/elflint.c:2885 #, c-format msgid "" "section [%2d] '%s': auxiliary entry %d of entry %d has wrong hash value: %" "#x, expected %#x\n" msgstr "" -#: src/elflint.c:2897 +#: src/elflint.c:2895 #, c-format msgid "" "section [%2d] '%s': auxiliary entry %d of entry %d has duplicate version " "name '%s'\n" msgstr "" -#: src/elflint.c:2908 +#: src/elflint.c:2906 #, c-format msgid "" "section [%2d] '%s': auxiliary entry %d of entry %d has wrong next field\n" msgstr "" -#: src/elflint.c:2924 src/elflint.c:3082 +#: src/elflint.c:2922 src/elflint.c:3080 #, c-format msgid "section [%2d] '%s': entry %d has invalid offset to next entry\n" msgstr "" -#: src/elflint.c:2937 +#: src/elflint.c:2935 #, c-format msgid "more than one version definition section present\n" msgstr "" -#: src/elflint.c:2982 +#: src/elflint.c:2980 #, c-format msgid "section [%2d] '%s': more than one BASE definition\n" msgstr "" -#: src/elflint.c:2986 +#: src/elflint.c:2984 #, c-format msgid "section [%2d] '%s': BASE definition must have index VER_NDX_GLOBAL\n" msgstr "" -#: src/elflint.c:2992 +#: src/elflint.c:2990 #, c-format msgid "section [%2d] '%s': entry %d has unknown flag\n" msgstr "" -#: src/elflint.c:3016 +#: src/elflint.c:3014 #, c-format msgid "section [%2d] '%s': entry %d has invalid name reference\n" msgstr "" -#: src/elflint.c:3023 +#: src/elflint.c:3021 #, c-format msgid "section [%2d] '%s': entry %d has wrong hash value: %#x, expected %#x\n" msgstr "" -#: src/elflint.c:3032 +#: src/elflint.c:3030 #, c-format msgid "section [%2d] '%s': entry %d has duplicate version name '%s'\n" msgstr "" -#: src/elflint.c:3051 +#: src/elflint.c:3049 #, c-format msgid "" "section [%2d] '%s': entry %d has invalid name reference in auxiliary data\n" msgstr "" -#: src/elflint.c:3066 +#: src/elflint.c:3064 #, c-format msgid "section [%2d] '%s': entry %d has wrong next field in auxiliary data\n" msgstr "" -#: src/elflint.c:3088 +#: src/elflint.c:3086 #, c-format msgid "section [%2d] '%s': no BASE definition\n" msgstr "" -#: src/elflint.c:3104 +#: src/elflint.c:3102 #, c-format msgid "section [%2d] '%s': unknown parent version '%s'\n" msgstr "" -#: src/elflint.c:3117 +#: src/elflint.c:3115 #, c-format msgid "section [%2d] '%s': empty object attributes section\n" msgstr "" -#: src/elflint.c:3138 +#: src/elflint.c:3136 #, c-format msgid "section [%2d] '%s': unrecognized attribute format\n" msgstr "" -#: src/elflint.c:3154 +#: src/elflint.c:3152 #, c-format msgid "" "section [%2d] '%s': offset %zu: zero length field in attribute section\n" msgstr "" -#: src/elflint.c:3163 +#: src/elflint.c:3161 #, c-format msgid "section [%2d] '%s': offset %zu: invalid length in attribute section\n" msgstr "" -#: src/elflint.c:3175 +#: src/elflint.c:3173 #, c-format msgid "section [%2d] '%s': offset %zu: unterminated vendor name string\n" msgstr "" -#: src/elflint.c:3192 +#: src/elflint.c:3190 #, c-format msgid "" "section [%2d] '%s': offset %zu: endless ULEB128 in attribute subsection tag\n" msgstr "" -#: src/elflint.c:3201 +#: src/elflint.c:3199 #, c-format msgid "section [%2d] '%s': offset %zu: truncated attribute section\n" msgstr "" -#: src/elflint.c:3210 +#: src/elflint.c:3208 #, c-format msgid "" "section [%2d] '%s': offset %zu: zero length field in attribute subsection\n" msgstr "" -#: src/elflint.c:3223 +#: src/elflint.c:3221 #, c-format msgid "" "section [%2d] '%s': offset %zu: invalid length in attribute subsection\n" msgstr "" -#: src/elflint.c:3234 +#: src/elflint.c:3232 #, c-format msgid "" "section [%2d] '%s': offset %zu: attribute subsection has unexpected tag %u\n" msgstr "" -#: src/elflint.c:3252 +#: src/elflint.c:3250 #, c-format msgid "section [%2d] '%s': offset %zu: endless ULEB128 in attribute tag\n" msgstr "" -#: src/elflint.c:3263 +#: src/elflint.c:3261 #, c-format msgid "section [%2d] '%s': offset %zu: unterminated string in attribute\n" msgstr "" -#: src/elflint.c:3276 +#: src/elflint.c:3274 #, c-format msgid "section [%2d] '%s': offset %zu: unrecognized attribute tag %u\n" msgstr "" -#: src/elflint.c:3280 +#: src/elflint.c:3278 #, c-format msgid "" "section [%2d] '%s': offset %zu: unrecognized %s attribute value %\n" msgstr "" -#: src/elflint.c:3290 +#: src/elflint.c:3288 #, c-format msgid "section [%2d] '%s': offset %zu: vendor '%s' unknown\n" msgstr "" -#: src/elflint.c:3296 +#: src/elflint.c:3294 #, c-format msgid "" "section [%2d] '%s': offset %zu: extra bytes after last attribute section\n" msgstr "" -#: src/elflint.c:3378 +#: src/elflint.c:3383 #, c-format msgid "cannot get section header of zeroth section\n" msgstr "" -#: src/elflint.c:3382 +#: src/elflint.c:3387 #, c-format msgid "zeroth section has nonzero name\n" msgstr "" -#: src/elflint.c:3384 +#: src/elflint.c:3389 #, c-format msgid "zeroth section has nonzero type\n" msgstr "" -#: src/elflint.c:3386 +#: src/elflint.c:3391 #, c-format msgid "zeroth section has nonzero flags\n" msgstr "" -#: src/elflint.c:3388 +#: src/elflint.c:3393 #, c-format msgid "zeroth section has nonzero address\n" msgstr "" -#: src/elflint.c:3390 +#: src/elflint.c:3395 #, c-format msgid "zeroth section has nonzero offset\n" msgstr "" -#: src/elflint.c:3392 +#: src/elflint.c:3397 #, c-format msgid "zeroth section has nonzero info field\n" msgstr "" -#: src/elflint.c:3394 +#: src/elflint.c:3399 #, c-format msgid "zeroth section has nonzero align value\n" msgstr "" -#: src/elflint.c:3396 +#: src/elflint.c:3401 #, c-format msgid "zeroth section has nonzero entry size value\n" msgstr "" -#: src/elflint.c:3399 +#: src/elflint.c:3404 #, c-format msgid "" "zeroth section has nonzero size value while ELF header has nonzero shnum " "value\n" msgstr "" -#: src/elflint.c:3403 +#: src/elflint.c:3408 #, c-format msgid "" "zeroth section has nonzero link value while ELF header does not signal " "overflow in shstrndx\n" msgstr "" -#: src/elflint.c:3420 +#: src/elflint.c:3425 #, c-format msgid "cannot get section header for section [%2zu] '%s': %s\n" msgstr "" -#: src/elflint.c:3429 +#: src/elflint.c:3434 #, c-format msgid "section [%2zu]: invalid name\n" msgstr "" -#: src/elflint.c:3456 +#: src/elflint.c:3461 #, c-format msgid "section [%2d] '%s' has wrong type: expected %s, is %s\n" msgstr "" -#: src/elflint.c:3472 +#: src/elflint.c:3477 #, c-format msgid "section [%2zu] '%s' has wrong flags: expected %s, is %s\n" msgstr "" -#: src/elflint.c:3489 +#: src/elflint.c:3494 #, c-format msgid "" "section [%2zu] '%s' has wrong flags: expected %s and possibly %s, is %s\n" msgstr "" -#: src/elflint.c:3507 +#: src/elflint.c:3512 #, c-format msgid "section [%2zu] '%s' present in object file\n" msgstr "" -#: src/elflint.c:3513 src/elflint.c:3545 +#: src/elflint.c:3518 src/elflint.c:3550 #, c-format msgid "" "section [%2zu] '%s' has SHF_ALLOC flag set but there is no loadable segment\n" msgstr "" -#: src/elflint.c:3518 src/elflint.c:3550 +#: src/elflint.c:3523 src/elflint.c:3555 #, c-format msgid "" "section [%2zu] '%s' has SHF_ALLOC flag not set but there are loadable " "segments\n" msgstr "" -#: src/elflint.c:3526 +#: src/elflint.c:3531 #, c-format msgid "" "section [%2zu] '%s' is extension section index table in non-object file\n" msgstr "" -#: src/elflint.c:3561 +#: src/elflint.c:3574 #, c-format msgid "section [%2zu] '%s': size not multiple of entry size\n" msgstr "" -#: src/elflint.c:3566 +#: src/elflint.c:3579 #, c-format msgid "cannot get section header\n" msgstr "" -#: src/elflint.c:3576 +#: src/elflint.c:3589 #, c-format msgid "section [%2zu] '%s' has unsupported type %d\n" msgstr "" -#: src/elflint.c:3590 +#: src/elflint.c:3603 #, c-format msgid "" "section [%2zu] '%s' contains invalid processor-specific flag(s) %#\n" msgstr "" -#: src/elflint.c:3597 +#: src/elflint.c:3610 #, c-format msgid "section [%2zu] '%s' contains unknown flag(s) %#\n" msgstr "" -#: src/elflint.c:3605 +#: src/elflint.c:3618 #, c-format msgid "section [%2zu] '%s': thread-local data sections address not zero\n" msgstr "" -#: src/elflint.c:3613 +#: src/elflint.c:3626 #, c-format msgid "section [%2zu] '%s': invalid section reference in link value\n" msgstr "" -#: src/elflint.c:3618 +#: src/elflint.c:3631 #, c-format msgid "section [%2zu] '%s': invalid section reference in info value\n" msgstr "" -#: src/elflint.c:3625 +#: src/elflint.c:3638 #, c-format msgid "section [%2zu] '%s': strings flag set without merge flag\n" msgstr "" -#: src/elflint.c:3630 +#: src/elflint.c:3643 #, c-format msgid "section [%2zu] '%s': merge flag set but entry size is zero\n" msgstr "" -#: src/elflint.c:3648 +#: src/elflint.c:3661 #, c-format msgid "section [%2zu] '%s' has unexpected type %d for an executable section\n" msgstr "" -#: src/elflint.c:3657 +#: src/elflint.c:3670 #, c-format msgid "section [%2zu] '%s' is both executable and writable\n" msgstr "" -#: src/elflint.c:3684 +#: src/elflint.c:3697 #, c-format msgid "" "section [%2zu] '%s' not fully contained in segment of program header entry %" "d\n" msgstr "" -#: src/elflint.c:3692 +#: src/elflint.c:3705 #, 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:3701 +#: src/elflint.c:3714 #, 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:3712 +#: src/elflint.c:3725 #, c-format msgid "section [%2zu] '%s' is executable in nonexecutable segment %d\n" msgstr "" -#: src/elflint.c:3722 +#: src/elflint.c:3735 #, c-format msgid "section [%2zu] '%s' is writable in unwritable segment %d\n" msgstr "" -#: src/elflint.c:3732 +#: src/elflint.c:3745 #, c-format msgid "" "section [%2zu] '%s': alloc flag set but section not in any loaded segment\n" msgstr "" -#: src/elflint.c:3738 +#: src/elflint.c:3751 #, 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:3746 +#: src/elflint.c:3759 #, c-format msgid "" "section [%2zu] '%s': relocatable files cannot have dynamic symbol tables\n" msgstr "" -#: src/elflint.c:3797 +#: src/elflint.c:3810 #, c-format msgid "more than one version symbol table present\n" msgstr "" -#: src/elflint.c:3820 +#: src/elflint.c:3833 #, c-format msgid "INTERP program header entry but no .interp section\n" msgstr "" -#: src/elflint.c:3831 +#: src/elflint.c:3844 #, c-format msgid "" "loadable segment [%u] is executable but contains no executable sections\n" msgstr "" -#: src/elflint.c:3837 +#: src/elflint.c:3850 #, c-format msgid "loadable segment [%u] is writable but contains no writable sections\n" msgstr "" -#: src/elflint.c:3848 +#: src/elflint.c:3861 #, c-format msgid "" "no .gnu.versym section present but .gnu.versym_d or .gnu.versym_r section " "exist\n" msgstr "" -#: src/elflint.c:3861 +#: src/elflint.c:3874 #, c-format msgid "duplicate version index %d\n" msgstr "" -#: src/elflint.c:3875 +#: src/elflint.c:3888 #, c-format msgid ".gnu.versym section present without .gnu.versym_d or .gnu.versym_r\n" msgstr "" -#: src/elflint.c:3924 +#: src/elflint.c:3937 #, c-format msgid "phdr[%d]: unknown core file note type % at offset %\n" msgstr "" -#: src/elflint.c:3928 +#: src/elflint.c:3941 #, c-format msgid "" "section [%2d] '%s': unknown core file note type % at offset %Zu\n" msgstr "" -#: src/elflint.c:3950 +#: src/elflint.c:3963 #, c-format msgid "phdr[%d]: unknown object file note type % at offset %Zu\n" msgstr "" -#: src/elflint.c:3954 +#: src/elflint.c:3967 #, c-format msgid "" "section [%2d] '%s': unknown object file note type % at offset %Zu\n" msgstr "" -#: src/elflint.c:3970 +#: src/elflint.c:3984 #, c-format msgid "phdr[%d]: no note entries defined for the type of file\n" msgstr "" -#: src/elflint.c:3989 +#: src/elflint.c:4003 #, c-format msgid "phdr[%d]: cannot get content of note section: %s\n" msgstr "" -#: src/elflint.c:3992 +#: src/elflint.c:4006 #, c-format msgid "phdr[%d]: extra % bytes after last note\n" msgstr "" -#: src/elflint.c:4012 +#: src/elflint.c:4027 #, c-format msgid "section [%2d] '%s': no note entries defined for the type of file\n" msgstr "" -#: src/elflint.c:4019 +#: src/elflint.c:4034 #, c-format msgid "section [%2d] '%s': cannot get content of note section\n" msgstr "" -#: src/elflint.c:4022 +#: src/elflint.c:4037 #, c-format msgid "section [%2d] '%s': extra % bytes after last note\n" msgstr "" -#: src/elflint.c:4035 +#: src/elflint.c:4055 #, c-format msgid "" "only executables, shared objects, and core files can have program headers\n" msgstr "" -#: src/elflint.c:4050 +#: src/elflint.c:4070 #, c-format msgid "cannot get program header entry %d: %s\n" msgstr "" -#: src/elflint.c:4059 +#: src/elflint.c:4079 #, c-format msgid "program header entry %d: unknown program header entry type %#\n" msgstr "" -#: src/elflint.c:4070 +#: src/elflint.c:4090 #, c-format msgid "more than one INTERP entry in program header\n" msgstr "" -#: src/elflint.c:4078 +#: src/elflint.c:4098 #, c-format msgid "more than one TLS entry in program header\n" msgstr "" -#: src/elflint.c:4085 +#: src/elflint.c:4105 #, c-format msgid "static executable cannot have dynamic sections\n" msgstr "" -#: src/elflint.c:4099 +#: src/elflint.c:4119 #, c-format msgid "dynamic section reference in program header has wrong offset\n" msgstr "" -#: src/elflint.c:4102 +#: src/elflint.c:4122 #, c-format msgid "dynamic section size mismatch in program and section header\n" msgstr "" -#: src/elflint.c:4112 +#: src/elflint.c:4132 #, c-format msgid "more than one GNU_RELRO entry in program header\n" msgstr "" -#: src/elflint.c:4133 +#: src/elflint.c:4153 #, c-format msgid "loadable segment GNU_RELRO applies to is not writable\n" msgstr "" -#: src/elflint.c:4136 +#: src/elflint.c:4156 #, c-format msgid "loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n" msgstr "" -#: src/elflint.c:4144 src/elflint.c:4167 +#: src/elflint.c:4164 src/elflint.c:4187 #, c-format msgid "%s segment not contained in a loaded segment\n" msgstr "" -#: src/elflint.c:4173 +#: src/elflint.c:4193 #, c-format msgid "program header offset in ELF header and PHDR entry do not match" msgstr "" -#: src/elflint.c:4179 +#: src/elflint.c:4217 +#, c-format +msgid "call frame search table reference in program header has wrong offset\n" +msgstr "" + +#: src/elflint.c:4220 +#, c-format +msgid "call frame search table size mismatch in program and section header\n" +msgstr "" + +#: src/elflint.c:4233 +#, c-format +msgid "PT_GNU_EH_FRAME present but no .eh_frame_hdr section\n" +msgstr "" + +#: src/elflint.c:4241 +#, c-format +msgid "call frame search table must be allocated\n" +msgstr "" + +#: src/elflint.c:4244 +#, c-format +msgid "section [%2zu] '%s' must be allocated\n" +msgstr "" + +#: src/elflint.c:4248 +#, c-format +msgid "call frame search table must not be writable\n" +msgstr "" + +#: src/elflint.c:4251 +#, c-format +msgid "section [%2zu] '%s' must not be writable\n" +msgstr "" + +#: src/elflint.c:4256 +#, c-format +msgid "call frame search table must not be executable\n" +msgstr "" + +#: src/elflint.c:4259 +#, c-format +msgid "section [%2zu] '%s' must not be executable\n" +msgstr "" + +#: src/elflint.c:4270 #, c-format msgid "program header entry %d: file size greater than memory size\n" msgstr "" -#: src/elflint.c:4186 +#: src/elflint.c:4277 #, c-format msgid "program header entry %d: alignment not a power of 2\n" msgstr "" -#: src/elflint.c:4189 +#: src/elflint.c:4280 #, c-format msgid "" "program header entry %d: file offset and virtual address not module of " "alignment\n" msgstr "" -#: src/elflint.c:4225 +#: src/elflint.c:4293 +#, 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:4327 #, c-format msgid "cannot read ELF header: %s\n" msgstr "" -#: src/elflint.c:4246 +#: src/elflint.c:4353 #, c-format msgid "text relocation flag set but not needed\n" msgstr "" -#: src/addr2line.c:64 +#: src/addr2line.c:66 msgid "Output selection options:" msgstr "" -#: src/addr2line.c:65 +#: src/addr2line.c:67 msgid "Show only base names of source files" msgstr "" -#: src/addr2line.c:67 +#: src/addr2line.c:69 msgid "Show absolute file names using compilation directory" msgstr "" -#: src/addr2line.c:68 +#: src/addr2line.c:70 msgid "Also show function names" msgstr "" -#: src/addr2line.c:69 +#: src/addr2line.c:71 msgid "Also show symbol or section names" msgstr "" -#: src/addr2line.c:80 +#: src/addr2line.c:73 +msgid "Treat addresses as offsets relative to NAME section." +msgstr "" + +#: src/addr2line.c:84 msgid "" "Locate source files and line information for ADDRs (in a.out by default)." msgstr "" -#: src/addr2line.c:84 +#: src/addr2line.c:88 msgid "[ADDR...]" msgstr "" -#: src/addr2line.c:385 +#: src/addr2line.c:405 #, c-format msgid "Section syntax requires exactly one module" msgstr "" -#: src/addr2line.c:408 +#: src/addr2line.c:428 #, c-format msgid "offset %# lies outside section '%s'" msgstr "" -#: src/addr2line.c:426 +#: src/addr2line.c:461 #, c-format msgid "cannot find symbol '%s'" msgstr "" -#: src/addr2line.c:431 +#: src/addr2line.c:466 #, c-format msgid "offset %# lies outside contents of '%s'" msgstr "" -#: src/findtextrel.c:68 +#: src/findtextrel.c:70 msgid "Input Selection:" msgstr "" -#: src/findtextrel.c:69 +#: src/findtextrel.c:71 msgid "Prepend PATH to all file names" msgstr "" -#: src/findtextrel.c:71 +#: src/findtextrel.c:73 msgid "Use PATH as root of debuginfo hierarchy" msgstr "" -#: src/findtextrel.c:78 +#: src/findtextrel.c:80 msgid "Locate source of text relocations in FILEs (a.out by default)." msgstr "" -#: src/findtextrel.c:234 src/elfcmp.c:577 src/ranlib.c:186 +#: src/findtextrel.c:236 src/elfcmp.c:578 src/ranlib.c:186 #, c-format msgid "cannot create ELF descriptor for '%s': %s" msgstr "" -#: src/findtextrel.c:244 +#: src/findtextrel.c:246 #, c-format msgid "cannot get ELF header '%s': %s" msgstr "" -#: src/findtextrel.c:255 +#: src/findtextrel.c:257 #, c-format msgid "'%s' is not a DSO or PIE" msgstr "" -#: src/findtextrel.c:272 +#: src/findtextrel.c:274 #, c-format msgid "getting get section header of section %zu: %s" msgstr "" -#: src/findtextrel.c:290 +#: src/findtextrel.c:292 #, c-format msgid "cannot read dynamic section: %s" msgstr "" -#: src/findtextrel.c:305 +#: src/findtextrel.c:307 #, c-format msgid "no text relocations reported in '%s'" msgstr "" -#: src/findtextrel.c:317 +#: src/findtextrel.c:319 #, c-format msgid "while reading ELF file" msgstr "" -#: src/findtextrel.c:326 src/findtextrel.c:343 +#: src/findtextrel.c:328 src/findtextrel.c:345 #, c-format msgid "cannot get program header index at offset %d: %s" msgstr "" -#: src/findtextrel.c:395 +#: src/findtextrel.c:397 #, c-format msgid "cannot get section header of section %Zu: %s" msgstr "" -#: src/findtextrel.c:407 +#: src/findtextrel.c:409 #, c-format msgid "cannot get symbol table section %zu in '%s': %s" msgstr "" -#: src/findtextrel.c:427 src/findtextrel.c:450 +#: src/findtextrel.c:429 src/findtextrel.c:452 #, c-format msgid "cannot get relocation at index %d in section %zu in '%s': %s" msgstr "" -#: src/findtextrel.c:515 +#: src/findtextrel.c:517 #, c-format msgid "%s not compiled with -fpic/-fPIC\n" msgstr "" -#: src/findtextrel.c:568 +#: src/findtextrel.c:570 #, c-format msgid "" "the file containing the function '%s' is not compiled with -fpic/-fPIC\n" msgstr "" -#: src/findtextrel.c:575 src/findtextrel.c:595 +#: src/findtextrel.c:577 src/findtextrel.c:597 #, c-format msgid "" "the file containing the function '%s' might not be compiled with -fpic/-" "fPIC\n" msgstr "" -#: src/findtextrel.c:583 +#: src/findtextrel.c:585 #, c-format msgid "" "either the file containing the function '%s' or the file containing the " "function '%s' is not compiled with -fpic/-fPIC\n" msgstr "" -#: src/findtextrel.c:603 +#: src/findtextrel.c:605 #, c-format msgid "" "a relocation modifies memory at offset %llu in a write-protected segment\n" msgstr "" -#: src/elfcmp.c:68 +#: src/elfcmp.c:69 msgid "Control options:" msgstr "" -#: src/elfcmp.c:69 +#: src/elfcmp.c:70 msgid "" "Control treatment of gaps in loadable segments [ignore|match] (default: " "ignore)" msgstr "" -#: src/elfcmp.c:71 +#: src/elfcmp.c:72 msgid "Ignore permutation of buckets in SHT_HASH section" msgstr "" -#: src/elfcmp.c:72 +#: src/elfcmp.c:73 msgid "Output nothing; yield exit status only" msgstr "" -#: src/elfcmp.c:79 +#: src/elfcmp.c:80 msgid "Compare relevant parts of two ELF files for equality." msgstr "" -#: src/elfcmp.c:83 +#: src/elfcmp.c:84 msgid "FILE1 FILE2" msgstr "" -#: src/elfcmp.c:139 +#: src/elfcmp.c:140 msgid "Invalid number of parameters.\n" msgstr "" -#: src/elfcmp.c:167 src/elfcmp.c:172 +#: src/elfcmp.c:168 src/elfcmp.c:173 #, c-format msgid "cannot get ELF header of '%s': %s" msgstr "" -#: src/elfcmp.c:189 +#: src/elfcmp.c:190 #, c-format msgid "%s %s diff: ELF header" msgstr "" -#: src/elfcmp.c:247 +#: src/elfcmp.c:248 #, c-format msgid "%s %s differ: section header" msgstr "" -#: src/elfcmp.c:275 src/elfcmp.c:281 +#: src/elfcmp.c:276 src/elfcmp.c:282 #, c-format msgid "cannot get content of section %zu in '%s': %s" msgstr "" -#: src/elfcmp.c:297 src/elfcmp.c:303 +#: src/elfcmp.c:298 src/elfcmp.c:304 #, c-format msgid "cannot get symbol in '%s': %s" msgstr "" -#: src/elfcmp.c:324 +#: src/elfcmp.c:325 #, c-format msgid "%s %s differ: symbol table [%zu]" msgstr "" -#: src/elfcmp.c:327 +#: src/elfcmp.c:328 #, c-format msgid "%s %s differ: symbol table [%zu,%zu]" msgstr "" -#: src/elfcmp.c:375 +#: src/elfcmp.c:376 #, c-format msgid "%s %s differ: section [%zu] '%s' content" msgstr "" -#: src/elfcmp.c:379 +#: src/elfcmp.c:380 #, c-format msgid "%s %s differ: section [%zu,%zu] '%s' content" msgstr "" -#: src/elfcmp.c:395 +#: src/elfcmp.c:396 #, c-format msgid "%s %s differ: unequal amount of important sections" msgstr "" -#: src/elfcmp.c:429 src/elfcmp.c:434 +#: src/elfcmp.c:430 src/elfcmp.c:435 #, c-format msgid "cannot load data of '%s': %s" msgstr "" -#: src/elfcmp.c:453 src/elfcmp.c:459 +#: src/elfcmp.c:454 src/elfcmp.c:460 #, c-format msgid "cannot get program header entry %d of '%s': %s" msgstr "" -#: src/elfcmp.c:465 +#: src/elfcmp.c:466 #, c-format msgid "%s %s differ: program header %d" msgstr "" -#: src/elfcmp.c:490 +#: src/elfcmp.c:491 #, c-format msgid "%s %s differ: gap" msgstr "" -#: src/elfcmp.c:549 +#: src/elfcmp.c:550 #, c-format msgid "Invalid value '%s' for --gaps parameter." msgstr "" -#: src/elfcmp.c:582 +#: src/elfcmp.c:583 #, c-format msgid "cannot create EBL descriptor for '%s'" msgstr "" -#: src/elfcmp.c:600 +#: src/elfcmp.c:601 #, c-format msgid "cannot get section header of section %zu: %s" msgstr "" -#: src/elfcmp.c:610 +#: src/elfcmp.c:611 #, c-format msgid "cannot get content of section %zu: %s" msgstr "" -#: src/elfcmp.c:620 src/elfcmp.c:634 +#: src/elfcmp.c:621 src/elfcmp.c:635 #, c-format msgid "cannot get relocation: %s" msgstr "" @@ -4546,11 +5076,6 @@ msgstr "" msgid "Archive name required" msgstr "" -#: src/ranlib.c:176 -#, c-format -msgid "cannot stat '%s'" -msgstr "" - #: src/ranlib.c:194 #, c-format msgid "'%s' is no archive" @@ -4561,11 +5086,6 @@ msgstr "" msgid "error while freeing sub-ELF descriptor: %s" msgstr "" -#: src/ranlib.c:250 -#, c-format -msgid "cannot create new file" -msgstr "" - #: src/strings.c:70 msgid "Output Selection:" msgstr "" @@ -4615,7 +5135,7 @@ msgstr "" msgid "lseek64 failed" msgstr "" -#: src/strings.c:616 +#: src/strings.c:616 src/strings.c:680 #, c-format msgid "re-mmap failed" msgstr "" @@ -4625,7 +5145,365 @@ msgstr "" msgid "mprotect failed" msgstr "" -#: src/strings.c:680 +#: src/unstrip.c:77 +msgid "Match MODULE against file names, not module names" +msgstr "" + +#: src/unstrip.c:78 +msgid "Silently skip unfindable files" +msgstr "" + +#: src/unstrip.c:81 +msgid "Place output into FILE" +msgstr "" + +#: src/unstrip.c:83 +msgid "Create multiple output files under DIRECTORY" +msgstr "" + +#: src/unstrip.c:84 +msgid "Use module rather than file names" +msgstr "" + +#: src/unstrip.c:86 +msgid "Create output for modules that have no separate debug information" +msgstr "" + +#: src/unstrip.c:89 +msgid "Apply relocations to section contents in ET_REL files" +msgstr "" + +#: src/unstrip.c:91 +msgid "Only list module and file names, build IDs" +msgstr "" + +#: src/unstrip.c:133 +#, c-format +msgid "-d option specified twice" +msgstr "" + +#: src/unstrip.c:165 +#, c-format +msgid "only one of -o or -d allowed" +msgstr "" + +#: src/unstrip.c:174 +#, c-format +msgid "-n cannot be used with explicit files or -o or -d" +msgstr "" + +#: src/unstrip.c:189 +#, c-format +msgid "output directory '%s'" +msgstr "" + +#: src/unstrip.c:198 +#, c-format +msgid "exactly two file arguments are required" +msgstr "" + +#: src/unstrip.c:204 +#, c-format +msgid "-m, -a, -R, and -i options not allowed with explicit files" +msgstr "" + +#: src/unstrip.c:217 +#, c-format +msgid "-o or -d is required when using implicit files" +msgstr "" + +#: src/unstrip.c:253 +#, c-format +msgid "cannot create ELF header: %s" +msgstr "" + +#: src/unstrip.c:258 +#, c-format +msgid "cannot copy ELF header: %s" +msgstr "" + +#: src/unstrip.c:263 src/unstrip.c:1816 +#, c-format +msgid "cannot create program headers: %s" +msgstr "" + +#: src/unstrip.c:269 +#, c-format +msgid "cannot copy program header: %s" +msgstr "" + +#: src/unstrip.c:279 +#, c-format +msgid "cannot copy section header: %s" +msgstr "" + +#: src/unstrip.c:282 src/unstrip.c:1504 +#, c-format +msgid "cannot get section data: %s" +msgstr "" + +#: src/unstrip.c:284 src/unstrip.c:1506 +#, c-format +msgid "cannot copy section data: %s" +msgstr "" + +#: src/unstrip.c:308 +#, c-format +msgid "cannot create directory '%s'" +msgstr "" + +#: src/unstrip.c:348 src/unstrip.c:762 src/unstrip.c:1539 +#, c-format +msgid "cannot get symbol table entry: %s" +msgstr "" + +#: src/unstrip.c:364 src/unstrip.c:579 src/unstrip.c:600 src/unstrip.c:612 +#: src/unstrip.c:1560 src/unstrip.c:1690 src/unstrip.c:1714 +#, c-format +msgid "cannot update symbol table: %s" +msgstr "" + +#: src/unstrip.c:381 src/unstrip.c:431 src/unstrip.c:561 src/unstrip.c:1208 +#: src/unstrip.c:1524 src/unstrip.c:1719 src/unstrip.c:1790 +#, c-format +msgid "cannot update section header: %s" +msgstr "" + +#: src/unstrip.c:407 src/unstrip.c:418 +#, c-format +msgid "cannot update relocation: %s" +msgstr "" + +#: src/unstrip.c:506 +#, c-format +msgid "cannot get symbol version: %s" +msgstr "" + +#: src/unstrip.c:518 +#, c-format +msgid "unexpected section type in [%Zu] with sh_link to symtab" +msgstr "" + +#: src/unstrip.c:768 +#, c-format +msgid "invalid string offset in symbol [%Zu]" +msgstr "" + +#: src/unstrip.c:910 src/unstrip.c:1247 +#, c-format +msgid "cannot read section [%Zu] name: %s" +msgstr "" + +#: src/unstrip.c:951 src/unstrip.c:970 src/unstrip.c:1003 +#, c-format +msgid "cannot read '.gnu.prelink_undo' section: %s" +msgstr "" + +#: src/unstrip.c:991 +#, c-format +msgid "invalid contents in '%s' section" +msgstr "" + +#: src/unstrip.c:1046 src/unstrip.c:1369 +#, c-format +msgid "cannot find matching section for [%Zu] '%s'" +msgstr "" + +#: src/unstrip.c:1170 src/unstrip.c:1185 src/unstrip.c:1450 +#, c-format +msgid "cannot add section name to string table: %s" +msgstr "" + +#: src/unstrip.c:1194 +#, c-format +msgid "cannot update section header string table data: %s" +msgstr "" + +#: src/unstrip.c:1222 src/unstrip.c:1226 +#, c-format +msgid "cannot get section header string table section index: %s" +msgstr "" + +#: src/unstrip.c:1230 src/unstrip.c:1234 src/unstrip.c:1465 +#, c-format +msgid "cannot get section count: %s" +msgstr "" + +#: src/unstrip.c:1292 src/unstrip.c:1384 +#, c-format +msgid "cannot read section header string table: %s" +msgstr "" + +#: src/unstrip.c:1444 +#, c-format +msgid "cannot add new section: %s" +msgstr "" + +#: src/unstrip.c:1547 +#, c-format +msgid "symbol [%Zu] has invalid section index" +msgstr "" + +#: src/unstrip.c:1799 +#, c-format +msgid "cannot get ELF header: %s" +msgstr "" + +#: src/unstrip.c:1826 +#, c-format +msgid "cannot update program header: %s" +msgstr "" + +#: src/unstrip.c:1831 src/unstrip.c:1910 +#, c-format +msgid "cannot write output file: %s" +msgstr "" + +#: src/unstrip.c:1879 +#, c-format +msgid "DWARF data not adjusted for prelinking bias; consider prelink -u" +msgstr "" + +#: src/unstrip.c:1882 +#, c-format +msgid "" +"DWARF data in '%s' not adjusted for prelinking bias; consider prelink -u" +msgstr "" + +#: src/unstrip.c:1901 src/unstrip.c:1941 src/unstrip.c:1953 src/unstrip.c:2033 +#, c-format +msgid "cannot create ELF descriptor: %s" +msgstr "" + +#: src/unstrip.c:1959 +#, c-format +msgid "'%s' and '%s' do not seem to match" +msgstr "" + +#: src/unstrip.c:1990 +#, c-format +msgid "cannot find stripped file for module '%s': %s" +msgstr "" + +#: src/unstrip.c:1994 +#, c-format +msgid "cannot open stripped file '%s' for module '%s': %s" +msgstr "" + +#: src/unstrip.c:2009 +#, c-format +msgid "cannot find debug file for module '%s': %s" +msgstr "" + +#: src/unstrip.c:2013 +#, c-format +msgid "cannot open debug file '%s' for module '%s': %s" +msgstr "" + +#: src/unstrip.c:2026 +#, c-format +msgid "module '%s' file '%s' is not stripped" +msgstr "" + +#: src/unstrip.c:2057 +#, c-format +msgid "cannot cache section addresses for module '%s': %s" +msgstr "" + +#: src/unstrip.c:2190 +#, c-format +msgid "no matching modules found" +msgstr "" + +#: src/unstrip.c:2199 +#, c-format +msgid "matched more than one module" +msgstr "" + +#: src/unstrip.c:2246 +msgid "" +"STRIPPED-FILE DEBUG-FILE\n" +"[MODULE...]" +msgstr "" + +#: src/unstrip.c:2247 +msgid "" +"Combine stripped files with separate symbols and debug information.\vThe " +"first form puts the result in DEBUG-FILE if -o was not given.\n" +"\n" +"MODULE arguments give file name patterns matching modules to process.\n" +"With -f these match the file name of the main (stripped) file (slashes are " +"never special), otherwise they match the simple module names. With no " +"arguments, process all modules found.\n" +"\n" +"Multiple modules are written to files under OUTPUT-DIRECTORY, creating " +"subdirectories as needed. With -m these files have simple module names, " +"otherwise they have the name of the main file complete with directory " +"underneath OUTPUT-DIRECTORY.\n" +"\n" +"With -n no files are written, but one line to standard output for each " +"module:\n" +"\tSTART+SIZE BUILDID FILE DEBUGFILE MODULENAME\n" +"START and SIZE are hexadecimal giving the address bounds of the module. " +"BUILDID is hexadecimal for the build ID bits, or - if no ID is known; the " +"hexadecimal may be followed by @0xADDR giving the address where the ID " +"resides if that is known. FILE is the file name found for the module, or - " +"if none was found, or . if an ELF image is available but not from any named " +"file. DEBUGFILE is the separate debuginfo file name, or - if no debuginfo " +"was found, or . if FILE contains the debug information." +msgstr "" + +#: src/objdump.c:61 +msgid "Mode selection:" +msgstr "" + +#: src/objdump.c:62 +msgid "Display relocation information." +msgstr "" + +#: src/objdump.c:64 +msgid "Display the full contents of all sections requested" +msgstr "" + +#: src/objdump.c:66 +msgid "Display assembler code of executable sections" +msgstr "" + +#: src/objdump.c:68 +msgid "Output option selection:" +msgstr "" + +#: src/objdump.c:70 +msgid "Only display information for section NAME." +msgstr "" + +#: src/objdump.c:76 +msgid "Show information from FILEs (a.out by default)." +msgstr "" + +#: src/objdump.c:274 src/objdump.c:286 +#, c-format +msgid "while close `%s'" +msgstr "" + +#: src/objdump.c:510 +#, c-format +msgid "" +"\n" +"RELOCATION RECORDS FOR [%s]:\n" +"%-*s TYPE VALUE\n" +msgstr "" + +#: src/objdump.c:513 +msgid "OFFSET" +msgstr "" + +#: src/objdump.c:576 +#, c-format +msgid "Contents of section %s:\n" +msgstr "" + +#: src/objdump.c:676 #, c-format -msgid "re=mmap failed" +msgid "cannot disassemble" msgstr "" diff --git a/elfutils/src/ChangeLog b/elfutils/src/ChangeLog index 4ef23a22..49b72037 100644 --- a/elfutils/src/ChangeLog +++ b/elfutils/src/ChangeLog @@ -1,3 +1,216 @@ +2009-04-23 Ulrich Drepper + + * Makefile [BUILD_STATIC] (libdw): Add $(zip_LIBS). + +2009-04-20 Roland McGrath + + * addr2line.c (print_dwarf_function): Honor -s and -A for file names + of inline call sites. + + * addr2line.c (just_section): New variable. + (adjust_to_section): New function, broken out of ... + (handle_address): ... here. + (options, parse_opt): Add -j/--section=NAME to set it. + +2009-04-15 Roland McGrath + + * readelf.c (print_debug_frame_section): Check for DW_CIE_ID_64 in + 64-bit format header, DW_CIE_ID_32 in 32-bit format header. + +2009-04-14 Roland McGrath + + * readelf.c (print_attributes): Treat SHT_ARM_ATTRIBUTES on EM_ARM + like SHT_GNU_ATTRIBUTES. + + * readelf.c (handle_core_registers): Fix error message. + + * strip.c (handle_elf: check_preserved): Don't note any change when + .debug_data is already filled from a previous pass. + +2009-02-05 Ulrich Drepper + + * objdump.c (show_relocs_x): Minor cleanups. + + * readelf.c (print_cfa_program): Correct a few labels. + Print first DW_CFA_expression and DW_CFA_val_expression parameter + as register. + +2009-02-01 Ulrich Drepper + + * objdump.c (show_relocs_rel, show_relocs_rela): Split common parts + into ... + (show_relocs_x): ...here. New function. + (show_relocs): Better spacing in output. + + * objdump.c (show_relocs_rela): Show offsets as signed values. + + * ar.c (main): Fix recognition of invalid modes for a, b, i modifiers. + Improve some error messages. + Use program_invocation_short_name instead of AR macro. + * Makefile.am (CFLAGS_ar): Remove. + * elflint.c (parse_opt): ARGP_HELP_EXIT_ERR does nothing for argp_help. + * objdump.c (parse_opt): Likewise. + * readelf.c (parse_opt): Likewise. + +2009-01-27 Roland McGrath + + * readelf.c (print_ops): Notice short length, don't overrun buffer + (still need to fix LEB128). + + * readelf.c (print_ops): Fix DW_OP_call[24] decoding. + + * readelf.c (print_ops): Print (empty)\n when LEN == 0. + +2009-01-24 Ulrich Drepper + + * readelf.c (print_debug_frame_section): Fix computation of vma_base + for PC-relative mode. + +2009-01-23 Ulrich Drepper + + * size.c (process_file): When handling archive, close file descriptor + here. For unknown file format also close file descriptor. + (handle_ar): Don't close file descriptor here. + + * readelf.c (parse_opt): Move code to add to dump_data_sections and + string_sections list in local function add_dump_section. Adjust 'x' + key handling. For 'a' key add .strtab, .dynstr, and .comment section + to string_sections list. + +2009-01-22 Roland McGrath + + * readelf.c (print_phdr): Don't print section mapping when no sections. + + * Makefile.am (AM_CFLAGS): Pass -Wno-format for *_no_Wformat. + + * readelf.c (print_debug_frame_section): Initialize IS_SIGNED to false + and reset it only for the 'true' cases. + + * Makefile.am (addr2line_no_Wformat): New variable. + + * readelf.c (print_debug_frame_section): Use t instead of j formats + for ptrdiff_t OFFSET. + +2009-01-21 Ulrich Drepper + + * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section + test. Handle debuginfo files. + (check_exception_data): First sanity test. + +2009-01-17 Ulrich Drepper + + * readelf.c (print_debug_exception_table): Show target of ar_disp + field. + + * elflint.c (check_program_header): Add most consistency checks for + PT_GNU_EH_FRAME entry. + + * addr2line.c: Use ARGP_PROGRAM_VERSION_HOOK_DEF and + ARGP_PROGRAM_BUG_ADDRESS_DEF. + * ar.c: Likewise. + * elfcmp.c: Likewise. + * elflint.c: Likewise. + * findtextrel.c: Likewise. + * ld.c: Likewise. + * nm.c: Likewise. + * objdump.c: Likewise. + * ranlib.c: Likewise. + * readelf.c: Likewise. + + * size.c: Likewise. + * strings.c: Likewise. + * strip.c: Likewise. + * unstrip.c: Likewise. + +2009-01-16 Ulrich Drepper + + * elflint.c (check_program_header): Check that PT_GNU_EH_FRAME entry + matches .eh_frame_hdr section, if it is available. Also check that + the segment is allocated, not writable, not executable. + + * readelf.c: Add -e option. Dump exception and unwind related + sections. Add -e to -a. + (print_encoding_base): Handle DW_EH_PE_omit. + (print_debug_exception_table): Beginning of support. + (print_debug): Hook up print_debug_exception_table for + .gcc_except_table sections. + + * readelf.c (print_debug_frame_section): Some fixes for last change. + +2009-01-15 Ulrich Drepper + + * readelf.c (print_encoding): Now a toplevel function. + (print_relinfo): Likewise. + (print_encoding_base): Broken out of print_debug_frame_section. + (print_debug_frame_section): Print different header for .eh_frame + sections. Fix recognition of matching CIEs in .debug_frame sections. + Print absolute offset for PC-relative FDE locations. Don't print + table header for FDEs if the table is empty. + (read_encoded): New function. + (print_debug_frame_hdr_section): New function. + (print_debug): Hook up print_debug_frame_hdr_section for .eh_frame_hdr + sections. + + * readelf.c (handle_relocs_rel): Print section number. + (print_debug_abbrev_section): Likewise. + (print_debug_aranges_section): Likewise. + (print_debug_ranges_section): Likewise. + (print_debug_info_section): Likewise. + (print_debug_line_section): Likewise. + (print_debug_loc_section): Likewise. + (print_debug_macinfo_section): Likewise. + (print_debug_pubnames_section): Likewise. + (print_debug_str_section): Likewise. + +2009-01-10 Ulrich Drepper + + * strings.c (read_block): Fix typo in error message string. + +2009-01-07 Ulrich Drepper + + * ld.c (ld_new_searchdir): Fix adding to search path list. + +2009-01-06 Ulrich Drepper + + * readelf.c: Implement call frame debug section dumping. + +2009-01-05 Roland McGrath + + * elfcmp.c: Exit with status 2 for errors (like cmp, diff, grep). + Status 1 (aka EXIT_FAILURE) is only for completed OK but not equal. + +2009-01-01 Ulrich Drepper + + * addr2line.c: Update copyright year. + * ar.c: Likewise. + * elfcmp.c: Likewise. + * elflint.c: Likewise. + * findtextrel.c: Likewise. + * ld.c: Likewise. + * nm.c: Likewise. + * objdump.c: Likewise. + * ranlib.c: Likewise. + * readelf.c: Likewise. + * size.c: Likewise. + * strings.c: Likewise. + * strip.c: Likewise. + * unstrip.c: Likewise. + +2008-12-11 Roland McGrath + + * nm.c (sym_name): New function. + (show_symbols_sysv): Use it in place of elf_strptr. + (show_symbols_bsd, show_symbols_posix): Likewise. + Fixes RHBZ#476136. + + * nm.c (show_symbols_sysv): Use an alloca'd backup section name when + elf_strptr fails. + +2008-12-02 Roland McGrath + + * readelf.c (count_dwflmod, process_file): Don't presume encoding of + nonzero OFFSET argument to dwfl_getmodules. + 2008-08-07 Roland McGrath * addr2line.c (main): Pass string to handle_address. diff --git a/elfutils/src/Makefile.am b/elfutils/src/Makefile.am index f72bb458..c644a062 100644 --- a/elfutils/src/Makefile.am +++ b/elfutils/src/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. +## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007, 2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -34,7 +34,7 @@ endif AM_CFLAGS += -Wall -Wshadow -std=gnu99 $(native_ld_cflags) \ $(if $($(*F)_no_Werror),,-Werror) \ $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ - $(if $($(*F)_no_Wformat),,-Wformat=2) $(CFLAGS_$(*F)) + $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(CFLAGS_$(*F)) INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \ @@ -95,7 +95,7 @@ endif if BUILD_STATIC libasm = ../libasm/libasm.a -libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl +libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl libelf = ../libelf/libelf.a else libasm = ../libasm/libasm.so @@ -108,6 +108,7 @@ libeu = ../lib/libeu.a nm_no_Wformat = yes size_no_Wformat = yes strings_no_Wformat = yes +addr2line_no_Wformat = yes # XXX While the file is not finished, don't warn about this ldgeneric_no_Wunused = yes @@ -129,7 +130,6 @@ objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) strings_LDADD = $(libelf) $(libeu) $(libmudflap) ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) -CFLAGS_ar = -DAR=\"$(shell echo ar|sed '$(transform)')\" unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl ldlex.o: ldscript.c diff --git a/elfutils/src/Makefile.in b/elfutils/src/Makefile.in index 77ef2f26..346bae5b 100644 --- a/elfutils/src/Makefile.in +++ b/elfutils/src/Makefile.in @@ -52,7 +52,8 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ChangeLog ldlex.c ldscript.c ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -84,30 +85,30 @@ am__EXEEXT_1 = libld_elf_i386.so$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) addr2line_SOURCES = addr2line.c addr2line_OBJECTS = addr2line.$(OBJEXT) -@BUILD_STATIC_FALSE@am__DEPENDENCIES_1 = ../libdw/libdw.so -@BUILD_STATIC_TRUE@am__DEPENDENCIES_1 = ../libdw/libdw.a $(libelf) \ -@BUILD_STATIC_TRUE@ $(libebl) -am__DEPENDENCIES_2 = -addr2line_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +am__DEPENDENCIES_1 = +@BUILD_STATIC_FALSE@am__DEPENDENCIES_2 = ../libdw/libdw.so +@BUILD_STATIC_TRUE@am__DEPENDENCIES_2 = ../libdw/libdw.a \ +@BUILD_STATIC_TRUE@ $(am__DEPENDENCIES_1) $(libelf) $(libebl) +addr2line_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) ar_SOURCES = ar.c ar_OBJECTS = ar.$(OBJEXT) -ar_DEPENDENCIES = libar.a $(libelf) $(libeu) $(am__DEPENDENCIES_2) +ar_DEPENDENCIES = libar.a $(libelf) $(libeu) $(am__DEPENDENCIES_1) elfcmp_SOURCES = elfcmp.c elfcmp_OBJECTS = elfcmp.$(OBJEXT) -elfcmp_DEPENDENCIES = $(libebl) $(libelf) $(am__DEPENDENCIES_2) +elfcmp_DEPENDENCIES = $(libebl) $(libelf) $(am__DEPENDENCIES_1) elflint_SOURCES = elflint.c elflint_OBJECTS = elflint.$(OBJEXT) elflint_DEPENDENCIES = $(libebl) $(libelf) $(libeu) \ - $(am__DEPENDENCIES_2) + $(am__DEPENDENCIES_1) findtextrel_SOURCES = findtextrel.c findtextrel_OBJECTS = findtextrel.$(OBJEXT) -findtextrel_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libelf) \ - $(am__DEPENDENCIES_2) +findtextrel_DEPENDENCIES = $(am__DEPENDENCIES_2) $(libelf) \ + $(am__DEPENDENCIES_1) am_ld_OBJECTS = ld.$(OBJEXT) ldgeneric.$(OBJEXT) ldlex.$(OBJEXT) \ ldscript.$(OBJEXT) symbolhash.$(OBJEXT) sectionhash.$(OBJEXT) \ versionhash.$(OBJEXT) ld_OBJECTS = $(am_ld_OBJECTS) -ld_DEPENDENCIES = $(libebl) $(libelf) $(libeu) $(am__DEPENDENCIES_2) \ +ld_DEPENDENCIES = $(libebl) $(libelf) $(libeu) $(am__DEPENDENCIES_1) \ $(am__append_2) ld_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ld_LDFLAGS) $(LDFLAGS) -o \ $@ @@ -116,33 +117,33 @@ libld_elf_i386_so_OBJECTS = $(am_libld_elf_i386_so_OBJECTS) libld_elf_i386_so_LDADD = $(LDADD) nm_SOURCES = nm.c nm_OBJECTS = nm.$(OBJEXT) -nm_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libebl) $(libelf) $(libeu) \ - $(am__DEPENDENCIES_2) +nm_DEPENDENCIES = $(am__DEPENDENCIES_2) $(libebl) $(libelf) $(libeu) \ + $(am__DEPENDENCIES_1) objdump_SOURCES = objdump.c objdump_OBJECTS = objdump.$(OBJEXT) objdump_DEPENDENCIES = $(libasm) $(libebl) $(libelf) $(libeu) \ - $(am__DEPENDENCIES_2) + $(am__DEPENDENCIES_1) ranlib_SOURCES = ranlib.c ranlib_OBJECTS = ranlib.$(OBJEXT) -ranlib_DEPENDENCIES = libar.a $(libelf) $(libeu) $(am__DEPENDENCIES_2) +ranlib_DEPENDENCIES = libar.a $(libelf) $(libeu) $(am__DEPENDENCIES_1) readelf_SOURCES = readelf.c readelf_OBJECTS = readelf.$(OBJEXT) -readelf_DEPENDENCIES = $(am__DEPENDENCIES_1) $(libebl) $(libelf) \ - $(libeu) $(am__DEPENDENCIES_2) +readelf_DEPENDENCIES = $(am__DEPENDENCIES_2) $(libebl) $(libelf) \ + $(libeu) $(am__DEPENDENCIES_1) size_SOURCES = size.c size_OBJECTS = size.$(OBJEXT) -size_DEPENDENCIES = $(libelf) $(libeu) $(am__DEPENDENCIES_2) +size_DEPENDENCIES = $(libelf) $(libeu) $(am__DEPENDENCIES_1) strings_SOURCES = strings.c strings_OBJECTS = strings.$(OBJEXT) -strings_DEPENDENCIES = $(libelf) $(libeu) $(am__DEPENDENCIES_2) +strings_DEPENDENCIES = $(libelf) $(libeu) $(am__DEPENDENCIES_1) strip_SOURCES = strip.c strip_OBJECTS = strip.$(OBJEXT) strip_DEPENDENCIES = $(libebl) $(libelf) $(libeu) \ - $(am__DEPENDENCIES_2) + $(am__DEPENDENCIES_1) unstrip_SOURCES = unstrip.c unstrip_OBJECTS = unstrip.$(OBJEXT) -unstrip_DEPENDENCIES = $(libebl) $(libelf) $(am__DEPENDENCIES_1) \ - $(libeu) $(am__DEPENDENCIES_2) +unstrip_DEPENDENCIES = $(libebl) $(libelf) $(am__DEPENDENCIES_2) \ + $(libeu) $(am__DEPENDENCIES_1) binSCRIPT_INSTALL = $(INSTALL_SCRIPT) SCRIPTS = $(bin_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) @@ -256,6 +257,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -284,17 +286,19 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ @MUDFLAP_FALSE@ $(native_ld_cflags) $(if \ @MUDFLAP_FALSE@ $($(*F)_no_Werror),,-Werror) $(if \ @MUDFLAP_FALSE@ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -@MUDFLAP_FALSE@ $($(*F)_no_Wformat),,-Wformat=2) \ +@MUDFLAP_FALSE@ $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ @MUDFLAP_FALSE@ $(CFLAGS_$(*F)) @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Wshadow -std=gnu99 \ @MUDFLAP_TRUE@ $(native_ld_cflags) $(if \ @MUDFLAP_TRUE@ $($(*F)_no_Werror),,-Werror) $(if \ @MUDFLAP_TRUE@ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -@MUDFLAP_TRUE@ $($(*F)_no_Wformat),,-Wformat=2) $(CFLAGS_$(*F)) +@MUDFLAP_TRUE@ $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ +@MUDFLAP_TRUE@ $(CFLAGS_$(*F)) INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \ -I$(srcdir)/../libasm -I$(srcdir)/../lib -I.. @@ -327,7 +331,7 @@ CLEANFILES = make-debug-archive none_ld.os $(ld_modules:.c=.os) *.gcno \ @BUILD_STATIC_FALSE@libasm = ../libasm/libasm.so @BUILD_STATIC_TRUE@libasm = ../libasm/libasm.a @BUILD_STATIC_FALSE@libdw = ../libdw/libdw.so -@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl +@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl @BUILD_STATIC_FALSE@libelf = ../libelf/libelf.so @BUILD_STATIC_TRUE@libelf = ../libelf/libelf.a libebl = ../libebl/libebl.a @@ -335,6 +339,7 @@ libeu = ../lib/libeu.a nm_no_Wformat = yes size_no_Wformat = yes strings_no_Wformat = yes +addr2line_no_Wformat = yes # XXX While the file is not finished, don't warn about this ldgeneric_no_Wunused = yes readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl @@ -352,7 +357,6 @@ objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) strings_LDADD = $(libelf) $(libeu) $(libmudflap) ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) -CFLAGS_ar = -DAR=\"$(shell echo ar|sed '$(transform)')\" unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl ldlex_no_Werror = yes diff --git a/elfutils/src/addr2line.c b/elfutils/src/addr2line.c index 0d11e188..99264b01 100644 --- a/elfutils/src/addr2line.c +++ b/elfutils/src/addr2line.c @@ -1,5 +1,5 @@ /* Locate source files and line information for given addresses - Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2005. @@ -46,13 +46,15 @@ #include #include +#include + /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Values for the parameters which have no short form. */ @@ -67,6 +69,8 @@ static const struct argp_option options[] = N_("Show absolute file names using compilation directory"), 0 }, { "functions", 'f', NULL, 0, N_("Also show function names"), 0 }, { "symbols", 'S', NULL, 0, N_("Also show symbol or section names"), 0 }, + { "section", 'j', "NAME", 0, + N_("Treat addresses as offsets relative to NAME section."), 0 }, { NULL, 0, NULL, 0, N_("Miscellaneous:"), 0 }, /* Unsupported options. */ @@ -111,6 +115,9 @@ static bool show_functions; /* True if ELF symbol or section info should be shown. */ static bool show_symbols; +/* If non-null, take address parameters as relative to named section. */ +static const char *just_section; + int main (int argc, char *argv[]) @@ -179,15 +186,14 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } /* Handle program arguments. */ static error_t -parse_opt (int key, char *arg __attribute__ ((unused)), - struct argp_state *state) +parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { @@ -217,6 +223,10 @@ parse_opt (int key, char *arg __attribute__ ((unused)), show_symbols = true; break; + case 'j': + just_section = arg; + break; + default: return ARGP_ERR_UNKNOWN; } @@ -274,15 +284,35 @@ print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr) DW_AT_call_column, &attr_mem), &val) == 0) colno = val; - if (lineno == 0) + + const char *comp_dir = ""; + const char *comp_dir_sep = ""; + + if (file == NULL) + file = "???"; + else if (only_basenames) + file = basename (file); + else if (use_comp_dir && file[0] != '/') { - if (file != NULL) - printf (" from %s", file); + const char *const *dirs; + size_t ndirs; + if (dwarf_getsrcdirs (files, &dirs, &ndirs) == 0 + && dirs[0] != NULL) + { + comp_dir = dirs[0]; + comp_dir_sep = "/"; + } } + + if (lineno == 0) + printf (" from %s%s%s", + comp_dir, comp_dir_sep, file); else if (colno == 0) - printf (" at %s:%u", file, lineno); + printf (" at %s%s%s:%u", + comp_dir, comp_dir_sep, file, lineno); else - printf (" at %s:%u:%u", file, lineno, colno); + printf (" at %s%s%s:%u:%u", + comp_dir, comp_dir_sep, file, lineno, colno); } } printf (" in "); @@ -364,6 +394,49 @@ find_symbol (Dwfl_Module *mod, return DWARF_CB_OK; } +static bool +adjust_to_section (const char *name, uintmax_t *addr, Dwfl *dwfl) +{ + /* It was (section)+offset. This makes sense if there is + only one module to look in for a section. */ + Dwfl_Module *mod = NULL; + if (dwfl_getmodules (dwfl, &see_one_module, &mod, 0) != 0 + || mod == NULL) + error (EXIT_FAILURE, 0, gettext ("Section syntax requires" + " exactly one module")); + + int nscn = dwfl_module_relocations (mod); + for (int i = 0; i < nscn; ++i) + { + GElf_Word shndx; + const char *scn = dwfl_module_relocation_info (mod, i, &shndx); + if (unlikely (scn == NULL)) + break; + if (!strcmp (scn, name)) + { + /* Found the section. */ + GElf_Shdr shdr_mem; + GElf_Addr shdr_bias; + GElf_Shdr *shdr = gelf_getshdr + (elf_getscn (dwfl_module_getelf (mod, &shdr_bias), shndx), + &shdr_mem); + if (unlikely (shdr == NULL)) + break; + + if (*addr >= shdr->sh_size) + error (0, 0, + gettext ("offset %#" PRIxMAX " lies outside" + " section '%s'"), + *addr, scn); + + *addr += shdr->sh_addr + shdr_bias; + return true; + } + } + + return false; +} + static int handle_address (const char *string, Dwfl *dwfl) { @@ -376,45 +449,7 @@ handle_address (const char *string, Dwfl *dwfl) char *name = NULL; if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &n) == 2 && string[n] == '\0') - { - /* It was (section)+offset. This makes sense if there is - only one module to look in for a section. */ - Dwfl_Module *mod = NULL; - if (dwfl_getmodules (dwfl, &see_one_module, &mod, 0) != 0 - || mod == NULL) - error (EXIT_FAILURE, 0, gettext ("Section syntax requires" - " exactly one module")); - - int nscn = dwfl_module_relocations (mod); - for (int i = 0; i < nscn; ++i) - { - GElf_Word shndx; - const char *scn = dwfl_module_relocation_info (mod, i, &shndx); - if (unlikely (scn == NULL)) - break; - if (!strcmp (scn, name)) - { - /* Found the section. */ - GElf_Shdr shdr_mem; - GElf_Addr shdr_bias; - GElf_Shdr *shdr = gelf_getshdr - (elf_getscn (dwfl_module_getelf (mod, &shdr_bias), shndx), - &shdr_mem); - if (unlikely (shdr == NULL)) - break; - - if (addr >= shdr->sh_size) - error (0, 0, - gettext ("offset %#" PRIxMAX " lies outside" - " section '%s'"), - addr, scn); - - addr += shdr->sh_addr + shdr_bias; - parsed = true; - break; - } - } - } + parsed = adjust_to_section (name, &addr, dwfl); else if (sscanf (string, "%m[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2 && string[n] == '\0') { @@ -440,6 +475,9 @@ handle_address (const char *string, Dwfl *dwfl) if (!parsed) return 1; } + else if (just_section != NULL + && !adjust_to_section (just_section, &addr, dwfl)) + return 1; Dwfl_Module *mod = dwfl_addrmodule (dwfl, addr); diff --git a/elfutils/src/ar.c b/elfutils/src/ar.c index aade3511..2d11b1ef 100644 --- a/elfutils/src/ar.c +++ b/elfutils/src/ar.c @@ -1,5 +1,5 @@ /* Create, modify, and extract from archives. - Copyright (C) 2005, 2007 Red Hat, Inc. + Copyright (C) 2005, 2007, 2009 Red Hat, Inc. Written by Ulrich Drepper , 2005. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -55,7 +55,8 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; + /* Prototypes for local functions. */ static int do_oper_extract (int oper, const char *arfname, char **argv, int argc, long int instance); @@ -66,7 +67,7 @@ static int do_oper_insert (int oper, const char *arfname, char **argv, /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Definitions of arguments for argp functions. */ @@ -187,14 +188,16 @@ main (int argc, char *argv[]) if (ipos != ipos_none) { /* Only valid for certain operations. */ - if (operation == oper_extract && operation == oper_delete) + if (operation != oper_move && operation != oper_replace) error (1, 0, gettext ("\ 'a', 'b', and 'i' are only allowed with the 'm' and 'r' options")); if (remaining == argc) { - error (0, 0, gettext ("MEMBER parameter required")); - argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + error (0, 0, gettext ("\ +MEMBER parameter required for 'a', 'b', and 'i' modifiers")); + argp_help (&argp, stderr, ARGP_HELP_USAGE | ARGP_HELP_SEE, + program_invocation_short_name); exit (EXIT_FAILURE); } @@ -213,7 +216,8 @@ main (int argc, char *argv[]) if (remaining == argc) { error (0, 0, gettext ("COUNT parameter required")); - argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + argp_help (&argp, stderr, ARGP_HELP_SEE, + program_invocation_short_name); exit (EXIT_FAILURE); } @@ -236,8 +240,8 @@ main (int argc, char *argv[]) /* There must at least be one more parameter specifying the archive. */ if (remaining == argc) { - error (0, 0, gettext ("Archive name required")); - argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + error (0, 0, gettext ("archive name required")); + argp_help (&argp, stderr, ARGP_HELP_SEE, program_invocation_short_name); exit (EXIT_FAILURE); } @@ -286,7 +290,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -308,7 +312,8 @@ parse_opt (int key, char *arg __attribute__ ((unused)), if (operation != oper_none) { error (0, 0, gettext ("More than one operation specified")); - argp_help (&argp, stderr, ARGP_HELP_SEE, AR); + argp_help (&argp, stderr, ARGP_HELP_SEE, + program_invocation_short_name); exit (EXIT_FAILURE); } @@ -1097,7 +1102,8 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc, if (fd == -1) { if (!suppress_create_msg) - fprintf (stderr, "%s: creating %s\n", AR, arfname); + fprintf (stderr, "%s: creating %s\n", + program_invocation_short_name, arfname); goto no_old; } @@ -1211,7 +1217,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc, if (found[cnt] == NULL) { fprintf (stderr, gettext ("%s: no entry %s in archive!\n"), - AR, argv[cnt]); + program_invocation_short_name, argv[cnt]); status = 1; } diff --git a/elfutils/src/elfcmp.c b/elfutils/src/elfcmp.c index 0e134df8..7f871ecf 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 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2005. @@ -41,6 +41,7 @@ #include #include +#include #include "../libelf/elf-knowledge.h" #include "../libebl/libeblP.h" @@ -53,10 +54,10 @@ static int regioncompare (const void *p1, const void *p2); /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Values for the parameters which have no short form. */ #define OPT_GAPS 0x100 @@ -164,12 +165,12 @@ main (int argc, char *argv[]) GElf_Ehdr ehdr1_mem; GElf_Ehdr *ehdr1 = gelf_getehdr (elf1, &ehdr1_mem); if (ehdr1 == NULL) - error (EXIT_FAILURE, 0, gettext ("cannot get ELF header of '%s': %s"), + error (2, 0, gettext ("cannot get ELF header of '%s': %s"), fname1, elf_errmsg (-1)); GElf_Ehdr ehdr2_mem; GElf_Ehdr *ehdr2 = gelf_getehdr (elf2, &ehdr2_mem); if (ehdr2 == NULL) - error (EXIT_FAILURE, 0, gettext ("cannot get ELF header of '%s': %s"), + error (2, 0, gettext ("cannot get ELF header of '%s': %s"), fname2, elf_errmsg (-1)); /* Compare the ELF headers. */ @@ -271,13 +272,13 @@ main (int argc, char *argv[]) Elf_Data *data1 = elf_getdata (scn1, NULL); if (data1 == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot get content of section %zu in '%s': %s"), elf_ndxscn (scn1), fname1, elf_errmsg (-1)); Elf_Data *data2 = elf_getdata (scn2, NULL); if (data2 == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot get content of section %zu in '%s': %s"), elf_ndxscn (scn2), fname2, elf_errmsg (-1)); @@ -293,13 +294,13 @@ main (int argc, char *argv[]) GElf_Sym sym1_mem; GElf_Sym *sym1 = gelf_getsym (data1, ndx, &sym1_mem); if (sym1 == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot get symbol in '%s': %s"), fname1, elf_errmsg (-1)); GElf_Sym sym2_mem; GElf_Sym *sym2 = gelf_getsym (data2, ndx, &sym2_mem); if (sym2 == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot get symbol in '%s': %s"), fname2, elf_errmsg (-1)); @@ -426,12 +427,12 @@ main (int argc, char *argv[]) { raw1 = elf_rawfile (elf1, &size1); if (raw1 == NULL ) - error (EXIT_FAILURE, 0, gettext ("cannot load data of '%s': %s"), + error (2, 0, gettext ("cannot load data of '%s': %s"), fname1, elf_errmsg (-1)); raw2 = elf_rawfile (elf2, &size2); if (raw2 == NULL ) - error (EXIT_FAILURE, 0, gettext ("cannot load data of '%s': %s"), + error (2, 0, gettext ("cannot load data of '%s': %s"), fname2, elf_errmsg (-1)); for (size_t cnt = 0; cnt < nregions; ++cnt) @@ -449,13 +450,13 @@ main (int argc, char *argv[]) GElf_Phdr phdr1_mem; GElf_Phdr *phdr1 = gelf_getphdr (elf1, ndx, &phdr1_mem); if (ehdr1 == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot get program header entry %d of '%s': %s"), ndx, fname1, elf_errmsg (-1)); GElf_Phdr phdr2_mem; GElf_Phdr *phdr2 = gelf_getphdr (elf2, ndx, &phdr2_mem); if (ehdr2 == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot get program header entry %d of '%s': %s"), ndx, fname2, elf_errmsg (-1)); @@ -522,7 +523,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -570,15 +571,15 @@ open_file (const char *fname, int *fdp, Ebl **eblp) { int fd = open (fname, O_RDONLY); if (unlikely (fd == -1)) - error (EXIT_FAILURE, errno, gettext ("cannot open '%s'"), fname); + error (2, errno, gettext ("cannot open '%s'"), fname); Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); if (elf == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot create ELF descriptor for '%s': %s"), fname, elf_errmsg (-1)); Ebl *ebl = ebl_openbackend (elf); if (ebl == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot create EBL descriptor for '%s'"), fname); *fdp = fd; @@ -596,7 +597,7 @@ search_for_copy_reloc (Ebl *ebl, size_t scnndx, int symndx) GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); if (shdr == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot get section header of section %zu: %s"), elf_ndxscn (scn), elf_errmsg (-1)); @@ -606,7 +607,7 @@ search_for_copy_reloc (Ebl *ebl, size_t scnndx, int symndx) Elf_Data *data = elf_getdata (scn, NULL); if (data == NULL) - error (EXIT_FAILURE, 0, + error (2, 0, gettext ("cannot get content of section %zu: %s"), elf_ndxscn (scn), elf_errmsg (-1)); @@ -617,7 +618,7 @@ search_for_copy_reloc (Ebl *ebl, size_t scnndx, int symndx) GElf_Rel rel_mem; GElf_Rel *rel = gelf_getrel (data, ndx, &rel_mem); if (rel == NULL) - error (EXIT_FAILURE, 0, gettext ("cannot get relocation: %s"), + error (2, 0, gettext ("cannot get relocation: %s"), elf_errmsg (-1)); if ((int) GELF_R_SYM (rel->r_info) == symndx @@ -631,7 +632,7 @@ search_for_copy_reloc (Ebl *ebl, size_t scnndx, int symndx) GElf_Rela rela_mem; GElf_Rela *rela = gelf_getrela (data, ndx, &rela_mem); if (rela == NULL) - error (EXIT_FAILURE, 0, gettext ("cannot get relocation: %s"), + error (2, 0, gettext ("cannot get relocation: %s"), elf_errmsg (-1)); if ((int) GELF_R_SYM (rela->r_info) == symndx diff --git a/elfutils/src/elflint.c b/elfutils/src/elflint.c index bc4219b3..7ddf3a9a 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 Red Hat, Inc. + Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2001. @@ -56,10 +56,10 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; #define ARGP_strict 300 #define ARGP_gnuld 301 @@ -67,7 +67,6 @@ const char *argp_program_bug_address = PACKAGE_BUGREPORT; /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = { - { "strict", ARGP_strict, NULL, 0, N_("Be extremely strict, flag level 2 features."), 0 }, { "quiet", 'q', NULL, 0, N_("Do not print anything if successful"), 0 }, @@ -221,9 +220,8 @@ parse_opt (int key, char *arg __attribute__ ((unused)), case ARGP_KEY_NO_ARGS: fputs (gettext ("Missing file name.\n"), stderr); - argp_help (&argp, stderr, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, - program_invocation_short_name); - exit (1); + argp_help (&argp, stderr, ARGP_HELP_SEE, program_invocation_short_name); + exit (EXIT_FAILURE); default: return ARGP_ERR_UNKNOWN; @@ -241,7 +239,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -3359,6 +3357,13 @@ static const struct && !memcmp (special_sections[idx].name, string, \ sizeof string - (prefix ? 1 : 0))) + +/* Indeces of some sections we need later. */ +static size_t eh_frame_hdr_scnndx; +static size_t eh_frame_scnndx; +static size_t gcc_except_table_scnndx; + + static void check_sections (Ebl *ebl, GElf_Ehdr *ehdr) { @@ -3555,6 +3560,14 @@ section [%2zu] '%s' has SHF_ALLOC flag not set but there are loadable segments\n break; } + + /* Remember a few special sections for later. */ + if (strcmp (scnname, ".eh_frame_hdr") == 0) + eh_frame_hdr_scnndx = cnt; + else if (strcmp (scnname, ".eh_frame") == 0) + eh_frame_scnndx = cnt; + else if (strcmp (scnname, ".gcc_except_table") == 0) + gcc_except_table_scnndx = cnt; } if (shdr->sh_entsize != 0 && shdr->sh_size % shdr->sh_entsize) @@ -3962,6 +3975,7 @@ section [%2d] '%s': unknown object file note type %" PRIu32 return last_offset; } + static void check_note (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Phdr *phdr, int cnt) { @@ -3993,6 +4007,7 @@ phdr[%d]: no note entries defined for the type of file\n"), cnt, phdr->p_filesz - notes_size); } + static void check_note_section (Ebl *ebl, GElf_Ehdr *ehdr, GElf_Shdr *shdr, int idx) { @@ -4024,6 +4039,11 @@ section [%2d] '%s': no note entries defined for the type of file\n"), idx, section_name (ebl, idx), shdr->sh_size - notes_size); } + +/* Index of the PT_GNU_EH_FRAME program eader entry. */ +static int pt_gnu_eh_frame_pndx; + + static void check_program_header (Ebl *ebl, GElf_Ehdr *ehdr) { @@ -4132,7 +4152,7 @@ more than one GNU_RELRO entry in program header\n")); if ((phdr2->p_flags & PF_W) == 0) ERROR (gettext ("\ loadable segment GNU_RELRO applies to is not writable\n")); - if ((phdr2->p_flags &~ PF_W) != (phdr->p_flags &~ PF_W)) + if ((phdr2->p_flags & ~PF_W) != (phdr->p_flags & ~PF_W)) ERROR (gettext ("\ loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"), cnt, inner); @@ -4173,6 +4193,77 @@ loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"), ERROR (gettext ("\ program header offset in ELF header and PHDR entry do not match")); } + else if (phdr->p_type == PT_GNU_EH_FRAME) + { + /* If there is an .eh_frame_hdr section it must be + referenced by this program header entry. */ + Elf_Scn *scn = NULL; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = NULL; + bool any = false; + while ((scn = elf_nextscn (ebl->elf, scn)) != NULL) + { + any = true; + shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr != NULL + && shdr->sh_type == (is_debuginfo + ? SHT_NOBITS : SHT_PROGBITS) + && ! strcmp (".eh_frame_hdr", + elf_strptr (ebl->elf, shstrndx, shdr->sh_name))) + { + if (! is_debuginfo) + { + if (phdr->p_offset != shdr->sh_offset) + ERROR (gettext ("\ +call frame search table reference in program header has wrong offset\n")); + if (phdr->p_memsz != shdr->sh_size) + ERROR (gettext ("\ +call frame search table size mismatch in program and section header\n")); + } + break; + } + } + + if (scn == NULL) + { + /* If there is no section header table we don't + complain. But if there is one there should be an + entry for .eh_frame_hdr. */ + if (any) + ERROR (gettext ("\ +PT_GNU_EH_FRAME present but no .eh_frame_hdr section\n")); + } + else + { + /* The section must be allocated and not be writable and + executable. */ + if ((phdr->p_flags & PF_R) == 0) + ERROR (gettext ("\ +call frame search table must be allocated\n")); + else if (shdr != NULL && (shdr->sh_flags & SHF_ALLOC) == 0) + ERROR (gettext ("\ +section [%2zu] '%s' must be allocated\n"), elf_ndxscn (scn), ".eh_frame_hdr"); + + if ((phdr->p_flags & PF_W) != 0) + ERROR (gettext ("\ +call frame search table must not be writable\n")); + else if (shdr != NULL && (shdr->sh_flags & SHF_WRITE) != 0) + ERROR (gettext ("\ +section [%2zu] '%s' must not be writable\n"), + elf_ndxscn (scn), ".eh_frame_hdr"); + + if ((phdr->p_flags & PF_X) != 0) + ERROR (gettext ("\ +call frame search table must not be executable\n")); + else if (shdr != NULL && (shdr->sh_flags & SHF_EXECINSTR) != 0) + ERROR (gettext ("\ +section [%2zu] '%s' must not be executable\n"), + elf_ndxscn (scn), ".eh_frame_hdr"); + } + + /* Remember which entry this is. */ + pt_gnu_eh_frame_pndx = cnt; + } if (phdr->p_filesz > phdr->p_memsz && (phdr->p_memsz != 0 || phdr->p_type != PT_NOTE)) @@ -4193,6 +4284,17 @@ program header entry %d: file offset and virtual address not module of alignment } +static void +check_exception_data (Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused))) +{ + if ((ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN) + && pt_gnu_eh_frame_pndx == 0 && eh_frame_hdr_scnndx != 0) + ERROR (gettext ("executable/DSO with .eh_frame_hdr section does not have " + "a PT_GNU_EH_FRAME program header entry")); +} + + /* Process one file. */ static void process_elf_file (Elf *elf, const char *prefix, const char *suffix, @@ -4241,6 +4343,11 @@ process_elf_file (Elf *elf, const char *prefix, const char *suffix, headers at all. */ check_sections (ebl, ehdr); + /* Check the exception handling data, if it exists. */ + if (pt_gnu_eh_frame_pndx != 0 || eh_frame_hdr_scnndx != 0 + || eh_frame_scnndx != 0 || gcc_except_table_scnndx != 0) + check_exception_data (ebl, ehdr); + /* Report if no relocation section needed the text relocation flag. */ if (textrel && !needed_textrel) ERROR (gettext ("text relocation flag set but not needed\n")); diff --git a/elfutils/src/findtextrel.c b/elfutils/src/findtextrel.c index 245db7fe..9d10982f 100644 --- a/elfutils/src/findtextrel.c +++ b/elfutils/src/findtextrel.c @@ -1,5 +1,5 @@ /* Locate source files or functions which caused text relocations. - Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2005. @@ -44,6 +44,8 @@ #include #include +#include + struct segments { @@ -54,10 +56,10 @@ struct segments /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Values for the parameters which have no short form. */ #define OPT_DEBUGINFO 0x100 @@ -169,7 +171,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } diff --git a/elfutils/src/ld.c b/elfutils/src/ld.c index 63fc378f..989bfaba 100644 --- a/elfutils/src/ld.c +++ b/elfutils/src/ld.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2001. @@ -48,10 +48,10 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Values for the various options. */ @@ -958,7 +958,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -1183,11 +1183,12 @@ ld_new_searchdir (const char *dir) /* Enqueue the file. */ if (ld_state.tailpaths == NULL) - ld_state.paths = ld_state.tailpaths = newpath; + ld_state.paths = ld_state.tailpaths = newpath->next = newpath; else { ld_state.tailpaths->next = newpath; ld_state.tailpaths = newpath; + newpath->next = ld_state.paths; } } diff --git a/elfutils/src/nm.c b/elfutils/src/nm.c index 1bef49fc..8833948a 100644 --- a/elfutils/src/nm.c +++ b/elfutils/src/nm.c @@ -1,5 +1,5 @@ /* Print symbol information from ELF file in human-readable form. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2000-2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2000. @@ -58,10 +58,10 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Values for the parameters which have no short form. */ @@ -254,7 +254,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -703,6 +703,18 @@ get_local_names (Dwarf *dbg) } } +/* Do elf_strptr, but return a backup string and never NULL. */ +static const char * +sym_name (Elf *elf, GElf_Word strndx, GElf_Word st_name, char buf[], size_t n) +{ + const char *symstr = elf_strptr (elf, strndx, st_name); + if (symstr == NULL) + { + snprintf (buf, n, "[invalid st_name %#" PRIx32 "]", st_name); + symstr = buf; + } + return symstr; +} /* Show symbols in SysV format. */ static void @@ -736,9 +748,15 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, assert (elf_ndxscn (scn) == cnt++); - scnnames[elf_ndxscn (scn)] - = elf_strptr (ebl->elf, shstrndx, - gelf_getshdr (scn, &shdr_mem)->sh_name); + char *name = elf_strptr (ebl->elf, shstrndx, + gelf_getshdr (scn, &shdr_mem)->sh_name); + if (unlikely (name == NULL)) + { + name = alloca (sizeof "[invalid sh_name 0x12345678]"); + snprintf (name, sizeof name, "[invalid sh_name %#" PRIx32 "]", + gelf_getshdr (scn, &shdr_mem)->sh_name); + } + scnnames[elf_ndxscn (scn)] = name; } int digits = length_map[gelf_getclass (ebl->elf) - 1][radix]; @@ -772,8 +790,10 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, /* Iterate over all symbols. */ for (cnt = 0; cnt < nsyms; ++cnt) { - const char *symstr = elf_strptr (ebl->elf, strndx, - syms[cnt].sym.st_name); + char symstrbuf[50]; + const char *symstr = sym_name (ebl->elf, strndx, syms[cnt].sym.st_name, + symstrbuf, sizeof symstrbuf); + char symbindbuf[50]; char symtypebuf[50]; char secnamebuf[1024]; @@ -850,7 +870,9 @@ show_symbols_bsd (Elf *elf, GElf_Word strndx, /* Iterate over all symbols. */ for (size_t cnt = 0; cnt < nsyms; ++cnt) { - const char *symstr = elf_strptr (elf, strndx, syms[cnt].sym.st_name); + char symstrbuf[50]; + const char *symstr = sym_name (elf, strndx, syms[cnt].sym.st_name, + symstrbuf, sizeof symstrbuf); /* Printing entries with a zero-length name makes the output not very well parseable. Since these entries don't carry @@ -872,7 +894,7 @@ show_symbols_bsd (Elf *elf, GElf_Word strndx, ? (GELF_ST_BIND (syms[cnt].sym.st_info) == STB_WEAK ? "*" : " ") : "", - elf_strptr (elf, strndx, syms[cnt].sym.st_name)); + symstr); else printf (print_size ? sfmtstrs[radix] : fmtstrs[radix], digits, syms[cnt].sym.st_value, @@ -881,7 +903,7 @@ show_symbols_bsd (Elf *elf, GElf_Word strndx, ? (GELF_ST_BIND (syms[cnt].sym.st_info) == STB_WEAK ? "*" : " ") : "", - elf_strptr (elf, strndx, syms[cnt].sym.st_name), + symstr, digits, (uint64_t) syms[cnt].sym.st_size); } } @@ -907,7 +929,9 @@ show_symbols_posix (Elf *elf, GElf_Word strndx, const char *prefix, /* Iterate over all symbols. */ for (size_t cnt = 0; cnt < nsyms; ++cnt) { - const char *symstr = elf_strptr (elf, strndx, syms[cnt].sym.st_name); + char symstrbuf[50]; + const char *symstr = sym_name (elf, strndx, syms[cnt].sym.st_name, + symstrbuf, sizeof symstrbuf); /* Printing entries with a zero-length name makes the output not very well parseable. Since these entries don't carry @@ -1056,6 +1080,8 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn, { const char *symstr = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name); + if (symstr == NULL) + continue; longest_name = MAX ((size_t) longest_name, strlen (symstr)); diff --git a/elfutils/src/objdump.c b/elfutils/src/objdump.c index 91fa8750..af8abf78 100644 --- a/elfutils/src/objdump.c +++ b/elfutils/src/objdump.c @@ -1,5 +1,5 @@ /* Print information from ELF file in human-readable form. - Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2005. @@ -49,10 +49,10 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Definitions of arguments for argp functions. */ @@ -182,7 +182,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "20089"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -234,9 +234,9 @@ parse_opt (int key, char *arg, if (! any_control_option) { fputs (gettext ("No operation specified.\n"), stderr); - argp_help (&argp, stderr, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, + argp_help (&argp, stderr, ARGP_HELP_SEE, program_invocation_short_name); - exit (1); + exit (EXIT_FAILURE); } default: @@ -357,12 +357,67 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname, } +static void +show_relocs_x (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *symdata, + Elf_Data *xndxdata, size_t symstrndx, size_t shstrndx, + GElf_Addr r_offset, GElf_Xword r_info, GElf_Sxword r_addend) +{ + int elfclass = gelf_getclass (ebl->elf); + char buf[128]; + + printf ("%0*" PRIx64 " %-20s ", + elfclass == ELFCLASS32 ? 8 : 16, r_offset, + ebl_reloc_type_name (ebl, GELF_R_TYPE (r_info), buf, sizeof (buf))); + + Elf32_Word xndx; + GElf_Sym symmem; + GElf_Sym *sym = gelf_getsymshndx (symdata, xndxdata, GELF_R_SYM (r_info), + &symmem, &xndx); + + if (sym == NULL) + printf ("<%s %ld>", + gettext ("INVALID SYMBOL"), (long int) GELF_R_SYM (r_info)); + else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION) + printf ("%s", + elf_strptr (ebl->elf, symstrndx, sym->st_name)); + else + { + GElf_Shdr destshdr_mem; + GElf_Shdr *destshdr; + destshdr = gelf_getshdr (elf_getscn (ebl->elf, + sym->st_shndx == SHN_XINDEX + ? xndx : sym->st_shndx), + &destshdr_mem); + + if (shdr == NULL) + printf ("<%s %ld>", + gettext ("INVALID SECTION"), + (long int) (sym->st_shndx == SHN_XINDEX + ? xndx : sym->st_shndx)); + else + printf ("%s", + elf_strptr (ebl->elf, shstrndx, destshdr->sh_name)); + } + + if (r_addend != 0) + { + char sign = '+'; + if (r_addend < 0) + { + sign = '-'; + r_addend = -r_addend; + } + printf ("%c%#" PRIx64, sign, r_addend); + } + putchar ('\n'); +} + + static void show_relocs_rel (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, Elf_Data *symdata, Elf_Data *xndxdata, size_t symstrndx, size_t shstrndx) { - int elfclass = gelf_getclass (ebl->elf); int nentries = shdr->sh_size / shdr->sh_entsize; for (int cnt = 0; cnt < nentries; ++cnt) @@ -372,60 +427,8 @@ show_relocs_rel (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, rel = gelf_getrel (data, cnt, &relmem); if (rel != NULL) - { - char buf[128]; - GElf_Sym symmem; - GElf_Sym *sym; - Elf32_Word xndx; - - sym = gelf_getsymshndx (symdata, xndxdata, GELF_R_SYM (rel->r_info), - &symmem, &xndx); - if (sym == NULL) - printf ("%0*" PRIx64 " %-20s <%s %ld>\n", - elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) - ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), - buf, sizeof (buf)) - : gettext (""), - gettext ("INVALID SYMBOL"), - (long int) GELF_R_SYM (rel->r_info)); - else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION) - printf ("%0*" PRIx64 " %-20s %s\n", - elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) - ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), - buf, sizeof (buf)) - : gettext (""), - elf_strptr (ebl->elf, symstrndx, sym->st_name)); - else - { - GElf_Shdr destshdr_mem; - GElf_Shdr *destshdr; - destshdr = gelf_getshdr (elf_getscn (ebl->elf, - sym->st_shndx == SHN_XINDEX - ? xndx : sym->st_shndx), - &destshdr_mem); - - if (shdr == NULL) - printf ("%0*" PRIx64 " %-20s <%s %ld>\n", - elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) - ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), - buf, sizeof (buf)) - : gettext (""), - gettext ("INVALID SECTION"), - (long int) (sym->st_shndx == SHN_XINDEX - ? xndx : sym->st_shndx)); - else - printf ("%0*" PRIx64 " %-20s %s\n", - elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) - ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), - buf, sizeof (buf)) - : gettext (""), - elf_strptr (ebl->elf, shstrndx, destshdr->sh_name)); - } - } + show_relocs_x (ebl, shdr, symdata, xndxdata, symstrndx, shstrndx, + rel->r_offset, rel->r_info, 0); } } @@ -435,7 +438,6 @@ show_relocs_rela (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, Elf_Data *symdata, Elf_Data *xndxdata, size_t symstrndx, size_t shstrndx) { - int elfclass = gelf_getclass (ebl->elf); int nentries = shdr->sh_size / shdr->sh_entsize; for (int cnt = 0; cnt < nentries; ++cnt) @@ -445,64 +447,8 @@ show_relocs_rela (Ebl *ebl, GElf_Shdr *shdr, Elf_Data *data, rel = gelf_getrela (data, cnt, &relmem); if (rel != NULL) - { - char buf[128]; - GElf_Sym symmem; - GElf_Sym *sym; - Elf32_Word xndx; - - sym = gelf_getsymshndx (symdata, xndxdata, GELF_R_SYM (rel->r_info), - &symmem, &xndx); - if (sym == NULL) - printf ("%0*" PRIx64 " %-20s <%s %ld>", - elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) - ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), - buf, sizeof (buf)) - : gettext (""), - gettext ("INVALID SYMBOL"), - (long int) GELF_R_SYM (rel->r_info)); - else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION) - printf ("%0*" PRIx64 " %-20s %s", - elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) - ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), - buf, sizeof (buf)) - : gettext (""), - elf_strptr (ebl->elf, symstrndx, sym->st_name)); - else - { - GElf_Shdr destshdr_mem; - GElf_Shdr *destshdr; - destshdr = gelf_getshdr (elf_getscn (ebl->elf, - sym->st_shndx == SHN_XINDEX - ? xndx : sym->st_shndx), - &destshdr_mem); - - if (shdr == NULL) - printf ("%0*" PRIx64 " %-20s <%s %ld>", - elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) - ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), - buf, sizeof (buf)) - : gettext (""), - gettext ("INVALID SECTION"), - (long int) (sym->st_shndx == SHN_XINDEX - ? xndx : sym->st_shndx)); - else - printf ("%0*" PRIx64 " %-20s %s", - elfclass == ELFCLASS32 ? 8 : 16, rel->r_offset, - ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info)) - ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info), - buf, sizeof (buf)) - : gettext (""), - elf_strptr (ebl->elf, shstrndx, destshdr->sh_name)); - } - - if (rel->r_addend != 0) - printf ("+%#" PRIx64, rel->r_addend); - putchar ('\n'); - } + show_relocs_x (ebl, shdr, symdata, xndxdata, symstrndx, shstrndx, + rel->r_offset, rel->r_info, rel->r_addend); } } @@ -561,7 +507,7 @@ show_relocs (Ebl *ebl, const char *fname, uint32_t shstrndx) shdr->sh_info), &destshdr_mem); - printf (gettext ("RELOCATION RECORDS FOR [%s]:\n" + printf (gettext ("\nRELOCATION RECORDS FOR [%s]:\n" "%-*s TYPE VALUE\n"), elf_strptr (ebl->elf, shstrndx, destshdr->sh_name), elfclass == ELFCLASS32 ? 8 : 16, gettext ("OFFSET")); @@ -601,11 +547,11 @@ show_relocs (Ebl *ebl, const char *fname, uint32_t shstrndx) else show_relocs_rela (ebl, shdr, data, symdata, xndxdata, symshdr->sh_link, shstrndx); + + putchar ('\n'); } } - fputs_unlocked ("\n\n", stdout); - return 0; } diff --git a/elfutils/src/ranlib.c b/elfutils/src/ranlib.c index a915e558..e92dc89b 100644 --- a/elfutils/src/ranlib.c +++ b/elfutils/src/ranlib.c @@ -1,5 +1,5 @@ /* Generate an index to speed access to archives. - Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2005. @@ -58,10 +58,10 @@ static int handle_file (const char *fname); /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Definitions of arguments for argp functions. */ @@ -137,7 +137,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } diff --git a/elfutils/src/readelf.c b/elfutils/src/readelf.c index 7b599ec8..1c790650 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,2000,2001,2002,2003,2004,2005,2006,2007,2008 Red Hat, Inc. + Copyright (C) 1999-2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 1999. @@ -61,16 +61,16 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +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: -h -l"), 0 }, + { "all", 'a', NULL, 0, N_("Equivalent to: -e -h -l"), 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, @@ -84,8 +84,8 @@ static const struct argp_option options[] = { "version-info", 'V', NULL, 0, N_("Display versioning information"), 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, or macinfo."), - 0 }, + "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 }, @@ -96,6 +96,8 @@ 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 }, @@ -166,20 +168,21 @@ static bool any_control_option; /* Select printing of debugging sections. */ static enum section_e { - section_abbrev = 1, /* .debug_abbrev */ - section_aranges = 2, /* .debug_aranges */ - section_frame = 4, /* .debug_frame or .eh_frame */ - section_info = 8, /* .debug_info */ - section_line = 16, /* .debug_line */ - section_loc = 32, /* .debug_loc */ - section_pubnames = 64,/* .debug_pubnames */ - section_str = 128, /* .debug_str */ - section_macinfo = 256,/* .debug_macinfo */ - section_ranges = 512, /* .debug_ranges */ + section_abbrev = 1, /* .debug_abbrev */ + section_aranges = 2, /* .debug_aranges */ + section_frame = 4, /* .debug_frame or .eh_frame & al. */ + section_info = 8, /* .debug_info */ + section_line = 16, /* .debug_line */ + section_loc = 32, /* .debug_loc */ + section_pubnames = 64, /* .debug_pubnames */ + section_str = 128, /* .debug_str */ + section_macinfo = 256, /* .debug_macinfo */ + section_ranges = 512, /* .debug_ranges */ + section_exception = 1024, /* .eh_frame & al. */ section_all = (section_abbrev | section_aranges | section_frame | section_info | section_line | section_loc | section_pubnames | section_str | section_macinfo - | section_ranges) + | section_ranges | section_exception) } print_debug_sections; /* Select hex dumping of sections. */ @@ -272,6 +275,17 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state __attribute__ ((unused))) { + void add_dump_section (const char *name) + { + struct section_argument *a = xmalloc (sizeof *a); + a->arg = name; + a->next = NULL; + struct section_argument ***tailp + = key == 'x' ? &dump_data_sections_tail : &string_sections_tail; + **tailp = a; + *tailp = &a->next; + } + switch (key) { case 'a': @@ -286,6 +300,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"); any_control_option = true; break; case 'A': @@ -296,6 +314,10 @@ parse_opt (int key, char *arg, print_dynamic_table = true; any_control_option = true; break; + case 'e': + print_debug_sections |= section_exception; + any_control_option = true; + break; case 'g': print_section_groups = true; any_control_option = true; @@ -344,7 +366,7 @@ parse_opt (int key, char *arg, print_debug_sections |= section_aranges; else if (strcmp (arg, "ranges") == 0) print_debug_sections |= section_ranges; - else if (strcmp (arg, "frame") == 0) + else if (strcmp (arg, "frame") == 0 || strcmp (arg, "frames") == 0) print_debug_sections |= section_frame; else if (strcmp (arg, "info") == 0) print_debug_sections |= section_info; @@ -358,6 +380,8 @@ parse_opt (int key, char *arg, print_debug_sections |= section_str; else if (strcmp (arg, "macinfo") == 0) print_debug_sections |= section_macinfo; + else if (strcmp (arg, "exception") == 0) + print_debug_sections |= section_exception; else { fprintf (stderr, gettext ("Unknown DWARF debug section `%s'.\n"), @@ -377,15 +401,7 @@ parse_opt (int key, char *arg, } /* Fall through. */ case 'x': - { - struct section_argument *a = xmalloc (sizeof *a); - a->arg = arg; - a->next = NULL; - struct section_argument ***tailp - = key == 'x' ? &dump_data_sections_tail : &string_sections_tail; - **tailp = a; - *tailp = &a->next; - } + add_dump_section (arg); any_control_option = true; break; case ARGP_KEY_NO_ARGS: @@ -396,9 +412,9 @@ parse_opt (int key, char *arg, { fputs (gettext ("No operation specified.\n"), stderr); do_argp_help: - argp_help (&argp, stderr, ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR, + argp_help (&argp, stderr, ARGP_HELP_SEE, program_invocation_short_name); - exit (1); + exit (EXIT_FAILURE); } break; default: @@ -417,7 +433,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -459,8 +475,10 @@ count_dwflmod (Dwfl_Module *dwflmod __attribute__ ((unused)), Dwarf_Addr base __attribute__ ((unused)), void *arg) { - *(bool *) arg = false; - return DWARF_CB_ABORT; + if (*(bool *) arg) + return DWARF_CB_ABORT; + *(bool *) arg = true; + return DWARF_CB_OK; } struct process_dwflmod_args @@ -548,8 +566,11 @@ process_file (int fd, const char *fname, bool only_one) dwfl_report_end (dwfl, NULL, NULL); if (only_one) - /* Clear ONLY_ONE if we have multiple modules, from an archive. */ - dwfl_getmodules (dwfl, &count_dwflmod, &only_one, 1); + { + /* Clear ONLY_ONE if we have multiple modules, from an archive. */ + bool seen = false; + only_one = dwfl_getmodules (dwfl, &count_dwflmod, &seen, 0) == 0; + } /* Process the one or more modules gleaned from this file. */ struct process_dwflmod_args a = { .fd = fd, .only_one = only_one }; @@ -961,6 +982,10 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr) } } + if (ehdr->e_shnum == 0) + /* No sections in the file. Punt. */ + return; + /* Get the section header string table index. */ size_t shstrndx; if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0)) @@ -1490,11 +1515,11 @@ handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) if (shdr->sh_info != 0) printf (ngettext ("\ -\nRelocation section [%2u] '%s' for section [%2u] '%s' at offset %#0" PRIx64 " contains %d entry:\n", +\nRelocation section [%2zu] '%s' for section [%2u] '%s' at offset %#0" PRIx64 " contains %d entry:\n", "\ -\nRelocation section [%2u] '%s' for section [%2u] '%s' at offset %#0" PRIx64 " contains %d entries:\n", +\nRelocation section [%2zu] '%s' for section [%2u] '%s' at offset %#0" PRIx64 " contains %d entries:\n", nentries), - (unsigned int) elf_ndxscn (scn), + elf_ndxscn (scn), elf_strptr (ebl->elf, shstrndx, shdr->sh_name), (unsigned int) shdr->sh_info, elf_strptr (ebl->elf, shstrndx, destshdr->sh_name), @@ -2799,7 +2824,9 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr) GElf_Shdr shdr_mem; GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - if (shdr == NULL || shdr->sh_type != SHT_GNU_ATTRIBUTES) + if (shdr == NULL || (shdr->sh_type != SHT_GNU_ATTRIBUTES + && (shdr->sh_type != SHT_ARM_ATTRIBUTES + || ehdr->e_machine != EM_ARM))) continue; printf (gettext ("\ @@ -2846,8 +2873,9 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr) printf (gettext (" %-13s %4" PRIu32 "\n"), name, len); - if (q - name == sizeof "gnu" - && !memcmp (name, "gnu", sizeof "gnu")) + if (shdr->sh_type != SHT_GNU_ATTRIBUTES + || (q - name == sizeof "gnu" + && !memcmp (name, "gnu", sizeof "gnu"))) while (q < p) { const unsigned char *const sub = q; @@ -3760,6 +3788,14 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, [DW_OP_bit_piece] = "bit_piece", }; + if (len == 0) + { + printf ("%*s(empty)\n", indent, ""); + return; + } + +#define NEED(n) if (len < n) goto invalid; + Dwarf_Word offset = 0; while (len-- > 0) { @@ -3771,6 +3807,7 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, case DW_OP_addr:; /* Address operand. */ Dwarf_Word addr; + NEED (addrsize); if (addrsize == 4) addr = read_4ubyte_unaligned (dbg, data); else @@ -3785,14 +3822,13 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, { char *a = format_dwarf_addr (dwflmod, 0, addr); printf ("%*s[%4" PRIuMAX "] %s %s\n", - indent, "", (uintmax_t) offset, - known[op] ?: "???", a); + indent, "", (uintmax_t) offset, known[op], a); free (a); } else printf ("%*s[%4" PRIuMAX "] %s %#" PRIxMAX "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", (uintmax_t) addr); + known[op], (uintmax_t) addr); offset += 1 + addrsize; break; @@ -3800,72 +3836,88 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, case DW_OP_xderef_size: case DW_OP_pick: case DW_OP_const1u: + // XXX value might be modified by relocation + NEED (1); printf ("%*s[%4" PRIuMAX "] %s %" PRIu8 "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", *((uint8_t *) data)); + known[op], *((uint8_t *) data)); ++data; --len; offset += 2; break; case DW_OP_const2u: + NEED (2); + // XXX value might be modified by relocation printf ("%*s[%4" PRIuMAX "] %s %" PRIu16 "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", read_2ubyte_unaligned (dbg, data)); + known[op], read_2ubyte_unaligned (dbg, data)); len -= 2; data += 2; offset += 3; break; case DW_OP_const4u: + NEED (4); + // XXX value might be modified by relocation printf ("%*s[%4" PRIuMAX "] %s %" PRIu32 "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", read_4ubyte_unaligned (dbg, data)); + known[op], read_4ubyte_unaligned (dbg, data)); len -= 4; data += 4; offset += 5; break; case DW_OP_const8u: + NEED (8); + // XXX value might be modified by relocation printf ("%*s[%4" PRIuMAX "] %s %" PRIu64 "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", read_8ubyte_unaligned (dbg, data)); + known[op], read_8ubyte_unaligned (dbg, data)); len -= 8; data += 8; offset += 9; break; case DW_OP_const1s: + NEED (1); + // XXX value might be modified by relocation printf ("%*s[%4" PRIuMAX "] %s %" PRId8 "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", *((int8_t *) data)); + known[op], *((int8_t *) data)); ++data; --len; offset += 2; break; case DW_OP_const2s: + NEED (2); + // XXX value might be modified by relocation printf ("%*s[%4" PRIuMAX "] %s %" PRId16 "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", read_2sbyte_unaligned (dbg, data)); + known[op], read_2sbyte_unaligned (dbg, data)); len -= 2; data += 2; offset += 3; break; case DW_OP_const4s: + NEED (4); + // XXX value might be modified by relocation printf ("%*s[%4" PRIuMAX "] %s %" PRId32 "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", read_4sbyte_unaligned (dbg, data)); + known[op], read_4sbyte_unaligned (dbg, data)); len -= 4; data += 4; offset += 5; break; case DW_OP_const8s: + NEED (8); + // XXX value might be modified by relocation printf ("%*s[%4" PRIuMAX "] %s %" PRId64 "\n", indent, "", (uintmax_t) offset, - known[op] ?: "???", read_8sbyte_unaligned (dbg, data)); + known[op], read_8sbyte_unaligned (dbg, data)); len -= 8; data += 8; offset += 9; @@ -3877,10 +3929,9 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, case DW_OP_constu:; const unsigned char *start = data; unsigned int uleb; - get_uleb128 (uleb, data); + get_uleb128 (uleb, data); /* XXX check overrun */ printf ("%*s[%4" PRIuMAX "] %s %u\n", - indent, "", (uintmax_t) offset, - known[op] ?: "???", uleb); + indent, "", (uintmax_t) offset, known[op], uleb); len -= data - start; offset += 1 + (data - start); break; @@ -3888,11 +3939,10 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, case DW_OP_bit_piece: start = data; unsigned int uleb2; - get_uleb128 (uleb, data); - get_uleb128 (uleb2, data); + get_uleb128 (uleb, data); /* XXX check overrun */ + get_uleb128 (uleb2, data); /* XXX check overrun */ printf ("%*s[%4" PRIuMAX "] %s %u, %u\n", - indent, "", (uintmax_t) offset, - known[op] ?: "???", uleb, uleb2); + indent, "", (uintmax_t) offset, known[op], uleb, uleb2); len -= data - start; offset += 1 + (data - start); break; @@ -3902,32 +3952,46 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, case DW_OP_consts: start = data; unsigned int sleb; - get_sleb128 (sleb, data); + get_sleb128 (sleb, data); /* XXX check overrun */ printf ("%*s[%4" PRIuMAX "] %s %d\n", - indent, "", (uintmax_t) offset, - known[op] ?: "???", sleb); + indent, "", (uintmax_t) offset, known[op], sleb); len -= data - start; offset += 1 + (data - start); break; case DW_OP_bregx: start = data; - get_uleb128 (uleb, data); - get_sleb128 (sleb, data); + get_uleb128 (uleb, data); /* XXX check overrun */ + get_sleb128 (sleb, data); /* XXX check overrun */ printf ("%*s[%4" PRIuMAX "] %s %u %d\n", - indent, "", (uintmax_t) offset, - known[op] ?: "???", uleb, sleb); + indent, "", (uintmax_t) offset, known[op], uleb, sleb); len -= data - start; offset += 1 + (data - start); break; case DW_OP_call2: + NEED (2); + printf ("%*s[%4" PRIuMAX "] %s %" PRIu16 "\n", + indent, "", (uintmax_t) offset, known[op], + read_2ubyte_unaligned (dbg, data)); + len -= 2; + offset += 3; + break; + case DW_OP_call4: + NEED (4); + printf ("%*s[%4" PRIuMAX "] %s %" PRIu32 "\n", + indent, "", (uintmax_t) offset, known[op], + read_4ubyte_unaligned (dbg, data)); + len -= 4; + offset += 5; + break; + case DW_OP_skip: case DW_OP_bra: + NEED (2); printf ("%*s[%4" PRIuMAX "] %s %" PRIuMAX "\n", - indent, "", (uintmax_t) offset, - known[op] ?: "???", + indent, "", (uintmax_t) offset, known[op], (uintmax_t) (offset + read_2sbyte_unaligned (dbg, data))); len -= 2; data += 2; @@ -3947,6 +4011,12 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, } indent = indentrest; + continue; + + invalid: + printf (gettext ("%*s[%4" PRIuMAX "] %s \n"), + indent, "", (uintmax_t) offset, known[op]); + break; } } @@ -3955,12 +4025,11 @@ static void print_debug_abbrev_section (Dwfl_Module *dwflmod __attribute__ ((unused)), Ebl *ebl __attribute__ ((unused)), GElf_Ehdr *ehdr __attribute__ ((unused)), - Elf_Scn *scn __attribute__ ((unused)), - GElf_Shdr *shdr, Dwarf *dbg) + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { - printf (gettext ("\nDWARF section '%s' at offset %#" PRIx64 ":\n" + printf (gettext ("\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n" " [ Code]\n"), - ".debug_abbrev", (uint64_t) shdr->sh_offset); + elf_ndxscn (scn), ".debug_abbrev", (uint64_t) shdr->sh_offset); Dwarf_Off offset = 0; while (offset < shdr->sh_size) @@ -4026,8 +4095,7 @@ print_debug_abbrev_section (Dwfl_Module *dwflmod __attribute__ ((unused)), static void print_debug_aranges_section (Dwfl_Module *dwflmod __attribute__ ((unused)), Ebl *ebl __attribute__ ((unused)), - GElf_Ehdr *ehdr __attribute__ ((unused)), - Elf_Scn *scn __attribute__ ((unused)), + GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { Dwarf_Aranges *aranges; @@ -4040,11 +4108,11 @@ print_debug_aranges_section (Dwfl_Module *dwflmod __attribute__ ((unused)), } printf (ngettext ("\ -\nDWARF section '%s' at offset %#" PRIx64 " contains %zu entry:\n", +\nDWARF section [%2zu] '%s' at offset %#" PRIx64 " contains %zu entry:\n", "\ -\nDWARF section '%s' at offset %#" PRIx64 " contains %zu entries:\n", +\nDWARF section [%2zu] '%s' at offset %#" PRIx64 " contains %zu entries:\n", cnt), - ".debug_aranges", (uint64_t) shdr->sh_offset, cnt); + elf_ndxscn (scn), ".debug_aranges", (uint64_t) shdr->sh_offset, cnt); /* Compute floor(log16(cnt)). */ size_t tmp = cnt; @@ -4096,8 +4164,8 @@ print_debug_ranges_section (Dwfl_Module *dwflmod, } printf (gettext ("\ -\nDWARF section '%s' at offset %#" PRIx64 ":\n"), - ".debug_ranges", (uint64_t) shdr->sh_offset); +\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"), + elf_ndxscn (scn), ".debug_ranges", (uint64_t) shdr->sh_offset); size_t address_size = ehdr->e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; @@ -4155,13 +4223,706 @@ print_debug_ranges_section (Dwfl_Module *dwflmod, static void -print_debug_frame_section (Dwfl_Module *dwflmod __attribute__ ((unused)), - Ebl *ebl __attribute__ ((unused)), - GElf_Ehdr *ehdr __attribute__ ((unused)), - Elf_Scn *scn __attribute__ ((unused)), - GElf_Shdr *shdr __attribute__ ((unused)), - Dwarf *dbg __attribute__ ((unused))) +print_cfa_program (const unsigned char *readp, const unsigned char *const endp, + Dwarf_Word vma_base, unsigned int code_align, + int data_align, unsigned int ptr_size, Dwfl_Module *dwflmod, + Ebl *ebl, Dwarf *dbg) { + char regnamebuf[16]; + const char *regname (unsigned int regno) + { + const char *str; + int i; + return (ebl_register_info (ebl, regno, regnamebuf, sizeof (regnamebuf), + &str, &str, &i, &i) < 0 + ? "???" : regnamebuf); + } + + puts ("\n Program:"); + Dwarf_Word pc = vma_base; + while (readp < endp) + { + unsigned int opcode = *readp++; + + if (opcode < DW_CFA_advance_loc) + /* Extended opcode. */ + switch (opcode) + { + uint64_t op1; + int64_t sop1; + uint64_t op2; + int64_t sop2; + + case DW_CFA_nop: + puts (" nop"); + break; + case DW_CFA_set_loc: + // XXX overflow check + get_uleb128 (op1, readp); + op1 += vma_base; + printf (" set_loc %" PRIu64 "\n", op1 * code_align); + break; + case DW_CFA_advance_loc1: + printf (" advance_loc1 %u to %#" PRIx64 "\n", + *readp, pc += *readp * code_align); + ++readp; + break; + case DW_CFA_advance_loc2: + op1 = read_2ubyte_unaligned_inc (dbg, readp); + printf (" advance_loc2 %" PRIu64 " to %#" PRIx64 "\n", + op1, pc += op1 * code_align); + break; + case DW_CFA_advance_loc4: + op1 = read_4ubyte_unaligned_inc (dbg, readp); + printf (" advance_loc4 %" PRIu64 " to %#" PRIx64 "\n", + op1, pc += op1 * code_align); + break; + case DW_CFA_offset_extended: + // XXX overflow check + get_uleb128 (op1, readp); + get_uleb128 (op2, readp); + printf (" offset_extended r%" PRIu64 " (%s) at cfa%+" PRId64 + "\n", + op1, regname (op1), op2 * data_align); + break; + case DW_CFA_restore_extended: + // XXX overflow check + get_uleb128 (op1, readp); + printf (" restore_extended r%" PRIu64 " (%s)\n", + op1, regname (op1)); + break; + case DW_CFA_undefined: + // XXX overflow check + get_uleb128 (op1, readp); + printf (" undefined r%" PRIu64 " (%s)\n", op1, regname (op1)); + break; + case DW_CFA_same_value: + // XXX overflow check + get_uleb128 (op1, readp); + printf (" same_value r%" PRIu64 " (%s)\n", op1, regname (op1)); + break; + case DW_CFA_register: + // XXX overflow check + get_uleb128 (op1, readp); + get_uleb128 (op2, readp); + printf (" register r%" PRIu64 " (%s) in r%" PRIu64 " (%s)\n", + op1, regname (op1), op2, regname (op2)); + break; + case DW_CFA_remember_state: + puts (" remember_state"); + break; + case DW_CFA_restore_state: + puts (" restore_state"); + break; + case DW_CFA_def_cfa: + // XXX overflow check + get_uleb128 (op1, readp); + get_uleb128 (op2, readp); + printf (" def_cfa r%" PRIu64 " (%s) at offset %" PRIu64 "\n", + op1, regname (op1), op2); + break; + case DW_CFA_def_cfa_register: + // XXX overflow check + get_uleb128 (op1, readp); + printf (" def_cfa_register r%" PRIu64 " (%s)\n", + op1, regname (op1)); + break; + case DW_CFA_def_cfa_offset: + // XXX overflow check + get_uleb128 (op1, readp); + printf (" def_cfa_offset %" PRIu64 "\n", op1); + break; + case DW_CFA_def_cfa_expression: + // XXX overflow check + get_uleb128 (op1, readp); /* Length of DW_FORM_block. */ + printf (" def_cfa_expression %" PRIu64 "\n", op1); + print_ops (dwflmod, dbg, 10, 10, ptr_size, op1, readp); + readp += op1; + break; + case DW_CFA_expression: + // XXX overflow check + get_uleb128 (op1, readp); + get_uleb128 (op2, readp); /* Length of DW_FORM_block. */ + printf (" expression r%" PRIu64 " (%s) \n", + op1, regname (op1)); + print_ops (dwflmod, dbg, 10, 10, ptr_size, op2, readp); + readp += op2; + break; + case DW_CFA_offset_extended_sf: + // XXX overflow check + get_uleb128 (op1, readp); + get_sleb128 (sop2, readp); + printf (" offset_extended_sf r%" PRIu64 " (%s) at cfa%+" + PRId64 "\n", + op1, regname (op1), sop2 * data_align); + break; + case DW_CFA_def_cfa_sf: + // XXX overflow check + get_uleb128 (op1, readp); + get_sleb128 (sop2, readp); + printf (" def_cfa_sf r%" PRIu64 " (%s) at offset %" PRId64 "\n", + op1, regname (op1), sop2 * data_align); + break; + case DW_CFA_def_cfa_offset_sf: + // XXX overflow check + get_sleb128 (sop1, readp); + printf (" def_cfa_offset_sf %" PRId64 "\n", sop1 * data_align); + break; + case DW_CFA_val_offset: + // XXX overflow check + get_uleb128 (op1, readp); + get_uleb128 (op2, readp); + printf (" val_offset %" PRIu64 " at offset %" PRIu64 "\n", + op1, op2 * data_align); + break; + case DW_CFA_val_offset_sf: + // XXX overflow check + get_uleb128 (op1, readp); + get_sleb128 (sop2, readp); + printf (" val_offset_sf %" PRIu64 " at offset %" PRId64 "\n", + op1, sop2 * data_align); + break; + case DW_CFA_val_expression: + // XXX overflow check + get_uleb128 (op1, readp); + get_uleb128 (op2, readp); /* Length of DW_FORM_block. */ + printf (" val_expression r%" PRIu64 " (%s)\n", + op1, regname (op1)); + print_ops (dwflmod, dbg, 10, 10, ptr_size, op2, readp); + readp += op2; + break; + case DW_CFA_MIPS_advance_loc8: + op1 = read_8ubyte_unaligned_inc (dbg, readp); + printf (" MIPS_advance_loc8 %" PRIu64 " to %#" PRIx64 "\n", + op1, pc += op1 * code_align); + break; + case DW_CFA_GNU_window_save: + puts (" GNU_window_save"); + break; + case DW_CFA_GNU_args_size: + // XXX overflow check + get_uleb128 (op1, readp); + printf (" args_size %" PRIu64 "\n", op1); + break; + default: + printf (" ??? (%u)\n", opcode); + break; + } + else if (opcode < DW_CFA_offset) + printf (" advance_loc %u to %#" PRIx64 "\n", + opcode & 0x3f, pc += (opcode & 0x3f) * code_align); + else if (opcode < DW_CFA_restore) + { + unsigned int offset; + // XXX overflow check + get_uleb128 (offset, readp); + printf (" offset r%u (%s) at cfa%+d\n", + opcode & 0x3f, regname (opcode & 0x3f), offset * data_align); + } + else + printf (" restore r%u (%s)\n", + opcode & 0x3f, regname (opcode & 0x3f)); + } +} + + +static unsigned int +encoded_ptr_size (int encoding, unsigned int ptr_size) +{ + switch (encoding & 7) + { + case 2: + return 2; + case 3: + return 4; + case 4: + return 8; + default: + return ptr_size; + } +} + + +static unsigned int +print_encoding (unsigned int val) +{ + switch (val & 0xf) + { + case DW_EH_PE_absptr: + fputs ("absptr", stdout); + break; + case DW_EH_PE_uleb128: + fputs ("uleb128", stdout); + break; + case DW_EH_PE_udata2: + fputs ("udata2", stdout); + break; + case DW_EH_PE_udata4: + fputs ("udata4", stdout); + break; + case DW_EH_PE_udata8: + fputs ("udata8", stdout); + break; + case DW_EH_PE_sleb128: + fputs ("sleb128", stdout); + break; + case DW_EH_PE_sdata2: + fputs ("sdata2", stdout); + break; + case DW_EH_PE_sdata4: + fputs ("sdata4", stdout); + break; + case DW_EH_PE_sdata8: + fputs ("sdata8", stdout); + break; + default: + /* We did not use any of the bits after all. */ + return val; + } + + return val & ~0xf; +} + + +static unsigned int +print_relinfo (unsigned int val) +{ + switch (val & 0x70) + { + case DW_EH_PE_pcrel: + fputs ("pcrel", stdout); + break; + case DW_EH_PE_textrel: + fputs ("textrel", stdout); + break; + case DW_EH_PE_datarel: + fputs ("datarel", stdout); + break; + case DW_EH_PE_funcrel: + fputs ("funcrel", stdout); + break; + case DW_EH_PE_aligned: + fputs ("aligned", stdout); + break; + default: + return val; + } + + return val & ~0x70; +} + + +static void +print_encoding_base (const char *pfx, unsigned int fde_encoding) +{ + printf ("(%s", pfx); + + if (fde_encoding == DW_EH_PE_omit) + puts ("omit)"); + else + { + unsigned int w = fde_encoding; + + if (w & 0xf) + w = print_encoding (w); + + if (w & 0x70) + { + if (w != fde_encoding) + fputc_unlocked (' ', stdout); + + w = print_relinfo (w); + } + + if (w != 0) + printf ("%s%x", w != fde_encoding ? " " : "", w); + + puts (")"); + } +} + + +static const unsigned char * +read_encoded (unsigned int encoding, const unsigned char *readp, + const unsigned char *const endp, uint64_t *res, Dwarf *dbg) +{ + switch (encoding & 0xf) + { + case DW_EH_PE_uleb128: + // XXX buffer overrun check + get_uleb128 (*res, readp); + break; + case DW_EH_PE_sleb128: + // XXX buffer overrun check + get_sleb128 (*res, readp); + break; + case DW_EH_PE_udata2: + if (readp + 2 > endp) + goto invalid; + *res = read_2ubyte_unaligned_inc (dbg, readp); + break; + case DW_EH_PE_udata4: + if (readp + 4 > endp) + goto invalid; + *res = read_4ubyte_unaligned_inc (dbg, readp); + break; + case DW_EH_PE_udata8: + if (readp + 8 > endp) + goto invalid; + *res = read_8ubyte_unaligned_inc (dbg, readp); + break; + case DW_EH_PE_sdata2: + if (readp + 2 > endp) + goto invalid; + *res = read_2sbyte_unaligned_inc (dbg, readp); + break; + case DW_EH_PE_sdata4: + if (readp + 4 > endp) + goto invalid; + *res = read_4sbyte_unaligned_inc (dbg, readp); + break; + case DW_EH_PE_sdata8: + if (readp + 8 > endp) + goto invalid; + *res = read_8sbyte_unaligned_inc (dbg, readp); + break; + default: + invalid: + error (1, 0, + gettext ("invalid encoding")); + } + + return readp; +} + + +static void +print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) +{ + size_t shstrndx; + /* We know this call will succeed since it did in the caller. */ + (void) elf_getshstrndx (ebl->elf, &shstrndx); + const char *scnname = elf_strptr (ebl->elf, shstrndx, shdr->sh_name); + + Elf_Data *data = elf_rawdata (scn, NULL); + + if (unlikely (data == NULL)) + { + error (0, 0, gettext ("cannot get %s content: %s"), + scnname, elf_errmsg (-1)); + return; + } + bool is_eh_frame = strcmp (scnname, ".eh_frame") == 0; + + if (is_eh_frame) + printf (gettext ("\ +\nCall frame information section [%2zu] '%s' at offset %#" PRIx64 ":\n"), + elf_ndxscn (scn), scnname, (uint64_t) shdr->sh_offset); + else + printf (gettext ("\ +\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"), + elf_ndxscn (scn), scnname, (uint64_t) shdr->sh_offset); + + struct cieinfo + { + ptrdiff_t cie_offset; + const char *augmentation; + unsigned int code_alignment_factor; + unsigned int data_alignment_factor; + unsigned int fde_encoding; + unsigned int lsda_encoding; + struct cieinfo *next; + } *cies = NULL; + + const unsigned char *readp = data->d_buf; + const unsigned char *const dataend = ((unsigned char *) data->d_buf + + data->d_size); + while (readp < dataend) + { + if (unlikely (readp + 4 > dataend)) + { + invalid_data: + error (0, 0, gettext ("invalid data in section [%zu] '%s'"), + elf_ndxscn (scn), scnname); + return; + } + + /* At the beginning there must be a CIE. There can be multiple, + hence we test tis in a loop. */ + ptrdiff_t offset = readp - (unsigned char *) data->d_buf; + + Dwarf_Word unit_length = read_4ubyte_unaligned_inc (dbg, readp); + unsigned int length = 4; + if (unlikely (unit_length == 0xffffffff)) + { + if (unlikely (readp + 8 > dataend)) + goto invalid_data; + + unit_length = read_8ubyte_unaligned_inc (dbg, readp); + length = 8; + } + + if (unlikely (unit_length == 0)) + { + printf (gettext ("\n [%6tx] Zero terminator\n"), offset); + continue; + } + + unsigned int ptr_size = ehdr->e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; + + ptrdiff_t start = readp - (unsigned char *) data->d_buf; + const unsigned char *const cieend = readp + unit_length; + if (unlikely (cieend > dataend || readp + 8 > dataend)) + goto invalid_data; + + Dwarf_Off cie_id; + if (length == 4) + { + cie_id = read_4ubyte_unaligned_inc (dbg, readp); + if (!is_eh_frame && cie_id == DW_CIE_ID_32) + cie_id = DW_CIE_ID_64; + } + else + cie_id = read_8ubyte_unaligned_inc (dbg, readp); + + unsigned int code_alignment_factor; + int data_alignment_factor; + unsigned int fde_encoding = 0; + unsigned int lsda_encoding = 0; + Dwarf_Word initial_location = 0; + Dwarf_Word vma_base = 0; + + if (cie_id == (is_eh_frame ? 0 : DW_CIE_ID_64)) + { + uint_fast8_t version = *readp++; + const char *const augmentation = (const char *) readp; + readp = memchr (readp, '\0', cieend - readp); + if (unlikely (readp == NULL)) + goto invalid_data; + ++readp; + // XXX Check overflow + get_uleb128 (code_alignment_factor, readp); + // XXX Check overflow + get_sleb128 (data_alignment_factor, readp); + + /* In some variant for unwind data there is another field. */ + if (strcmp (augmentation, "eh") == 0) + readp += ehdr->e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; + + unsigned int return_address_register; + if (unlikely (version == 1)) + return_address_register = *readp++; + else + // XXX Check overflow + get_uleb128 (return_address_register, readp); + + printf ("\n [%6tx] CIE length=%" PRIu64 "\n" + " CIE_id: %" PRIu64 "\n" + " version: %u\n" + " augmentation: \"%s\"\n" + " code_alignment_factor: %u\n" + " data_alignment_factor: %d\n" + " return_address_register: %u\n", + offset, (uint64_t) unit_length, (uint64_t) cie_id, + version, augmentation, code_alignment_factor, + data_alignment_factor, return_address_register); + + if (augmentation[0] == 'z') + { + unsigned int augmentationlen; + get_uleb128 (augmentationlen, readp); + + const char *hdr = "Augmentation data:"; + const char *cp = augmentation + 1; + while (*cp != '\0') + { + printf (" %-26s%#x ", hdr, *readp); + hdr = ""; + + if (*cp == 'R') + { + fde_encoding = *readp++; + print_encoding_base (gettext ("FDE address encoding: "), + fde_encoding); + } + else if (*cp == 'L') + { + lsda_encoding = *readp++; + print_encoding_base (gettext ("LSDA pointer encoding: "), + lsda_encoding); + } + else if (*cp == 'P') + { + /* Personality. This field usually has a relocation + attached pointing to __gcc_personality_v0. */ + const unsigned char *startp = readp; + unsigned int encoding = *readp++; + uint64_t val = 0; + int64_t sval = 0; + bool is_signed = false; + + switch (encoding & 0xf) + { + case DW_EH_PE_uleb128: + get_uleb128 (val, readp); + break; + case DW_EH_PE_sleb128: + get_sleb128 (sval, readp); + is_signed = true; + break; + case DW_EH_PE_udata2: + val = read_2ubyte_unaligned_inc (dbg, readp); + break; + case DW_EH_PE_udata4: + val = read_4ubyte_unaligned_inc (dbg, readp); + break; + case DW_EH_PE_udata8: + val = read_8ubyte_unaligned_inc (dbg, readp); + break; + case DW_EH_PE_sdata2: + val = read_2sbyte_unaligned_inc (dbg, readp); + is_signed = true; + break; + case DW_EH_PE_sdata4: + val = read_4sbyte_unaligned_inc (dbg, readp); + is_signed = true; + break; + case DW_EH_PE_sdata8: + val = read_8sbyte_unaligned_inc (dbg, readp); + is_signed = true; + break; + default: + error (1, 0, + gettext ("invalid augmentation encoding")); + } + + while (++startp < readp) + printf ("%#x ", *startp); + + if (is_signed) + printf ("(%" PRId64 ")\n", sval); + else + printf ("(%" PRIu64 ")\n", val); + } + else + printf ("(%x)\n", *readp++); + + ++cp; + } + } + + struct cieinfo *newp = alloca (sizeof (*newp)); + newp->cie_offset = offset; + newp->augmentation = augmentation; + newp->fde_encoding = fde_encoding; + newp->lsda_encoding = lsda_encoding; + newp->code_alignment_factor = code_alignment_factor; + newp->data_alignment_factor = data_alignment_factor; + newp->next = cies; + cies = newp; + } + else + { + struct cieinfo *cie = cies; + while (cie != NULL) + if (is_eh_frame + ? start - (ptrdiff_t) cie_id == cie->cie_offset + : (ptrdiff_t) cie_id == cie->cie_offset) + break; + else + cie = cie->next; + if (unlikely (cie == NULL)) + { + puts ("invalid CIE reference in FDE"); + return; + } + + /* Initialize from CIE data. */ + fde_encoding = cie->fde_encoding; + lsda_encoding = cie->lsda_encoding; + ptr_size = encoded_ptr_size (fde_encoding, ptr_size); + code_alignment_factor = cie->code_alignment_factor; + data_alignment_factor = cie->data_alignment_factor; + + const unsigned char *base = readp; + // XXX There are sometimes relocations for this value + initial_location = read_ubyte_unaligned_inc (ptr_size, dbg, readp); + Dwarf_Word address_range + = read_ubyte_unaligned_inc (ptr_size, dbg, readp); + + printf ("\n [%6tx] FDE length=%" PRIu64 " cie=[%6tx]\n" + " CIE_pointer: %" PRIu64 "\n" + " initial_location: %#" PRIx64, + offset, (uint64_t) unit_length, + cie->cie_offset, (uint64_t) cie_id, + (uint64_t) initial_location); + if ((fde_encoding & 0x70) == DW_EH_PE_pcrel) + { + vma_base = (((uint64_t) shdr->sh_offset + + (base - (const unsigned char *) data->d_buf) + + (uint64_t) initial_location) + & (ptr_size == 4 + ? UINT64_C (0xffffffff) + : UINT64_C (0xffffffffffffffff))); + printf (gettext (" (offset: %#" PRIx64 ")"), + (uint64_t) vma_base); + } + + printf ("\n address_range: %#" PRIx64, + (uint64_t) address_range); + if ((fde_encoding & 0x70) == DW_EH_PE_pcrel) + printf (gettext (" (end offset: %#" PRIx64 ")"), + ((uint64_t) vma_base + (uint64_t) address_range) + & (ptr_size == 4 + ? UINT64_C (0xffffffff) + : UINT64_C (0xffffffffffffffff))); + putchar ('\n'); + + if (cie->augmentation[0] == 'z') + { + unsigned int augmentationlen; + get_uleb128 (augmentationlen, readp); + + if (augmentationlen > 0) + { + const char *hdr = "Augmentation data:"; + const char *cp = cie->augmentation + 1; + unsigned int u = 0; + while (*cp != '\0') + { + if (*cp == 'L') + { + uint64_t lsda_pointer; + const unsigned char *p + = read_encoded (lsda_encoding, &readp[u], + &readp[augmentationlen], + &lsda_pointer, dbg); + u = p - readp; + printf (gettext ("\ + %-26sLSDA pointer: %#" PRIx64 "\n"), + hdr, lsda_pointer); + hdr = ""; + } + ++cp; + } + + while (u < augmentationlen) + { + printf (" %-26s%#x\n", hdr, readp[u++]); + hdr = ""; + } + } + + readp += augmentationlen; + } + } + + /* Handle the initialization instructions. */ + print_cfa_program (readp, cieend, vma_base, code_alignment_factor, + data_alignment_factor, ptr_size, dwflmod, ebl, dbg); + readp = cieend; + } } @@ -4384,12 +5145,12 @@ static void print_debug_info_section (Dwfl_Module *dwflmod, Ebl *ebl __attribute__ ((unused)), GElf_Ehdr *ehdr __attribute__ ((unused)), - Elf_Scn *scn __attribute__ ((unused)), + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { printf (gettext ("\ -\nDWARF section '%s' at offset %#" PRIx64 ":\n [Offset]\n"), - ".debug_info", (uint64_t) shdr->sh_offset); +\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n [Offset]\n"), + elf_ndxscn (scn), ".debug_info", (uint64_t) shdr->sh_offset); /* If the section is empty we don't have to do anything. */ if (shdr->sh_size == 0) @@ -4509,8 +5270,8 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { printf (gettext ("\ -\nDWARF section '%s' at offset %#" PRIx64 ":\n"), - ".debug_line", (uint64_t) shdr->sh_offset); +\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"), + elf_ndxscn (scn), ".debug_line", (uint64_t) shdr->sh_offset); if (shdr->sh_size == 0) return; @@ -4941,11 +5702,8 @@ advance address by fixed value %u to %s\n"), static void print_debug_loc_section (Dwfl_Module *dwflmod, - Ebl *ebl __attribute__ ((unused)), - GElf_Ehdr *ehdr __attribute__ ((unused)), - Elf_Scn *scn __attribute__ ((unused)), - GElf_Shdr *shdr, - Dwarf *dbg __attribute__ ((unused))) + Ebl *ebl __attribute__ ((unused)), GElf_Ehdr *ehdr, + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { Elf_Data *data = elf_rawdata (scn, NULL); @@ -4957,8 +5715,8 @@ print_debug_loc_section (Dwfl_Module *dwflmod, } printf (gettext ("\ -\nDWARF section '%s' at offset %#" PRIx64 ":\n"), - ".debug_loc", (uint64_t) shdr->sh_offset); +\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"), + elf_ndxscn (scn), ".debug_loc", (uint64_t) shdr->sh_offset); size_t address_size = ehdr->e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; @@ -5052,8 +5810,8 @@ print_debug_macinfo_section (Dwfl_Module *dwflmod __attribute__ ((unused)), Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { printf (gettext ("\ -\nDWARF section '%s' at offset %#" PRIx64 ":\n"), - ".debug_macinfo", (uint64_t) shdr->sh_offset); +\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"), + elf_ndxscn (scn), ".debug_macinfo", (uint64_t) shdr->sh_offset); putc_unlocked ('\n', stdout); /* There is no function in libdw to iterate over the raw content of @@ -5221,11 +5979,10 @@ static void print_debug_pubnames_section (Dwfl_Module *dwflmod __attribute__ ((unused)), Ebl *ebl __attribute__ ((unused)), GElf_Ehdr *ehdr __attribute__ ((unused)), - Elf_Scn *scn __attribute__ ((unused)), - GElf_Shdr *shdr, Dwarf *dbg) + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { - printf (gettext ("\nDWARF section '%s' at offset %#" PRIx64 ":\n"), - ".debug_pubnames", (uint64_t) shdr->sh_offset); + printf (gettext ("\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n"), + elf_ndxscn (scn), ".debug_pubnames", (uint64_t) shdr->sh_offset); int n = 0; (void) dwarf_getpubnames (dbg, print_pubnames, &n, 0); @@ -5236,8 +5993,7 @@ static void print_debug_str_section (Dwfl_Module *dwflmod __attribute__ ((unused)), Ebl *ebl __attribute__ ((unused)), GElf_Ehdr *ehdr __attribute__ ((unused)), - Elf_Scn *scn __attribute__ ((unused)), - GElf_Shdr *shdr, Dwarf *dbg) + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) { /* Compute floor(log16(shdr->sh_size)). */ GElf_Addr tmp = shdr->sh_size; @@ -5249,8 +6005,9 @@ print_debug_str_section (Dwfl_Module *dwflmod __attribute__ ((unused)), } digits = MAX (4, digits); - printf (gettext ("\nDWARF section '%s' at offset %#" PRIx64 ":\n" + printf (gettext ("\nDWARF section [%2zu] '%s' at offset %#" PRIx64 ":\n" " %*s String\n"), + elf_ndxscn (scn), ".debug_str", (uint64_t) shdr->sh_offset, /* TRANS: the debugstr| prefix makes the string unique. */ digits + 2, sgettext ("debugstr|Offset")); @@ -5273,6 +6030,268 @@ print_debug_str_section (Dwfl_Module *dwflmod __attribute__ ((unused)), } } + +/* Print the content of the call frame search table section + '.eh_frame_hdr'. */ +static void +print_debug_frame_hdr_section (Dwfl_Module *dwflmod __attribute__ ((unused)), + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg) +{ + printf (gettext ("\ +\nCall frame search table section [%2zu] '.eh_frame_hdr':\n"), + elf_ndxscn (scn)); + + Elf_Data *data = elf_rawdata (scn, NULL); + + if (unlikely (data == NULL)) + { + error (0, 0, gettext ("cannot get %s content: %s"), + ".eh_frame_hdr", elf_errmsg (-1)); + return; + } + + const unsigned char *readp = data->d_buf; + const unsigned char *const dataend = ((unsigned char *) data->d_buf + + data->d_size); + + if (unlikely (readp + 4 > dataend)) + { + invalid_data: + error (0, 0, gettext ("invalid data")); + return; + } + + unsigned int version = *readp++; + unsigned int eh_frame_ptr_enc = *readp++; + unsigned int fde_count_enc = *readp++; + unsigned int table_enc = *readp++; + + printf (" version: %u\n" + " eh_frame_ptr_enc: %#x ", + version, eh_frame_ptr_enc); + print_encoding_base ("", eh_frame_ptr_enc); + printf (" fde_count_enc: %#x ", fde_count_enc); + print_encoding_base ("", fde_count_enc); + printf (" table_enc: %#x ", table_enc); + print_encoding_base ("", table_enc); + + uint64_t eh_frame_ptr = 0; + if (eh_frame_ptr_enc != DW_EH_PE_omit) + { + readp = read_encoded (eh_frame_ptr_enc, readp, dataend, &eh_frame_ptr, + dbg); + if (unlikely (readp == NULL)) + goto invalid_data; + + printf (" eh_frame_ptr: %#" PRIx64, eh_frame_ptr); + if ((eh_frame_ptr_enc & 0x70) == DW_EH_PE_pcrel) + printf (" (offset: %#" PRIx64 ")", + /* +4 because of the 4 byte header of the section. */ + (uint64_t) shdr->sh_offset + 4 + eh_frame_ptr); + + putchar_unlocked ('\n'); + } + + uint64_t fde_count = 0; + if (fde_count_enc != DW_EH_PE_omit) + { + readp = read_encoded (fde_count_enc, readp, dataend, &fde_count, dbg); + if (unlikely (readp == NULL)) + goto invalid_data; + + printf (" fde_count: %" PRIu64 "\n", fde_count); + } + + if (fde_count == 0 || table_enc == DW_EH_PE_omit) + return; + + puts (" Table:"); + + /* Optimize for the most common case. */ + if (table_enc == (DW_EH_PE_datarel | DW_EH_PE_sdata4)) + while (fde_count > 0 && readp + 8 <= dataend) + { + int32_t initial_location = read_4sbyte_unaligned_inc (dbg, readp); + uint64_t initial_offset = ((uint64_t) shdr->sh_offset + + (int64_t) initial_location); + int32_t address = read_4sbyte_unaligned_inc (dbg, readp); + // XXX Possibly print symbol name or section offset for initial_offset + printf (" %#" PRIx32 " (offset: %#6" PRIx64 ") -> %#" PRIx32 + " fde=[%6" PRIx64 "]\n", + initial_location, initial_offset, + address, address - (eh_frame_ptr + 4)); + } + else + while (0 && readp < dataend) + { + + } +} + + +/* Print the content of the exception handling table section + '.eh_frame_hdr'. */ +static void +print_debug_exception_table (Dwfl_Module *dwflmod __attribute__ ((unused)), + Ebl *ebl __attribute__ ((unused)), + GElf_Ehdr *ehdr __attribute__ ((unused)), + Elf_Scn *scn, + GElf_Shdr *shdr __attribute__ ((unused)), + Dwarf *dbg __attribute__ ((unused))) +{ + printf (gettext ("\ +\nException handling table section [%2zu] '.gcc_except_table':\n"), + elf_ndxscn (scn)); + + Elf_Data *data = elf_rawdata (scn, NULL); + + if (unlikely (data == NULL)) + { + error (0, 0, gettext ("cannot get %s content: %s"), + ".gcc_except_table", elf_errmsg (-1)); + return; + } + + const unsigned char *readp = data->d_buf; + const unsigned char *const dataend = readp + data->d_size; + + if (unlikely (readp + 1 > dataend)) + { + invalid_data: + error (0, 0, gettext ("invalid data")); + return; + } + unsigned int lpstart_encoding = *readp++; + printf (gettext (" LPStart encoding: %#x "), lpstart_encoding); + print_encoding_base ("", lpstart_encoding); + if (lpstart_encoding != DW_EH_PE_omit) + { + uint64_t lpstart; + readp = read_encoded (lpstart_encoding, readp, dataend, &lpstart, dbg); + printf (" LPStart: %#" PRIx64 "\n", lpstart); + } + + if (unlikely (readp + 1 > dataend)) + goto invalid_data; + unsigned int ttype_encoding = *readp++; + printf (gettext (" TType encoding: %#x "), ttype_encoding); + print_encoding_base ("", ttype_encoding); + const unsigned char *ttype_base = NULL; + if (ttype_encoding != DW_EH_PE_omit) + { + unsigned int ttype_base_offset; + get_uleb128 (ttype_base_offset, readp); + printf (" TType base offset: %#x\n", ttype_base_offset); + ttype_base = readp + ttype_base_offset; + } + + if (unlikely (readp + 1 > dataend)) + goto invalid_data; + unsigned int call_site_encoding = *readp++; + printf (gettext (" Call site encoding: %#x "), call_site_encoding); + print_encoding_base ("", call_site_encoding); + unsigned int call_site_table_len; + get_uleb128 (call_site_table_len, readp); + + const unsigned char *const action_table = readp + call_site_table_len; + if (unlikely (action_table > dataend)) + goto invalid_data; + unsigned int u = 0; + unsigned int max_action = 0; + while (readp < action_table) + { + if (u == 0) + puts (gettext ("\n Call site table:")); + + uint64_t call_site_start; + readp = read_encoded (call_site_encoding, readp, dataend, + &call_site_start, dbg); + uint64_t call_site_length; + readp = read_encoded (call_site_encoding, readp, dataend, + &call_site_length, dbg); + uint64_t landing_pad; + readp = read_encoded (call_site_encoding, readp, dataend, + &landing_pad, dbg); + unsigned int action; + get_uleb128 (action, readp); + max_action = MAX (action, max_action); + printf (gettext (" [%4u] Call site start: %#" PRIx64 "\n" + " Call site length: %" PRIu64 "\n" + " Landing pad: %#" PRIx64 "\n" + " Action: %u\n"), + u++, call_site_start, call_site_length, landing_pad, action); + } + assert (readp == action_table); + + unsigned int max_ar_filter = 0; + if (max_action > 0) + { + puts ("\n Action table:"); + + const unsigned char *const action_table_end + = action_table + max_action + 1; + + u = 0; + do + { + int ar_filter; + get_sleb128 (ar_filter, readp); + if (ar_filter > 0 && (unsigned int) ar_filter > max_ar_filter) + max_ar_filter = ar_filter; + int ar_disp; + get_sleb128 (ar_disp, readp); + + printf (" [%4u] ar_filter: % d\n" + " ar_disp: % -5d", + u, ar_filter, ar_disp); + if (abs (ar_disp) & 1) + printf (" -> [%4u]\n", u + (ar_disp + 1) / 2); + else if (ar_disp != 0) + puts (" -> ???"); + else + putchar_unlocked ('\n'); + ++u; + } + while (readp < action_table_end); + } + + if (max_ar_filter > 0) + { + puts ("\n TType table:"); + + // XXX Not *4, size of encoding; + switch (ttype_encoding & 7) + { + case DW_EH_PE_udata2: + case DW_EH_PE_sdata2: + readp = ttype_base - max_ar_filter * 2; + break; + case DW_EH_PE_udata4: + case DW_EH_PE_sdata4: + readp = ttype_base - max_ar_filter * 4; + break; + case DW_EH_PE_udata8: + case DW_EH_PE_sdata8: + readp = ttype_base - max_ar_filter * 8; + break; + default: + error (1, 0, gettext ("invalid TType encoding")); + } + + do + { + uint64_t ttype; + readp = read_encoded (ttype_encoding, readp, ttype_base, &ttype, + dbg); + printf (" [%4u] %#" PRIx64 "\n", max_ar_filter--, ttype); + } + while (readp < ttype_base); + } +} + + static void print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) { @@ -5321,7 +6340,12 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) NEW_SECTION (str), NEW_SECTION (macinfo), NEW_SECTION (ranges), - { ".eh_frame", section_frame, print_debug_frame_section } + { ".eh_frame", section_frame | section_exception, + print_debug_frame_section }, + { ".eh_frame_hdr", section_frame | section_exception, + print_debug_frame_hdr_section }, + { ".gcc_except_table", section_frame | section_exception, + print_debug_exception_table } }; const int ndebug_sections = (sizeof (debug_sections) / sizeof (debug_sections[0])); @@ -5905,7 +6929,7 @@ handle_core_registers (Ebl *ebl, Elf *core, const void *desc, ssize_t maxnreg = ebl_register_info (ebl, 0, NULL, 0, NULL, NULL, NULL, NULL); if (maxnreg <= 0) error (EXIT_FAILURE, 0, - gettext ("cannot register info: %s"), elf_errmsg (-1)); + gettext ("cannot get register info: %s"), elf_errmsg (-1)); struct register_info regs[maxnreg]; memset (regs, 0, sizeof regs); diff --git a/elfutils/src/size.c b/elfutils/src/size.c index d226f402..4698c350 100644 --- a/elfutils/src/size.c +++ b/elfutils/src/size.c @@ -1,5 +1,5 @@ /* Print size information from ELF file. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2000. @@ -50,10 +50,10 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Values for the parameters which have no short form. */ @@ -220,7 +220,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -319,13 +319,23 @@ process_file (const char *fname) return 0; } else if (likely (elf_kind (elf) == ELF_K_AR)) - return handle_ar (fd, elf, NULL, fname); + { + int result = handle_ar (fd, elf, NULL, fname); + + if (unlikely (close (fd) != 0)) + error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname); + + return result; + } /* We cannot handle this type. Close the descriptor anyway. */ if (unlikely (elf_end (elf) != 0)) INTERNAL_ERROR (fname); } + if (unlikely (close (fd) != 0)) + error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname); + error (0, 0, gettext ("%s: file format not recognized"), fname); return 1; @@ -396,9 +406,6 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname) if (unlikely (elf_end (elf) != 0)) INTERNAL_ERROR (fname); - if (unlikely (close (fd) != 0)) - error (EXIT_FAILURE, errno, gettext ("while closing '%s'"), fname); - return result; } diff --git a/elfutils/src/strings.c b/elfutils/src/strings.c index b2109961..b69f2ad2 100644 --- a/elfutils/src/strings.c +++ b/elfutils/src/strings.c @@ -1,5 +1,5 @@ /* Print the strings of printable characters in files. - Copyright (C) 2005, 2006, 2007 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2005. @@ -59,10 +59,10 @@ static int read_elf (Elf *elf, int fd, const char *fname, off64_t fdlen); /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = @@ -228,7 +228,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -677,7 +677,7 @@ read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to) if (mmap64 (remap_base, read_now, PROT_READ, MAP_PRIVATE | MAP_POPULATE | MAP_FIXED, fd, handled_to) == MAP_FAILED) - error (EXIT_FAILURE, errno, gettext ("re=mmap failed")); + error (EXIT_FAILURE, errno, gettext ("re-mmap failed")); elfmap_off = handled_to; process_chunk (fname, remap_base - to_keep, diff --git a/elfutils/src/strip.c b/elfutils/src/strip.c index 0f83e61d..d788ebf2 100644 --- a/elfutils/src/strip.c +++ b/elfutils/src/strip.c @@ -1,5 +1,5 @@ /* Discard section not used at runtime from object files. - Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008 Red Hat, Inc. + Copyright (C) 2000-2008, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2000. @@ -55,10 +55,10 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Values for the parameters which have no short form. */ @@ -204,7 +204,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -437,7 +437,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, int debug_fd = -1; /* Get the EBL handling. The -g option is currently the only reason - we need EBL so dont open the backend unless necessary. */ + we need EBL so don't open the backend unless necessary. */ Ebl *ebl = NULL; if (remove_debug) { @@ -835,7 +835,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, inline void check_preserved (size_t i) { - if (i != 0 && shdr_info[i].idx != 0) + if (i != 0 && shdr_info[i].idx != 0 + && shdr_info[i].debug_data == NULL) { if (shdr_info[i].data == NULL) shdr_info[i].data = elf_getdata (shdr_info[i].scn, NULL); diff --git a/elfutils/src/unstrip.c b/elfutils/src/unstrip.c index 676a0c7f..97b73c6f 100644 --- a/elfutils/src/unstrip.c +++ b/elfutils/src/unstrip.c @@ -1,5 +1,5 @@ /* Combine stripped files with separate symbols and debug information. - Copyright (C) 2007 Red Hat, Inc. + Copyright (C) 2007, 2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Roland McGrath , 2007. @@ -64,11 +64,10 @@ /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -void (*argp_program_version_hook) (FILE *, struct argp_state *) - = print_version; +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ -const char *argp_program_bug_address = PACKAGE_BUGREPORT; +ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; /* Definitions of arguments for argp functions. */ static const struct argp_option options[] = @@ -235,7 +234,7 @@ print_version (FILE *stream, struct argp_state *state __attribute__ ((unused))) Copyright (C) %s Red Hat, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2008"); +"), "2009"); fprintf (stream, gettext ("Written by %s.\n"), "Roland McGrath"); } diff --git a/elfutils/tests/ChangeLog b/elfutils/tests/ChangeLog index 15e38181..f1fd512b 100644 --- a/elfutils/tests/ChangeLog +++ b/elfutils/tests/ChangeLog @@ -1,3 +1,58 @@ +2009-04-23 Ulrich Drepper + + * Makefile [BUILD_STATIC] (libdw): Add $(zip_LIBS). + (rdwrmmap_LDADD): Add $(libmudflap). + +2009-04-21 Roland McGrath + + * testfile50.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-dwfl-addr-sect.sh: Add a case using it. + +2008-12-31 Ulrich Drepper + + * testfile44.S.bz2: Add tests for dppd, dpps, insertps, movntdqa, + mpsadbw, packusdw, pblendvb, pblendw, pcmpeqq, pcmpestri, pcmpestrm, + pcmpistri, pcmpistrm, pcmpgtq, phminposuw, pinsrb, pinsrd, pmaxsb, + pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw, pmovsxbw, + pmovsxbd, pmovsxbq, pmovsxwd, pmovsxwq, pmovsxdq, pmovsxbw, pmovsxbd, + pmovsxbq, pmovsxwd, pmovsxwq, pmovsxdq, pmuldq, pmulld, popcnt, ptest, + roundss, roundps, roundpd, and roundsd. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + + * testfile44.S.bz2: Add tests for blendvpd and blendvps. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-12-30 Ulrich Drepper + + * testfile44.S.bz2: Add tests for blendpd and blendps. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-12-19 Ulrich Drepper + + * testfile44.S.bz2: Add tests for AMD 3DNOW. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-11-26 Roland McGrath + + * dwfl-bug-getmodules.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (dwfl_bug_getmodules_LDADD): New variable. + +2008-09-10 Roland McGrath + + * test-subr.sh (LC_ALL): Export it set to "C". + * run-dwfl-addr-sect.sh: Don't do it here. + * run-strings-test.sh: Likewise. + 2008-08-21 Denys Vlasenko * run-addrname-test.sh: Add a new case. diff --git a/elfutils/tests/Makefile.am b/elfutils/tests/Makefile.am index f57e4328..9f4ccddb 100644 --- a/elfutils/tests/Makefile.am +++ b/elfutils/tests/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. +## Copyright (C) 1996-2009 Red Hat, Inc. ## This file is part of Red Hat elfutils. ## ## Red Hat elfutils is free software; you can redistribute it and/or modify @@ -59,7 +59,8 @@ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ show-abbrev hash newscn ecp dwflmodtest \ find-prologues funcretval allregs rdwrmmap \ dwfl-bug-addr-overflow arls dwfl-bug-fd-leak \ - dwfl-addr-sect dwfl-bug-report early-offscn + dwfl-addr-sect dwfl-bug-report early-offscn \ + dwfl-bug-getmodules # get-ciefde asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ asm-tst6 asm-tst7 asm-tst8 asm-tst9 @@ -140,7 +141,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \ testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \ testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \ - testfile49.bz2 + testfile49.bz2 testfile50.bz2 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ bindir=$(DESTDIR)$(bindir) \ @@ -159,7 +160,7 @@ installcheck-local: endif !STANDALONE if MUDFLAP -static_build=yes +static_build = yes libmudflap = -lmudflap endif @@ -170,7 +171,7 @@ libasm = -lasm libebl = -lebl else !STANDALONE if BUILD_STATIC -libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl +libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl libelf = ../libelf/libelf.a libasm = ../libasm/libasm.a else @@ -224,11 +225,12 @@ asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl -rdwrmmap_LDADD = $(libelf) +rdwrmmap_LDADD = $(libelf) $(libmudflap) dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl arls_LDADD = $(libelf) $(libmudflap) dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl sha1_tst_LDADD = $(libeu) $(libmudflap) diff --git a/elfutils/tests/Makefile.in b/elfutils/tests/Makefile.in index b9cacea1..205486e0 100644 --- a/elfutils/tests/Makefile.in +++ b/elfutils/tests/Makefile.in @@ -47,7 +47,8 @@ noinst_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \ rdwrmmap$(EXEEXT) dwfl-bug-addr-overflow$(EXEEXT) \ arls$(EXEEXT) dwfl-bug-fd-leak$(EXEEXT) \ dwfl-addr-sect$(EXEEXT) dwfl-bug-report$(EXEEXT) \ - early-offscn$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_3) + early-offscn$(EXEEXT) dwfl-bug-getmodules$(EXEEXT) \ + $(am__EXEEXT_1) $(am__EXEEXT_3) TESTS = run-arextract.sh run-arsymtest.sh newfile$(EXEEXT) \ test-nlist$(EXEEXT) update1$(EXEEXT) update2$(EXEEXT) \ update3$(EXEEXT) update4$(EXEEXT) run-show-die-info.sh \ @@ -78,7 +79,8 @@ subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -92,190 +94,196 @@ am__EXEEXT_2 = asm-tst1$(EXEEXT) asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) \ PROGRAMS = $(noinst_PROGRAMS) addrscopes_SOURCES = addrscopes.c addrscopes_OBJECTS = addrscopes.$(OBJEXT) -@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_1 = \ +am__DEPENDENCIES_1 = +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_2 = \ @BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libelf/libelf.so -@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_1 = \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_2 = \ @BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libelf/libelf.a -@STANDALONE_FALSE@am__DEPENDENCIES_2 = ../libebl/libebl.a -@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_3 = \ +@STANDALONE_FALSE@am__DEPENDENCIES_3 = ../libebl/libebl.a +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_4 = \ @BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libdw/libdw.so -@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_3 = \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_4 = \ @BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libdw/libdw.a \ @BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_1) \ -@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_2) -am__DEPENDENCIES_4 = -addrscopes_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_2) \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_3) +addrscopes_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) allfcts_SOURCES = allfcts.c allfcts_OBJECTS = allfcts.$(OBJEXT) -allfcts_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +allfcts_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) allregs_SOURCES = allregs.c allregs_OBJECTS = allregs.$(OBJEXT) -allregs_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +allregs_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) arextract_SOURCES = arextract.c arextract_OBJECTS = arextract.$(OBJEXT) -arextract_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +arextract_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) arls_SOURCES = arls.c arls_OBJECTS = arls.$(OBJEXT) -arls_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +arls_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) arsymtest_SOURCES = arsymtest.c arsymtest_OBJECTS = arsymtest.$(OBJEXT) -arsymtest_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +arsymtest_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst1_SOURCES = asm-tst1.c asm_tst1_OBJECTS = asm-tst1.$(OBJEXT) @BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_5 = \ @BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libasm/libasm.so @BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_5 = \ @BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libasm/libasm.a -asm_tst1_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst1_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst2_SOURCES = asm-tst2.c asm_tst2_OBJECTS = asm-tst2.$(OBJEXT) -asm_tst2_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst2_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst3_SOURCES = asm-tst3.c asm_tst3_OBJECTS = asm-tst3.$(OBJEXT) -asm_tst3_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst3_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst4_SOURCES = asm-tst4.c asm_tst4_OBJECTS = asm-tst4.$(OBJEXT) -asm_tst4_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst4_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst5_SOURCES = asm-tst5.c asm_tst5_OBJECTS = asm-tst5.$(OBJEXT) -asm_tst5_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst5_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst6_SOURCES = asm-tst6.c asm_tst6_OBJECTS = asm-tst6.$(OBJEXT) -asm_tst6_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst6_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst7_SOURCES = asm-tst7.c asm_tst7_OBJECTS = asm-tst7.$(OBJEXT) -asm_tst7_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst7_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst8_SOURCES = asm-tst8.c asm_tst8_OBJECTS = asm-tst8.$(OBJEXT) -asm_tst8_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst8_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) asm_tst9_SOURCES = asm-tst9.c asm_tst9_OBJECTS = asm-tst9.$(OBJEXT) -asm_tst9_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +asm_tst9_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) dwfl_addr_sect_SOURCES = dwfl-addr-sect.c dwfl_addr_sect_OBJECTS = dwfl-addr-sect.$(OBJEXT) -dwfl_addr_sect_DEPENDENCIES = $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +dwfl_addr_sect_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) dwfl_bug_addr_overflow_SOURCES = dwfl-bug-addr-overflow.c dwfl_bug_addr_overflow_OBJECTS = dwfl-bug-addr-overflow.$(OBJEXT) -dwfl_bug_addr_overflow_DEPENDENCIES = $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +dwfl_bug_addr_overflow_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) dwfl_bug_fd_leak_SOURCES = dwfl-bug-fd-leak.c dwfl_bug_fd_leak_OBJECTS = dwfl-bug-fd-leak.$(OBJEXT) -dwfl_bug_fd_leak_DEPENDENCIES = $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +dwfl_bug_fd_leak_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +dwfl_bug_getmodules_SOURCES = dwfl-bug-getmodules.c +dwfl_bug_getmodules_OBJECTS = dwfl-bug-getmodules.$(OBJEXT) +dwfl_bug_getmodules_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) dwfl_bug_report_SOURCES = dwfl-bug-report.c dwfl_bug_report_OBJECTS = dwfl-bug-report.$(OBJEXT) -dwfl_bug_report_DEPENDENCIES = $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +dwfl_bug_report_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) dwflmodtest_SOURCES = dwflmodtest.c dwflmodtest_OBJECTS = dwflmodtest.$(OBJEXT) -dwflmodtest_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +dwflmodtest_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) early_offscn_SOURCES = early-offscn.c early_offscn_OBJECTS = early-offscn.$(OBJEXT) -early_offscn_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +early_offscn_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) ecp_SOURCES = ecp.c ecp_OBJECTS = ecp.$(OBJEXT) -ecp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +ecp_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) find_prologues_SOURCES = find-prologues.c find_prologues_OBJECTS = find-prologues.$(OBJEXT) -find_prologues_DEPENDENCIES = $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_4) +find_prologues_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_1) funcretval_SOURCES = funcretval.c funcretval_OBJECTS = funcretval.$(OBJEXT) -funcretval_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +funcretval_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) funcscopes_SOURCES = funcscopes.c funcscopes_OBJECTS = funcscopes.$(OBJEXT) -funcscopes_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +funcscopes_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) get_aranges_SOURCES = get-aranges.c get_aranges_OBJECTS = get-aranges.$(OBJEXT) -get_aranges_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +get_aranges_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) get_files_SOURCES = get-files.c get_files_OBJECTS = get-files.$(OBJEXT) -get_files_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +get_files_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) get_lines_SOURCES = get-lines.c get_lines_OBJECTS = get-lines.$(OBJEXT) -get_lines_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +get_lines_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) get_pubnames_SOURCES = get-pubnames.c get_pubnames_OBJECTS = get-pubnames.$(OBJEXT) -get_pubnames_DEPENDENCIES = $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +get_pubnames_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) hash_SOURCES = hash.c hash_OBJECTS = hash.$(OBJEXT) -hash_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +hash_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) line2addr_SOURCES = line2addr.c line2addr_OBJECTS = line2addr.$(OBJEXT) -line2addr_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) +line2addr_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) msg_tst_SOURCES = msg_tst.c msg_tst_OBJECTS = msg_tst.$(OBJEXT) -msg_tst_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +msg_tst_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) newfile_SOURCES = newfile.c newfile_OBJECTS = newfile.$(OBJEXT) -newfile_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +newfile_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) newscn_SOURCES = newscn.c newscn_OBJECTS = newscn.$(OBJEXT) -newscn_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +newscn_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) rdwrmmap_SOURCES = rdwrmmap.c rdwrmmap_OBJECTS = rdwrmmap.$(OBJEXT) -rdwrmmap_DEPENDENCIES = $(am__DEPENDENCIES_1) +rdwrmmap_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) saridx_SOURCES = saridx.c saridx_OBJECTS = saridx.$(OBJEXT) -saridx_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +saridx_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) scnnames_SOURCES = scnnames.c scnnames_OBJECTS = scnnames.$(OBJEXT) -scnnames_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +scnnames_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) sectiondump_SOURCES = sectiondump.c sectiondump_OBJECTS = sectiondump.$(OBJEXT) -sectiondump_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +sectiondump_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) sha1_tst_SOURCES = sha1-tst.c sha1_tst_OBJECTS = sha1-tst.$(OBJEXT) -sha1_tst_DEPENDENCIES = $(libeu) $(am__DEPENDENCIES_4) +sha1_tst_DEPENDENCIES = $(libeu) $(am__DEPENDENCIES_1) show_abbrev_SOURCES = show-abbrev.c show_abbrev_OBJECTS = show-abbrev.$(OBJEXT) -show_abbrev_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +show_abbrev_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) show_die_info_SOURCES = show-die-info.c show_die_info_OBJECTS = show-die-info.$(OBJEXT) -show_die_info_DEPENDENCIES = $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +show_die_info_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) showptable_SOURCES = showptable.c showptable_OBJECTS = showptable.$(OBJEXT) -showptable_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +showptable_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) test_nlist_SOURCES = test-nlist.c test_nlist_OBJECTS = test-nlist.$(OBJEXT) -test_nlist_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +test_nlist_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) update1_SOURCES = update1.c update1_OBJECTS = update1.$(OBJEXT) -update1_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +update1_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) update2_SOURCES = update2.c update2_OBJECTS = update2.$(OBJEXT) -update2_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +update2_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) update3_SOURCES = update3.c update3_OBJECTS = update3.$(OBJEXT) -update3_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +update3_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) update4_SOURCES = update4.c update4_OBJECTS = update4.$(OBJEXT) -update4_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_4) +update4_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles @@ -287,24 +295,24 @@ SOURCES = addrscopes.c allfcts.c allregs.c arextract.c arls.c \ arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c \ asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c asm-tst9.c \ dwfl-addr-sect.c dwfl-bug-addr-overflow.c dwfl-bug-fd-leak.c \ - dwfl-bug-report.c dwflmodtest.c early-offscn.c ecp.c \ - find-prologues.c funcretval.c funcscopes.c get-aranges.c \ - get-files.c get-lines.c get-pubnames.c hash.c line2addr.c \ - msg_tst.c newfile.c newscn.c rdwrmmap.c saridx.c scnnames.c \ - sectiondump.c sha1-tst.c show-abbrev.c show-die-info.c \ - showptable.c test-nlist.c update1.c update2.c update3.c \ - update4.c + dwfl-bug-getmodules.c dwfl-bug-report.c dwflmodtest.c \ + early-offscn.c ecp.c find-prologues.c funcretval.c \ + funcscopes.c get-aranges.c get-files.c get-lines.c \ + get-pubnames.c hash.c line2addr.c msg_tst.c newfile.c newscn.c \ + rdwrmmap.c saridx.c scnnames.c sectiondump.c sha1-tst.c \ + show-abbrev.c show-die-info.c showptable.c test-nlist.c \ + update1.c update2.c update3.c update4.c DIST_SOURCES = addrscopes.c allfcts.c allregs.c arextract.c arls.c \ arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c \ asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c asm-tst9.c \ dwfl-addr-sect.c dwfl-bug-addr-overflow.c dwfl-bug-fd-leak.c \ - dwfl-bug-report.c dwflmodtest.c early-offscn.c ecp.c \ - find-prologues.c funcretval.c funcscopes.c get-aranges.c \ - get-files.c get-lines.c get-pubnames.c hash.c line2addr.c \ - msg_tst.c newfile.c newscn.c rdwrmmap.c saridx.c scnnames.c \ - sectiondump.c sha1-tst.c show-abbrev.c show-die-info.c \ - showptable.c test-nlist.c update1.c update2.c update3.c \ - update4.c + dwfl-bug-getmodules.c dwfl-bug-report.c dwflmodtest.c \ + early-offscn.c ecp.c find-prologues.c funcretval.c \ + funcscopes.c get-aranges.c get-files.c get-lines.c \ + get-pubnames.c hash.c line2addr.c msg_tst.c newfile.c newscn.c \ + rdwrmmap.c saridx.c scnnames.c sectiondump.c sha1-tst.c \ + show-abbrev.c show-die-info.c showptable.c test-nlist.c \ + update1.c update2.c update3.c update4.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -390,6 +398,7 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +eu_version = @eu_version@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -418,6 +427,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ @MUDFLAP_FALSE@ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) @@ -479,7 +489,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \ testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \ testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \ - testfile49.bz2 + testfile49.bz2 testfile50.bz2 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ bindir=$(DESTDIR)$(bindir) \ @@ -494,7 +504,7 @@ installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ @MUDFLAP_TRUE@static_build = yes @MUDFLAP_TRUE@libmudflap = -lmudflap @BUILD_STATIC_FALSE@@STANDALONE_FALSE@libdw = ../libdw/libdw.so -@BUILD_STATIC_TRUE@@STANDALONE_FALSE@libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl @STANDALONE_TRUE@libdw = -ldw @BUILD_STATIC_FALSE@@STANDALONE_FALSE@libelf = ../libelf/libelf.so @BUILD_STATIC_TRUE@@STANDALONE_FALSE@libelf = ../libelf/libelf.a @@ -547,11 +557,12 @@ asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl -rdwrmmap_LDADD = $(libelf) +rdwrmmap_LDADD = $(libelf) $(libmudflap) dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl arls_LDADD = $(libelf) $(libmudflap) dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl sha1_tst_LDADD = $(libeu) $(libmudflap) CLEANFILES = xxx *.gcno *.gcda *gconv @@ -645,6 +656,9 @@ dwfl-bug-addr-overflow$(EXEEXT): $(dwfl_bug_addr_overflow_OBJECTS) $(dwfl_bug_ad dwfl-bug-fd-leak$(EXEEXT): $(dwfl_bug_fd_leak_OBJECTS) $(dwfl_bug_fd_leak_DEPENDENCIES) @rm -f dwfl-bug-fd-leak$(EXEEXT) $(LINK) $(dwfl_bug_fd_leak_OBJECTS) $(dwfl_bug_fd_leak_LDADD) $(LIBS) +dwfl-bug-getmodules$(EXEEXT): $(dwfl_bug_getmodules_OBJECTS) $(dwfl_bug_getmodules_DEPENDENCIES) + @rm -f dwfl-bug-getmodules$(EXEEXT) + $(LINK) $(dwfl_bug_getmodules_OBJECTS) $(dwfl_bug_getmodules_LDADD) $(LIBS) dwfl-bug-report$(EXEEXT): $(dwfl_bug_report_OBJECTS) $(dwfl_bug_report_DEPENDENCIES) @rm -f dwfl-bug-report$(EXEEXT) $(LINK) $(dwfl_bug_report_OBJECTS) $(dwfl_bug_report_LDADD) $(LIBS) @@ -757,6 +771,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-addr-sect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-addr-overflow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-fd-leak.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-getmodules.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-report.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwflmodtest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/early-offscn.Po@am__quote@ diff --git a/elfutils/tests/dwfl-bug-getmodules.c b/elfutils/tests/dwfl-bug-getmodules.c new file mode 100644 index 00000000..f7042c02 --- /dev/null +++ b/elfutils/tests/dwfl-bug-getmodules.c @@ -0,0 +1,74 @@ +/* Test program for dwfl_getmodules bug. + Copyright (C) 2008 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. + + 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 + . */ + +#include +#include ELFUTILS_HEADER(dwfl) + +#include + +static const Dwfl_Callbacks callbacks = + { + .find_elf = dwfl_linux_proc_find_elf, + .find_debuginfo = dwfl_standard_find_debuginfo, + }; + +static int +iterate (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr base, void *arg) +{ + if (base != 0x2000) + return DWARF_CB_OK; + + if (dwfl_addrmodule (arg, 0x2100) == NULL) + error (1, 0, "dwfl_addrmodule: %s", dwfl_errmsg (-1)); + + return DWARF_CB_ABORT; +} + +int +main (void) +{ + Dwfl *dwfl = dwfl_begin (&callbacks); + + dwfl_report_module (dwfl, "m1", 0, 0x1000); + dwfl_report_module (dwfl, "m2", 0x2000, 0x3000); + dwfl_report_module (dwfl, "m3", 0x4000, 0x5000); + + dwfl_report_end (dwfl, NULL, NULL); + + ptrdiff_t offset = dwfl_getmodules (dwfl, &iterate, dwfl, 0); + if (offset <= 0) + error (1, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + offset = dwfl_getmodules (dwfl, &iterate, NULL, offset); + if (offset != 0) + error (1, 0, "dwfl_getmodules (%d): %s", (int) offset, dwfl_errmsg (-1)); + + dwfl_end (dwfl); + + return 0; +} diff --git a/elfutils/tests/run-dwfl-addr-sect.sh b/elfutils/tests/run-dwfl-addr-sect.sh index 69280f58..f33a6e42 100755 --- a/elfutils/tests/run-dwfl-addr-sect.sh +++ b/elfutils/tests/run-dwfl-addr-sect.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2007 Red Hat, Inc. +# Copyright (C) 2007-2009 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,13 +25,16 @@ . $srcdir/test-subr.sh -testfiles testfile43 +testfiles testfile43 testfile50 -export LC_ALL=C testrun_compare ./dwfl-addr-sect -e testfile43 0x64 0x8 0x98 <<\EOF address 0x64 => module "" section 4 + 0 address 0x8 => module "" section 1 + 0x8 address 0x98 => module "" section 7 + 0 EOF +testrun_compare ./dwfl-addr-sect -e testfile50 0x1 <<\EOF +address 0x1 => module "" section 1 + 0x1 +EOF + exit 0 diff --git a/elfutils/tests/run-strings-test.sh b/elfutils/tests/run-strings-test.sh index cfd9d236..a5dac634 100755 --- a/elfutils/tests/run-strings-test.sh +++ b/elfutils/tests/run-strings-test.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005, 2006 Red Hat, Inc. +# Copyright (C) 2005, 2006, 2008 Red Hat, Inc. # This file is part of Red Hat elfutils. # Written by Ulrich Drepper , 2005. # @@ -29,9 +29,6 @@ files="testfile `seq 2 9 | while read n; do echo testfile$n; done`" testfiles $files -LC_ALL=C -export LC_ALL - testrun_compare ../src/strings -tx -f $files <<\EOF testfile: f4 /lib/ld-linux.so.2 testfile: 1c9 __gmon_start__ diff --git a/elfutils/tests/test-subr.sh b/elfutils/tests/test-subr.sh index 7fda05a0..cb34b93b 100644 --- a/elfutils/tests/test-subr.sh +++ b/elfutils/tests/test-subr.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005, 2007 Red Hat, Inc. +# Copyright (C) 2005, 2007, 2008 Red Hat, Inc. # This file is part of Red Hat elfutils. # # Red Hat elfutils is free software; you can redistribute it and/or modify @@ -30,6 +30,9 @@ set -e +#LC_ALL=C +#export LC_ALL + remove_files= trap 'rm -f $remove_files' 0 diff --git a/elfutils/tests/testfile44.S.bz2 b/elfutils/tests/testfile44.S.bz2 index cbd0da3d..4e874340 100644 Binary files a/elfutils/tests/testfile44.S.bz2 and b/elfutils/tests/testfile44.S.bz2 differ diff --git a/elfutils/tests/testfile44.expect.bz2 b/elfutils/tests/testfile44.expect.bz2 index 2347aea1..b3937b9c 100644 Binary files a/elfutils/tests/testfile44.expect.bz2 and b/elfutils/tests/testfile44.expect.bz2 differ diff --git a/elfutils/tests/testfile45.S.bz2 b/elfutils/tests/testfile45.S.bz2 index 91b47955..00e819e0 100644 Binary files a/elfutils/tests/testfile45.S.bz2 and b/elfutils/tests/testfile45.S.bz2 differ diff --git a/elfutils/tests/testfile45.expect.bz2 b/elfutils/tests/testfile45.expect.bz2 index 06b4d9bd..b8b33e9b 100644 Binary files a/elfutils/tests/testfile45.expect.bz2 and b/elfutils/tests/testfile45.expect.bz2 differ diff --git a/elfutils/tests/testfile50.bz2 b/elfutils/tests/testfile50.bz2 new file mode 100644 index 00000000..fce43321 Binary files /dev/null and b/elfutils/tests/testfile50.bz2 differ diff --git a/elfutils/version.h b/elfutils/version.h new file mode 100644 index 00000000..687350e0 --- /dev/null +++ b/elfutils/version.h @@ -0,0 +1,58 @@ +/* Version information about elfutils development libraries. + Copyright (C) 2008 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 + . */ + +#ifndef _ELFUTILS_VERSION_H +#define _ELFUTILS_VERSION_H 1 + +#define _ELFUTILS_VERSION 141 + +#define _ELFUTILS_PREREQ(major, minor) \ + (_ELFUTILS_VERSION >= ((major) * 1000 + (minor))) + +#endif /* elfutils/version.h */ -- cgit v1.2.1