summaryrefslogtreecommitdiff
path: root/elfutils
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2005-10-14 15:03:21 +0000
committerDmitry V. Levin <ldv@altlinux.org>2005-10-14 15:03:21 +0000
commit743e33eeb33512b69912da1f5dfd2d4e136a003a (patch)
tree17d99932d329188c2ba9a8e6a070f6f3dfe06ae8 /elfutils
parent10317c17ff72b7cf3bba318881d3224a7909341b (diff)
downloadelfutils-743e33eeb33512b69912da1f5dfd2d4e136a003a.tar.gz
0.115-alt10.115-alt1
- Updated to 0.115. - Create libelf-devel-static and package it by default.
Diffstat (limited to 'elfutils')
-rw-r--r--elfutils/ChangeLog8
-rw-r--r--elfutils/Makefile.in2
-rw-r--r--elfutils/NEWS10
-rw-r--r--elfutils/TODO26
-rw-r--r--elfutils/config/Makefile.in2
-rw-r--r--elfutils/config/elfutils.spec.in12
-rwxr-xr-xelfutils/configure58
-rw-r--r--elfutils/configure.ac15
-rw-r--r--elfutils/elfutils.spec14
-rw-r--r--elfutils/lib/ChangeLog4
-rw-r--r--elfutils/lib/Makefile.in2
-rw-r--r--elfutils/lib/system.h8
-rw-r--r--elfutils/libasm/ChangeLog6
-rw-r--r--elfutils/libasm/Makefile.am15
-rw-r--r--elfutils/libasm/Makefile.in17
-rw-r--r--elfutils/libcpu/Makefile.in2
-rw-r--r--elfutils/libdw/ChangeLog28
-rw-r--r--elfutils/libdw/Makefile.am17
-rw-r--r--elfutils/libdw/Makefile.in27
-rw-r--r--elfutils/libdw/dwarf_diename.c6
-rw-r--r--elfutils/libdw/dwarf_func_inline.c11
-rw-r--r--elfutils/libdw/dwarf_func_name.c5
-rw-r--r--elfutils/libdw/dwarf_getscopes.c383
-rw-r--r--elfutils/libdw/dwarf_getscopes_die.c69
-rw-r--r--elfutils/libdw/libdw.h9
-rw-r--r--elfutils/libdw/libdw.map3
-rw-r--r--elfutils/libdw/libdwP.h18
-rw-r--r--elfutils/libdw/libdw_visit_scopes.c93
-rw-r--r--elfutils/libdwfl/ChangeLog12
-rw-r--r--elfutils/libdwfl/Makefile.am5
-rw-r--r--elfutils/libdwfl/Makefile.in7
-rw-r--r--elfutils/libdwfl/cu.c10
-rw-r--r--elfutils/libdwfl/dwfl_lineinfo.c2
-rw-r--r--elfutils/libdwfl/dwfl_nextcu.c25
-rw-r--r--elfutils/libebl/ChangeLog4
-rw-r--r--elfutils/libebl/Makefile.am56
-rw-r--r--elfutils/libebl/Makefile.in58
-rw-r--r--elfutils/libelf-po/libelf.pot2
-rw-r--r--elfutils/libelf/ChangeLog24
-rw-r--r--elfutils/libelf/Makefile.am13
-rw-r--r--elfutils/libelf/Makefile.in15
-rw-r--r--elfutils/libelf/elf32_getphdr.c9
-rw-r--r--elfutils/libelf/elf32_getshdr.c11
-rw-r--r--elfutils/libelf/elf32_updatefile.c30
-rw-r--r--elfutils/libelf/elf_begin.c294
-rw-r--r--elfutils/libelf/elf_getarsym.c5
-rw-r--r--elfutils/libelf/elf_getdata.c13
-rw-r--r--elfutils/libelf/elf_getshstrndx.c18
-rw-r--r--elfutils/libelf/elf_readall.c10
-rw-r--r--elfutils/libelf/gelf_rawchunk.c15
-rw-r--r--elfutils/m4/Makefile.in2
-rw-r--r--elfutils/po/ChangeLog6
-rw-r--r--elfutils/po/POTFILES.in1
-rw-r--r--elfutils/po/elfutils.pot90
-rw-r--r--elfutils/src/ChangeLog25
-rw-r--r--elfutils/src/Makefile.am8
-rw-r--r--elfutils/src/Makefile.in22
-rw-r--r--elfutils/src/addr2line.c11
-rw-r--r--elfutils/src/ranlib.c5
-rw-r--r--elfutils/src/strings.c729
-rw-r--r--elfutils/tests/ChangeLog75
-rw-r--r--elfutils/tests/Makefile.am21
-rw-r--r--elfutils/tests/Makefile.in56
-rw-r--r--elfutils/tests/addrscopes.c15
-rwxr-xr-xelfutils/tests/coverage.sh27
-rw-r--r--elfutils/tests/funcscopes.c192
-rw-r--r--elfutils/tests/line2addr.c2
-rwxr-xr-xelfutils/tests/run-addrscopes.sh20
-rwxr-xr-xelfutils/tests/run-allfcts.sh6
-rwxr-xr-xelfutils/tests/run-ecp-test.sh4
-rwxr-xr-xelfutils/tests/run-ecp-test2.sh4
-rwxr-xr-xelfutils/tests/run-elflint-test.sh4
-rwxr-xr-xelfutils/tests/run-funcscopes.sh30
-rwxr-xr-xelfutils/tests/run-get-aranges.sh6
-rwxr-xr-xelfutils/tests/run-get-files.sh6
-rwxr-xr-xelfutils/tests/run-get-lines.sh6
-rwxr-xr-xelfutils/tests/run-get-pubnames.sh6
-rwxr-xr-xelfutils/tests/run-line2addr.sh10
-rwxr-xr-xelfutils/tests/run-ranlib-test2.sh4
-rwxr-xr-xelfutils/tests/run-show-abbrev.sh6
-rwxr-xr-xelfutils/tests/run-show-ciefde.sh6
-rwxr-xr-xelfutils/tests/run-show-die-info.sh6
-rwxr-xr-xelfutils/tests/run-strings-test.sh475
-rwxr-xr-xelfutils/tests/run-strip-test.sh6
-rw-r--r--elfutils/tests/testfile24.bz2bin0 -> 2644 bytes
-rw-r--r--elfutils/tests/testfile25.bz2bin0 -> 2575 bytes
86 files changed, 2596 insertions, 804 deletions
diff --git a/elfutils/ChangeLog b/elfutils/ChangeLog
index 9a7850aa..fc5cb13a 100644
--- a/elfutils/ChangeLog
+++ b/elfutils/ChangeLog
@@ -1,3 +1,11 @@
+2005-08-29 Ulrich Drepper <drepper@redhat.com>
+
+ * configure.ac: Fix GCOV make condition generation.
+
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * configure.ac: Add --enable-gcov option.
+
2005-08-06 Ulrich Drepper <drepper@redhat.com>
* configure.ac: Add --enable-gprof option.
diff --git a/elfutils/Makefile.in b/elfutils/Makefile.in
index 41a9b790..5ffa0a5a 100644
--- a/elfutils/Makefile.in
+++ b/elfutils/Makefile.in
@@ -94,6 +94,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
diff --git a/elfutils/NEWS b/elfutils/NEWS
index a15e1f12..1d88564f 100644
--- a/elfutils/NEWS
+++ b/elfutils/NEWS
@@ -1,3 +1,13 @@
+Version 0.115:
+
+libelf: speed-ups of non-mmap reading.
+
+strings: New program.
+
+Implement --enable-gcov option for configure.
+
+libdw: New function dwarf_getscopes_die.
+
Version 0.114:
libelf: new function elf_getaroff
diff --git a/elfutils/TODO b/elfutils/TODO
index 318da823..9eb7b6ca 100644
--- a/elfutils/TODO
+++ b/elfutils/TODO
@@ -1,7 +1,7 @@
ToDo list for elfutils -*-outline-*-
----------------------
-Time-stamp: <2005-08-03 20:38:01 drepper>
+Time-stamp: <2005-08-29 08:58:24 drepper>
* mkinstalldirs
@@ -23,15 +23,7 @@ Time-stamp: <2005-08-03 20:38:01 drepper>
remains maintainable.
-* libdwarf
-
-** Should we do more error checking?
-
- Most functions don't check whether they get a NULL value passed for
- a pointer argument. It could be argued that this is OK since it's
- a bug inthe program. But perhaps one could catch the case and return
- an error which would allow the program using libdwarf to have fewer
- places with error checking.
+* libdw
** More memory access checks needed
@@ -45,12 +37,6 @@ Time-stamp: <2005-08-03 20:38:01 drepper>
** Rename dwarf_getabbrev
-** dwarf_loclist()
-
- This function and its interface seem to be misdesigned. The specification
- is unclear and its changed between v2 and v2.1. Other implementation
- implement even different behavior.
-
* nm:
@@ -116,6 +102,14 @@ Time-stamp: <2005-08-03 20:38:01 drepper>
prelink generated files
+* elfcmp
+
+** treat relocation sections special
+
+ Differences in the relocation sections can be ignored if all
+ the same symbols with the same targets are present and the order
+ of overlapping relocations doesn't change. There really never
+ should be overlapping relocations but who knows.
* mcs
diff --git a/elfutils/config/Makefile.in b/elfutils/config/Makefile.in
index 5388cf9c..b84b6b9b 100644
--- a/elfutils/config/Makefile.in
+++ b/elfutils/config/Makefile.in
@@ -72,6 +72,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
diff --git a/elfutils/config/elfutils.spec.in b/elfutils/config/elfutils.spec.in
index bfeda144..229bd3e7 100644
--- a/elfutils/config/elfutils.spec.in
+++ b/elfutils/config/elfutils.spec.in
@@ -143,6 +143,8 @@ rm -rf ${RPM_BUILD_ROOT}
%{_bindir}/eu-findtextrel
%{_bindir}/eu-addr2line
%{_bindir}/eu-elfcmp
+%{_bindir}/eu-ranlib
+%{_bindir}/eu-strings
%if !%{fake}
#%{_bindir}/eu-ld
#%{_libdir}/libasm-%{version}.so
@@ -183,6 +185,12 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.so
%changelog
+* Fri Sep 2 2005 Ulrich Drepper <drepper@redhat.com> 0.115-1
+- libelf: speed-ups of non-mmap reading.
+- strings: New program.
+- Implement --enable-gcov option for configure.
+- libdw: New function dwarf_getscopes_die.
+
* Wed Aug 24 2005 Ulrich Drepper <drepper@redhat.com> 0.114-1
- libelf: new function elf_getaroff
- libdw: Added dwarf_func_die, dwarf_func_inline, dwarf_func_inline_inst
@@ -197,13 +205,13 @@ ss, dwfl_linux_kernel_report_offline.
* Wed Aug 10 2005 Ulrich Drepper <@redhat.com> 0.113-1
- elflint: relax a bit. Allow version definitions for defined symbols ag
-ainstDSO versions also for symbols in nobits sections. Allow .rodata
+ainstDSO versions also for symbols in nobits sections. Allow .rodata
sectionto have STRINGS and MERGE flag set.
- strip: add some more compatibility with binutils.
* Sat Aug 6 2005 Ulrich Drepper <@redhat.com> 0.113-1
- elflint: relax a bit. Allow version definitions for defined symbols ag
-ainstDSO versions also for symbols in nobits sections. Allow .rodata
+ainstDSO versions also for symbols in nobits sections. Allow .rodata
sectionto have STRINGS and MERGE flag set.
* Sat Aug 6 2005 Ulrich Drepper <@redhat.com> 0.113-1
diff --git a/elfutils/configure b/elfutils/configure
index 1fec1206..d9514ca4 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.59 for Red Hat elfutils 0.114.
+# Generated by GNU Autoconf 2.59 for Red Hat elfutils 0.115.
#
# Report bugs to <http://bugzilla.redhat.com/bugzilla/>.
#
@@ -271,12 +271,12 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='Red Hat elfutils'
PACKAGE_TARNAME='elfutils'
-PACKAGE_VERSION='0.114'
-PACKAGE_STRING='Red Hat elfutils 0.114'
+PACKAGE_VERSION='0.115'
+PACKAGE_STRING='Red Hat elfutils 0.115'
PACKAGE_BUGREPORT='http://bugzilla.redhat.com/bugzilla/'
ac_unique_file="libelf/libelf.h"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MODVERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB YACC LEX LEXLIB LEX_OUTPUT_ROOT LOCALEDIR DATADIRNAME NATIVE_LD_TRUE NATIVE_LD_FALSE base_cpu MUDFLAP_TRUE MUDFLAP_FALSE GPROF_TRUE GPROF_FALSE BUILD_STATIC_TRUE BUILD_STATIC_FALSE LIBEBL_SUBDIR USE_NLS MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MODVERSION build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB YACC LEX LEXLIB LEX_OUTPUT_ROOT LOCALEDIR DATADIRNAME NATIVE_LD_TRUE NATIVE_LD_FALSE base_cpu MUDFLAP_TRUE MUDFLAP_FALSE GPROF_TRUE GPROF_FALSE GCOV_TRUE GCOV_FALSE BUILD_STATIC_TRUE BUILD_STATIC_FALSE LIBEBL_SUBDIR USE_NLS MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -741,7 +741,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.114 to adapt to many kinds of systems.
+\`configure' configures Red Hat elfutils 0.115 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -807,7 +807,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of Red Hat elfutils 0.114:";;
+ short | recursive ) echo "Configuration of Red Hat elfutils 0.115:";;
esac
cat <<\_ACEOF
@@ -821,6 +821,7 @@ Optional Features:
--disable-generic do not build generic linker
--enable-mudflap build binaries with mudflap instrumentation
--enable-gprof build binaries with gprof support
+ --enable-gcov build binaries with gcov support
--enable-libebl-subdir=DIR
install libebl_CPU modules in $(libdir)/DIR
@@ -931,7 +932,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-Red Hat elfutils configure 0.114
+Red Hat elfutils configure 0.115
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -947,7 +948,7 @@ cat >&5 <<_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.114, which was
+It was created by Red Hat elfutils $as_me 0.115, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1596,7 +1597,7 @@ fi
# Define the identity of the package.
PACKAGE='elfutils'
- VERSION='0.114'
+ VERSION='0.115'
cat >>confdefs.h <<_ACEOF
@@ -3897,8 +3898,32 @@ else
fi
+# Enable gcov suport.
+# Check whether --enable-gcov or --disable-gcov was given.
+if test "${enable_gcov+set}" = set; then
+ enableval="$enable_gcov"
+ use_gcov=yes
+else
+ use_gcov=no
+fi;
+if test "$use_gcov" = yes; then
+ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+ LDFLAGS="$LDFLAGS -fprofile-arcs"
+fi
+
+
+if test "$use_gcov" = yes; then
+ GCOV_TRUE=
+ GCOV_FALSE='#'
+else
+ GCOV_TRUE='#'
+ GCOV_FALSE=
+fi
-if test "$use_mudflap" = yes -o "$use_gprof" = yes; then
+
+
+
+if test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes; then
BUILD_STATIC_TRUE=
BUILD_STATIC_FALSE='#'
else
@@ -4279,6 +4304,13 @@ echo "$as_me: error: conditional \"GPROF\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${GCOV_TRUE}" && test -z "${GCOV_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"GCOV\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"GCOV\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${BUILD_STATIC_TRUE}" && test -z "${BUILD_STATIC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"BUILD_STATIC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -4557,7 +4589,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by Red Hat elfutils $as_me 0.114, which was
+This file was extended by Red Hat elfutils $as_me 0.115, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4620,7 +4652,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-Red Hat elfutils config.status 0.114
+Red Hat elfutils config.status 0.115
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -4902,6 +4934,8 @@ s,@MUDFLAP_TRUE@,$MUDFLAP_TRUE,;t t
s,@MUDFLAP_FALSE@,$MUDFLAP_FALSE,;t t
s,@GPROF_TRUE@,$GPROF_TRUE,;t t
s,@GPROF_FALSE@,$GPROF_FALSE,;t t
+s,@GCOV_TRUE@,$GCOV_TRUE,;t t
+s,@GCOV_FALSE@,$GCOV_FALSE,;t t
s,@BUILD_STATIC_TRUE@,$BUILD_STATIC_TRUE,;t t
s,@BUILD_STATIC_FALSE@,$BUILD_STATIC_FALSE,;t t
s,@LIBEBL_SUBDIR@,$LIBEBL_SUBDIR,;t t
diff --git a/elfutils/configure.ac b/elfutils/configure.ac
index f8d4ef35..547d1182 100644
--- a/elfutils/configure.ac
+++ b/elfutils/configure.ac
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software Foundation,
dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dnl
-AC_INIT([Red Hat elfutils],[0.114],[http://bugzilla.redhat.com/bugzilla/],
+AC_INIT([Red Hat elfutils],[0.115],[http://bugzilla.redhat.com/bugzilla/],
[elfutils])
AC_CONFIG_AUX_DIR([config])
@@ -138,8 +138,19 @@ if test "$use_gprof" = yes; then
LDFLAGS="$LDFLAGS -pg"
fi
AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
+
+# Enable gcov suport.
+AC_ARG_ENABLE([gcov],
+AC_HELP_STRING([--enable-gcov],
+[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no])
+if test "$use_gcov" = yes; then
+ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+ LDFLAGS="$LDFLAGS -fprofile-arcs"
+fi
+AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
+
AM_CONDITIONAL(BUILD_STATIC, [dnl
-test "$use_mudflap" = yes -o "$use_gprof" = yes])
+test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
LIBEBL_SUBDIR="$PACKAGE"
AC_ARG_ENABLE([libebl-subdir],
diff --git a/elfutils/elfutils.spec b/elfutils/elfutils.spec
index 049477c2..47da48ee 100644
--- a/elfutils/elfutils.spec
+++ b/elfutils/elfutils.spec
@@ -2,7 +2,7 @@
%define fake 0
Summary: A collection of utilities and DSOs to handle compiled objects.
Name: elfutils
-Version: 0.114
+Version: 0.115
Release: 1
%if %{fake}
License: GPL
@@ -143,6 +143,8 @@ rm -rf ${RPM_BUILD_ROOT}
%{_bindir}/eu-findtextrel
%{_bindir}/eu-addr2line
%{_bindir}/eu-elfcmp
+%{_bindir}/eu-ranlib
+%{_bindir}/eu-strings
%if !%{fake}
#%{_bindir}/eu-ld
#%{_libdir}/libasm-%{version}.so
@@ -183,6 +185,12 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.so
%changelog
+* Fri Sep 2 2005 Ulrich Drepper <drepper@redhat.com> 0.115-1
+- libelf: speed-ups of non-mmap reading.
+- strings: New program.
+- Implement --enable-gcov option for configure.
+- libdw: New function dwarf_getscopes_die.
+
* Wed Aug 24 2005 Ulrich Drepper <drepper@redhat.com> 0.114-1
- libelf: new function elf_getaroff
- libdw: Added dwarf_func_die, dwarf_func_inline, dwarf_func_inline_inst
@@ -197,13 +205,13 @@ ss, dwfl_linux_kernel_report_offline.
* Wed Aug 10 2005 Ulrich Drepper <@redhat.com> 0.113-1
- elflint: relax a bit. Allow version definitions for defined symbols ag
-ainstDSO versions also for symbols in nobits sections. Allow .rodata
+ainstDSO versions also for symbols in nobits sections. Allow .rodata
sectionto have STRINGS and MERGE flag set.
- strip: add some more compatibility with binutils.
* Sat Aug 6 2005 Ulrich Drepper <@redhat.com> 0.113-1
- elflint: relax a bit. Allow version definitions for defined symbols ag
-ainstDSO versions also for symbols in nobits sections. Allow .rodata
+ainstDSO versions also for symbols in nobits sections. Allow .rodata
sectionto have STRINGS and MERGE flag set.
* Sat Aug 6 2005 Ulrich Drepper <@redhat.com> 0.113-1
diff --git a/elfutils/lib/ChangeLog b/elfutils/lib/ChangeLog
index 5b79d096..f7760f13 100644
--- a/elfutils/lib/ChangeLog
+++ b/elfutils/lib/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * system.h: Define pwrite_retry, write_retry, and pread_retry.
+
2005-08-06 Ulrich Drepper <drepper@redhat.com>
* Makefile.am (xmalloc_CFLAGS): Define only if !GPROF.
diff --git a/elfutils/lib/Makefile.in b/elfutils/lib/Makefile.in
index 25d95b55..72d32cf9 100644
--- a/elfutils/lib/Makefile.in
+++ b/elfutils/lib/Makefile.in
@@ -92,6 +92,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
diff --git a/elfutils/lib/system.h b/elfutils/lib/system.h
index e29c2dbb..998bf729 100644
--- a/elfutils/lib/system.h
+++ b/elfutils/lib/system.h
@@ -37,4 +37,12 @@ extern int crc32_file (int fd, uint32_t *resp);
#define gettext_noop(Str) Str
+
+#define pwrite_retry(fd, buf, len, off) \
+ TEMP_FAILURE_RETRY (pwrite (fd, buf, len, off))
+#define write_retry(fd, buf, n) \
+ TEMP_FAILURE_RETRY (write (fd, buf, n))
+#define pread_retry(fd, buf, len, off) \
+ TEMP_FAILURE_RETRY (pread (fd, buf, len, off))
+
#endif /* system.h */
diff --git a/elfutils/libasm/ChangeLog b/elfutils/libasm/ChangeLog
index 6adeef1e..d4c06348 100644
--- a/elfutils/libasm/ChangeLog
+++ b/elfutils/libasm/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am: Use $(LINK) not $(CC) when creating DSO.
+ (%.os): Use COMPILE.os.
+ (COMPILE.os): Filter out gconv options.
+
2005-08-02 Ulrich Drepper <drepper@redhat.com>
* Makefile.am (AM_CFLAGS): Add -std=gnu99.
diff --git a/elfutils/libasm/Makefile.am b/elfutils/libasm/Makefile.am
index 7802a5c0..e9b99397 100644
--- a/elfutils/libasm/Makefile.am
+++ b/elfutils/libasm/Makefile.am
@@ -24,6 +24,9 @@ INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
VERSION = 1
+COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
+ $(COMPILE)))
+
lib_LIBRARIES = libasm.a
if !MUDFLAP
noinst_LIBRARIES = libasm_pic.a
@@ -51,16 +54,16 @@ am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
libasm_so_SOURCES =
libasm.so: libasm_pic.a libasm.map
- $(CC) -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
+ $(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
if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
%.os: %.c %.o
- if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
-MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
rm -f "$(DEPDIR)/$*.Tpo"; \
@@ -83,4 +86,4 @@ endif
noinst_HEADERS = libasmP.h symbolhash.h
EXTRA_DIST = libasm.map
-CLEANFILES = $(am_libasm_pic_a_OBJECTS)
+CLEANFILES = $(am_libasm_pic_a_OBJECTS) *.gcno *.gcda
diff --git a/elfutils/libasm/Makefile.in b/elfutils/libasm/Makefile.in
index 875106cf..f1d90c93 100644
--- a/elfutils/libasm/Makefile.in
+++ b/elfutils/libasm/Makefile.in
@@ -124,6 +124,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
@@ -212,6 +214,9 @@ INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \
-I$(top_srcdir)/lib
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
+COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
+ $(COMPILE)))
+
lib_LIBRARIES = libasm.a
@MUDFLAP_FALSE@noinst_LIBRARIES = libasm_pic.a
euincludedir = ${includedir}/elfutils
@@ -234,7 +239,7 @@ libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
@MUDFLAP_FALSE@libasm_so_SOURCES =
noinst_HEADERS = libasmP.h symbolhash.h
EXTRA_DIST = libasm.map
-CLEANFILES = $(am_libasm_pic_a_OBJECTS)
+CLEANFILES = $(am_libasm_pic_a_OBJECTS) *.gcno *.gcda
all: all-am
.SUFFIXES:
@@ -553,15 +558,15 @@ uninstall-am: uninstall-euincludeHEADERS uninstall-info-am \
uninstall-info-am uninstall-libLIBRARIES
@MUDFLAP_FALSE@libasm.so: libasm_pic.a libasm.map
-@MUDFLAP_FALSE@ $(CC) -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@ $(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@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
@MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION)
@MUDFLAP_FALSE@%.os: %.c %.o
-@MUDFLAP_FALSE@ if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+@MUDFLAP_FALSE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
@MUDFLAP_FALSE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
@MUDFLAP_FALSE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
@MUDFLAP_FALSE@ rm -f "$(DEPDIR)/$*.Tpo"; \
diff --git a/elfutils/libcpu/Makefile.in b/elfutils/libcpu/Makefile.in
index fc3a6a9a..3ec168b3 100644
--- a/elfutils/libcpu/Makefile.in
+++ b/elfutils/libcpu/Makefile.in
@@ -87,6 +87,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
diff --git a/elfutils/libdw/ChangeLog b/elfutils/libdw/ChangeLog
index 3b84ab9e..db069c94 100644
--- a/elfutils/libdw/ChangeLog
+++ b/elfutils/libdw/ChangeLog
@@ -1,3 +1,31 @@
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am: Use $(LINK) not $(CC) when creating DSO.
+ (%.os): Use COMPILE.os.
+ (COMPILE.os): Filter out gconv options.
+
+2005-08-27 Roland McGrath <roland@redhat.com>
+
+ * dwarf_getscopes.c (dwarf_getscopes): Rewritten using
+ __libdw_visit_scopes.
+
+ * dwarf_getscopes_die.c: New file.
+ * Makefile.am (libdw_a_SOURCES): Add it.
+ * libdw.h: Declare dwarf_getscopes_die.
+ * libdw.map: Bump to 0.115 and add it.
+
+ * libdw_visit_scopes.c (__libdw_visit_scopes): Pass a struct
+ containing a DIE and its parent pointer, instead of just Dwarf_Die.
+ Take two functions for both preorder and postorder visitors.
+ * libdwP.h: Update decl.
+ (struct Dwarf_Die_Chain): New type.
+ * dwarf_func_inline.c: Update uses.
+
+ * dwarf_diename.c (dwarf_diename): Use dwarf_attr_integrate.
+ Add INTDEF.
+ * libdwP.h: Add INTDECL.
+ * dwarf_func_name.c (dwarf_func_name): Use dwarf_diename.
+
2005-08-23 Roland McGrath <roland@redhat.com>
* dwarf_attr_integrate.c (dwarf_attr_integrate): Treat
diff --git a/elfutils/libdw/Makefile.am b/elfutils/libdw/Makefile.am
index ad6b28a1..a35f5dcc 100644
--- a/elfutils/libdw/Makefile.am
+++ b/elfutils/libdw/Makefile.am
@@ -22,6 +22,9 @@ AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
VERSION = 1
+COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
+ $(COMPILE)))
+
lib_LIBRARIES = libdw.a
if !MUDFLAP
noinst_LIBRARIES = libdw_pic.a
@@ -48,7 +51,7 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \
dwarf_getattrcnt.c dwarf_getabbrevattr.c \
dwarf_getsrclines.c dwarf_getsrc_die.c \
- dwarf_getscopes.c dwarf_getscopevar.c \
+ dwarf_getscopes.c dwarf_getscopes_die.c dwarf_getscopevar.c \
dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \
dwarf_linecol.c dwarf_linebeginstatement.c \
dwarf_lineendsequence.c dwarf_lineblock.c \
@@ -76,15 +79,15 @@ libdw_so_SOURCES =
libdw.so: $(srcdir)/libdw.map libdw_pic.a \
../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
../libelf/libelf.so
- $(CC) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
- -Wl,--version-script,$<,--no-undefined \
- -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive \
- -ldl
+ $(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
+ -Wl,--version-script,$<,--no-undefined \
+ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+ -ldl
if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
%.os: %.c %.o
- if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
-MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
rm -f "$(DEPDIR)/$*.Tpo"; \
@@ -110,4 +113,4 @@ noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h
EXTRA_DIST = libdw.map
-CLEANFILES = $(am_libdw_pic_a_OBJECTS)
+CLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda
diff --git a/elfutils/libdw/Makefile.in b/elfutils/libdw/Makefile.in
index 47a7217f..32323433 100644
--- a/elfutils/libdw/Makefile.in
+++ b/elfutils/libdw/Makefile.in
@@ -92,9 +92,10 @@ am_libdw_a_OBJECTS = dwarf_begin.$(OBJEXT) dwarf_begin_elf.$(OBJEXT) \
dwarf_abbrevhaschildren.$(OBJEXT) dwarf_getattrcnt.$(OBJEXT) \
dwarf_getabbrevattr.$(OBJEXT) dwarf_getsrclines.$(OBJEXT) \
dwarf_getsrc_die.$(OBJEXT) dwarf_getscopes.$(OBJEXT) \
- dwarf_getscopevar.$(OBJEXT) dwarf_linesrc.$(OBJEXT) \
- dwarf_lineno.$(OBJEXT) dwarf_lineaddr.$(OBJEXT) \
- dwarf_linecol.$(OBJEXT) dwarf_linebeginstatement.$(OBJEXT) \
+ dwarf_getscopes_die.$(OBJEXT) dwarf_getscopevar.$(OBJEXT) \
+ dwarf_linesrc.$(OBJEXT) dwarf_lineno.$(OBJEXT) \
+ dwarf_lineaddr.$(OBJEXT) dwarf_linecol.$(OBJEXT) \
+ dwarf_linebeginstatement.$(OBJEXT) \
dwarf_lineendsequence.$(OBJEXT) dwarf_lineblock.$(OBJEXT) \
dwarf_lineprologueend.$(OBJEXT) \
dwarf_lineepiloguebegin.$(OBJEXT) dwarf_onesrcline.$(OBJEXT) \
@@ -163,6 +164,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
@@ -248,6 +251,9 @@ target_alias = @target_alias@
@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Werror -Wshadow -Wunused \
@MUDFLAP_TRUE@ -Wformat=2 -Wextra -std=gnu99
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
+COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
+ $(COMPILE)))
+
lib_LIBRARIES = libdw.a
@MUDFLAP_FALSE@noinst_LIBRARIES = libdw_pic.a
include_HEADERS = dwarf.h
@@ -269,7 +275,7 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \
dwarf_getattrcnt.c dwarf_getabbrevattr.c \
dwarf_getsrclines.c dwarf_getsrc_die.c \
- dwarf_getscopes.c dwarf_getscopevar.c \
+ dwarf_getscopes.c dwarf_getscopes_die.c dwarf_getscopevar.c \
dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \
dwarf_linecol.c dwarf_linebeginstatement.c \
dwarf_lineendsequence.c dwarf_lineblock.c \
@@ -294,7 +300,7 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
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)
+CLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda
all: all-am
.SUFFIXES:
@@ -431,6 +437,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getmacros.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getpubnames.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getscopes.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getscopes_die.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getscopevar.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrc_die.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_getsrc_file.Po@am__quote@
@@ -697,15 +704,15 @@ uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \
@MUDFLAP_FALSE@libdw.so: $(srcdir)/libdw.map libdw_pic.a \
@MUDFLAP_FALSE@ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
@MUDFLAP_FALSE@ ../libelf/libelf.so
-@MUDFLAP_FALSE@ $(CC) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
-@MUDFLAP_FALSE@ -Wl,--version-script,$<,--no-undefined \
-@MUDFLAP_FALSE@ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive \
-@MUDFLAP_FALSE@ -ldl
+@MUDFLAP_FALSE@ $(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
+@MUDFLAP_FALSE@ -Wl,--version-script,$<,--no-undefined \
+@MUDFLAP_FALSE@ -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
+@MUDFLAP_FALSE@ -ldl
@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
@MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION)
@MUDFLAP_FALSE@%.os: %.c %.o
-@MUDFLAP_FALSE@ if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+@MUDFLAP_FALSE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
@MUDFLAP_FALSE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
@MUDFLAP_FALSE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
@MUDFLAP_FALSE@ rm -f "$(DEPDIR)/$*.Tpo"; \
diff --git a/elfutils/libdw/dwarf_diename.c b/elfutils/libdw/dwarf_diename.c
index 41d763c5..daef5fbd 100644
--- a/elfutils/libdw/dwarf_diename.c
+++ b/elfutils/libdw/dwarf_diename.c
@@ -26,6 +26,8 @@ dwarf_diename (die)
{
Dwarf_Attribute attr_mem;
- return INTUSE(dwarf_formstring) (INTUSE(dwarf_attr) (die, DW_AT_name,
- &attr_mem));
+ return INTUSE(dwarf_formstring) (INTUSE(dwarf_attr_integrate) (die,
+ DW_AT_name,
+ &attr_mem));
}
+INTDEF (dwarf_diename)
diff --git a/elfutils/libdw/dwarf_func_inline.c b/elfutils/libdw/dwarf_func_inline.c
index 7656286f..4472515d 100644
--- a/elfutils/libdw/dwarf_func_inline.c
+++ b/elfutils/libdw/dwarf_func_inline.c
@@ -14,15 +14,15 @@ struct visitor_info
static int
scope_visitor (unsigned int depth __attribute__ ((unused)),
- Dwarf_Die *die, void *arg)
+ struct Dwarf_Die_Chain *die, void *arg)
{
struct visitor_info *const v = arg;
- if (INTUSE(dwarf_tag) (die) != DW_TAG_inlined_subroutine)
+ if (INTUSE(dwarf_tag) (&die->die) != DW_TAG_inlined_subroutine)
return DWARF_CB_OK;
Dwarf_Attribute attr_mem;
- Dwarf_Attribute *attr = INTUSE(dwarf_attr) (die, DW_AT_abstract_origin,
+ Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&die->die, DW_AT_abstract_origin,
&attr_mem);
if (attr == NULL)
return DWARF_CB_OK;
@@ -35,7 +35,7 @@ scope_visitor (unsigned int depth __attribute__ ((unused)),
if (origin->addr != v->die_addr)
return DWARF_CB_OK;
- return (*v->callback) (die, v->arg);
+ return (*v->callback) (&die->die, v->arg);
}
int
@@ -68,5 +68,6 @@ dwarf_func_inline_instances (Dwarf_Func *func,
void *arg)
{
struct visitor_info v = { func->die->addr, callback, arg };
- return __libdw_visit_scopes (0, func->cudie, &scope_visitor, &v);
+ struct Dwarf_Die_Chain cu = { .die = *func->cudie, .parent = NULL };
+ return __libdw_visit_scopes (0, &cu, &scope_visitor, NULL, &v);
}
diff --git a/elfutils/libdw/dwarf_func_name.c b/elfutils/libdw/dwarf_func_name.c
index 4151c359..c6912aa6 100644
--- a/elfutils/libdw/dwarf_func_name.c
+++ b/elfutils/libdw/dwarf_func_name.c
@@ -23,8 +23,5 @@
const char *
dwarf_func_name (Dwarf_Func *func)
{
- Dwarf_Attribute attr_mem;
-
- return INTUSE(dwarf_formstring) (INTUSE(dwarf_attr) (func->die, DW_AT_name,
- &attr_mem));
+ return INTUSE(dwarf_diename) (func->die);
}
diff --git a/elfutils/libdw/dwarf_getscopes.c b/elfutils/libdw/dwarf_getscopes.c
index 7863036b..2d5345ed 100644
--- a/elfutils/libdw/dwarf_getscopes.c
+++ b/elfutils/libdw/dwarf_getscopes.c
@@ -15,279 +15,131 @@
# include <config.h>
#endif
+#include <assert.h>
#include <stdlib.h>
#include "libdwP.h"
#include <dwarf.h>
-enum die_class { ignore, match, match_inline, walk, imported };
+struct args
+{
+ Dwarf_Addr pc;
+ Dwarf_Die *scopes;
+ unsigned int inlined, nscopes;
+ Dwarf_Die inlined_origin;
+};
-static enum die_class
-classify_die (Dwarf_Die *die)
+/* Preorder visitor: prune the traversal if this DIE does not contain PC. */
+static int
+pc_match (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg)
{
- switch (INTUSE(dwarf_tag) (die))
- {
- /* DIEs with addresses we can try to match. */
- case DW_TAG_compile_unit:
- case DW_TAG_module:
- case DW_TAG_lexical_block:
- case DW_TAG_with_stmt:
- case DW_TAG_catch_block:
- case DW_TAG_try_block:
- case DW_TAG_entry_point:
- return match;
- case DW_TAG_inlined_subroutine:
- return match_inline;
- case DW_TAG_subprogram:
- /* This might be a concrete out-of-line instance of an inline, in
- which case it is not guaranteed to be owned by the right scope and
- we will search for its origin as for DW_TAG_inlined_subroutine. */
- return (INTUSE(dwarf_hasattr) (die, DW_AT_abstract_origin)
- ? match_inline : match);
-
- /* DIEs without addresses that can own DIEs with addresses. */
- case DW_TAG_namespace:
- return walk;
-
- /* Special indirection required. */
- case DW_TAG_imported_unit:
- return imported;
-
- /* Other DIEs we have no reason to descend. */
- default:
- break;
- }
- return ignore;
+ struct args *a = arg;
+
+ if (a->scopes != NULL || INTUSE(dwarf_haspc) (&die->die, a->pc) <= 0)
+ die->prune = true;
+ else if (INTUSE (dwarf_tag) (&die->die) == DW_TAG_inlined_subroutine)
+ a->inlined = depth;
+
+ return 0;
}
-/* DIE contains PC. Find its child that contains PC. Returns -1 for
- errors, 0 for no matches. On success, *SCOPES gets the malloc'd array
- of containing scopes. A positive return value is the number of those
- scopes. A return value < -1 is -1 - number of those scopes, when the
- outermost scope is a concrete instance of an inline subroutine. */
+/* Preorder visitor for second partial traversal after finding a
+ concrete inlined instance. */
static int
-find_pc (unsigned int depth, Dwarf_Die *die, Dwarf_Addr pc, Dwarf_Die **scopes)
+origin_match (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg)
{
- Dwarf_Die child;
- if (INTUSE(dwarf_child) (die, &child) != 0)
- return -1;
+ struct args *a = arg;
+
+ if (die->die.addr != a->inlined_origin.addr)
+ return 0;
- /* Recurse on this DIE to search within its children.
- Return nonzero if this gets an error or a final result. */
- inline int search_child (void)
+ /* We have a winner! This is the abstract definition of the inline
+ function of which A->scopes[A->nscopes - 1] is a concrete instance.
+ */
+
+ unsigned int nscopes = a->nscopes + depth;
+ Dwarf_Die *scopes = realloc (a->scopes, nscopes * sizeof scopes[0]);
+ if (scopes == NULL)
{
- int n = find_pc (depth + 1, &child, pc, scopes);
- if (n > 0)
- /* That stored the N innermost scopes. Now store ours. */
- (*scopes)[n++] = child;
- return n;
+ free (a->scopes);
+ __libdw_seterrno (DWARF_E_NOMEM);
+ return -1;
}
- /* Check each of our child DIEs. */
- enum die_class got = ignore;
+ a->scopes = scopes;
do
{
- enum die_class child_class = classify_die (&child);
- switch (child_class)
- {
- case match:
- case match_inline:
- if (INTUSE(dwarf_haspc) (&child, pc) > 0)
- break;
- continue;
-
- case walk:
- if (INTUSE(dwarf_haschildren) (&child))
- got = walk;
- continue;
-
- case imported:
- got = walk;
- continue;
-
- default:
- case ignore:
- continue;
- }
-
- /* We get here only when the PC has matched. */
- got = child_class;
- break;
+ die = die->parent;
+ scopes[a->nscopes++] = die->die;
}
- while (INTUSE(dwarf_siblingof) (&child, &child) == 0);
+ while (a->nscopes < nscopes);
+ assert (die->parent == NULL);
+ return a->nscopes;
+}
+
+/* Postorder visitor: first (innermost) call wins. */
+static int
+pc_record (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg)
+{
+ struct args *a = arg;
- switch (got)
+ if (a->scopes == NULL)
{
- case match:
- case match_inline:
- /* We have a DIE that matched the PC. */
- if (INTUSE(dwarf_haschildren) (&child))
- {
- /* Recurse on this DIE to narrow within its children.
- Return now if this gets an error or a final result. */
- int result = search_child ();
- if (result < 0 || (got == match && result > 0))
- return result;
- if (result > 0) /* got == match_inline */
- /* We have a winner, but CHILD is a concrete inline instance
- so DIE and its containing scopes do not actually apply.
- DIE is the scope that inlined the function. Our root
- caller must find the abstract scope that defines us. */
- return -1 - result;
- }
+ if (die->prune)
+ return 0;
+
+ /* We have hit the innermost DIE that contains the target PC. */
- /* This DIE has no children containing the PC, so this is it. */
- *scopes = malloc (depth * sizeof (*scopes)[0]);
- if (*scopes == NULL)
+ a->nscopes = depth + 1 - a->inlined;
+ a->scopes = malloc (a->nscopes * sizeof a->scopes[0]);
+ if (a->scopes == NULL)
{
__libdw_seterrno (DWARF_E_NOMEM);
return -1;
}
- (*scopes)[0] = child;
- return got == match ? 1 : -2;
- case walk:
- /* We don't have anything matching the PC, but we have some things
- we might descend to find one. Recurse on each of those. */
- if (INTUSE(dwarf_child) (die, &child) != 0)
- return -1;
- do
- switch (classify_die (&child))
- {
- case walk:
- if (INTUSE(dwarf_haschildren) (&child))
- {
- /* Recurse on this DIE to look for the PC within its children.
- Return now if this gets an error or a final result. */
- int result = search_child ();
- if (result != 0)
- return result;
- }
- break;
-
- case imported:
- {
- /* This imports another compilation unit to appear
- as part of this one, inside the current scope.
- Recurse to search the referenced unit, but without
- recording it as an inner scoping level. */
-
- Dwarf_Attribute attr_mem;
- Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&child, DW_AT_import,
- &attr_mem);
- if (INTUSE(dwarf_formref_die) (attr, &child) != NULL)
- {
- int result = find_pc (depth, &child, pc, scopes);
- if (result != 0)
- return result;
- }
- }
- break;
-
- default:
- break;
- }
- while (INTUSE(dwarf_siblingof) (&child, &child) == 0);
- break;
-
- default:
- case ignore:
- /* Nothing to see here. */
- break;
- }
+ for (unsigned int i = 0; i < a->nscopes; ++i)
+ {
+ a->scopes[i] = die->die;
+ die = die->parent;
+ }
- /* No matches. */
- return 0;
-}
+ if (a->inlined == 0)
+ {
+ assert (die == NULL);
+ return a->nscopes;
+ }
+ /* This is the concrete inlined instance itself.
+ Record its abstract_origin pointer. */
+ Dwarf_Die *const inlinedie = &a->scopes[depth - a->inlined];
-/* OWNER owns OWNED. Find intermediate scopes. *SCOPES was allocated by
- find_pc and has SKIP elements. We realloc it, append more containing
- scopes, and return 1 + the number appended. Returns -1 on errors,
- or 0 when OWNED was not found within OWNER. */
-static int
-find_die (unsigned int depth, Dwarf_Die *owner, Dwarf_Die *owned,
- Dwarf_Die **scopes, unsigned int skip)
-{
- Dwarf_Die child;
- if (INTUSE(dwarf_child) (owner, &child) != 0)
- return -1;
+ assert (INTUSE (dwarf_tag) (inlinedie) == DW_TAG_inlined_subroutine);
+ Dwarf_Attribute attr_mem;
+ Dwarf_Attribute *attr = INTUSE (dwarf_attr) (inlinedie,
+ DW_AT_abstract_origin,
+ &attr_mem);
+ if (INTUSE (dwarf_formref_die) (attr, &a->inlined_origin) == NULL)
+ return -1;
+ return 0;
+ }
- do
- {
- if (child.addr == owned->addr)
- /* This is the one. OWNER is the innermost owner. */
- return 1;
- /* Unfortunately we cannot short-circuit the dead-end paths just by
- checking the physical layout to see if OWNED falls within CHILD.
- If it doesn't, there may still be a DW_TAG_imported_unit that
- refers to its true owner indirectly. */
+ /* We've recorded the scopes back to one that is a concrete inlined
+ instance. Now return out of the traversal back to the scope
+ containing that instance. */
- switch (classify_die (&child))
- {
- case match:
- case match_inline:
- case walk:
- if (INTUSE(dwarf_haschildren) (&child))
- {
- /* Recurse on this DIE to look for OWNED within its children.
- Return now if this gets an error or a final result. */
- int n = find_die (depth + 1, &child, owned, scopes, skip);
- if (n < 0)
- return n;
- if (n > 1)
- {
- /* We have a winner. CHILD owns the owner of OWNED. */
- (*scopes)[skip + n - 1] = child;
- return n + 1;
- }
- if (n > 0) /* n == 1 */
- {
- /* CHILD is the direct owner of OWNED. */
- Dwarf_Die *nscopes = realloc (*scopes,
- (skip + depth)
- * sizeof nscopes[0]);
- if (nscopes == NULL)
- {
- free (*scopes);
- *scopes = NULL;
- __libdw_seterrno (DWARF_E_NOMEM);
- return -1;
- }
- nscopes[skip] = child;
- *scopes = nscopes;
- return 2;
- }
- }
- break;
-
- case imported:
- {
- /* This is imports another compilation unit to appear
- as part of this one, inside the current scope.
- Recurse to search the referenced unit, but without
- recording it as an inner scoping level. */
-
- Dwarf_Attribute attr_mem;
- Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&child, DW_AT_import,
- &attr_mem);
- if (INTUSE(dwarf_formref_die) (attr, &child) != NULL)
- {
- int result = find_die (depth, &child, owner, scopes, skip);
- if (result != 0)
- return result;
- }
- }
- break;
-
- default:
- break;
- }
- }
- while (INTUSE(dwarf_siblingof) (&child, &child) == 0);
+ assert (a->inlined);
+ if (depth >= a->inlined)
+ /* Not there yet. */
+ return 0;
- return 0;
+ /* Now we are in a scope that contains the concrete inlined instance.
+ Search it for the inline function's abstract definition.
+ If we don't find it, return to search the containing scope.
+ If we do find it, the nonzero return value will bail us out
+ of the postorder traversal. */
+ return __libdw_visit_scopes (depth, die, &origin_match, NULL, &a);
}
@@ -297,47 +149,16 @@ dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc, Dwarf_Die **scopes)
if (cudie == NULL)
return -1;
- int n = find_pc (2, cudie, pc, scopes);
- if (likely (n >= 0))
- {
- /* We have a final result. Now store the outermost scope, the CU. */
- (*scopes)[n++] = *cudie;
- return n;
- }
- if (n == -1)
- return n;
-
- /* We have the scopes out to one that is a concrete instance of an
- inlined subroutine (usually DW_TAG_inlined_subroutine, but can
- be DW_TAG_subprogram for a concrete out-of-line instance).
- Now we must find the lexical scopes that contain the
- corresponding abstract inline subroutine definition. */
-
- n = -n - 1;
-
- Dwarf_Attribute attr_mem;
- Dwarf_Die die_mem;
- Dwarf_Die *origin = INTUSE(dwarf_formref_die)
- (INTUSE(dwarf_attr) (&(*scopes)[n - 1], DW_AT_abstract_origin, &attr_mem),
- &die_mem);
- if (unlikely (origin == NULL))
- goto invalid;
-
- int result = find_die (0, cudie, origin, scopes, n);
- if (likely (result > 0))
- {
- n = n + result - 1;
- (*scopes)[n++] = *cudie;
- return n;
- }
+ struct Dwarf_Die_Chain cu = { .parent = NULL, .die = *cudie };
+ struct args a = { .pc = pc };
- if (result == 0) /* No match, shouldn't happen. */
- {
- invalid:
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- }
+ int result = __libdw_visit_scopes (0, &cu, &pc_match, &pc_record, &a);
+
+ if (result == 0 && a.scopes != NULL)
+ result = __libdw_visit_scopes (0, &cu, &origin_match, NULL, &a);
+
+ if (result > 0)
+ *scopes = a.scopes;
- free (*scopes);
- *scopes = NULL;
- return -1;
+ return result;
}
diff --git a/elfutils/libdw/dwarf_getscopes_die.c b/elfutils/libdw/dwarf_getscopes_die.c
new file mode 100644
index 00000000..bdcee354
--- /dev/null
+++ b/elfutils/libdw/dwarf_getscopes_die.c
@@ -0,0 +1,69 @@
+/* Return scope DIEs containing given DIE.
+ Copyright (C) 2005 Red Hat, Inc.
+
+ This program is Open Source software; you can redistribute it and/or
+ modify it under the terms of the Open Software License version 1.0 as
+ published by the Open Source Initiative.
+
+ You should have received a copy of the Open Software License along
+ with this program; if not, you may obtain a copy of the Open Software
+ License version 1.0 from http://www.opensource.org/licenses/osl.php or
+ by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
+ 3001 King Ranch Road, Ukiah, CA 95482. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include "libdwP.h"
+#include <assert.h>
+#include <stdlib.h>
+
+static int
+scope_visitor (unsigned int depth, struct Dwarf_Die_Chain *die, void *arg)
+{
+ if (die->die.addr != *(void **) arg)
+ return 0;
+
+ Dwarf_Die *scopes = malloc (depth * sizeof scopes[0]);
+ if (scopes == NULL)
+ {
+ __libdw_seterrno (DWARF_E_NOMEM);
+ return -1;
+ }
+
+ unsigned int i = 0;
+ do
+ {
+ scopes[i++] = die->die;
+ die = die->parent;
+ }
+ while (die != NULL);
+ assert (i == depth);
+
+ *(void **) arg = scopes;
+ return depth;
+}
+
+int
+dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes)
+{
+ if (die == NULL)
+ return -1;
+
+ struct Dwarf_Die_Chain cu =
+ {
+ .parent = NULL,
+ .die =
+ {
+ .cu = die->cu,
+ .addr = ((char *) die->cu->dbg->sectiondata[IDX_debug_info]->d_buf
+ + die->cu->start + 3 * die->cu->offset_size - 4 + 3),
+ }
+ };
+
+ void *info = die->addr;
+ int result = __libdw_visit_scopes (1, &cu, &scope_visitor, NULL, &info);
+ if (result > 0)
+ *scopes = info;
+ return result;
+}
diff --git a/elfutils/libdw/libdw.h b/elfutils/libdw/libdw.h
index e6b30597..350aa440 100644
--- a/elfutils/libdw/libdw.h
+++ b/elfutils/libdw/libdw.h
@@ -442,6 +442,15 @@ extern int dwarf_addrloclists (Dwarf_Attribute *attr, Dwarf_Addr address,
extern int dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc,
Dwarf_Die **scopes);
+/* Return scope DIEs containing the given DIE.
+ Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
+ and returns the number of elements in the array.
+ (*SCOPES)[0] is a copy of DIE.
+ (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
+ Returns -1 for errors or 0 if DIE is not found in any scope entry. */
+extern int dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes);
+
+
/* Search SCOPES[0..NSCOPES-1] for a variable called NAME.
Ignore the first SKIP_SHADOWS scopes that match the name.
If MATCH_FILE is not null, accept only declaration in that source file;
diff --git a/elfutils/libdw/libdw.map b/elfutils/libdw/libdw.map
index 01ee5f60..a5324bd1 100644
--- a/elfutils/libdw/libdw.map
+++ b/elfutils/libdw/libdw.map
@@ -1,5 +1,5 @@
ELFUTILS_0 { };
-ELFUTILS_0.114 {
+ELFUTILS_0.115 {
global:
dwarf_abbrevhaschildren;
dwarf_addrdie;
@@ -53,6 +53,7 @@ ELFUTILS_0.114 {
dwarf_getmacros;
dwarf_getpubnames;
dwarf_getscopes;
+ dwarf_getscopes_die;
dwarf_getscopevar;
dwarf_getscn_info;
dwarf_getsrc_die;
diff --git a/elfutils/libdw/libdwP.h b/elfutils/libdw/libdwP.h
index 5f15cf9d..37f28721 100644
--- a/elfutils/libdw/libdwP.h
+++ b/elfutils/libdw/libdwP.h
@@ -343,9 +343,20 @@ extern int __libdw_func_intval (Dwarf_Func *func, int *linep, int attval)
__nonnull_attribute__ (1, 2) internal_function;
/* Helper function to walk scopes. */
-extern int __libdw_visit_scopes (unsigned int depth, Dwarf_Die *root,
- int (*visit) (unsigned int depth,
- Dwarf_Die *die, void *arg),
+struct Dwarf_Die_Chain
+{
+ Dwarf_Die die;
+ struct Dwarf_Die_Chain *parent;
+ bool prune; /* The PREVISIT function can set this. */
+};
+extern int __libdw_visit_scopes (unsigned int depth,
+ struct Dwarf_Die_Chain *root,
+ int (*previsit) (unsigned int depth,
+ struct Dwarf_Die_Chain *,
+ void *arg),
+ int (*postvisit) (unsigned int depth,
+ struct Dwarf_Die_Chain *,
+ void *arg),
void *arg)
__nonnull_attribute__ (2, 3) internal_function;
@@ -360,6 +371,7 @@ INTDECL (dwarf_attr_integrate)
INTDECL (dwarf_begin_elf)
INTDECL (dwarf_child)
INTDECL (dwarf_dieoffset)
+INTDECL (dwarf_diename)
INTDECL (dwarf_end)
INTDECL (dwarf_errmsg)
INTDECL (dwarf_formaddr)
diff --git a/elfutils/libdw/libdw_visit_scopes.c b/elfutils/libdw/libdw_visit_scopes.c
index 06168fb1..3b92ea09 100644
--- a/elfutils/libdw/libdw_visit_scopes.c
+++ b/elfutils/libdw/libdw_visit_scopes.c
@@ -46,59 +46,82 @@ classify_die (Dwarf_Die *die)
}
int
-__libdw_visit_scopes (depth, root, visit, arg)
+__libdw_visit_scopes (depth, root, previsit, postvisit, arg)
unsigned int depth;
- Dwarf_Die *root;
- int (*visit) (unsigned int depth, Dwarf_Die *die, void *arg);
+ struct Dwarf_Die_Chain *root;
+ int (*previsit) (unsigned int depth, struct Dwarf_Die_Chain *, void *);
+ int (*postvisit) (unsigned int depth, struct Dwarf_Die_Chain *, void *);
void *arg;
{
- Dwarf_Die child;
- if (INTUSE(dwarf_child) (root, &child) != 0)
+ struct Dwarf_Die_Chain child;
+
+ child.parent = root;
+ if (INTUSE(dwarf_child) (&root->die, &child.die) != 0)
return -1;
+ inline int recurse (void)
+ {
+ return __libdw_visit_scopes (depth + 1, &child,
+ previsit, postvisit, arg);
+ }
+
do
{
- int result = (*visit) (depth, &child, arg);
- if (result != DWARF_CB_OK)
- return result;
+ child.prune = false;
- switch (classify_die (&child))
+ if (previsit != NULL)
{
- case match:
- case match_inline:
- case walk:
- if (INTUSE(dwarf_haschildren) (&child))
- {
- result = __libdw_visit_scopes (depth + 1, &child, visit, arg);
- if (result != DWARF_CB_OK)
- return result;
- }
- break;
+ int result = (*previsit) (depth + 1, &child, arg);
+ if (result != DWARF_CB_OK)
+ return result;
+ }
- case imported:
+ if (!child.prune)
+ switch (classify_die (&child.die))
{
- /* This is imports another compilation unit to appear
- as part of this one, inside the current scope.
- Recurse to searesulth the referenced unit, but without
- recording it as an inner scoping level. */
-
- Dwarf_Attribute attr_mem;
- Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&child, DW_AT_import,
- &attr_mem);
- if (INTUSE(dwarf_formref_die) (attr, &child) != NULL)
+ case match:
+ case match_inline:
+ case walk:
+ if (INTUSE(dwarf_haschildren) (&child.die))
{
- result = __libdw_visit_scopes (depth + 1, &child, visit, arg);
- if (result != 0)
+ int result = recurse ();
+ if (result != DWARF_CB_OK)
return result;
}
+ break;
+
+ case imported:
+ {
+ /* This imports another compilation unit to appear
+ as part of this one, inside the current scope.
+ Recurse to search the referenced unit, but without
+ recording it as an inner scoping level. */
+
+ Dwarf_Attribute attr_mem;
+ Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&child.die,
+ DW_AT_import,
+ &attr_mem);
+ if (INTUSE(dwarf_formref_die) (attr, &child.die) != NULL)
+ {
+ int result = recurse ();
+ if (result != DWARF_CB_OK)
+ return result;
+ }
+ }
+ break;
+
+ default:
+ break;
}
- break;
- default:
- break;
+ if (postvisit != NULL)
+ {
+ int result = (*postvisit) (depth + 1, &child, arg);
+ if (result != DWARF_CB_OK)
+ return result;
}
}
- while (INTUSE(dwarf_siblingof) (&child, &child) == 0);
+ while (INTUSE(dwarf_siblingof) (&child.die, &child.die) == 0);
return 0;
}
diff --git a/elfutils/libdwfl/ChangeLog b/elfutils/libdwfl/ChangeLog
index 139ab47b..efffa616 100644
--- a/elfutils/libdwfl/ChangeLog
+++ b/elfutils/libdwfl/ChangeLog
@@ -1,5 +1,17 @@
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (%.os): Use COMPILE.os.
+ (COMPILE.os): Filter out gconv options.
+
+2005-08-25 Roland McGrath <roland@redhat.com>
+
+ * cu.c (__libdwfl_nextcu): Return success when dwarf_nextcu hits end.
+ * dwfl_nextcu.c (dwfl_nextcu): Skip modules with no dwarf info.
+
2005-08-24 Roland McGrath <roland@redhat.com>
+ * dwfl_lineinfo.c (dwfl_lineinfo): Add bias, don't subtract it.
+
* argp-std.c [_MUDFLAP] (__libdwfl_argp_mudflap_options): New function,
magic initializer to set -heur-stack-bound option.
diff --git a/elfutils/libdwfl/Makefile.am b/elfutils/libdwfl/Makefile.am
index a0735ff0..510e7599 100644
--- a/elfutils/libdwfl/Makefile.am
+++ b/elfutils/libdwfl/Makefile.am
@@ -25,6 +25,9 @@ INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
-I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib
VERSION = 1
+COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
+ $(COMPILE)))
+
noinst_LIBRARIES = libdwfl.a
if !MUDFLAP
noinst_LIBRARIES += libdwfl_pic.a
@@ -71,7 +74,7 @@ libdwfl_pic_a_SOURCES =
am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
%.os: %.c %.o
- if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
-MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
rm -f "$(DEPDIR)/$*.Tpo"; \
diff --git a/elfutils/libdwfl/Makefile.in b/elfutils/libdwfl/Makefile.in
index ae41d2b1..1713d2b1 100644
--- a/elfutils/libdwfl/Makefile.in
+++ b/elfutils/libdwfl/Makefile.in
@@ -120,6 +120,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
@@ -207,6 +209,9 @@ target_alias = @target_alias@
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
-I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib
+COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
+ $(COMPILE)))
+
noinst_LIBRARIES = libdwfl.a $(am__append_1)
euincludedir = ${includedir}/elfutils
euinclude_HEADERS = libdwfl.h
@@ -531,7 +536,7 @@ uninstall-am: uninstall-euincludeHEADERS uninstall-info-am
@MUDFLAP_FALSE@%.os: %.c %.o
-@MUDFLAP_FALSE@ if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+@MUDFLAP_FALSE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
@MUDFLAP_FALSE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
@MUDFLAP_FALSE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
@MUDFLAP_FALSE@ rm -f "$(DEPDIR)/$*.Tpo"; \
diff --git a/elfutils/libdwfl/cu.c b/elfutils/libdwfl/cu.c
index cf7e3887..22865df7 100644
--- a/elfutils/libdwfl/cu.c
+++ b/elfutils/libdwfl/cu.c
@@ -230,9 +230,15 @@ __libdwfl_nextcu (Dwfl_Module *mod, struct dwfl_cu *lastcu,
{
size_t cuhdrsz;
Dwarf_Off nextoff;
- if (INTUSE(dwarf_nextcu) (mod->dw, cuoff, &nextoff, &cuhdrsz,
- NULL, NULL, NULL) != 0)
+ int end = INTUSE(dwarf_nextcu) (mod->dw, cuoff, &nextoff, &cuhdrsz,
+ NULL, NULL, NULL);
+ if (end < 0)
return DWFL_E_LIBDW;
+ if (end > 0)
+ {
+ *cu = NULL;
+ return DWFL_E_NOERROR;
+ }
Dwfl_Error result = intern_cu (mod, cuoff + cuhdrsz, nextp);
if (result != DWFL_E_NOERROR)
diff --git a/elfutils/libdwfl/dwfl_lineinfo.c b/elfutils/libdwfl/dwfl_lineinfo.c
index 4771e003..3801fe44 100644
--- a/elfutils/libdwfl/dwfl_lineinfo.c
+++ b/elfutils/libdwfl/dwfl_lineinfo.c
@@ -25,7 +25,7 @@ dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, int *linep, int *colp,
const Dwarf_Line *info = &cu->die.cu->lines->info[line->idx];
if (addr != NULL)
- *addr = info->addr - cu->mod->debug.bias;
+ *addr = info->addr + cu->mod->debug.bias;
if (linep != NULL)
*linep = info->line;
if (colp != NULL)
diff --git a/elfutils/libdwfl/dwfl_nextcu.c b/elfutils/libdwfl/dwfl_nextcu.c
index a5565c69..7224bb35 100644
--- a/elfutils/libdwfl/dwfl_nextcu.c
+++ b/elfutils/libdwfl/dwfl_nextcu.c
@@ -31,20 +31,35 @@ dwfl_nextcu (Dwfl *dwfl, Dwarf_Die *lastcu, Dwarf_Addr *bias)
mod = cu->mod;
Dwfl_Error error;
- while ((error = __libdwfl_nextcu (mod, cu, &cu)) == DWFL_E_NOERROR)
+ do
{
+ error = __libdwfl_nextcu (mod, cu, &cu);
+ if (error != DWFL_E_NOERROR)
+ break;
+
if (cu != NULL)
{
*bias = mod->debug.bias;
return &cu->die;
}
- mod = mod->next;
+ do
+ {
+ mod = mod->next;
+
+ nextmod:
+ if (mod == NULL)
+ return NULL;
- nextmod:
- if (mod == NULL || INTUSE(dwfl_module_getdwarf) (mod, bias) == NULL)
- return NULL;
+ error = mod->dwerr;
+ if (error == DWFL_E_NOERROR
+ && (mod->dw != NULL
+ || INTUSE(dwfl_module_getdwarf) (mod, bias) != NULL))
+ break;
+ }
+ while (error == DWFL_E_NO_DWARF);
}
+ while (error == DWFL_E_NOERROR);
__libdwfl_seterrno (error);
return NULL;
diff --git a/elfutils/libebl/ChangeLog b/elfutils/libebl/ChangeLog
index cb0d0095..d5248293 100644
--- a/elfutils/libebl/ChangeLog
+++ b/elfutils/libebl/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am: Use $(LINK) not $(CC) when creating DSOs.
+
2005-08-13 Roland McGrath <roland@redhat.com>
* ia64_symbol.c (ia64_machine_flag_check): New function.
diff --git a/elfutils/libebl/Makefile.am b/elfutils/libebl/Makefile.am
index ead129bd..93271e52 100644
--- a/elfutils/libebl/Makefile.am
+++ b/elfutils/libebl/Makefile.am
@@ -69,9 +69,9 @@ textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
libebl_i386_so_SOURCES =
libebl_i386.so: libebl_i386_pic.a libebl_i386.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_i386.map \
- -Wl,-z,defs $(libelf) $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_i386.map \
+ -Wl,-z,defs $(libelf) $(libmudflap)
$(textrel_check)
@@ -81,9 +81,9 @@ am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os)
libebl_sh_so_SOURCES =
libebl_sh.so: libebl_sh_pic.a libebl_sh.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_sh.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_sh.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
@@ -93,9 +93,9 @@ am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
libebl_x86_64_so_SOURCES =
libebl_x86_64.so: libebl_x86_64_pic.a libebl_x86_64.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_x86_64.map \
- -Wl,-z,defs $(libelf) $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_x86_64.map \
+ -Wl,-z,defs $(libelf) $(libmudflap)
$(textrel_check)
@@ -105,9 +105,9 @@ am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
libebl_ia64_so_SOURCES =
libebl_ia64.so: libebl_ia64_pic.a libebl_ia64.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_ia64.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_ia64.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
@@ -117,9 +117,9 @@ am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
libebl_alpha_so_SOURCES =
libebl_alpha.so: libebl_alpha_pic.a libebl_alpha.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_alpha.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_alpha.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
@@ -129,9 +129,9 @@ am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
libebl_arm_so_SOURCES =
libebl_arm.so: libebl_arm_pic.a libebl_arm.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_arm.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_arm.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
@@ -141,9 +141,9 @@ am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os)
libebl_sparc_so_SOURCES =
libebl_sparc.so: libebl_sparc_pic.a libebl_sparc.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_sparc.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_sparc.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
@@ -153,9 +153,9 @@ am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os)
libebl_ppc_so_SOURCES =
libebl_ppc.so: libebl_ppc_pic.a libebl_ppc.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_ppc.map \
- -Wl,-z,defs $(libelf) $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_ppc.map \
+ -Wl,-z,defs $(libelf) $(libmudflap)
$(textrel_check)
@@ -165,9 +165,9 @@ am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
libebl_ppc64_so_SOURCES =
libebl_ppc64.so: libebl_ppc64_pic.a libebl_ppc64.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_ppc64.map \
- -Wl,-z,defs $(libelf) $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_ppc64.map \
+ -Wl,-z,defs $(libelf) $(libmudflap)
$(textrel_check)
@@ -199,5 +199,5 @@ noinst_HEADERS = libeblP.h $(noinst_LIBRARIES:%_pic.a=%.h)
EXTRA_DIST = $(noinst_LIBRARIES:%_pic.a=%.map) \
$(foreach m,$(modules),$($(m)_SRCS))
-CLEANFILES = $(am_libebl_pic_a_OBJECTS) \
+CLEANFILES = $(am_libebl_pic_a_OBJECTS) *.gcno *.gcda \
$(foreach m,$(modules),$(am_libebl_$(m)_pic_a_OBJECTS))
diff --git a/elfutils/libebl/Makefile.in b/elfutils/libebl/Makefile.in
index 2c30d604..b8e0a855 100644
--- a/elfutils/libebl/Makefile.in
+++ b/elfutils/libebl/Makefile.in
@@ -215,6 +215,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
@@ -369,7 +371,7 @@ noinst_HEADERS = libeblP.h $(noinst_LIBRARIES:%_pic.a=%.h)
EXTRA_DIST = $(noinst_LIBRARIES:%_pic.a=%.map) \
$(foreach m,$(modules),$($(m)_SRCS))
-CLEANFILES = $(am_libebl_pic_a_OBJECTS) \
+CLEANFILES = $(am_libebl_pic_a_OBJECTS) *.gcno *.gcda \
$(foreach m,$(modules),$(am_libebl_$(m)_pic_a_OBJECTS))
all: all-am
@@ -754,49 +756,49 @@ uninstall-am: uninstall-euincludeHEADERS uninstall-info-am \
uninstall-info-am uninstall-libLIBRARIES
libebl_i386.so: libebl_i386_pic.a libebl_i386.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_i386.map \
- -Wl,-z,defs $(libelf) $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_i386.map \
+ -Wl,-z,defs $(libelf) $(libmudflap)
$(textrel_check)
libebl_sh.so: libebl_sh_pic.a libebl_sh.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_sh.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_sh.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
libebl_x86_64.so: libebl_x86_64_pic.a libebl_x86_64.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_x86_64.map \
- -Wl,-z,defs $(libelf) $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_x86_64.map \
+ -Wl,-z,defs $(libelf) $(libmudflap)
$(textrel_check)
libebl_ia64.so: libebl_ia64_pic.a libebl_ia64.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_ia64.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_ia64.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
libebl_alpha.so: libebl_alpha_pic.a libebl_alpha.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_alpha.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_alpha.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
libebl_arm.so: libebl_arm_pic.a libebl_arm.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_arm.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_arm.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
libebl_sparc.so: libebl_sparc_pic.a libebl_sparc.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_sparc.map \
- -Wl,-z,defs $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_sparc.map \
+ -Wl,-z,defs $(libmudflap)
$(textrel_check)
libebl_ppc.so: libebl_ppc_pic.a libebl_ppc.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_ppc.map \
- -Wl,-z,defs $(libelf) $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_ppc.map \
+ -Wl,-z,defs $(libelf) $(libmudflap)
$(textrel_check)
libebl_ppc64.so: libebl_ppc64_pic.a libebl_ppc64.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libebl_ppc64.map \
- -Wl,-z,defs $(libelf) $(libmudflap)
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libebl_ppc64.map \
+ -Wl,-z,defs $(libelf) $(libmudflap)
$(textrel_check)
%.os: %.c %.o
diff --git a/elfutils/libelf-po/libelf.pot b/elfutils/libelf-po/libelf.pot
index 0aa50281..e9f4cf43 100644
--- a/elfutils/libelf-po/libelf.pot
+++ b/elfutils/libelf-po/libelf.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-08-24 14:41-0700\n"
+"POT-Creation-Date: 2005-09-02 13:30-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/elfutils/libelf/ChangeLog b/elfutils/libelf/ChangeLog
index 5c68569e..bd710aee 100644
--- a/elfutils/libelf/ChangeLog
+++ b/elfutils/libelf/ChangeLog
@@ -1,3 +1,27 @@
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * elf32_getphdr.c: Include <system.h>. Use pread_retry instead of
+ pread. And branch prediction where useful.
+ * elf_begin.c: Likewise.
+ * elf_getdata.c: Likewise.
+ * elf_getshstrndx.c: Likewise.
+ * elf_readall.c: Likewise.
+ * gelf_rawchunk.c: Likewise.
+ * elf32_updatefile.c: Include <system.h>. Use pread_retry instead of
+ pread. And branch prediction where useful.
+ * elf_getarsym.c: Don't define pread_retry here.
+
+ * Makefile.am: Use $(LINK) not $(CC) when creating DSO.
+ (%.os): Use COMPILE.os.
+ (COMPILE.os): Filter out gconv options.
+
+2005-08-27 Ulrich Drepper <drepper@redhat.com>
+
+ * elf_begin.c (file_read_elf): Avoid reading ELF header from file
+ again. Instead accept additional parameter which points to it if we
+ don't use mmap.
+ (get_shnum): Use passed in e_ident value as source of ELF header.
+
2005-08-15 Ulrich Drepper <drepper@redhat.com>
* elf_begin.c (__libelf_next_arhdr): Use TEMP_FAILURE_RETRY.
diff --git a/elfutils/libelf/Makefile.am b/elfutils/libelf/Makefile.am
index 28d0d6ed..37683d85 100644
--- a/elfutils/libelf/Makefile.am
+++ b/elfutils/libelf/Makefile.am
@@ -31,6 +31,9 @@ GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
VERSION = 1
PACKAGE_VERSION = @PACKAGE_VERSION@
+COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
+ $(COMPILE)))
+
lib_LIBRARIES = libelf.a
if !MUDFLAP
noinst_LIBRARIES = libelf_pic.a
@@ -92,14 +95,14 @@ am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
libelf_so_SOURCES =
libelf.so: libelf_pic.a libelf.map
- $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
- -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
- -Wl,--soname,$@.$(VERSION),-z,-defs
+ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+ -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
+ -Wl,--soname,$@.$(VERSION),-z,-defs
if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
ln -fs $@ $@.$(VERSION)
%.os: %.c %.o
- if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
-MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
rm -f "$(DEPDIR)/$*.Tpo"; \
@@ -122,4 +125,4 @@ noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
version_xlate.h dl-hash.h
EXTRA_DIST = libelf.map
-CLEANFILES = $(am_libelf_pic_a_OBJECTS)
+CLEANFILES = $(am_libelf_pic_a_OBJECTS) *.gcno *.gcda
diff --git a/elfutils/libelf/Makefile.in b/elfutils/libelf/Makefile.in
index 90182919..f2ff2f5f 100644
--- a/elfutils/libelf/Makefile.in
+++ b/elfutils/libelf/Makefile.in
@@ -167,6 +167,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
@@ -255,6 +257,9 @@ target_alias = @target_alias@
@MUDFLAP_TRUE@ $($(*F)_CFLAGS)
INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I..
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
+COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
+ $(COMPILE)))
+
lib_LIBRARIES = libelf.a
@MUDFLAP_FALSE@noinst_LIBRARIES = libelf_pic.a
include_HEADERS = libelf.h gelf.h nlist.h
@@ -312,7 +317,7 @@ noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
version_xlate.h dl-hash.h
EXTRA_DIST = libelf.map
-CLEANFILES = $(am_libelf_pic_a_OBJECTS)
+CLEANFILES = $(am_libelf_pic_a_OBJECTS) *.gcno *.gcda
all: all-am
.SUFFIXES:
@@ -729,14 +734,14 @@ uninstall-am: uninstall-euincludeHEADERS uninstall-includeHEADERS \
uninstall-libLIBRARIES
@MUDFLAP_FALSE@libelf.so: libelf_pic.a libelf.map
-@MUDFLAP_FALSE@ $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
-@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION),-z,-defs
+@MUDFLAP_FALSE@ $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+@MUDFLAP_FALSE@ -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
+@MUDFLAP_FALSE@ -Wl,--soname,$@.$(VERSION),-z,-defs
@MUDFLAP_FALSE@ if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
@MUDFLAP_FALSE@ ln -fs $@ $@.$(VERSION)
@MUDFLAP_FALSE@%.os: %.c %.o
-@MUDFLAP_FALSE@ if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+@MUDFLAP_FALSE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
@MUDFLAP_FALSE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
@MUDFLAP_FALSE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
@MUDFLAP_FALSE@ rm -f "$(DEPDIR)/$*.Tpo"; \
diff --git a/elfutils/libelf/elf32_getphdr.c b/elfutils/libelf/elf32_getphdr.c
index 25693687..341acf09 100644
--- a/elfutils/libelf/elf32_getphdr.c
+++ b/elfutils/libelf/elf32_getphdr.c
@@ -19,9 +19,11 @@
# include <config.h>
#endif
+#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
+#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -148,9 +150,10 @@ elfw2(LIBELFBITS,getphdr) (elf)
elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_MALLOCED;
/* Read the header. */
- if ((size_t) pread (elf->fildes,
- elf->state.ELFW(elf,LIBELFBITS).phdr, size,
- (elf->start_offset + ehdr->e_phoff)) != size)
+ ssize_t n = pread_retry (elf->fildes,
+ elf->state.ELFW(elf,LIBELFBITS).phdr, size,
+ elf->start_offset + ehdr->e_phoff);
+ if (unlikely ((size_t) n != size))
{
/* Severe problems. We cannot read the data. */
__libelf_seterrno (ELF_E_READ_ERROR);
diff --git a/elfutils/libelf/elf32_getshdr.c b/elfutils/libelf/elf32_getshdr.c
index 1e26e854..cf7a41fd 100644
--- a/elfutils/libelf/elf32_getshdr.c
+++ b/elfutils/libelf/elf32_getshdr.c
@@ -20,8 +20,10 @@
#endif
#include <assert.h>
+#include <errno.h>
#include <unistd.h>
+#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -122,12 +124,13 @@ elfw2(LIBELFBITS,getshdr) (scn)
CONVERT_TO (shdr[cnt].sh_entsize, notcvt[cnt].sh_entsize);
}
}
- else if (elf->fildes != -1)
+ else if (likely (elf->fildes != -1))
{
/* Read the header. */
- if ((size_t) pread (elf->fildes,
- elf->state.ELFW(elf,LIBELFBITS).shdr, size,
- elf->start_offset + ehdr->e_shoff) != size)
+ ssize_t n = pread_retry (elf->fildes,
+ elf->state.ELFW(elf,LIBELFBITS).shdr, size,
+ elf->start_offset + ehdr->e_shoff);
+ if (unlikely ((size_t) n != size))
{
/* Severe problems. We cannot read the data. */
__libelf_seterrno (ELF_E_READ_ERROR);
diff --git a/elfutils/libelf/elf32_updatefile.c b/elfutils/libelf/elf32_updatefile.c
index 14893def..260fb346 100644
--- a/elfutils/libelf/elf32_updatefile.c
+++ b/elfutils/libelf/elf32_updatefile.c
@@ -20,6 +20,7 @@
#endif
#include <assert.h>
+#include <errno.h>
#include <libelf.h>
#include <stdbool.h>
#include <stdlib.h>
@@ -27,6 +28,7 @@
#include <unistd.h>
#include <sys/param.h>
+#include <system.h>
#include "libelfP.h"
@@ -326,7 +328,7 @@ fill (int fd, off_t pos, size_t len, char *fillbuf, size_t *filledp)
/* This many bytes we want to write in this round. */
size_t n = MIN (filled, len);
- if (unlikely ((size_t) pwrite (fd, fillbuf, n, pos) != n))
+ if (unlikely ((size_t) pwrite_retry (fd, fillbuf, n, pos) != n))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
return 1;
@@ -381,8 +383,8 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
}
/* Write out the ELF header. */
- if (unlikely (pwrite (elf->fildes, out_ehdr,
- sizeof (ElfW2(LIBELFBITS,Ehdr)), 0)
+ if (unlikely (pwrite_retry (elf->fildes, out_ehdr,
+ sizeof (ElfW2(LIBELFBITS,Ehdr)), 0)
!= sizeof (ElfW2(LIBELFBITS,Ehdr))))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
@@ -441,10 +443,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
}
/* Write out the ELF header. */
- if (unlikely ((size_t) pwrite (elf->fildes, out_phdr,
- sizeof (ElfW2(LIBELFBITS,Phdr))
- * ehdr->e_phnum, ehdr->e_phoff)
- != sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum))
+ size_t phdr_size = sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum;
+ if (unlikely ((size_t) pwrite_retry (elf->fildes, out_phdr,
+ phdr_size, ehdr->e_phoff)
+ != phdr_size))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
return 1;
@@ -544,10 +546,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
(*fctp) (buf, dl->data.d.d_buf, dl->data.d.d_size, 1);
}
- if (unlikely ((size_t) pwrite (elf->fildes, buf,
- dl->data.d.d_size,
- last_offset)
- != dl->data.d.d_size))
+ ssize_t n = pwrite_retry (elf->fildes, buf,
+ dl->data.d.d_size,
+ last_offset);
+ if (unlikely ((size_t) n != dl->data.d.d_size))
{
if (buf != dl->data.d.d_buf && buf != tmpbuf)
free (buf);
@@ -593,9 +595,9 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
/* Write out the section header table. */
if (shdr_flags & ELF_F_DIRTY
- && unlikely ((size_t) pwrite (elf->fildes, shdr_data,
- sizeof (ElfW2(LIBELFBITS,Shdr))
- * shnum, shdr_offset)
+ && unlikely ((size_t) pwrite_retry (elf->fildes, shdr_data,
+ sizeof (ElfW2(LIBELFBITS,Shdr))
+ * shnum, shdr_offset)
!= sizeof (ElfW2(LIBELFBITS,Shdr)) * shnum))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
diff --git a/elfutils/libelf/elf_begin.c b/elfutils/libelf/elf_begin.c
index c4b33595..c21a52b5 100644
--- a/elfutils/libelf/elf_begin.c
+++ b/elfutils/libelf/elf_begin.c
@@ -31,6 +31,7 @@
#include <sys/param.h>
#include <sys/stat.h>
+#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -77,41 +78,40 @@ 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 (likely (map_address != NULL) && e_ident[EI_DATA] == MY_ELFDATA
- && (ALLOW_UNALIGNED
- || (((size_t) ((char *) map_address + offset))
- & ((is32 ? __alignof__ (Elf32_Ehdr) : __alignof__ (Elf64_Ehdr))
- - 1)) == 0))
- ehdr.p = (char *) map_address + offset;
+ if (e_ident[EI_DATA] == MY_ELFDATA)
+ ehdr.p = e_ident;
else
{
- /* We have to read the data from the file. */
- size_t len = is32 ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr);
+ /* We already read the ELF header. We have to copy the header
+ since we possibly modify the data here and the caller
+ expects the memory it passes in to be preserved. */
+ ehdr.p = &ehdr_mem;
- if (likely (map_address != NULL))
- ehdr.p = memcpy (&ehdr_mem, (char *) map_address + offset, len);
- else
- {
- /* Fill it. */
- if ((size_t) TEMP_FAILURE_RETRY (pread (fildes, &ehdr_mem, len,
- offset)) != len)
- /* Failed reading. */
- return (size_t) -1l;
- ehdr.p = &ehdr_mem;
- }
-
- if (e_ident[EI_DATA] != MY_ELFDATA)
+ if (is32)
{
- if (is32)
+ if (ALLOW_UNALIGNED)
{
- CONVERT (ehdr.e32->e_shnum);
- CONVERT (ehdr.e32->e_shoff);
+ ehdr_mem.e32.e_shnum = ((Elf32_Ehdr *) e_ident)->e_shnum;
+ ehdr_mem.e32.e_shoff = ((Elf32_Ehdr *) e_ident)->e_shoff;
}
else
+ memcpy (&ehdr_mem, e_ident, sizeof (Elf32_Ehdr));
+
+ CONVERT (ehdr_mem.e32.e_shnum);
+ CONVERT (ehdr_mem.e32.e_shoff);
+ }
+ else
+ {
+ if (ALLOW_UNALIGNED)
{
- CONVERT (ehdr.e64->e_shnum);
- CONVERT (ehdr.e64->e_shoff);
+ ehdr_mem.e64.e_shnum = ((Elf64_Ehdr *) e_ident)->e_shnum;
+ ehdr_mem.e64.e_shoff = ((Elf64_Ehdr *) e_ident)->e_shoff;
}
+ else
+ memcpy (&ehdr_mem, e_ident, sizeof (Elf64_Ehdr));
+
+ CONVERT (ehdr_mem.e64.e_shnum);
+ CONVERT (ehdr_mem.e64.e_shoff);
}
}
@@ -145,12 +145,10 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset,
+ offset))->sh_size,
sizeof (Elf32_Word));
else
- if (TEMP_FAILURE_RETRY (pread (fildes, &size,
- sizeof (Elf32_Word),
- offset + ehdr.e32->e_shoff
- + offsetof (Elf32_Shdr,
- sh_size)))
- != sizeof (Elf32_Word))
+ if (unlikely (pread_retry (fildes, &size, sizeof (Elf32_Word),
+ offset + ehdr.e32->e_shoff
+ + offsetof (Elf32_Shdr, sh_size))
+ != sizeof (Elf32_Word)))
return (size_t) -1l;
if (e_ident[EI_DATA] != MY_ELFDATA)
@@ -189,12 +187,10 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset,
+ offset))->sh_size,
sizeof (Elf64_Xword));
else
- if (TEMP_FAILURE_RETRY (pread (fildes, &size,
- sizeof (Elf64_Word),
- offset + ehdr.e64->e_shoff
- + offsetof (Elf64_Shdr,
- sh_size)))
- != sizeof (Elf64_Xword))
+ if (unlikely (pread_retry (fildes, &size, sizeof (Elf64_Word),
+ offset + ehdr.e64->e_shoff
+ + offsetof (Elf64_Shdr, sh_size))
+ != sizeof (Elf64_Xword)))
return (size_t) -1l;
if (e_ident[EI_DATA] != MY_ELFDATA)
@@ -215,37 +211,15 @@ get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset,
/* Create descriptor for ELF file in memory. */
static Elf *
-file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
- Elf_Cmd cmd, Elf *parent)
+file_read_elf (int fildes, void *map_address, unsigned char *e_ident,
+ off_t offset, size_t maxsize, Elf_Cmd cmd, Elf *parent)
{
- /* We only read the ELF header now. */
- unsigned char *e_ident;
- unsigned char e_ident_mem[EI_NIDENT];
- size_t scncnt;
- Elf *elf;
-
- if (map_address != NULL)
- /* It's right at the beginning of the file. No word access
- required, just bytes. */
- e_ident = (unsigned char *) map_address + offset;
- else
- {
- e_ident = e_ident_mem;
-
- if (TEMP_FAILURE_RETRY (pread (fildes, e_ident, EI_NIDENT, offset))
- != EI_NIDENT)
- {
- __libelf_seterrno (ELF_E_READ_ERROR);
- return NULL;
- }
- }
-
/* Verify the binary is of the class we can handle. */
- if ((e_ident[EI_CLASS] != ELFCLASS32
- && e_ident[EI_CLASS] != ELFCLASS64)
- /* We also can only handle two encodings. */
- || (e_ident[EI_DATA] != ELFDATA2LSB
- && e_ident[EI_DATA] != ELFDATA2MSB))
+ if (unlikely ((e_ident[EI_CLASS] != ELFCLASS32
+ && e_ident[EI_CLASS] != ELFCLASS64)
+ /* We also can only handle two encodings. */
+ || (e_ident[EI_DATA] != ELFDATA2LSB
+ && e_ident[EI_DATA] != ELFDATA2MSB)))
{
/* Cannot handle this. */
__libelf_seterrno (ELF_E_INVALID_FILE);
@@ -253,14 +227,14 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
}
/* Determine the number of sections. */
- scncnt = get_shnum (map_address, e_ident, fildes, offset, maxsize);
+ size_t scncnt = get_shnum (map_address, e_ident, fildes, offset, maxsize);
if (scncnt == (size_t) -1l)
/* Could not determine the number of sections. */
return NULL;
/* We can now allocate the memory. */
- elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent,
- ELF_K_ELF, scncnt * sizeof (Elf_Scn));
+ Elf *elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent,
+ ELF_K_ELF, scncnt * sizeof (Elf_Scn));
if (elf == NULL)
/* Not enough memory. */
return NULL;
@@ -268,6 +242,9 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
/* Some more or less arbitrary value. */
elf->state.elf.scnincr = 10;
+ /* Make the class easily available. */
+ elf->class = e_ident[EI_CLASS];
+
if (e_ident[EI_CLASS] == ELFCLASS32)
{
/* This pointer might not be directly usable if the alignment is
@@ -287,17 +264,14 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
& (__alignof__ (Elf32_Phdr) - 1)) == 0)))
{
/* We can use the mmapped memory. */
- elf->state.elf32.ehdr =
- (Elf32_Ehdr *) ((char *) map_address + offset);
- elf->state.elf32.shdr =
- (Elf32_Shdr *) ((char *) map_address + offset
- + elf->state.elf32.ehdr->e_shoff);
- if (elf->state.elf32.ehdr->e_phnum)
+ elf->state.elf32.ehdr = ehdr;
+ elf->state.elf32.shdr
+ = (Elf32_Shdr *) ((char *) ehdr + ehdr->e_shoff);
+ if (ehdr->e_phnum > 0)
/* Assign a value only if there really is a program
header. Otherwise the value remains NULL. */
elf->state.elf32.phdr
- = (Elf32_Phdr *) ((char *) map_address + offset
- + elf->state.elf32.ehdr->e_phoff);
+ = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff);
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
@@ -314,21 +288,9 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
}
else
{
- if (likely (map_address != NULL))
- /* Copy the data. */
- memcpy (&elf->state.elf32.ehdr_mem,
- (char *) map_address + offset, sizeof (Elf32_Ehdr));
- else
- /* Read the data. */
- if (TEMP_FAILURE_RETRY (pread (elf->fildes,
- &elf->state.elf32.ehdr_mem,
- sizeof (Elf32_Ehdr), offset))
- != sizeof (Elf32_Ehdr))
- {
- /* We must be able to read the ELF header. */
- __libelf_seterrno (ELF_E_INVALID_FILE);
- return NULL;
- }
+ /* Copy the ELF header. */
+ elf->state.elf32.ehdr = memcpy (&elf->state.elf32.ehdr_mem, e_ident,
+ sizeof (Elf32_Ehdr));
if (e_ident[EI_DATA] != MY_ELFDATA)
{
@@ -347,8 +309,6 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
CONVERT (elf->state.elf32.ehdr_mem.e_shstrndx);
}
- elf->state.elf32.ehdr = &elf->state.elf32.ehdr_mem;
-
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
elf->state.elf32.scns.data[cnt].index = cnt;
@@ -379,17 +339,14 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
& (__alignof__ (Elf64_Phdr) - 1)) == 0)))
{
/* We can use the mmapped memory. */
- elf->state.elf64.ehdr =
- (Elf64_Ehdr *) ((char *) map_address + offset);
- elf->state.elf64.shdr =
- (Elf64_Shdr *) ((char *) map_address + offset
- + elf->state.elf64.ehdr->e_shoff);
- if (elf->state.elf64.ehdr->e_phnum)
+ elf->state.elf64.ehdr = ehdr;
+ elf->state.elf64.shdr
+ = (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff);
+ if (ehdr->e_phnum > 0)
/* Assign a value only if there really is a program
header. Otherwise the value remains NULL. */
elf->state.elf64.phdr
- = (Elf64_Phdr *) ((char *) map_address + offset
- + elf->state.elf64.ehdr->e_phoff);
+ = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff);
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
@@ -406,21 +363,9 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
}
else
{
- if (likely (map_address != NULL))
- /* Copy the data. */
- memcpy (&elf->state.elf64.ehdr_mem,
- (char *) map_address + offset, sizeof (Elf64_Ehdr));
- else
- /* Read the data. */
- if (TEMP_FAILURE_RETRY (pread (elf->fildes,
- &elf->state.elf64.ehdr_mem,
- sizeof (Elf64_Ehdr), offset))
- != sizeof (Elf64_Ehdr))
- {
- /* We must be able to read the ELF header. */
- __libelf_seterrno (ELF_E_INVALID_FILE);
- return NULL;
- }
+ /* Copy the ELF header. */
+ elf->state.elf64.ehdr = memcpy (&elf->state.elf64.ehdr_mem, e_ident,
+ sizeof (Elf64_Ehdr));
if (e_ident[EI_DATA] != MY_ELFDATA)
{
@@ -439,8 +384,6 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
CONVERT (elf->state.elf64.ehdr_mem.e_shstrndx);
}
- elf->state.elf64.ehdr = &elf->state.elf64.ehdr_mem;
-
for (size_t cnt = 0; cnt < scncnt; ++cnt)
{
elf->state.elf64.scns.data[cnt].index = cnt;
@@ -453,9 +396,6 @@ file_read_elf (int fildes, void *map_address, off_t offset, size_t maxsize,
elf->state.elf64.scns_last = &elf->state.elf64.scns;
}
- /* Make the class easily available. */
- elf->class = e_ident[EI_CLASS];
-
return elf;
}
@@ -469,15 +409,16 @@ __libelf_read_mmaped_file (int fildes, void *map_address, off_t offset,
files and archives. To find out what we have we must look at the
header. The header for an ELF file is EI_NIDENT bytes in size,
the header for an archive file SARMAG bytes long. */
- Elf_Kind kind;
+ unsigned char *e_ident = (unsigned char *) map_address + offset;
/* See what kind of object we have here. */
- kind = determine_kind (map_address + offset, maxsize);
+ Elf_Kind kind = determine_kind (e_ident, maxsize);
switch (kind)
{
case ELF_K_ELF:
- return file_read_elf (fildes, map_address, offset, maxsize, cmd, parent);
+ return file_read_elf (fildes, map_address, e_ident, offset, maxsize,
+ cmd, parent);
case ELF_K_AR:
return file_read_ar (fildes, map_address, offset, maxsize, cmd, parent);
@@ -499,25 +440,33 @@ read_unmmaped_file (int fildes, off_t offset, size_t maxsize, Elf_Cmd cmd,
{
/* We have to find out what kind of file this is. We handle ELF
files and archives. To find out what we have we must read the
- header. The header for an ELF file is EI_NIDENT bytes in size,
- the header for an archive file SARMAG bytes long. Read the
- maximum of these numbers.
+ header. The identification header for an ELF file is EI_NIDENT
+ bytes in size, but we read the whole ELF header since we will
+ need it anyway later. For archives the header in SARMAG bytes
+ long. Read the maximum of these numbers.
+
+ XXX We have to change this for the extended `ar' format some day.
- XXX We have to change this for the extended `ar' format some day. */
- unsigned char header[MAX (EI_NIDENT, SARMAG)];
- ssize_t nread;
- Elf_Kind kind;
+ Use a union to ensure alignment. We might later access the
+ memory as a ElfXX_Ehdr. */
+ union
+ {
+ Elf64_Ehdr ehdr;
+ unsigned char header[MAX (sizeof (Elf64_Ehdr), SARMAG)];
+ } mem;
/* Read the head of the file. */
- nread = pread (fildes, header, MIN (MAX (EI_NIDENT, SARMAG), maxsize),
- offset);
- if (nread == -1)
+ ssize_t nread = pread_retry (fildes, mem.header,
+ MIN (MAX (sizeof (Elf64_Ehdr), SARMAG),
+ maxsize),
+ offset);
+ if (unlikely (nread == -1))
/* We cannot even read the head of the file. Maybe FILDES is associated
with an unseekable device. This is nothing we can handle. */
return NULL;
/* See what kind of object we have here. */
- kind = determine_kind (header, nread);
+ Elf_Kind kind = determine_kind (mem.header, nread);
switch (kind)
{
@@ -526,9 +475,10 @@ read_unmmaped_file (int fildes, off_t offset, size_t maxsize, Elf_Cmd cmd,
case ELF_K_ELF:
/* Make sure at least the ELF header is contained in the file. */
- if (maxsize >= (header[EI_CLASS] == ELFCLASS32
- ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr)))
- return file_read_elf (fildes, NULL, offset, maxsize, cmd, parent);
+ if ((size_t) nread >= (mem.header[EI_CLASS] == ELFCLASS32
+ ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr)))
+ return file_read_elf (fildes, NULL, mem.header, offset, maxsize, cmd,
+ parent);
/* FALLTHROUGH */
default:
@@ -596,10 +546,11 @@ read_file (int fildes, off_t offset, size_t maxsize,
/* If we have the file in memory optimize the access. */
if (map_address != NULL)
{
- struct Elf *result;
+ assert (map_address != MAP_FAILED);
- result = __libelf_read_mmaped_file (fildes, map_address, offset, maxsize,
- cmd, parent);
+ struct Elf *result = __libelf_read_mmaped_file (fildes, map_address,
+ offset, maxsize, cmd,
+ parent);
/* If something went wrong during the initialization unmap the
memory if we mmaped here. */
@@ -643,8 +594,9 @@ read_long_names (Elf *elf)
else
{
/* Read the header from the file. */
- if (pread (elf->fildes, &hdrm, sizeof (hdrm),
- elf->start_offset + offset) != sizeof (hdrm))
+ if (unlikely (pread_retry (elf->fildes, &hdrm, sizeof (hdrm),
+ elf->start_offset + offset)
+ != sizeof (hdrm)))
return NULL;
hdr = &hdrm;
@@ -674,10 +626,10 @@ read_long_names (Elf *elf)
len);
else
{
- if ((size_t) pread (elf->fildes, newp, len,
- elf->start_offset + offset
- + sizeof (struct ar_hdr))
- != len)
+ if (unlikely ((size_t) pread_retry (elf->fildes, newp, len,
+ elf->start_offset + offset
+ + sizeof (struct ar_hdr))
+ != len))
{
/* We were not able to read all data. */
free (newp);
@@ -727,8 +679,8 @@ __libelf_next_arhdr (elf)
if (elf->map_address != NULL)
{
/* See whether this entry is in the file. */
- if (elf->state.ar.offset + sizeof (struct ar_hdr)
- > elf->start_offset + elf->maximum_size)
+ if (unlikely (elf->state.ar.offset + sizeof (struct ar_hdr)
+ > elf->start_offset + elf->maximum_size))
{
/* This record is not anymore in the file. */
__libelf_seterrno (ELF_E_RANGE);
@@ -740,10 +692,9 @@ __libelf_next_arhdr (elf)
{
ar_hdr = &elf->state.ar.ar_hdr;
- if (TEMP_FAILURE_RETRY (pread (elf->fildes, ar_hdr,
- sizeof (struct ar_hdr),
- elf->state.ar.offset))
- != sizeof (struct ar_hdr))
+ if (unlikely (pread_retry (elf->fildes, ar_hdr, sizeof (struct ar_hdr),
+ elf->state.ar.offset)
+ != sizeof (struct ar_hdr)))
{
/* Something went wrong while reading the file. */
__libelf_seterrno (ELF_E_RANGE);
@@ -752,7 +703,7 @@ __libelf_next_arhdr (elf)
}
/* One little consistency check. */
- if (memcmp (ar_hdr->ar_fmag, ARFMAG, 2) != 0)
+ if (unlikely (memcmp (ar_hdr->ar_fmag, ARFMAG, 2) != 0))
{
/* This is no valid archive. */
__libelf_seterrno (ELF_E_ARCHIVE_FMAG);
@@ -776,14 +727,14 @@ __libelf_next_arhdr (elf)
&& memcmp (ar_hdr->ar_name, "// ", 16) == 0)
/* This is the array with the long names. */
elf_ar_hdr->ar_name = memcpy (elf->state.ar.ar_name, "//", 3);
- else if (isdigit (ar_hdr->ar_name[1]))
+ else if (likely (isdigit (ar_hdr->ar_name[1])))
{
size_t offset;
/* This is a long name. First we have to read the long name
table, if this hasn't happened already. */
- if (elf->state.ar.long_names == NULL
- && read_long_names (elf) == NULL)
+ if (unlikely (elf->state.ar.long_names == NULL
+ && read_long_names (elf) == NULL))
{
/* No long name table although it is reference. The archive is
broken. */
@@ -792,7 +743,7 @@ __libelf_next_arhdr (elf)
}
offset = atol (ar_hdr->ar_name + 1);
- if (offset >= elf->state.ar.long_names_len)
+ if (unlikely (offset >= elf->state.ar.long_names_len))
{
/* The index in the long name table is larger than the table. */
__libelf_seterrno (ELF_E_INVALID_ARCHIVE);
@@ -906,7 +857,7 @@ __libelf_next_arhdr (elf)
if (ar_hdr->ar_size[sizeof (ar_hdr->ar_size) - 1] == ' ')
{
- if (ar_hdr->ar_size[0] == ' ')
+ if (unlikely (ar_hdr->ar_size[0] == ' '))
/* Something is really wrong. We cannot live without a size for
the member since it will not be possible to find the next
archive member. */
@@ -946,7 +897,7 @@ dup_elf (int fildes, Elf_Cmd cmd, Elf *ref)
fildes = ref->fildes;
/* The file descriptor better should be the same. If it was disconnected
already (using `elf_cntl') we do not test it. */
- else if (ref->fildes != -1 && fildes != ref->fildes)
+ else if (unlikely (ref->fildes != -1 && fildes != ref->fildes))
{
__libelf_seterrno (ELF_E_FD_MISMATCH);
return NULL;
@@ -955,10 +906,10 @@ dup_elf (int fildes, Elf_Cmd cmd, Elf *ref)
/* The mode must allow reading. I.e., a descriptor creating with a
command different then ELF_C_READ, ELF_C_WRITE and ELF_C_RDWR is
not allowed. */
- if (ref->cmd != ELF_C_READ && ref->cmd != ELF_C_READ_MMAP
- && ref->cmd != ELF_C_WRITE && ref->cmd != ELF_C_WRITE_MMAP
- && ref->cmd != ELF_C_RDWR && ref->cmd != ELF_C_RDWR_MMAP
- && ref->cmd != ELF_C_READ_MMAP_PRIVATE)
+ if (unlikely (ref->cmd != ELF_C_READ && ref->cmd != ELF_C_READ_MMAP
+ && ref->cmd != ELF_C_WRITE && ref->cmd != ELF_C_WRITE_MMAP
+ && ref->cmd != ELF_C_RDWR && ref->cmd != ELF_C_RDWR_MMAP
+ && ref->cmd != ELF_C_READ_MMAP_PRIVATE))
{
__libelf_seterrno (ELF_E_INVALID_OP);
return NULL;
@@ -1035,7 +986,7 @@ elf_begin (fildes, cmd, ref)
{
Elf *retval;
- if (! __libelf_version_initialized)
+ if (unlikely (! __libelf_version_initialized))
{
/* Version wasn't set so far. */
__libelf_seterrno (ELF_E_NO_VERSION);
@@ -1045,7 +996,7 @@ elf_begin (fildes, cmd, ref)
if (ref != NULL)
/* Make sure the descriptor is not suddenly going away. */
rwlock_rdlock (ref->lock);
- else if (fcntl (fildes, F_GETFL) == -1 && errno == EBADF)
+ else if (unlikely (fcntl (fildes, F_GETFL) == -1 && errno == EBADF))
{
/* We cannot do anything productive without a file descriptor. */
__libelf_seterrno (ELF_E_INVALID_FILE);
@@ -1061,7 +1012,7 @@ elf_begin (fildes, cmd, ref)
case ELF_C_READ_MMAP_PRIVATE:
/* If we have a reference it must also be opened this way. */
- if (ref != NULL && ref->cmd != ELF_C_READ_MMAP_PRIVATE)
+ if (unlikely (ref != NULL && ref->cmd != ELF_C_READ_MMAP_PRIVATE))
{
__libelf_seterrno (ELF_E_INVALID_CMD);
retval = NULL;
@@ -1085,8 +1036,9 @@ elf_begin (fildes, cmd, ref)
command. */
if (ref != NULL)
{
- if (ref->cmd != ELF_C_RDWR && ref->cmd != ELF_C_RDWR_MMAP
- && ref->cmd != ELF_C_WRITE && ref->cmd != ELF_C_WRITE_MMAP)
+ if (unlikely (ref->cmd != ELF_C_RDWR && ref->cmd != ELF_C_RDWR_MMAP
+ && ref->cmd != ELF_C_WRITE
+ && ref->cmd != ELF_C_WRITE_MMAP))
{
/* This is not ok. REF must also be opened for writing. */
__libelf_seterrno (ELF_E_INVALID_CMD);
diff --git a/elfutils/libelf/elf_getarsym.c b/elfutils/libelf/elf_getarsym.c
index 67b2697c..1af1b1dc 100644
--- a/elfutils/libelf/elf_getarsym.c
+++ b/elfutils/libelf/elf_getarsym.c
@@ -28,14 +28,11 @@
#include <string.h>
#include <unistd.h>
+#include <system.h>
#include <dl-hash.h>
#include "libelfP.h"
-#define pread_retry(fd, buf, len, off) \
- TEMP_FAILURE_RETRY (pread (fd, buf, len, off))
-
-
Elf_Arsym *
elf_getarsym (elf, ptr)
Elf *elf;
diff --git a/elfutils/libelf/elf_getdata.c b/elfutils/libelf/elf_getdata.c
index 20e8e624..a21d1f9b 100644
--- a/elfutils/libelf/elf_getdata.c
+++ b/elfutils/libelf/elf_getdata.c
@@ -19,11 +19,13 @@
# include <config.h>
#endif
+#include <errno.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include "libelfP.h"
+#include <system.h>
#include "common.h"
#include "elf-knowledge.h"
@@ -239,7 +241,7 @@ __libelf_set_rawdata (Elf_Scn *scn)
if (entsize == 0)
entsize = 1;
- if (size % entsize != 0)
+ if (unlikely (size % entsize != 0))
{
__libelf_seterrno (ELF_E_INVALID_DATA);
return 1;
@@ -250,7 +252,7 @@ __libelf_set_rawdata (Elf_Scn *scn)
{
/* First see whether the information in the section header is
valid and it does not ask for too much. */
- if (offset + size > elf->maximum_size)
+ if (unlikely (offset + size > elf->maximum_size))
{
/* Something is wrong. */
__libelf_seterrno (ELF_E_INVALID_SECTION_HEADER);
@@ -260,7 +262,7 @@ __libelf_set_rawdata (Elf_Scn *scn)
scn->rawdata_base = scn->rawdata.d.d_buf
= (char *) elf->map_address + elf->start_offset + offset;
}
- else if (elf->fildes != -1)
+ else if (likely (elf->fildes != -1))
{
/* We have to read the data from the file. Allocate the needed
memory. */
@@ -272,8 +274,9 @@ __libelf_set_rawdata (Elf_Scn *scn)
return 1;
}
- if ((size_t) pread (elf->fildes, scn->rawdata.d.d_buf, size,
- elf->start_offset + offset) != size)
+ ssize_t n = pread_retry (elf->fildes, scn->rawdata.d.d_buf, size,
+ elf->start_offset + offset);
+ if (unlikely ((size_t) n != size))
{
/* Cannot read the data. */
free (scn->rawdata.d.d_buf);
diff --git a/elfutils/libelf/elf_getshstrndx.c b/elfutils/libelf/elf_getshstrndx.c
index 706092b7..a765f4e3 100644
--- a/elfutils/libelf/elf_getshstrndx.c
+++ b/elfutils/libelf/elf_getshstrndx.c
@@ -1,5 +1,5 @@
/* Return section index of section header string table.
- Copyright (C) 2002 Red Hat, Inc.
+ Copyright (C) 2002, 2005 Red Hat, Inc.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
This program is free software; you can redistribute it and/or modify
@@ -20,10 +20,12 @@
#endif
#include <assert.h>
+#include <errno.h>
#include <gelf.h>
#include <stddef.h>
#include <unistd.h>
+#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -100,8 +102,9 @@ elf_getshstrndx (elf, dst)
the first one. */
Elf32_Shdr shdr_mem;
- if (pread (elf->fildes, &shdr_mem, sizeof (Elf32_Shdr),
- offset) != sizeof (Elf32_Shdr))
+ if (unlikely (pread_retry (elf->fildes, &shdr_mem,
+ sizeof (Elf32_Shdr), offset)
+ != sizeof (Elf32_Shdr)))
{
/* We must be able to read this ELF section header. */
__libelf_seterrno (ELF_E_INVALID_FILE);
@@ -116,15 +119,13 @@ elf_getshstrndx (elf, dst)
}
else
{
- size_t offset;
-
if (elf->state.elf64.scns.data[0].shdr.e64 != NULL)
{
num = elf->state.elf64.scns.data[0].shdr.e64->sh_link;
goto success;
}
- offset = elf->state.elf64.ehdr->e_shoff;
+ size_t offset = elf->state.elf64.ehdr->e_shoff;
if (elf->map_address != NULL
&& elf->state.elf64.ehdr->e_ident[EI_DATA] == MY_ELFDATA
@@ -139,8 +140,9 @@ elf_getshstrndx (elf, dst)
the first one. */
Elf64_Shdr shdr_mem;
- if (pread (elf->fildes, &shdr_mem, sizeof (Elf64_Shdr),
- offset) != sizeof (Elf64_Shdr))
+ if (unlikely (pread_retry (elf->fildes, &shdr_mem,
+ sizeof (Elf64_Shdr), offset)
+ != sizeof (Elf64_Shdr)))
{
/* We must be able to read this ELF section header. */
__libelf_seterrno (ELF_E_INVALID_FILE);
diff --git a/elfutils/libelf/elf_readall.c b/elfutils/libelf/elf_readall.c
index d36da270..efe44bf8 100644
--- a/elfutils/libelf/elf_readall.c
+++ b/elfutils/libelf/elf_readall.c
@@ -1,5 +1,5 @@
/* Read all of the file associated with the descriptor.
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Red Hat, Inc.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,10 @@
# include <config.h>
#endif
+#include <errno.h>
#include <unistd.h>
+#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -78,8 +80,10 @@ __libelf_readall (elf)
if (mem != NULL)
{
/* Read the file content. */
- if ((size_t) pread (elf->fildes, mem, elf->maximum_size,
- elf->start_offset) != elf->maximum_size)
+ if (unlikely ((size_t) pread_retry (elf->fildes, mem,
+ elf->maximum_size,
+ elf->start_offset)
+ != elf->maximum_size))
{
/* Something went wrong. */
__libelf_seterrno (ELF_E_READ_ERROR);
diff --git a/elfutils/libelf/gelf_rawchunk.c b/elfutils/libelf/gelf_rawchunk.c
index 667f3013..6e05c0d4 100644
--- a/elfutils/libelf/gelf_rawchunk.c
+++ b/elfutils/libelf/gelf_rawchunk.c
@@ -1,5 +1,5 @@
/* Retrieve uninterpreted chunk of the file contents.
- Copyright (C) 2002 Red Hat, Inc.
+ Copyright (C) 2002, 2005 Red Hat, Inc.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
This program is free software; you can redistribute it and/or modify
@@ -19,11 +19,13 @@
# include <config.h>
#endif
+#include <errno.h>
#include <libelf.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
+#include <system.h>
#include "libelfP.h"
@@ -40,9 +42,9 @@ gelf_rawchunk (elf, offset, size)
return NULL;
}
- if (offset >= elf->maximum_size
- || offset + size >= elf->maximum_size
- || offset + size < offset)
+ if (unlikely (offset >= elf->maximum_size
+ || offset + size >= elf->maximum_size
+ || offset + size < offset))
{
/* Invalid request. */
__libelf_seterrno (ELF_E_INVALID_OP);
@@ -59,8 +61,9 @@ gelf_rawchunk (elf, offset, size)
__libelf_seterrno (ELF_E_NOMEM);
else
/* Read the file content. */
- if ((size_t) pread (elf->fildes, result, size, elf->start_offset + offset)
- != size)
+ if (unlikely ((size_t) pread_retry (elf->fildes, result, size,
+ elf->start_offset + offset)
+ != size))
{
/* Something went wrong. */
__libelf_seterrno (ELF_E_READ_ERROR);
diff --git a/elfutils/m4/Makefile.in b/elfutils/m4/Makefile.in
index e8485283..9bba03fc 100644
--- a/elfutils/m4/Makefile.in
+++ b/elfutils/m4/Makefile.in
@@ -70,6 +70,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
diff --git a/elfutils/po/ChangeLog b/elfutils/po/ChangeLog
index cea77df8..118952bf 100644
--- a/elfutils/po/ChangeLog
+++ b/elfutils/po/ChangeLog
@@ -1,6 +1,10 @@
+2005-08-27 Ulrich Drepper <drepper@redhat.com>
+
+ * POTFILES.in: Add src/strings.c.
+
2005-08-15 Ulrich Drepper <drepper@redhat.com>
- * POTFILES.in: Add src/ranlib.
+ * POTFILES.in: Add src/ranlib.c.
2005-08-05 Ulrich Drepper <drepper@redhat.com>
diff --git a/elfutils/po/POTFILES.in b/elfutils/po/POTFILES.in
index c45ee76d..0e74aeb1 100644
--- a/elfutils/po/POTFILES.in
+++ b/elfutils/po/POTFILES.in
@@ -23,3 +23,4 @@ src/addr2line.c
src/findtextrel.c
src/elfcmp.c
src/ranlib.c
+src/strings.c
diff --git a/elfutils/po/elfutils.pot b/elfutils/po/elfutils.pot
index e4a11db9..dab6c0c3 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: \n"
-"POT-Creation-Date: 2005-08-24 14:41-0700\n"
+"POT-Creation-Date: 2005-09-02 13:30-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -275,6 +275,7 @@ msgid "Reverse the sense of the sort"
msgstr ""
#: src/nm.c:91 src/addr2line.c:56 src/findtextrel.c:61 src/elfcmp.c:59
+#: src/strings.c:71
msgid "Miscellaneous:"
msgstr ""
@@ -283,6 +284,7 @@ msgid "List symbols from FILEs (a.out by default)."
msgstr ""
#: src/nm.c:99 src/size.c:80 src/strip.c:84 src/findtextrel.c:70
+#: src/strings.c:80
msgid "[FILE...]"
msgstr ""
@@ -293,7 +295,7 @@ msgstr ""
#: src/nm.c:241 src/readelf.c:356 src/size.c:207 src/strip.c:191 src/ld.c:857
#: src/elflint.c:220 src/addr2line.c:168 src/findtextrel.c:156
-#: src/elfcmp.c:493 src/ranlib.c:139
+#: src/elfcmp.c:493 src/ranlib.c:134 src/strings.c:215
#, c-format
msgid ""
"Copyright (C) %s Red Hat, Inc.\n"
@@ -303,13 +305,13 @@ msgstr ""
#: src/nm.c:246 src/readelf.c:361 src/size.c:212 src/strip.c:196 src/ld.c:862
#: src/elflint.c:225 src/addr2line.c:173 src/findtextrel.c:161
-#: src/elfcmp.c:498 src/ranlib.c:144
+#: src/elfcmp.c:498 src/ranlib.c:139 src/strings.c:220
#, c-format
msgid "Written by %s.\n"
msgstr ""
#: src/nm.c:351 src/strip.c:418 src/strip.c:453 src/findtextrel.c:215
-#: src/ranlib.c:293
+#: src/ranlib.c:288 src/strings.c:171
#, c-format
msgid "cannot open '%s'"
msgstr ""
@@ -499,7 +501,7 @@ msgstr ""
msgid "No operation specified.\n"
msgstr ""
-#: src/readelf.c:416 src/elflint.c:283 src/ranlib.c:369
+#: src/readelf.c:416 src/elflint.c:283 src/ranlib.c:364
#, c-format
msgid " error while freeing sub-ELF descriptor: %s\n"
msgstr ""
@@ -3461,7 +3463,7 @@ msgstr ""
msgid "text relocation flag set but not needed\n"
msgstr ""
-#: src/addr2line.c:52
+#: src/addr2line.c:52 src/strings.c:58
msgid "Output Selection:"
msgstr ""
@@ -3498,7 +3500,7 @@ msgstr ""
msgid "Locate source of text relocations in FILEs (a.out by default)."
msgstr ""
-#: src/findtextrel.c:222 src/ranlib.c:310
+#: src/findtextrel.c:222 src/ranlib.c:305
#, c-format
msgid "cannot create ELF descriptor for '%s': %s"
msgstr ""
@@ -3710,35 +3712,95 @@ msgstr ""
msgid "cannot get relocation: %s"
msgstr ""
-#: src/ranlib.c:74
+#: src/ranlib.c:69
msgid "Generate an index to speed access to archives."
msgstr ""
-#: src/ranlib.c:77
+#: src/ranlib.c:72
msgid "ARCHIVE"
msgstr ""
-#: src/ranlib.c:119
+#: src/ranlib.c:114
#, c-format
msgid "Archive name required"
msgstr ""
-#: src/ranlib.c:175
+#: src/ranlib.c:170
#, c-format
msgid "the archive '%s' is too large"
msgstr ""
-#: src/ranlib.c:300
+#: src/ranlib.c:295
#, c-format
msgid "cannot stat '%s'"
msgstr ""
-#: src/ranlib.c:318
+#: src/ranlib.c:313
#, c-format
msgid "'%s' is no archive"
msgstr ""
-#: src/ranlib.c:397
+#: src/ranlib.c:392
#, c-format
msgid "cannot create new file"
msgstr ""
+
+#: src/strings.c:59
+msgid "Scan entire file, not only loaded sections"
+msgstr ""
+
+#: src/strings.c:61
+msgid "Only NUL-terminated sequences of MIN-LEN characters or more are printed"
+msgstr ""
+
+#: src/strings.c:62
+msgid ""
+"Select character size and endianess: s = 7-bit, S = 8-bit, {b,l} = 16-bit, "
+"{B,L} = 32-bit"
+msgstr ""
+
+#: src/strings.c:66
+msgid "Print name of the file before each string."
+msgstr ""
+
+#: src/strings.c:68
+msgid "Print location of the string in base 8, 10, or 16 respectively."
+msgstr ""
+
+#: src/strings.c:69
+msgid "Alias for --radix=o"
+msgstr ""
+
+#: src/strings.c:76
+msgid "Print the strings of printable characters in files."
+msgstr ""
+
+#: src/strings.c:256 src/strings.c:291
+#, c-format
+msgid "invalid value '%s' for %s parameter"
+msgstr ""
+
+#: src/strings.c:302
+#, c-format
+msgid "invalid minimum length of matched string size"
+msgstr ""
+
+#: src/strings.c:589
+#, c-format
+msgid "lseek64 failed"
+msgstr ""
+
+#: src/strings.c:604
+#, c-format
+msgid "re-mmap failed"
+msgstr ""
+
+#: src/strings.c:641
+#, c-format
+msgid "mprotect failed"
+msgstr ""
+
+#: src/strings.c:668
+#, c-format
+msgid "re=mmap failed"
+msgstr ""
diff --git a/elfutils/src/ChangeLog b/elfutils/src/ChangeLog
index 7707ac17..66b09544 100644
--- a/elfutils/src/ChangeLog
+++ b/elfutils/src/ChangeLog
@@ -1,3 +1,28 @@
+2005-09-02 Ulrich Drepper <drepper@redhat.com>
+
+ * strings.c (main): Reset elfmap variable afte rmunmap call.
+ [_MUDFLAP] (map_file): Simplify mudflap debugging by not using mmap.
+
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * ranlib.c: Don't define pread_retry and write_retry here.
+
+ * Makefile.an [BUILD_STATIC] (libdw): Add -ldl.
+ (CLEANFILES): Add *.gcno *.gcda *.gconv.
+
+ * strings.c (process_chunk): Reorder expressions in conditional
+ (process_chunk_mb): Likewise.
+
+ * strings.c: New file.
+ * Makefile.am (bin_PROGRAMS): Add strings.
+ (strings_no_Wstring): Define.
+ (strings_LDADD): Define.
+
+2005-08-27 Roland McGrath <roland@redhat.com>
+
+ * addr2line.c (dwarf_diename_integrate): Function removed.
+ (print_dwarf_function): Use plain dwarf_diename.
+
2005-08-24 Ulrich Drepper <drepper@redhat.com>
* elflint.c (check_versym): Versioned symbols should not have
diff --git a/elfutils/src/Makefile.am b/elfutils/src/Makefile.am
index 234d1b6f..1a489497 100644
--- a/elfutils/src/Makefile.am
+++ b/elfutils/src/Makefile.am
@@ -38,7 +38,7 @@ native_ld = @native_ld@
base_cpu = @base_cpu@
bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \
- elfcmp objdump ranlib
+ elfcmp objdump ranlib strings
ld_dsos = libld_elf_i386_pic.a
@@ -67,7 +67,7 @@ libmudflap = -lmudflap
endif
if BUILD_STATIC
-libdw = ../libdw/libdw.a $(libelf) $(libebl)
+libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl
libelf = ../libelf/libelf.a
else
libdw = ../libdw/libdw.so
@@ -78,6 +78,7 @@ libeu = ../lib/libeu.a
nm_no_Wformat = yes
size_no_Wformat = yes
+strings_no_Wformat = yes
# XXX While the file is not finished, don't warn about this
ldgeneric_no_Wunused = yes
@@ -96,6 +97,7 @@ addr2line_LDADD = $(libdw) $(libmudflap)
elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl
objdump_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
ranlib_LDADD = $(libelf) $(libeu) $(libmudflap)
+strings_LDADD = $(libelf) $(libeu) $(libmudflap)
ldlex.o: ldscript.c
ldlex_no_Werror = yes
@@ -146,4 +148,4 @@ installcheck-binPROGRAMS: $(bin_PROGRAMS)
done; \
done; rm -f c$${pid}_.???; exit $$bad
-CLEANFILES = none_ld.os $(ld_modules:.c=.os)
+CLEANFILES = none_ld.os $(ld_modules:.c=.os) *.gcno *.gcda *.gconv
diff --git a/elfutils/src/Makefile.in b/elfutils/src/Makefile.in
index 34e5eafd..2d7cadc4 100644
--- a/elfutils/src/Makefile.in
+++ b/elfutils/src/Makefile.in
@@ -41,7 +41,7 @@ host_triplet = @host@
bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEEXT) size$(EXEEXT) \
strip$(EXEEXT) ld$(EXEEXT) elflint$(EXEEXT) \
findtextrel$(EXEEXT) addr2line$(EXEEXT) elfcmp$(EXEEXT) \
- objdump$(EXEEXT) ranlib$(EXEEXT)
+ objdump$(EXEEXT) ranlib$(EXEEXT) strings$(EXEEXT)
@NATIVE_LD_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
@NATIVE_LD_TRUE@am__append_1 = libld_elf.a
subdir = src
@@ -125,6 +125,10 @@ size_SOURCES = size.c
size_OBJECTS = size.$(OBJEXT)
size_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_5) \
$(am__DEPENDENCIES_4)
+strings_SOURCES = strings.c
+strings_OBJECTS = strings.$(OBJEXT)
+strings_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_5) \
+ $(am__DEPENDENCIES_4)
strip_SOURCES = strip.c
strip_OBJECTS = strip.$(OBJEXT)
strip_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
@@ -141,11 +145,11 @@ YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \
addr2line.c elfcmp.c elflint.c findtextrel.c $(ld_SOURCES) \
$(libld_elf_i386_so_SOURCES) nm.c objdump.c ranlib.c readelf.c \
- size.c strip.c
+ size.c strings.c strip.c
DIST_SOURCES = $(libld_elf_a_SOURCES) $(libld_elf_i386_pic_a_SOURCES) \
addr2line.c elfcmp.c elflint.c findtextrel.c $(ld_SOURCES) \
$(libld_elf_i386_so_SOURCES) nm.c objdump.c ranlib.c readelf.c \
- size.c strip.c
+ size.c strings.c strip.c
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -174,6 +178,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
@@ -286,13 +292,14 @@ EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules)
ld_modules = i386_ld.c
@MUDFLAP_TRUE@libmudflap = -lmudflap
@BUILD_STATIC_FALSE@libdw = ../libdw/libdw.so
-@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(libelf) $(libebl)
+@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl
@BUILD_STATIC_FALSE@libelf = ../libelf/libelf.so
@BUILD_STATIC_TRUE@libelf = ../libelf/libelf.a
libebl = ../libebl/libebl.a
libeu = ../lib/libeu.a
nm_no_Wformat = yes
size_no_Wformat = yes
+strings_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
@@ -308,6 +315,7 @@ addr2line_LDADD = $(libdw) $(libmudflap)
elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl
objdump_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
ranlib_LDADD = $(libelf) $(libeu) $(libmudflap)
+strings_LDADD = $(libelf) $(libeu) $(libmudflap)
ldlex_no_Werror = yes
# Machine-specific linker code.
@@ -315,7 +323,7 @@ libld_elf_a_SOURCES = $(base_cpu)_ld.c
libld_elf_i386_pic_a_SOURCES =
am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os
libld_elf_i386_so_SOURCES =
-CLEANFILES = none_ld.os $(ld_modules:.c=.os)
+CLEANFILES = none_ld.os $(ld_modules:.c=.os) *.gcno *.gcda *.gconv
all: all-am
.SUFFIXES:
@@ -416,6 +424,9 @@ readelf$(EXEEXT): $(readelf_OBJECTS) $(readelf_DEPENDENCIES)
size$(EXEEXT): $(size_OBJECTS) $(size_DEPENDENCIES)
@rm -f size$(EXEEXT)
$(LINK) $(size_LDFLAGS) $(size_OBJECTS) $(size_LDADD) $(LIBS)
+strings$(EXEEXT): $(strings_OBJECTS) $(strings_DEPENDENCIES)
+ @rm -f strings$(EXEEXT)
+ $(LINK) $(strings_LDFLAGS) $(strings_OBJECTS) $(strings_LDADD) $(LIBS)
strip$(EXEEXT): $(strip_OBJECTS) $(strip_DEPENDENCIES)
@rm -f strip$(EXEEXT)
$(LINK) $(strip_LDFLAGS) $(strip_OBJECTS) $(strip_LDADD) $(LIBS)
@@ -441,6 +452,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readelf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sectionhash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/size.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strings.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbolhash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/versionhash.Po@am__quote@
diff --git a/elfutils/src/addr2line.c b/elfutils/src/addr2line.c
index 97eaed10..f79dc5f3 100644
--- a/elfutils/src/addr2line.c
+++ b/elfutils/src/addr2line.c
@@ -206,13 +206,6 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
}
-static const char *
-dwarf_diename_integrate (Dwarf_Die *die)
-{
- Dwarf_Attribute attr_mem;
- return dwarf_formstring (dwarf_attr_integrate (die, DW_AT_name, &attr_mem));
-}
-
static bool
print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr)
{
@@ -229,7 +222,7 @@ print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr)
{
case DW_TAG_subprogram:
{
- const char *name = dwarf_diename_integrate (&scopes[i]);
+ const char *name = dwarf_diename (&scopes[i]);
if (name == NULL)
return false;
puts (name);
@@ -238,7 +231,7 @@ print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr)
case DW_TAG_inlined_subroutine:
{
- const char *name = dwarf_diename_integrate (&scopes[i]);
+ const char *name = dwarf_diename (&scopes[i]);
if (name == NULL)
return false;
printf ("%s inlined", name);
diff --git a/elfutils/src/ranlib.c b/elfutils/src/ranlib.c
index ce2e6820..1914a178 100644
--- a/elfutils/src/ranlib.c
+++ b/elfutils/src/ranlib.c
@@ -40,11 +40,6 @@
#include <system.h>
-#define pread_retry(fd, buf, n, off) \
- TEMP_FAILURE_RETRY (pread (fd, buf, n, off))
-#define write_retry(fd, buf, n) \
- TEMP_FAILURE_RETRY (write (fd, buf, n))
-
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define le_bswap_32(val) bswap_32 (val)
#else
diff --git a/elfutils/src/strings.c b/elfutils/src/strings.c
new file mode 100644
index 00000000..d9434c92
--- /dev/null
+++ b/elfutils/src/strings.c
@@ -0,0 +1,729 @@
+/* Print the strings of printable characters in files.
+ Copyright (C) 2005 Red Hat, Inc.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2005.
+
+ This program is Open Source software; you can redistribute it and/or
+ modify it under the terms of the Open Software License version 1.0 as
+ published by the Open Source Initiative.
+
+ You should have received a copy of the Open Software License along
+ with this program; if not, you may obtain a copy of the Open Software
+ License version 1.0 from http://www.opensource.org/licenses/osl.php or
+ by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
+ 3001 King Ranch Road, Ukiah, CA 95482. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <argp.h>
+#include <assert.h>
+#include <ctype.h>
+#include <endian.h>
+#include <errno.h>
+#include <error.h>
+#include <fcntl.h>
+#include <gelf.h>
+#include <inttypes.h>
+#include <libintl.h>
+#include <locale.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <system.h>
+
+
+/* Prototypes of local functions. */
+static int read_fd (int fd, const char *fname, off64_t fdlen);
+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;
+
+/* Bug report address. */
+const char *argp_program_bug_address = 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_("Scan entire file, not only loaded sections"), 0 },
+ { "bytes", 'n', "MIN-LEN", 0,
+ N_("Only NUL-terminated sequences of MIN-LEN characters or more are printed"), 0 },
+ { "encoding", 'e', "SELECTOR", 0, N_("\
+Select character size and endianess: s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit"),
+ 0},
+ { "print-file-name", 'f', NULL, 0,
+ N_("Print name of the file before each string."), 0 },
+ { "radix", 't', "{o,d,x}", 0,
+ N_("Print location of the string in base 8, 10, or 16 respectively."), 0 },
+ { NULL, 'o', NULL, 0, N_("Alias for --radix=o"), 0 },
+
+ { NULL, 0, NULL, 0, N_("Miscellaneous:"), 0 },
+ { NULL, 0, NULL, 0, NULL, 0 }
+};
+
+/* Short description of program. */
+static const char doc[] = N_("\
+Print the strings of printable characters in files.");
+
+/* Strings for arguments in help texts. */
+static const char args_doc[] = N_("[FILE...]");
+
+/* Prototype for option handler. */
+static error_t parse_opt (int key, char *arg, struct argp_state *state);
+
+/* Data structure to communicate with argp functions. */
+static struct argp argp =
+{
+ options, parse_opt, args_doc, doc, NULL, NULL, NULL
+};
+
+
+/* Global variables. */
+
+/* True if whole file and not only loaded sections are looked at. */
+static bool entire_file;
+
+/* Minimum length of any sequence reported. */
+static size_t min_len = 4;
+
+/* Number of bytes per character. */
+static size_t bytes_per_char = 1;
+
+/* Minimum length of any sequence reported in bytes. */
+static size_t min_len_bytes;
+
+/* True if multibyte characters are in big-endian order. */
+static bool big_endian;
+
+/* True unless 7-bit ASCII are expected. */
+static bool char_7bit;
+
+/* True if file names should be printed before strings. */
+static bool print_file_name;
+
+/* Location print format string. */
+static const char *locfmt;
+
+/* Page size in use. */
+static size_t ps;
+
+
+/* Mapped parts of the ELF file. */
+static unsigned char *elfmap;
+static unsigned char *elfmap_base;
+static size_t elfmap_size;
+static off64_t elfmap_off;
+
+
+int
+main (int argc, char *argv[])
+{
+ /* We use no threads. */
+ __fsetlocking (stdin, FSETLOCKING_BYCALLER);
+ __fsetlocking (stdout, FSETLOCKING_BYCALLER);
+
+ /* Set locale. */
+ (void) setlocale (LC_ALL, "");
+
+ /* Make sure the message catalog can be found. */
+ (void) bindtextdomain (PACKAGE, LOCALEDIR);
+
+ /* Initialize the message catalog. */
+ (void) textdomain (PACKAGE);
+
+ /* Parse and process arguments. */
+ int remaining;
+ (void) argp_parse (&argp, argc, argv, 0, &remaining, NULL);
+
+ /* Tell the library which version we are expecting. */
+ elf_version (EV_CURRENT);
+
+ /* Determine the page size. We will likely need it a couple of times. */
+ ps = sysconf (_SC_PAGESIZE);
+
+ struct stat64 st;
+ int result = 0;
+ if (remaining == argc)
+ /* We read from standard input. This we cannot do for a
+ structured file. */
+ result = read_fd (STDOUT_FILENO,
+ print_file_name ? "{standard input}" : NULL,
+ fstat64 (STDOUT_FILENO, &st) == 0
+ ? st.st_size : INT64_C (0x7fffffffffffffff));
+ else
+ do
+ {
+ int fd = (strcmp (argv[remaining], "-") == 0
+ ? STDIN_FILENO : open (argv[remaining], O_RDONLY));
+ if (unlikely (fd == -1))
+ {
+ error (0, errno, gettext ("cannot open '%s'"), argv[remaining]);
+ result = 1;
+ }
+ else
+ {
+ const char *fname = print_file_name ? argv[remaining] : NULL;
+ int fstat_fail = fstat64 (fd, &st);
+ off64_t fdlen = (fstat_fail
+ ? INT64_C (0x7fffffffffffffff) : st.st_size);
+ if (fdlen > (off64_t) min_len_bytes)
+ {
+ Elf *elf = NULL;
+ if (entire_file
+ || fstat_fail
+ || !S_ISREG (st.st_mode)
+ || (elf = elf_begin (fd, ELF_C_READ, NULL)) == NULL
+ || elf_kind (elf) != ELF_K_ELF)
+ result |= read_fd (fd, fname, fdlen);
+ else
+ result |= read_elf (elf, fd, fname, fdlen);
+
+ /* This call will succeed even if ELF is NULL. */
+ elf_end (elf);
+ }
+
+ if (strcmp (argv[remaining], "-") != 0)
+ close (fd);
+ }
+
+ if (elfmap != NULL && elfmap != MAP_FAILED)
+ munmap (elfmap, elfmap_size);
+ elfmap = NULL;
+ }
+ while (++remaining < argc);
+
+ return result;
+}
+
+
+/* Print the version information. */
+static void
+print_version (FILE *stream, struct argp_state *state __attribute__ ((unused)))
+{
+ fprintf (stream, "strings (%s) %s\n", PACKAGE_NAME, VERSION);
+ fprintf (stream, gettext ("\
+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\
+"), "2005");
+ fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
+}
+
+
+/* Handle program arguments. */
+static error_t
+parse_opt (int key, char *arg,
+ struct argp_state *state __attribute__ ((unused)))
+{
+ switch (key)
+ {
+ case 'a':
+ entire_file = true;
+ break;
+
+ case 'e':
+ /* We expect a string of one character. */
+ switch (arg[1] != '\0' ? '\0' : arg[0])
+ {
+ case 's':
+ case 'S':
+ char_7bit = arg[0] == 's';
+ bytes_per_char = 1;
+ break;
+
+ case 'b':
+ case 'B':
+ big_endian = true;
+ /* FALLTHROUGH */
+
+ case 'l':
+ case 'L':
+ bytes_per_char = isupper (arg[0]) ? 4 : 2;
+ break;
+
+ default:
+ error (0, 0, gettext ("invalid value '%s' for %s parameter"),
+ arg, "-e");
+ argp_help (&argp, stderr, ARGP_HELP_SEE, "strings");
+ return ARGP_ERR_UNKNOWN;
+ }
+ break;
+
+ case 'f':
+ print_file_name = true;
+ break;
+
+ case 'n':
+ min_len = atoi (arg);
+ break;
+
+ case 'o':
+ goto octfmt;
+
+ case 't':
+ switch (arg[0])
+ {
+ case 'd':
+ locfmt = "%7" PRId64 " ";
+ break;
+
+ case 'o':
+ octfmt:
+ locfmt = "%7" PRIo64 " ";
+ break;
+
+ case 'x':
+ locfmt = "%7" PRIx64 " ";
+ break;
+
+ default:
+ error (0, 0, gettext ("invalid value '%s' for %s parameter"),
+ arg, "-t");
+ argp_help (&argp, stderr, ARGP_HELP_SEE, "strings");
+ return ARGP_ERR_UNKNOWN;
+ }
+ break;
+
+ case ARGP_KEY_FINI:
+ /* Compute the length in bytes of any match. */
+ if (min_len <= 0 || min_len > INT_MAX / bytes_per_char)
+ error (EXIT_FAILURE, 0,
+ gettext ("invalid minimum length of matched string size"));
+ min_len_bytes = min_len * bytes_per_char;
+ break;
+
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+ return 0;
+}
+
+
+static void
+process_chunk_mb (const char *fname, const unsigned char *buf, off64_t to,
+ size_t len, char **unprinted)
+{
+ size_t curlen = *unprinted == NULL ? 0 : strlen (*unprinted);
+ const unsigned char *start = buf;
+ while (len >= bytes_per_char)
+ {
+ uint32_t ch;
+
+ if (bytes_per_char == 2)
+ {
+ if (big_endian)
+ ch = buf[0] << 8 | buf[1];
+ else
+ ch = buf[1] << 8 | buf[0];
+ }
+ else
+ {
+ if (big_endian)
+ ch = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
+ else
+ ch = buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0];
+ }
+
+ if (ch <= 255 && (isprint (ch) || ch == '\t'))
+ {
+ ++buf;
+ ++curlen;
+ }
+ else
+ {
+ if (curlen >= min_len)
+ {
+ /* We found a match. */
+ if (unlikely (fname != NULL))
+ {
+ fputs_unlocked (fname, stdout);
+ fputs_unlocked (": ", stdout);
+ }
+
+ if (unlikely (locfmt != NULL))
+ printf (locfmt, (int64_t) to - len - (buf - start));
+
+ if (unlikely (*unprinted != NULL))
+ {
+ fputs_unlocked (*unprinted, stdout);
+ free (*unprinted);
+ *unprinted = NULL;
+ }
+
+ /* There is no sane way of printing the string. If we
+ assume the file data is encoded in UCS-2/UTF-16 or
+ UCS-4/UTF-32 respectively we could covert the string.
+ But there is no such guarantee. */
+ fwrite_unlocked (start, 1, buf - start, stdout);
+ putc_unlocked ('\n', stdout);
+ }
+
+ start = ++buf;
+ curlen = 0;
+
+ if (len <= min_len)
+ break;
+ }
+
+ --len;
+ }
+
+ if (curlen != 0)
+ *unprinted = xstrndup ((const char *) start, curlen);
+}
+
+
+static void
+process_chunk (const char *fname, const unsigned char *buf, off64_t to,
+ size_t len, char **unprinted)
+{
+ /* We are not going to slow the check down for the 2- and 4-byte
+ encodings. Handle them special. */
+ if (unlikely (bytes_per_char != 1))
+ {
+ process_chunk_mb (fname, buf, to, len, unprinted);
+ return;
+ }
+
+ size_t curlen = *unprinted == NULL ? 0 : strlen (*unprinted);
+ const unsigned char *start = buf;
+ while (len > 0)
+ {
+ if ((isprint (*buf) || *buf == '\t') && (! char_7bit || *buf <= 127))
+ {
+ ++buf;
+ ++curlen;
+ }
+ else
+ {
+ if (curlen >= min_len)
+ {
+ /* We found a match. */
+ if (unlikely (fname != NULL))
+ {
+ fputs_unlocked (fname, stdout);
+ fputs_unlocked (": ", stdout);
+ }
+
+ if (unlikely (locfmt != NULL))
+ printf (locfmt, (int64_t) to - len - (buf - start));
+
+ if (unlikely (*unprinted != NULL))
+ {
+ fputs_unlocked (*unprinted, stdout);
+ free (*unprinted);
+ *unprinted = NULL;
+ }
+ fwrite_unlocked (start, 1, buf - start, stdout);
+ putc_unlocked ('\n', stdout);
+ }
+
+ start = ++buf;
+ curlen = 0;
+
+ if (len <= min_len)
+ break;
+ }
+
+ --len;
+ }
+
+ if (curlen != 0)
+ *unprinted = xstrndup ((const char *) start, curlen);
+}
+
+
+/* Map a file in as large chunks as possible. */
+static void *
+map_file (int fd, off64_t start_off, off64_t fdlen, size_t *map_sizep)
+{
+#if _MUDFLAP
+ (void) fd;
+ (void) start_off;
+ (void) fdlen;
+ (void) map_sizep;
+ return MAP_FAILED;
+#else
+ /* Maximum size we mmap. We use an #ifdef to avoid overflows on
+ 32-bit machines. 64-bit machines these days do not have usable
+ address spaces larger than about 43 bits. Not that any file
+ should be that large. */
+# if SIZE_MAX > 0xffffffff
+ const size_t mmap_max = 0x4000000000lu;
+# else
+ const size_t mmap_max = 0x40000000lu;
+# endif
+
+ /* Try to mmap the file. */
+ size_t map_size = MIN ((off64_t) mmap_max, fdlen);
+ const size_t map_size_min = MAX (MAX (SIZE_MAX / 16, 2 * ps),
+ roundup (2 * min_len_bytes + 1, ps));
+ void *mem;
+ while (1)
+ {
+ /* We map the memory for reading only here. Since we will
+ always look at every byte of the file it makes sense to
+ use MAP_POPULATE. */
+ mem = mmap64 (NULL, map_size, PROT_READ, MAP_PRIVATE | MAP_POPULATE,
+ fd, start_off);
+ if (mem != MAP_FAILED)
+ {
+ /* We will go through the mapping sequentially. */
+ (void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL);
+ break;
+ }
+ if (errno != EINVAL && errno != ENOMEM)
+ /* This is an error other than the lack of address space. */
+ break;
+
+ /* Maybe the size of the mapping is too big. Try again. */
+ map_size /= 2;
+ if (map_size < map_size_min)
+ /* That size should have fit. */
+ break;
+ }
+
+ *map_sizep = map_size;
+ return mem;
+#endif
+}
+
+
+/* Read the file without mapping. */
+static int
+read_block_no_mmap (int fd, const char *fname, off64_t from, off64_t fdlen)
+{
+ char *unprinted = NULL;
+#define CHUNKSIZE 65536
+ unsigned char *buf = xmalloc (CHUNKSIZE + min_len_bytes
+ + bytes_per_char - 1);
+ size_t ntrailer = 0;
+ int result = 0;
+ while (fdlen > 0)
+ {
+ ssize_t n = TEMP_FAILURE_RETRY (read (fd, buf + ntrailer,
+ MIN (fdlen, CHUNKSIZE)));
+ if (n == 0)
+ {
+ /* There are less than MIN_LEN+1 bytes left so there cannot be
+ another match. */
+ assert (unprinted == NULL || ntrailer == 0);
+ break;
+ }
+ if (unlikely (n < 0))
+ {
+ /* Something went wrong. */
+ result = 1;
+ break;
+ }
+
+ /* Account for the number of bytes read in this round. */
+ fdlen -= n;
+
+ /* Do not use the signed N value. Note that the addition cannot
+ overflow. */
+ size_t nb = (size_t) n + ntrailer;
+ if (nb >= min_len_bytes)
+ {
+ /* We only use complete charactesr. */
+ nb &= ~(bytes_per_char - 1);
+
+ process_chunk (fname, buf, from + nb, nb, &unprinted);
+
+ /* If the last bytes of the buffer (module the character
+ size) have been printed we are not copying them. */
+ size_t to_keep = unprinted != NULL ? 0 : min_len_bytes;
+
+ memmove (buf, buf + nb - to_keep, to_keep + nb);
+ ntrailer = to_keep + nb;
+ from += nb;
+ }
+ else
+ ntrailer = nb;
+ }
+
+ free (buf);
+
+ /* Don't print anything we collected so far. There is no
+ terminating NUL byte. */
+ free (unprinted);
+
+ return result;
+}
+
+
+static int
+read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to)
+{
+ assert ((off64_t) min_len_bytes < fdlen);
+
+ if (elfmap == NULL)
+ {
+ /* We need a completely new mapping. */
+ elfmap_off = from & ~(ps - 1);
+ elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
+
+ if (unlikely (elfmap == MAP_FAILED))
+ /* Let the kernel know we are going to read everything in sequence. */
+ (void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
+ }
+
+ if (unlikely (elfmap == MAP_FAILED))
+ {
+ /* Read from the file descriptor. For this we must position the
+ read pointer. */
+ // XXX Eventually add flag which avoids this if the position
+ // XXX is known to match.
+ if (lseek64 (fd, from, SEEK_SET) != from)
+ error (EXIT_FAILURE, errno, gettext ("lseek64 failed"));
+
+ return read_block_no_mmap (fd, fname, from, to - from);
+ }
+
+ if (to < (off64_t) elfmap_off || from > (off64_t) (elfmap_off + elfmap_size))
+ {
+ /* The existing mapping cannot fit at all. Map the new area.
+ We always map the full range of ELFMAP_SIZE bytes even if
+ this extend beyond the end of the file. The Linux kernel
+ handles this OK if the access pages are not touched. */
+ elfmap_off = from & ~(ps - 1);
+ if (mmap64 (elfmap, elfmap_size, PROT_READ,
+ MAP_PRIVATE | MAP_POPULATE | MAP_FIXED, fd, from)
+ == MAP_FAILED)
+ error (EXIT_FAILURE, errno, gettext ("re-mmap failed"));
+ elfmap_base = elfmap;
+ }
+
+ char *unprinted = NULL;
+
+ /* Use the existing mapping as much as possible. If necessary, map
+ new pages. */
+ if (from >= (off64_t) elfmap_off
+ && from < (off64_t) (elfmap_off + elfmap_size))
+ /* There are at least a few bytes in this mapping which we can
+ use. */
+ process_chunk (fname, elfmap_base + (from - elfmap_off),
+ MIN (to, (off64_t) (elfmap_off + elfmap_size)),
+ MIN (to, (off64_t) (elfmap_off + elfmap_size)) - from,
+ &unprinted);
+
+ if (to > (off64_t) (elfmap_off + elfmap_size))
+ {
+ unsigned char *remap_base = elfmap_base;
+ size_t read_now = elfmap_size - (elfmap_base - elfmap);
+
+ assert (from >= (off64_t) elfmap_off
+ && from < (off64_t) (elfmap_off + elfmap_size));
+ off64_t handled_to = elfmap_off + elfmap_size;
+ assert (elfmap == elfmap_base
+ || (elfmap_base - elfmap
+ == (ptrdiff_t) ((min_len_bytes + ps - 1) & ~(ps - 1))));
+ if (elfmap == elfmap_base)
+ {
+ size_t keep_area = (min_len_bytes + ps - 1) & ~(ps - 1);
+ assert (elfmap_size >= keep_area + ps);
+ /* The keep area is used for the content of the previous
+ buffer we have to keep. This means copying those bytes
+ and for this we have to make the data writable. */
+ if (unlikely (mprotect (elfmap, keep_area, PROT_READ | PROT_WRITE)
+ != 0))
+ error (EXIT_FAILURE, errno, gettext ("mprotect failed"));
+
+ elfmap_base = elfmap + keep_area;
+ }
+
+ while (1)
+ {
+ /* Map the rest of the file, eventually again in pieces.
+ We speed things up with a nice Linux feature. Note
+ that we have at least two pages mapped. */
+ size_t to_keep = unprinted != NULL ? 0 : min_len_bytes;
+
+ assert (read_now >= to_keep);
+ memmove (elfmap_base - to_keep,
+ remap_base + read_now - to_keep, to_keep);
+ remap_base = elfmap_base;
+
+ assert ((elfmap_size - (elfmap_base - elfmap)) % bytes_per_char
+ == 0);
+ read_now = MIN (to - handled_to,
+ (ptrdiff_t) elfmap_size - (elfmap_base - elfmap));
+
+ assert (handled_to % ps == 0);
+ assert (handled_to % bytes_per_char == 0);
+ 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"));
+ elfmap_off = handled_to;
+
+ process_chunk (fname, remap_base - to_keep,
+ elfmap_off + (read_now & ~(bytes_per_char - 1)),
+ to_keep + (read_now & ~(bytes_per_char - 1)),
+ &unprinted);
+ handled_to += read_now;
+ if (handled_to >= to)
+ break;
+ }
+ }
+
+ /* Don't print anything we collected so far. There is no
+ terminating NUL byte. */
+ free (unprinted);
+
+ return 0;
+}
+
+
+static int
+read_fd (int fd, const char *fname, off64_t fdlen)
+{
+ return read_block (fd, fname, fdlen, 0, fdlen);
+}
+
+
+static int
+read_elf (Elf *elf, int fd, const char *fname, off64_t fdlen)
+{
+ assert (fdlen >= 0);
+
+ /* We will look at each section separately. The ELF file is not
+ mmapped. The libelf implementation will load the needed parts on
+ demand. Since we only interate over the section header table the
+ memory consumption at this stage is kept minimal. */
+ Elf_Scn *scn = elf_nextscn (elf, NULL);
+ if (scn == NULL)
+ return read_fd (fd, fname, fdlen);
+
+ int result = 0;
+ do
+ {
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+
+ /* Only look in sections which are loaded at runtime and
+ actually have content. */
+ if (shdr != NULL && shdr->sh_type != SHT_NOBITS
+ && (shdr->sh_flags & SHF_ALLOC) != 0)
+ result |= read_block (fd, fname, fdlen, shdr->sh_offset,
+ shdr->sh_offset + shdr->sh_size);
+ }
+ while ((scn = elf_nextscn (elf, scn)) != NULL);
+
+ if (elfmap != NULL && elfmap != MAP_FAILED)
+ munmap (elfmap, elfmap_size);
+ elfmap = NULL;
+
+ return result;
+}
diff --git a/elfutils/tests/ChangeLog b/elfutils/tests/ChangeLog
index 176f6b23..ec47a31d 100644
--- a/elfutils/tests/ChangeLog
+++ b/elfutils/tests/ChangeLog
@@ -1,3 +1,78 @@
+2005-09-02 Ulrich Drepper <drepper@redhat.com>
+
+ * run-strings-test.sh: Remove strings.out in the end.
+
+2005-08-31 Ulrich Drepper <drepper@redhat.com>
+
+ * run-addrscopes.sh: Use correct exit code if test cannot be performed.
+ * run-allfcts.sh: Likewise.
+ * run-ecp-test.sh: Likewise.
+ * run-ecp-test2.sh: Likewise.
+ * run-elflint-test.sh: Likewise.
+ * run-funcscopes.sh: Likewise.
+ * run-get-aranges.sh: Likewise.
+ * run-get-files.sh: Likewise.
+ * run-get-lines.sh: Likewise.
+ * run-get-pubnames.sh: Likewise.
+ * run-line2addr.sh: Likewise.
+ * run-ranlib-test2.sh: Likewise.
+ * run-show-abbrev.sh: Likewise.
+ * run-show-ciefde.sh: Likewise.
+ * run-show-die-info.sh: Likewise.
+ * run-strings-test.sh: Likewise.
+ * run-strip-test.sh: Likewise.
+
+2005-08-30 Ulrich Drepper <drepper@redhat.com>
+
+ * coverage.sh: Handle case where there is no .gcno file at all.
+
+2005-08-29 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.am (EXTRA_DIST): Add coverage.
+ [GCOV]: Generate coverage summary after the tests ran
+ * coverage.sh: New file.
+
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * Makefile.an [BUILD_STATIC] (libdw): Add -ldl.
+ (CLEANFILES): Add *.gcno *.gcda *.gconv.
+
+2005-08-28 Ulrich Drepper <drepper@redhat.com>
+
+ * run-strings-test.sh: New file.
+ * Makefile.am (TESTS, EXTRA_DIST): Add it.
+
+2005-08-27 Roland McGrath <roland@redhat.com>
+
+ * addrscopes.c (handle_address): Apply bias to PC addresses.
+
+ * run-funcscopes.sh: New file.
+ * testfile25.bz2: New data file.
+ * Makefile.am (TESTS, EXTRA_DIST): Add them.
+
+2005-08-26 Roland McGrath <roland@redhat.com>
+
+ * addrscopes.c (dwarf_diename_integrate): Removed.
+ (print_vars, handle_address): Use plain dwarf_diename.
+
+2005-08-25 Roland McGrath <roland@redhat.com>
+
+ * funcscopes.c: New file.
+ * Makefile.am (noinst_PROGRAMS): Add it.
+ (funcscopes_LDADD): New variable.
+
+ * run-addrscopes.sh: Add another case.
+ * testfile24.bz2: New data file.
+ * Makefile.am (EXTRA_DIST): Add it.
+
+ * addrscopes.c (handle_address): Take new argument IGNORE_INLINES,
+ pass it to dwarf_getscopes.
+ (main): Pass it, true when '=' follows an address.
+
+2005-08-24 Roland McGrath <roland@redhat.com>
+
+ * line2addr.c (print_address): Omit () for DSOs.
+
2005-08-24 Ulrich Drepper <drepper@redhat.com>
* run-line2addr.sh: Remove testfile23 in the end.
diff --git a/elfutils/tests/Makefile.am b/elfutils/tests/Makefile.am
index b4cc1b04..119e11d7 100644
--- a/elfutils/tests/Makefile.am
+++ b/elfutils/tests/Makefile.am
@@ -30,7 +30,7 @@ INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \
noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
showptable update1 update2 update3 update4 test-nlist \
show-die-info get-files get-lines get-pubnames \
- get-aranges allfcts line2addr addrscopes \
+ get-aranges allfcts line2addr addrscopes funcscopes \
show-abbrev hash asm-tst1 asm-tst2 asm-tst3 \
asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \
msg_tst newscn ecp dwflmodtest
@@ -47,7 +47,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-strip-test6.sh run-ecp-test.sh run-ecp-test2.sh \
run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \
run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \
- run-addrscopes.sh
+ run-addrscopes.sh run-strings-test.sh run-funcscopes.sh
# run-show-ciefde.sh
EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
@@ -63,14 +63,15 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \
run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \
run-ranlib-test3.sh run-ranlib-test4.sh \
- run-addrscopes.sh \
+ run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \
testfile15.bz2 testfile15.debug.bz2 \
testfile16.bz2 testfile16.debug.bz2 \
testfile17.bz2 testfile17.debug.bz2 \
testfile18.bz2 testfile19.bz2 testfile19.index.bz2 \
testfile20.bz2 testfile20.index.bz2 \
testfile21.bz2 testfile21.index.bz2 \
- testfile22.bz2 testfile23.bz2
+ testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2 \
+ coverage.sh
if MUDFLAP
static_build=yes
@@ -78,7 +79,7 @@ libmudflap = -lmudflap
endif
if BUILD_STATIC
-libdw = ../libdw/libdw.a $(libelf) $(libebl)
+libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl
libelf = ../libelf/libelf.a
libasm = ../libasm/libasm.a
else
@@ -114,6 +115,7 @@ allfcts_LDADD = $(libdw) $(libelf) $(libmudflap)
line2addr_no_Wformat = yes
line2addr_LDADD = $(libdw) $(libmudflap)
addrscopes_LDADD = $(libdw) $(libmudflap)
+funcscopes_LDADD = $(libdw) $(libmudflap)
#show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) $(libmudflap)
asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
@@ -126,4 +128,11 @@ asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
-CLEANFILES = xxx
+CLEANFILES = xxx *.gcno *.gcda *gconv
+
+if GCOV
+check: check-am coverage
+.PHONY: coverage
+coverage:
+ -$(srcdir)/coverage.sh
+endif
diff --git a/elfutils/tests/Makefile.in b/elfutils/tests/Makefile.in
index 81e864b1..0c9d1d95 100644
--- a/elfutils/tests/Makefile.in
+++ b/elfutils/tests/Makefile.in
@@ -43,11 +43,12 @@ noinst_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \
test-nlist$(EXEEXT) show-die-info$(EXEEXT) get-files$(EXEEXT) \
get-lines$(EXEEXT) get-pubnames$(EXEEXT) get-aranges$(EXEEXT) \
allfcts$(EXEEXT) line2addr$(EXEEXT) addrscopes$(EXEEXT) \
- show-abbrev$(EXEEXT) hash$(EXEEXT) asm-tst1$(EXEEXT) \
- asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) asm-tst4$(EXEEXT) \
- asm-tst5$(EXEEXT) asm-tst6$(EXEEXT) asm-tst7$(EXEEXT) \
- asm-tst8$(EXEEXT) asm-tst9$(EXEEXT) msg_tst$(EXEEXT) \
- newscn$(EXEEXT) ecp$(EXEEXT) dwflmodtest$(EXEEXT)
+ funcscopes$(EXEEXT) show-abbrev$(EXEEXT) hash$(EXEEXT) \
+ asm-tst1$(EXEEXT) asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) \
+ asm-tst4$(EXEEXT) asm-tst5$(EXEEXT) asm-tst6$(EXEEXT) \
+ asm-tst7$(EXEEXT) asm-tst8$(EXEEXT) asm-tst9$(EXEEXT) \
+ msg_tst$(EXEEXT) newscn$(EXEEXT) ecp$(EXEEXT) \
+ dwflmodtest$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -124,6 +125,9 @@ dwflmodtest_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \
ecp_SOURCES = ecp.c
ecp_OBJECTS = ecp.$(OBJEXT)
ecp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4)
+funcscopes_SOURCES = funcscopes.c
+funcscopes_OBJECTS = funcscopes.$(OBJEXT)
+funcscopes_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4)
get_aranges_SOURCES = get-aranges.c
get_aranges_OBJECTS = get-aranges.$(OBJEXT)
get_aranges_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \
@@ -202,18 +206,19 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = addrscopes.c allfcts.c arextract.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 dwflmodtest.c ecp.c \
- get-aranges.c get-files.c get-lines.c get-pubnames.c hash.c \
- line2addr.c msg_tst.c newfile.c newscn.c saridx.c scnnames.c \
- sectiondump.c show-abbrev.c show-die-info.c showptable.c \
- test-nlist.c update1.c update2.c update3.c update4.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 \
+ saridx.c scnnames.c sectiondump.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 arextract.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 dwflmodtest.c \
- ecp.c get-aranges.c get-files.c get-lines.c get-pubnames.c \
- hash.c line2addr.c msg_tst.c newfile.c newscn.c saridx.c \
- scnnames.c sectiondump.c show-abbrev.c show-die-info.c \
- showptable.c test-nlist.c update1.c update2.c update3.c \
- update4.c
+ ecp.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 \
+ saridx.c scnnames.c sectiondump.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)
@@ -239,6 +244,8 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = @EXEEXT@
+GCOV_FALSE = @GCOV_FALSE@
+GCOV_TRUE = @GCOV_TRUE@
GMSGFMT = @GMSGFMT@
GPROF_FALSE = @GPROF_FALSE@
GPROF_TRUE = @GPROF_TRUE@
@@ -344,7 +351,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-strip-test6.sh run-ecp-test.sh run-ecp-test2.sh \
run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \
run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \
- run-addrscopes.sh
+ run-addrscopes.sh run-strings-test.sh run-funcscopes.sh
# run-show-ciefde.sh
EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
@@ -360,19 +367,20 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \
run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \
run-ranlib-test3.sh run-ranlib-test4.sh \
- run-addrscopes.sh \
+ run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \
testfile15.bz2 testfile15.debug.bz2 \
testfile16.bz2 testfile16.debug.bz2 \
testfile17.bz2 testfile17.debug.bz2 \
testfile18.bz2 testfile19.bz2 testfile19.index.bz2 \
testfile20.bz2 testfile20.index.bz2 \
testfile21.bz2 testfile21.index.bz2 \
- testfile22.bz2 testfile23.bz2
+ testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2 \
+ coverage.sh
@MUDFLAP_TRUE@static_build = yes
@MUDFLAP_TRUE@libmudflap = -lmudflap
@BUILD_STATIC_FALSE@libdw = ../libdw/libdw.so
-@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(libelf) $(libebl)
+@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl
@BUILD_STATIC_FALSE@libelf = ../libelf/libelf.so
@BUILD_STATIC_TRUE@libelf = ../libelf/libelf.a
@BUILD_STATIC_FALSE@libasm = ../libasm/libasm.so
@@ -404,6 +412,7 @@ allfcts_LDADD = $(libdw) $(libelf) $(libmudflap)
line2addr_no_Wformat = yes
line2addr_LDADD = $(libdw) $(libmudflap)
addrscopes_LDADD = $(libdw) $(libmudflap)
+funcscopes_LDADD = $(libdw) $(libmudflap)
#show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) $(libmudflap)
asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl
@@ -415,7 +424,7 @@ 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
-CLEANFILES = xxx
+CLEANFILES = xxx *.gcno *.gcda *gconv
all: all-am
.SUFFIXES:
@@ -497,6 +506,9 @@ dwflmodtest$(EXEEXT): $(dwflmodtest_OBJECTS) $(dwflmodtest_DEPENDENCIES)
ecp$(EXEEXT): $(ecp_OBJECTS) $(ecp_DEPENDENCIES)
@rm -f ecp$(EXEEXT)
$(LINK) $(ecp_LDFLAGS) $(ecp_OBJECTS) $(ecp_LDADD) $(LIBS)
+funcscopes$(EXEEXT): $(funcscopes_OBJECTS) $(funcscopes_DEPENDENCIES)
+ @rm -f funcscopes$(EXEEXT)
+ $(LINK) $(funcscopes_LDFLAGS) $(funcscopes_OBJECTS) $(funcscopes_LDADD) $(LIBS)
get-aranges$(EXEEXT): $(get_aranges_OBJECTS) $(get_aranges_DEPENDENCIES)
@rm -f get-aranges$(EXEEXT)
$(LINK) $(get_aranges_LDFLAGS) $(get_aranges_OBJECTS) $(get_aranges_LDADD) $(LIBS)
@@ -579,6 +591,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst9.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwflmodtest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funcscopes.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-aranges.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-files.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-lines.Po@am__quote@
@@ -853,6 +866,11 @@ uninstall-am: uninstall-info-am
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am
+
+@GCOV_TRUE@check: check-am coverage
+@GCOV_TRUE@.PHONY: coverage
+@GCOV_TRUE@coverage:
+@GCOV_TRUE@ -$(srcdir)/coverage.sh
# 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/tests/addrscopes.c b/elfutils/tests/addrscopes.c
index 4ef00648..1526f02a 100644
--- a/elfutils/tests/addrscopes.c
+++ b/elfutils/tests/addrscopes.c
@@ -45,13 +45,6 @@ paddr (const char *prefix, Dwarf_Addr addr, Dwfl_Line *line)
printf ("%s%#" PRIx64, prefix, addr);
}
-static const char *
-dwarf_diename_integrate (Dwarf_Die *die)
-{
- Dwarf_Attribute attr_mem;
- return dwarf_formstring (dwarf_attr_integrate (die, DW_AT_name, &attr_mem));
-}
-
static void
print_vars (unsigned int indent, Dwarf_Die *die)
{
@@ -63,7 +56,7 @@ print_vars (unsigned int indent, Dwarf_Die *die)
case DW_TAG_variable:
case DW_TAG_formal_parameter:
printf ("%*s%-30s[%6" PRIx64 "]\n", indent, "",
- dwarf_diename_integrate (&child),
+ dwarf_diename (&child),
(uint64_t) dwarf_dieoffset (&child));
break;
default:
@@ -83,7 +76,7 @@ print_vars (unsigned int indent, Dwarf_Die *die)
case DW_TAG_variable:
case DW_TAG_formal_parameter:
printf ("%*s%s (abstract)\n", indent, "",
- dwarf_diename_integrate (&child));
+ dwarf_diename (&child));
break;
default:
break;
@@ -118,13 +111,15 @@ handle_address (GElf_Addr pc, Dwfl *dwfl)
indent += INDENT;
printf ("%*s%s (%#x)", indent, "",
- dwarf_diename_integrate (die) ?: "<unnamed>",
+ dwarf_diename (die) ?: "<unnamed>",
dwarf_tag (die));
Dwarf_Addr lowpc, highpc;
if (dwarf_lowpc (die, &lowpc) == 0
&& dwarf_highpc (die, &highpc) == 0)
{
+ lowpc += cubias;
+ highpc += cubias;
Dwfl_Line *loline = dwfl_getsrc (dwfl, lowpc);
Dwfl_Line *hiline = dwfl_getsrc (dwfl, highpc);
paddr (": ", lowpc, loline);
diff --git a/elfutils/tests/coverage.sh b/elfutils/tests/coverage.sh
new file mode 100755
index 00000000..f09f644f
--- /dev/null
+++ b/elfutils/tests/coverage.sh
@@ -0,0 +1,27 @@
+#! /bin/bash
+
+cd ..
+
+for d in lib libasm libdw libdwfl libebl libelf src; do
+ tmp=$d-data
+ cd $d
+ unused=0
+ for f in *.gcno; do
+ base="$(basename $f .gcno)"
+ fc="$base.c"
+ gcda="$base.gcda"
+ if [ -f "$gcda" ]; then
+ gcov -n -a "$fc" |
+ gawk "/$d.$fc/ { getline; co=gensub(/.*:(.*)% .*/, \"\\\\1\", \"g\"); co=co+0.0; li=\$4+0; printf \"%-35s %6.2f %5d\n\", \"$d/$fc\", co, li } " >> $tmp
+ else
+ unused=$(($unused + 1))
+ fi
+ done
+ if [ -f $tmp ]; then
+ gawk "{ copct=\$2; co=(\$3*copct)/100; toco+=(co+0); toli += (\$3+0); } END { printf \"%-12s %6.2f%% covered unused files: %3d\n\", \"$d\", (toco*100)/toli, \"$unused\" }" $tmp
+ rm -f $tmp
+ else
+ printf "%-12s 0.00%% covered unused files: %3d\n" "$d" $unused
+ fi
+ cd ..
+done
diff --git a/elfutils/tests/funcscopes.c b/elfutils/tests/funcscopes.c
new file mode 100644
index 00000000..a74e8d87
--- /dev/null
+++ b/elfutils/tests/funcscopes.c
@@ -0,0 +1,192 @@
+/* Test program for dwarf_getscopes.
+ Copyright (C) 2005 Red Hat, Inc.
+
+ This program is Open Source software; you can redistribute it and/or
+ modify it under the terms of the Open Software License version 1.0 as
+ published by the Open Source Initiative.
+
+ You should have received a copy of the Open Software License along
+ with this program; if not, you may obtain a copy of the Open Software
+ License version 1.0 from http://www.opensource.org/licenses/osl.php or
+ by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
+ 3001 King Ranch Road, Ukiah, CA 95482. */
+
+#include <config.h>
+#include <assert.h>
+#include <inttypes.h>
+#include <libdwfl.h>
+#include <dwarf.h>
+#include <argp.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <error.h>
+#include <string.h>
+#include <fnmatch.h>
+
+
+static void
+paddr (const char *prefix, Dwarf_Addr addr, Dwfl_Line *line)
+{
+ const char *src;
+ int lineno, linecol;
+ if (line != NULL
+ && (src = dwfl_lineinfo (line, &addr, &lineno, &linecol,
+ NULL, NULL)) != NULL)
+ {
+ if (linecol != 0)
+ printf ("%s%#" PRIx64 " (%s:%d:%d)",
+ prefix, addr, src, lineno, linecol);
+ else
+ printf ("%s%#" PRIx64 " (%s:%d)",
+ prefix, addr, src, lineno);
+ }
+ else
+ printf ("%s%#" PRIx64, prefix, addr);
+}
+
+
+static void
+print_vars (unsigned int indent, Dwarf_Die *die)
+{
+ Dwarf_Die child;
+ if (dwarf_child (die, &child) == 0)
+ do
+ switch (dwarf_tag (&child))
+ {
+ case DW_TAG_variable:
+ case DW_TAG_formal_parameter:
+ printf ("%*s%-30s[%6" PRIx64 "]\n", indent, "",
+ dwarf_diename (&child),
+ (uint64_t) dwarf_dieoffset (&child));
+ break;
+ default:
+ break;
+ }
+ while (dwarf_siblingof (&child, &child) == 0);
+
+ Dwarf_Attribute attr_mem;
+ Dwarf_Die origin;
+ if (dwarf_hasattr (die, DW_AT_abstract_origin)
+ && dwarf_formref_die (dwarf_attr (die, DW_AT_abstract_origin, &attr_mem),
+ &origin) != NULL
+ && dwarf_child (&origin, &child) == 0)
+ do
+ switch (dwarf_tag (&child))
+ {
+ case DW_TAG_variable:
+ case DW_TAG_formal_parameter:
+ printf ("%*s%s (abstract)\n", indent, "",
+ dwarf_diename (&child));
+ break;
+ default:
+ break;
+ }
+ while (dwarf_siblingof (&child, &child) == 0);
+}
+
+
+#define INDENT 4
+
+struct args
+{
+ Dwfl *dwfl;
+ Dwarf_Die *cu;
+ Dwarf_Addr dwbias;
+ char **argv;
+};
+
+static int
+handle_function (Dwarf_Func *func, void *arg)
+{
+ struct args *a = arg;
+
+ const char *name = dwarf_func_name (func);
+ char **argv = a->argv;
+ if (argv[0] != NULL)
+ {
+ bool match;
+ do
+ match = fnmatch (*argv, name, 0) == 0;
+ while (!match && *++argv);
+ if (!match)
+ return 0;
+ }
+
+ Dwarf_Die funcdie_mem;
+ Dwarf_Die *funcdie = dwarf_func_die (func, &funcdie_mem);
+ assert (funcdie == &funcdie_mem);
+
+ Dwarf_Die *scopes;
+ int n = dwarf_getscopes_die (funcdie, &scopes);
+ if (n <= 0)
+ error (EXIT_FAILURE, 0, "dwarf_getscopes_die: %s", dwarf_errmsg (-1));
+ else
+ {
+ Dwarf_Addr start, end;
+ const char *fname;
+ const char *modname = dwfl_module_info (dwfl_cumodule (a->cu), NULL,
+ &start, &end,
+ NULL, NULL,
+ &fname, NULL);
+ if (modname == NULL)
+ error (EXIT_FAILURE, 0, "dwfl_module_info: %s", dwarf_errmsg (-1));
+ if (modname[0] == '\0')
+ modname = fname;
+ printf ("%s: %#" PRIx64 " .. %#" PRIx64 "\n", modname, start, end);
+
+ unsigned int indent = 0;
+ while (n-- > 0)
+ {
+ Dwarf_Die *const die = &scopes[n];
+
+ indent += INDENT;
+ printf ("%*s%s (%#x)", indent, "",
+ dwarf_diename (die) ?: "<unnamed>",
+ dwarf_tag (die));
+
+ Dwarf_Addr lowpc, highpc;
+ if (dwarf_lowpc (die, &lowpc) == 0
+ && dwarf_highpc (die, &highpc) == 0)
+ {
+ lowpc += a->dwbias;
+ highpc += a->dwbias;
+ Dwfl_Line *loline = dwfl_getsrc (a->dwfl, lowpc);
+ Dwfl_Line *hiline = dwfl_getsrc (a->dwfl, highpc);
+ paddr (": ", lowpc, loline);
+ if (highpc != lowpc)
+ paddr (" .. ", lowpc, hiline == loline ? NULL : hiline);
+ }
+ puts ("");
+
+ print_vars (indent + INDENT, die);
+ }
+ }
+
+ return 0;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ int remaining;
+
+ /* Set locale. */
+ (void) setlocale (LC_ALL, "");
+
+ struct args a = { .dwfl = NULL, .cu = NULL };
+
+ (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining,
+ &a.dwfl);
+ assert (a.dwfl != NULL);
+ a.argv = &argv[remaining];
+
+ int result = 0;
+
+ while ((a.cu = dwfl_nextcu (a.dwfl, a.cu, &a.dwbias)) != NULL)
+ dwarf_getfuncs (a.cu, &handle_function, &a, 0);
+
+ return result;
+}
diff --git a/elfutils/tests/line2addr.c b/elfutils/tests/line2addr.c
index 73c57f49..4c3b6045 100644
--- a/elfutils/tests/line2addr.c
+++ b/elfutils/tests/line2addr.c
@@ -28,7 +28,7 @@ print_address (Dwfl_Module *mod, Dwarf_Addr address)
if (n > 1 || secname[0] != '\0')
printf ("%s(%s)+%#" PRIx64, modname, secname, address);
else
- printf ("%s(%s)+%#" PRIx64, modname, secname, address);
+ printf ("%s+%#" PRIx64, modname, address);
return;
}
}
diff --git a/elfutils/tests/run-addrscopes.sh b/elfutils/tests/run-addrscopes.sh
index 901d02e1..d1e89cc8 100755
--- a/elfutils/tests/run-addrscopes.sh
+++ b/elfutils/tests/run-addrscopes.sh
@@ -13,7 +13,7 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile22.bz2 > testfile22 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile22.bz2 > testfile22 2>/dev/null || exit 77
LD_LIBRARY_PATH=../libdw:../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \
./addrscopes -e testfile22 0x8048353 >& addrscopes-test.out || :
@@ -28,4 +28,22 @@ EOF
rm -f testfile22 addrscopes-test.out
+# Don't fail if we cannot decompress the file.
+bunzip2 -c $srcdir/testfile24.bz2 > testfile24 2>/dev/null || exit 77
+
+LD_LIBRARY_PATH=../libdw:../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \
+ ./addrscopes -e testfile24 0x804834e >& addrscopes-test.out || :
+
+diff -Bbu addrscopes-test.out - <<\EOF
+0x804834e:
+ inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x8048364 (/home/roland/build/stock-elfutils/inline-test.c:16)
+ add (0x1d): 0x804834e (/home/roland/build/stock-elfutils/inline-test.c:3) .. 0x8048350 (/home/roland/build/stock-elfutils/inline-test.c:9)
+ y [ 9d]
+ x [ a2]
+ x (abstract)
+ y (abstract)
+EOF
+
+rm -f testfile24 addrscopes-test.out
+
exit 0
diff --git a/elfutils/tests/run-allfcts.sh b/elfutils/tests/run-allfcts.sh
index 51fe75ce..3fde34b9 100755
--- a/elfutils/tests/run-allfcts.sh
+++ b/elfutils/tests/run-allfcts.sh
@@ -14,13 +14,13 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 77
./allfcts testfile testfile2 testfile8 > allfcts.out
diff --git a/elfutils/tests/run-ecp-test.sh b/elfutils/tests/run-ecp-test.sh
index e4304965..c21bb6ca 100755
--- a/elfutils/tests/run-ecp-test.sh
+++ b/elfutils/tests/run-ecp-test.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2002 Red Hat, Inc.
+# Copyright (C) 2002, 2005 Red Hat, Inc.
# Written by Jakub Jelinek <jakub@redhat.com>, 2002.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,7 +14,7 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile10.bz2 > testfile10 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile10.bz2 > testfile10 2>/dev/null || exit 77
./ecp testfile10 testfile10.tmp
diff --git a/elfutils/tests/run-ecp-test2.sh b/elfutils/tests/run-ecp-test2.sh
index 143c70a6..8f3775be 100755
--- a/elfutils/tests/run-ecp-test2.sh
+++ b/elfutils/tests/run-ecp-test2.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2002 Red Hat, Inc.
+# Copyright (C) 2002, 2005 Red Hat, Inc.
# Written by Jakub Jelinek <jakub@redhat.com>, 2002.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,7 +14,7 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
./ecp testfile2 testfile2.tmp
diff --git a/elfutils/tests/run-elflint-test.sh b/elfutils/tests/run-elflint-test.sh
index f008ccdc..74727b66 100755
--- a/elfutils/tests/run-elflint-test.sh
+++ b/elfutils/tests/run-elflint-test.sh
@@ -14,10 +14,10 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile18.bz2 > testfile18 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile18.bz2 > testfile18 2>/dev/null || exit 77
LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \
- ../src/elflint --gnu testfile18 >& elflint-test.out || :
+ ../src/elflint --gnu-ld testfile18 >& elflint-test.out || :
diff -u elflint-test.out - <<"EOF"
section [ 8] '.rela.dyn': relocation 1: copy relocation against symbol of type FUNC
diff --git a/elfutils/tests/run-funcscopes.sh b/elfutils/tests/run-funcscopes.sh
new file mode 100755
index 00000000..e0dcfae1
--- /dev/null
+++ b/elfutils/tests/run-funcscopes.sh
@@ -0,0 +1,30 @@
+#! /bin/sh
+# Copyright (C) 2005 Red Hat, Inc.
+#
+# This program is Open Source software; you can redistribute it and/or
+# modify it under the terms of the Open Software License version 1.0 as
+# published by the Open Source Initiative.
+#
+# You should have received a copy of the Open Software License along
+# with this program; if not, you may obtain a copy of the Open Software
+# License version 1.0 from http://www.opensource.org/licenses/osl.php or
+# by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
+# 3001 King Ranch Road, Ukiah, CA 95482.
+set -e
+
+# Don't fail if we cannot decompress the file.
+bunzip2 -c $srcdir/testfile25.bz2 > testfile25 2>/dev/null || exit 77
+
+LD_LIBRARY_PATH=../libdw:../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \
+ ./funcscopes -e testfile25 incr >& funcscopes-test.out || :
+
+diff -Bbu funcscopes-test.out - <<\EOF
+testfile25: 0x8048000 .. 0x8049528
+ inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834f (/home/roland/build/stock-elfutils/inline-test.c:9)
+ incr (0x2e): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834f (/home/roland/build/stock-elfutils/inline-test.c:9)
+ x [ 66]
+EOF
+
+rm -f testfile25 funcscopes-test.out
+
+exit 0
diff --git a/elfutils/tests/run-get-aranges.sh b/elfutils/tests/run-get-aranges.sh
index 26b29863..a816c218 100755
--- a/elfutils/tests/run-get-aranges.sh
+++ b/elfutils/tests/run-get-aranges.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1999, 2000, 2002 Red Hat, Inc.
+# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc.
# Written by Ulrich Drepper <drepper@redhat.com>, 1999.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,10 +14,10 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
./get-aranges testfile testfile2 > get-aranges.out
diff --git a/elfutils/tests/run-get-files.sh b/elfutils/tests/run-get-files.sh
index 7af5c139..e80cf68d 100755
--- a/elfutils/tests/run-get-files.sh
+++ b/elfutils/tests/run-get-files.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1999, 2000, 2002, 2004 Red Hat, Inc.
+# Copyright (C) 1999, 2000, 2002, 2004, 2005 Red Hat, Inc.
# Written by Ulrich Drepper <drepper@redhat.com>, 1999.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,10 +14,10 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
./get-files testfile testfile2 > get-files.out
diff --git a/elfutils/tests/run-get-lines.sh b/elfutils/tests/run-get-lines.sh
index 70c9cd84..2f7f8580 100755
--- a/elfutils/tests/run-get-lines.sh
+++ b/elfutils/tests/run-get-lines.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1999, 2000, 2002, 2004 Red Hat, Inc.
+# Copyright (C) 1999, 2000, 2002, 2004, 2005 Red Hat, Inc.
# Written by Ulrich Drepper <drepper@redhat.com>, 1999.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,10 +14,10 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
./get-lines testfile testfile2 > get-lines.out
diff --git a/elfutils/tests/run-get-pubnames.sh b/elfutils/tests/run-get-pubnames.sh
index a232bfd2..4c9d5c2a 100755
--- a/elfutils/tests/run-get-pubnames.sh
+++ b/elfutils/tests/run-get-pubnames.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1999, 2000, 2002, 2003 Red Hat, Inc.
+# Copyright (C) 1999, 2000, 2002, 2003, 2005 Red Hat, Inc.
# Written by Ulrich Drepper <drepper@redhat.com>, 1999.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,10 +14,10 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
./get-pubnames testfile testfile2 > get-pubnames.out
diff --git a/elfutils/tests/run-line2addr.sh b/elfutils/tests/run-line2addr.sh
index c103ae03..91047c27 100755
--- a/elfutils/tests/run-line2addr.sh
+++ b/elfutils/tests/run-line2addr.sh
@@ -14,19 +14,19 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile14.bz2 > testfile14 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile14.bz2 > testfile14 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile23.bz2 > testfile23 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile23.bz2 > testfile23 2>/dev/null || exit 77
(./line2addr -e testfile f.c:4 testfile f.c:8
./line2addr -e testfile2 m.c:6 b.c:1
diff --git a/elfutils/tests/run-ranlib-test2.sh b/elfutils/tests/run-ranlib-test2.sh
index cce9ca7c..6eb62f2e 100755
--- a/elfutils/tests/run-ranlib-test2.sh
+++ b/elfutils/tests/run-ranlib-test2.sh
@@ -17,10 +17,10 @@ original=${original:-testfile19}
indexed=${indexed:-testfile19.index}
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/$original.bz2 > $original 2>/dev/null || exit 0
+bunzip2 -c $srcdir/$original.bz2 > $original 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/$indexed.bz2 > $indexed 2>/dev/null || exit 0
+bunzip2 -c $srcdir/$indexed.bz2 > $indexed 2>/dev/null || exit 77
LD_LIBRARY_PATH=../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \
../src/ranlib $original
diff --git a/elfutils/tests/run-show-abbrev.sh b/elfutils/tests/run-show-abbrev.sh
index 78812a5f..0d0ff60c 100755
--- a/elfutils/tests/run-show-abbrev.sh
+++ b/elfutils/tests/run-show-abbrev.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1999, 2000, 2002, 2003, 2004 Red Hat, Inc.
+# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc.
# Written by Ulrich Drepper <drepper@redhat.com>, 1999.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,10 +14,10 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
./show-abbrev testfile testfile2 > show-abbrev.out
diff --git a/elfutils/tests/run-show-ciefde.sh b/elfutils/tests/run-show-ciefde.sh
index b3355334..ac97bbb3 100755
--- a/elfutils/tests/run-show-ciefde.sh
+++ b/elfutils/tests/run-show-ciefde.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1999, 2000, 2002 Red Hat, Inc.
+# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc.
# Written by Ulrich Drepper <drepper@redhat.com>, 1999.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,10 +14,10 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile3.bz2 > testfile3 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile3.bz2 > testfile3 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile4.bz2 > testfile4 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile4.bz2 > testfile4 2>/dev/null || exit 77
./show-ciefde testfile3 testfile4 > show-ciefde.out
diff --git a/elfutils/tests/run-show-die-info.sh b/elfutils/tests/run-show-die-info.sh
index 04263268..3cdfae50 100755
--- a/elfutils/tests/run-show-die-info.sh
+++ b/elfutils/tests/run-show-die-info.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 1999, 2000, 2002, 2003, 2004 Red Hat, Inc.
+# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc.
# Written by Ulrich Drepper <drepper@redhat.com>, 1999.
#
# This program is Open Source software; you can redistribute it and/or
@@ -14,10 +14,10 @@
set -e
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile5.bz2 > testfile5 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile5.bz2 > testfile5 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0
+bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77
./show-die-info testfile5 testfile2 > show-die-info.out
diff --git a/elfutils/tests/run-strings-test.sh b/elfutils/tests/run-strings-test.sh
new file mode 100755
index 00000000..66918008
--- /dev/null
+++ b/elfutils/tests/run-strings-test.sh
@@ -0,0 +1,475 @@
+#! /bin/sh
+# Copyright (C) 2005 Red Hat, Inc.
+# Written by Ulrich Drepper <drepper@redhat.com>, 2005.
+#
+# This program is Open Source software; you can redistribute it and/or
+# modify it under the terms of the Open Software License version 1.0 as
+# published by the Open Source Initiative.
+#
+# You should have received a copy of the Open Software License along
+# with this program; if not, you may obtain a copy of the Open Software
+# License version 1.0 from http://www.opensource.org/licenses/osl.php or
+# by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
+# 3001 King Ranch Road, Ukiah, CA 95482.
+set -e
+
+# Don't fail if we cannot decompress the file.
+bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77
+
+# Don't fail if we cannot decompress the file.
+for n in $(seq 2 9); do
+bunzip2 -c $srcdir/testfile$n.bz2 > testfile$n 2>/dev/null || exit 77
+done
+
+LD_LIBRARY_PATH=../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \
+ ../src/strings -tx -f testfile testfile[23456789] > strings.out
+
+diff -u strings.out - <<"EOF"
+testfile: f4 /lib/ld-linux.so.2
+testfile: 1c9 __gmon_start__
+testfile: 1d8 libc.so.6
+testfile: 1e2 __cxa_finalize
+testfile: 1f1 __deregister_frame_info
+testfile: 209 _IO_stdin_used
+testfile: 218 __libc_start_main
+testfile: 22a __register_frame_info
+testfile: 240 GLIBC_2.1.3
+testfile: 24c GLIBC_2.0
+testfile: 338 PTRh
+testfile: 345 QVh,
+testfile2: 114 /lib/ld.so.1
+testfile2: 1f1 __gmon_start__
+testfile2: 200 __deregister_frame_info
+testfile2: 218 __register_frame_info
+testfile2: 22e libc.so.6
+testfile2: 238 __cxa_finalize
+testfile2: 247 _IO_stdin_used
+testfile2: 256 __libc_start_main
+testfile2: 268 GLIBC_2.1.3
+testfile2: 274 GLIBC_2.0
+testfile2: 488 }a[xN
+testfile2: 4a8 }a[xN
+testfile2: 50c }a[xN
+testfile2: 540 }?Kx
+testfile3: f4 /lib/ld-linux.so.2
+testfile3: 1c9 __gmon_start__
+testfile3: 1d8 libc.so.6
+testfile3: 1e2 __cxa_finalize
+testfile3: 1f1 __deregister_frame_info
+testfile3: 209 _IO_stdin_used
+testfile3: 218 __libc_start_main
+testfile3: 22a __register_frame_info
+testfile3: 240 GLIBC_2.1.3
+testfile3: 24c GLIBC_2.0
+testfile3: 338 PTRh
+testfile3: 345 QVh,
+testfile4: f4 /lib/ld-linux.so.2
+testfile4: 8e1 __gmon_start__
+testfile4: 8f0 __terminate_func
+testfile4: 901 stderr
+testfile4: 908 __tf9type_info
+testfile4: 917 __tf16__user_type_info
+testfile4: 92e __tf19__pointer_type_info
+testfile4: 948 __tf16__attr_type_info
+testfile4: 95f __tf16__func_type_info
+testfile4: 976 __vt_9type_info
+testfile4: 986 __vt_19__pointer_type_info
+testfile4: 9a1 __vt_16__attr_type_info
+testfile4: 9b9 __vt_16__func_type_info
+testfile4: 9d1 __vt_16__ptmf_type_info
+testfile4: 9e9 __vt_16__ptmd_type_info
+testfile4: a01 __vt_17__array_type_info
+testfile4: a1a __tiv
+testfile4: a20 __vt_19__builtin_type_info
+testfile4: a3b __tix
+testfile4: a41 __til
+testfile4: a47 __tii
+testfile4: a4d __tis
+testfile4: a53 __tib
+testfile4: a59 __tic
+testfile4: a5f __tiw
+testfile4: a65 __tir
+testfile4: a6b __tid
+testfile4: a71 __tif
+testfile4: a77 __tiUi
+testfile4: a7e __tiUl
+testfile4: a85 __tiUx
+testfile4: a8c __tiUs
+testfile4: a93 __tiUc
+testfile4: a9a __tiSc
+testfile4: aa1 __ti19__pointer_type_info
+testfile4: abb __ti9type_info
+testfile4: aca __ti16__attr_type_info
+testfile4: ae1 __ti19__builtin_type_info
+testfile4: afb __ti16__func_type_info
+testfile4: b12 __ti16__ptmf_type_info
+testfile4: b29 __ti16__ptmd_type_info
+testfile4: b40 __ti17__array_type_info
+testfile4: b58 __cplus_type_matcher
+testfile4: b6d __vt_13bad_exception
+testfile4: b82 __vt_9exception
+testfile4: b92 _._13bad_exception
+testfile4: ba5 __vt_8bad_cast
+testfile4: bb4 _._8bad_cast
+testfile4: bc1 __vt_10bad_typeid
+testfile4: bd3 _._10bad_typeid
+testfile4: be3 __ti9exception
+testfile4: bf2 __ti13bad_exception
+testfile4: c06 __vt_16__user_type_info
+testfile4: c1e __vt_17__class_type_info
+testfile4: c37 __vt_14__si_type_info
+testfile4: c4d __ti8bad_cast
+testfile4: c5b __ti10bad_typeid
+testfile4: c6c __ti16__user_type_info
+testfile4: c83 __ti14__si_type_info
+testfile4: c98 __ti17__class_type_info
+testfile4: cb0 libc.so.6
+testfile4: cba __register_frame
+testfile4: ccb pthread_create
+testfile4: cda pthread_getspecific
+testfile4: cee pthread_key_delete
+testfile4: d01 __cxa_finalize
+testfile4: d10 malloc
+testfile4: d17 __frame_state_for
+testfile4: d29 abort
+testfile4: d2f __register_frame_table
+testfile4: d46 fprintf
+testfile4: d4e pthread_once
+testfile4: d5b __deregister_frame_info
+testfile4: d73 pthread_key_create
+testfile4: d86 memset
+testfile4: d8d strcmp
+testfile4: d94 pthread_mutex_unlock
+testfile4: da9 __deregister_frame
+testfile4: dbc pthread_mutex_lock
+testfile4: dcf _IO_stdin_used
+testfile4: dde __libc_start_main
+testfile4: df0 strlen
+testfile4: df7 __register_frame_info_table
+testfile4: e13 __register_frame_info
+testfile4: e29 pthread_setspecific
+testfile4: e3d free
+testfile4: e42 GLIBC_2.1.3
+testfile4: e4e GLIBC_2.0
+testfile4: 1308 PTRh<
+testfile4: 194b [^_]
+testfile4: 19bf [^_]
+testfile4: 1dd9 wT9L>
+testfile4: 1f3b [^_]
+testfile4: 1fae [^_]
+testfile4: 21c1 BZQRP
+testfile4: 237f [^_]
+testfile4: 2431 JWRV
+testfile4: 2454 [^_]
+testfile4: 2506 JWRV
+testfile4: 2529 [^_]
+testfile4: 2b6c [^_]
+testfile4: 2b9d ZYPV
+testfile4: 2c28 [^_]
+testfile4: 2c4d ZYPV
+testfile4: 2ce2 [^_]
+testfile4: 2dfb X^_]
+testfile4: 2fc8 [^_]
+testfile4: 307d tq;F
+testfile4: 315a [^_]
+testfile4: 31a5 :zt 1
+testfile4: 3238 [^_]
+testfile4: 32f8 AXY_VR
+testfile4: 334a [^_]
+testfile4: 37ab [^_]
+testfile4: 38b8 sU;E
+testfile4: 38f2 QRPV
+testfile4: 3926 [^_]
+testfile4: 3bfe QRWP
+testfile4: 3e65 [^_]
+testfile4: 4136 [^_]
+testfile4: 472d [^_]
+testfile4: 47a5 0[^_]
+testfile4: 48ab [^_]
+testfile4: 4ab1 _ZPV
+testfile4: 4b53 _ZPV
+testfile4: 4bd3 _ZPV
+testfile4: 4e05 PQWj
+testfile4: 4f75 [^_]
+testfile4: 4f9b u$;E u
+testfile4: 4feb [^_]
+testfile4: 5080 [^_]
+testfile4: 50a8 }$9u
+testfile4: 5149 [^_]
+testfile4: 51b0 [^_]
+testfile4: 539b [^_]
+testfile4: 53b5 E 9E
+testfile4: 540d x!)E
+testfile4: 5598 U$ B
+testfile4: 571c [^_]
+testfile4: 5819 [^_]
+testfile4: 5922 [^_]
+testfile4: 59c2 [^_]
+testfile4: 5a62 [^_]
+testfile4: 5b02 [^_]
+testfile4: 5ba2 [^_]
+testfile4: 5c42 [^_]
+testfile4: 5ce2 [^_]
+testfile4: 6112 [^_]
+testfile4: 62bb [^_]
+testfile4: 639b [^_]
+testfile4: 6436 [^_]
+testfile4: 6468 val is zero
+testfile4: 6480 Internal Compiler Bug: No runtime type matcher.
+testfile4: 64dc 19__pointer_type_info
+testfile4: 64f2 16__attr_type_info
+testfile4: 6505 19__builtin_type_info
+testfile4: 651b 16__func_type_info
+testfile4: 652e 16__ptmf_type_info
+testfile4: 6541 16__ptmd_type_info
+testfile4: 6554 17__array_type_info
+testfile4: 6568 9exception
+testfile4: 6573 13bad_exception
+testfile4: 6583 9type_info
+testfile4: 658e 8bad_cast
+testfile4: 6598 10bad_typeid
+testfile4: 65a5 16__user_type_info
+testfile4: 65b8 14__si_type_info
+testfile4: 65c9 17__class_type_info
+testfile4: 6fc1 H. $
+testfile5: f4 /lib/ld-linux.so.2
+testfile5: 1c9 __gmon_start__
+testfile5: 1d8 libc.so.6
+testfile5: 1e2 __cxa_finalize
+testfile5: 1f1 __deregister_frame_info
+testfile5: 209 _IO_stdin_used
+testfile5: 218 __libc_start_main
+testfile5: 22a __register_frame_info
+testfile5: 240 GLIBC_2.1.3
+testfile5: 24c GLIBC_2.0
+testfile5: 338 PTRh
+testfile5: 345 QVhD
+testfile6: 114 /lib/ld-linux.so.2
+testfile6: 3d9 libstdc++.so.5
+testfile6: 3e8 _ZTVSt16invalid_argument
+testfile6: 401 _ZNSaIcEC1Ev
+testfile6: 40e _ZTSSt16invalid_argument
+testfile6: 427 _ZTVN10__cxxabiv120__si_class_type_infoE
+testfile6: 450 _ZNSsD1Ev
+testfile6: 45a _ZdlPv
+testfile6: 461 __cxa_end_catch
+testfile6: 471 __gxx_personality_v0
+testfile6: 486 _ZTISt9exception
+testfile6: 497 _ZNSaIcED1Ev
+testfile6: 4a4 _ZTISt11logic_error
+testfile6: 4b8 _ZNSt16invalid_argumentD1Ev
+testfile6: 4d4 _ZTVN10__cxxabiv117__class_type_infoE
+testfile6: 4fa __cxa_throw
+testfile6: 506 _ZNSt16invalid_argumentC1ERKSs
+testfile6: 525 _ZNSsC1EPKcRKSaIcE
+testfile6: 538 _ZNSt11logic_errorD2Ev
+testfile6: 54f _ZTVN10__cxxabiv121__vmi_class_type_infoE
+testfile6: 579 _ZNSt16invalid_argumentD0Ev
+testfile6: 595 __cxa_begin_catch
+testfile6: 5a7 __cxa_allocate_exception
+testfile6: 5c0 _ZNKSt11logic_error4whatEv
+testfile6: 5db _Jv_RegisterClasses
+testfile6: 5ef _ZTISt16invalid_argument
+testfile6: 608 __gmon_start__
+testfile6: 617 libm.so.6
+testfile6: 621 _IO_stdin_used
+testfile6: 630 libgcc_s.so.1
+testfile6: 63e _Unwind_Resume
+testfile6: 64d libc.so.6
+testfile6: 657 __libc_start_main
+testfile6: 669 GCC_3.0
+testfile6: 671 GLIBC_2.0
+testfile6: 67b GLIBCPP_3.2
+testfile6: 687 CXXABI_1.2
+testfile6: 908 PTRh
+testfile6: e48 gdb.1
+testfile6: ec8 N10__gnu_test9gnu_obj_1E
+testfile6: ee1 N10__gnu_test9gnu_obj_2IiEE
+testfile6: efd N10__gnu_test9gnu_obj_2IlEE
+testfile6: f19 St16invalid_argument
+testfile7: 114 /lib/ld-linux.so.2
+testfile7: 3d9 libstdc++.so.5
+testfile7: 3e8 _ZTVSt16invalid_argument
+testfile7: 401 _ZNSaIcEC1Ev
+testfile7: 40e _ZTSSt16invalid_argument
+testfile7: 427 _ZTVN10__cxxabiv120__si_class_type_infoE
+testfile7: 450 _ZNSsD1Ev
+testfile7: 45a _ZdlPv
+testfile7: 461 __cxa_end_catch
+testfile7: 471 __gxx_personality_v0
+testfile7: 486 _ZTISt9exception
+testfile7: 497 _ZNSaIcED1Ev
+testfile7: 4a4 _ZTISt11logic_error
+testfile7: 4b8 _ZNSt16invalid_argumentD1Ev
+testfile7: 4d4 _ZTVN10__cxxabiv117__class_type_infoE
+testfile7: 4fa __cxa_throw
+testfile7: 506 _ZNSt16invalid_argumentC1ERKSs
+testfile7: 525 _ZNSsC1EPKcRKSaIcE
+testfile7: 538 _ZNSt11logic_errorD2Ev
+testfile7: 54f _ZTVN10__cxxabiv121__vmi_class_type_infoE
+testfile7: 579 _ZNSt16invalid_argumentD0Ev
+testfile7: 595 __cxa_begin_catch
+testfile7: 5a7 __cxa_allocate_exception
+testfile7: 5c0 _ZNKSt11logic_error4whatEv
+testfile7: 5db _Jv_RegisterClasses
+testfile7: 5ef _ZTISt16invalid_argument
+testfile7: 608 __gmon_start__
+testfile7: 617 libm.so.6
+testfile7: 621 _IO_stdin_used
+testfile7: 630 libgcc_s.so.1
+testfile7: 63e _Unwind_Resume
+testfile7: 64d libc.so.6
+testfile7: 657 __libc_start_main
+testfile7: 669 GCC_3.0
+testfile7: 671 GLIBC_2.0
+testfile7: 67b GLIBCPP_3.2
+testfile7: 687 CXXABI_1.2
+testfile7: 908 PTRh
+testfile7: e48 gdb.1
+testfile7: ec8 N10__gnu_test9gnu_obj_1E
+testfile7: ee1 N10__gnu_test9gnu_obj_2IiEE
+testfile7: efd N10__gnu_test9gnu_obj_2IlEE
+testfile7: f19 St16invalid_argument
+testfile8: 79 XZh;
+testfile8: 87 YXh<
+testfile8: 14f SQh[
+testfile8: 259 t5Wj
+testfile8: 502 WRVQ
+testfile8: 1fe7 ZYPj
+testfile8: 2115 u'Pj
+testfile8: 7bba FILE
+testfile8: 7bbf preserve-dates
+testfile8: 7bce remove-comment
+testfile8: 7bdd Remove .comment section
+testfile8: 7bf6 ${prefix}/share
+testfile8: 7c06 elfutils
+testfile8: 7c0f a.out
+testfile8: 7c15 0.58
+testfile8: 7c1a strip (Red Hat %s) %s
+testfile8: 7c31 2002
+testfile8: 7c36 Ulrich Drepper
+testfile8: 7c45 Written by %s.
+testfile8: 7c55 cannot stat input file "%s"
+testfile8: 7c71 %s: INTERNAL ERROR: %s
+testfile8: 7c88 while opening "%s"
+testfile8: 7c9b handle_elf
+testfile8: 7ca6 ../../src/strip.c
+testfile8: 7cb8 shdr_info[cnt].group_idx != 0
+testfile8: 7cd6 illformed file `%s'
+testfile8: 7cea elf_ndxscn (scn) == cnt
+testfile8: 7d02 .shstrtab
+testfile8: 7d0c while writing `%s': %s
+testfile8: 7d23 ((sym->st_info) & 0xf) == 3
+testfile8: 7d3f shndxdata != ((void *)0)
+testfile8: 7d58 scn != ((void *)0)
+testfile8: 7d6b .gnu_debuglink
+testfile8: 7d7a .comment
+testfile8: 7d83 cannot open `%s'
+testfile8: 7da0 Place stripped output into FILE
+testfile8: 7dc0 Extract the removed sections into FILE
+testfile8: 7e00 Copy modified/access timestamps to the output
+testfile8: 7e40 Only one input file allowed together with '-o' and '-f'
+testfile8: 7e80 Copyright (C) %s Red Hat, Inc.
+testfile8: 7e9f This is free software; see the source for copying conditions. There is NO
+testfile8: 7eea warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+testfile8: 7f40 Report bugs to <drepper@redhat.com>.
+testfile8: 7f80 %s: File format not recognized
+testfile8: 7fa0 cannot set access and modification date of "%s"
+testfile8: 7fe0 cannot create new file `%s': %s
+testfile8: 8000 error while finishing `%s': %s
+testfile8: 8020 shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0
+testfile8: 8060 shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0
+testfile8: 80a0 %s: error while creating ELF header: %s
+testfile8: 80e0 %s: error while reading the file: %s
+testfile8: 8120 sec < 0xff00 || shndxdata != ((void *)0)
+testfile8: 8160 (versiondata->d_size / sizeof (GElf_Versym)) >= shdr_info[cnt].data->d_size / elsize
+testfile8: 81c0 shdr_info[cnt].shdr.sh_type == 11
+testfile8: 8200 (versiondata->d_size / sizeof (Elf32_Word)) >= shdr_info[cnt].data->d_size / elsize
+testfile8: 8260 shdr_info[cnt].shdr.sh_type == 18
+testfile8: 82a0 shdr_info[cnt].data != ((void *)0)
+testfile8: 82e0 elf_ndxscn (shdr_info[cnt].newscn) == idx
+testfile8: 8320 while create section header section: %s
+testfile8: 8360 cannot allocate section data: %s
+testfile8: 83a0 elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx
+testfile8: 83e0 while generating output file: %s
+testfile8: 8420 while preparing output for `%s'
+testfile8: 8440 shdr_info[cnt].shdr.sh_type == 2
+testfile8: 8480 shdr_info[idx].data != ((void *)0)
+testfile8: 84c0 cannot determine number of sections: %s
+testfile8: 8500 cannot get section header string table index
+testfile8: 85c0 Discard symbols from object files.
+testfile8: 85e3 [FILE...]
+testfile9: 79 XZh;
+testfile9: 87 YXh<
+testfile9: 14f SQh[
+testfile9: 259 t5Wj
+testfile9: 502 WRVQ
+testfile9: 1fe7 ZYPj
+testfile9: 2115 u'Pj
+testfile9: 3414 FILE
+testfile9: 3419 preserve-dates
+testfile9: 3428 remove-comment
+testfile9: 3437 Remove .comment section
+testfile9: 3450 ${prefix}/share
+testfile9: 3460 elfutils
+testfile9: 3469 a.out
+testfile9: 346f 0.58
+testfile9: 3474 strip (Red Hat %s) %s
+testfile9: 348b 2002
+testfile9: 3490 Ulrich Drepper
+testfile9: 349f Written by %s.
+testfile9: 34af cannot stat input file "%s"
+testfile9: 34cb %s: INTERNAL ERROR: %s
+testfile9: 34e2 while opening "%s"
+testfile9: 34f5 handle_elf
+testfile9: 3500 ../../src/strip.c
+testfile9: 3512 shdr_info[cnt].group_idx != 0
+testfile9: 3530 illformed file `%s'
+testfile9: 3544 elf_ndxscn (scn) == cnt
+testfile9: 355c .shstrtab
+testfile9: 3566 while writing `%s': %s
+testfile9: 357d ((sym->st_info) & 0xf) == 3
+testfile9: 3599 shndxdata != ((void *)0)
+testfile9: 35b2 scn != ((void *)0)
+testfile9: 35c5 .gnu_debuglink
+testfile9: 35d4 .comment
+testfile9: 35dd cannot open `%s'
+testfile9: 3600 Place stripped output into FILE
+testfile9: 3620 Extract the removed sections into FILE
+testfile9: 3660 Copy modified/access timestamps to the output
+testfile9: 36a0 Only one input file allowed together with '-o' and '-f'
+testfile9: 36e0 Copyright (C) %s Red Hat, Inc.
+testfile9: 36ff This is free software; see the source for copying conditions. There is NO
+testfile9: 374a warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+testfile9: 37a0 Report bugs to <drepper@redhat.com>.
+testfile9: 37e0 %s: File format not recognized
+testfile9: 3800 cannot set access and modification date of "%s"
+testfile9: 3840 cannot create new file `%s': %s
+testfile9: 3860 error while finishing `%s': %s
+testfile9: 3880 shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0
+testfile9: 38c0 shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0
+testfile9: 3900 %s: error while creating ELF header: %s
+testfile9: 3940 %s: error while reading the file: %s
+testfile9: 3980 sec < 0xff00 || shndxdata != ((void *)0)
+testfile9: 39c0 (versiondata->d_size / sizeof (GElf_Versym)) >= shdr_info[cnt].data->d_size / elsize
+testfile9: 3a20 shdr_info[cnt].shdr.sh_type == 11
+testfile9: 3a60 (versiondata->d_size / sizeof (Elf32_Word)) >= shdr_info[cnt].data->d_size / elsize
+testfile9: 3ac0 shdr_info[cnt].shdr.sh_type == 18
+testfile9: 3b00 shdr_info[cnt].data != ((void *)0)
+testfile9: 3b40 elf_ndxscn (shdr_info[cnt].newscn) == idx
+testfile9: 3b80 while create section header section: %s
+testfile9: 3bc0 cannot allocate section data: %s
+testfile9: 3c00 elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx
+testfile9: 3c40 while generating output file: %s
+testfile9: 3c80 while preparing output for `%s'
+testfile9: 3ca0 shdr_info[cnt].shdr.sh_type == 2
+testfile9: 3ce0 shdr_info[idx].data != ((void *)0)
+testfile9: 3d20 cannot determine number of sections: %s
+testfile9: 3d60 cannot get section header string table index
+testfile9: 3e20 Discard symbols from object files.
+testfile9: 3e43 [FILE...]
+EOF
+
+rm -f testfile testfile[23456789] strings.out
+
+exit 0
diff --git a/elfutils/tests/run-strip-test.sh b/elfutils/tests/run-strip-test.sh
index 526eb091..169e8929 100755
--- a/elfutils/tests/run-strip-test.sh
+++ b/elfutils/tests/run-strip-test.sh
@@ -18,14 +18,14 @@ stripped=${stripped:-testfile7}
debugout=${debugfile:+-f testfile.debug.temp -F $debugfile}
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/$original.bz2 > $original 2>/dev/null || exit 0
+bunzip2 -c $srcdir/$original.bz2 > $original 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
-bunzip2 -c $srcdir/$stripped.bz2 > $stripped 2>/dev/null || exit 0
+bunzip2 -c $srcdir/$stripped.bz2 > $stripped 2>/dev/null || exit 77
# Don't fail if we cannot decompress the file.
test -z "$debugfile" ||
-bunzip2 -c $srcdir/$debugfile.bz2 > $debugfile 2>/dev/null || exit 0
+bunzip2 -c $srcdir/$debugfile.bz2 > $debugfile 2>/dev/null || exit 77
LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \
../src/strip -o testfile.temp $debugout $original
diff --git a/elfutils/tests/testfile24.bz2 b/elfutils/tests/testfile24.bz2
new file mode 100644
index 00000000..2320acb3
--- /dev/null
+++ b/elfutils/tests/testfile24.bz2
Binary files differ
diff --git a/elfutils/tests/testfile25.bz2 b/elfutils/tests/testfile25.bz2
new file mode 100644
index 00000000..51e04213
--- /dev/null
+++ b/elfutils/tests/testfile25.bz2
Binary files differ