Speedup dwfl_module_addrsym
by Mark Wielaard
Hi,
dwfl_module_addrsym is a bit slow because it wants to return global
symbols in preference to local symbols, but first looks at all the local
symbols. To speed this up I wrote the following patches, which
introduces dwfl_module_symtab_global to get the first index of the
global symbols in the symtab. And the uses this in dwfl_module_addrsym
to search through the global symbols first, and only if no symbol was
found, go through the local symbols afterwards.
This gives a nice speedup on readelf -w libstdc++.so.debug for example,
from 35 seconds to 25 seconds, on my machine. The output is exactly the
same.
Comments?
Thanks,
Mark
12 years, 4 months
bug in dwfl_module_addrsym
by Mark Wielaard
Hi,
I found a small bug in dwfl_module_addrsym. If no symbol with an actual
size was found for an address the sizeless_sym closest to the desired
address could be replaced with a sizeless_sym that was actually further
away. And so no sym would be returned at all. The attached patch fixes
it and adds a check to see if the whole same_section check and the
sizeless_sym update is even needed (it isn't if a full sized symbol has
already been found). Which gives a small speedup and turns up a couple
of extra symbols when inspecting vmlinux debuginfo with eu-readelf -w.
OK, to apply?
Thanks,
Mark
12 years, 4 months
[PATCH] Run gawk on config/known-dwarf.awk.
by Mark Wielaard
Hi,
I found myself on a system where the system awk wasn't gawk. sigh. Since
config/known-dwarf.awk uses some GNU extensions I was a little puzzled
for some time why things were failing (in maintainer-mode). Instead of
trying to make this work on all awk versions out there I think we should
just require running gawk on it instead. Like is already done for some
other scripts in elfutils. Unless someone complains this is wrong I
would like to install the attached patch to make it so.
Thanks,
Mark
12 years, 4 months
Bug in dwfl_module_relocations
by Mark Wielaard
Hi,
When you call dwfl_module_relocations() on a mod that isn't ET_REL, then
it can potentially return the wrong answer because it checks and returns
mod->reloc_info->count. Which for ET_EXEC and ET_DYN can be setup
because someone called dwfl_module_address_section(), but doesn't
correspond to the actual relocation count in that case.
Does the following fix look sane?
2011-10-19 Mark Wielaard <mjw(a)redhat.com>
* derelocate.c (dwfl_module_relocations): Only check
mod->reloc_info->count for ET_REL.
Thanks,
Mark
12 years, 5 months
cross-compiling elfutils and i386_gendis
by Mike Frysinger
this has come up before on the list, but i'm not looking for support to make
it work locally (i can handle that). i'm interested in how to make it work
out of the box for people.
the problem: libcpu/ creates a binary named "i386_gendis" which is then
executed on the --build system to generate local dis.h headers based on some
input files. but when cross-compiling, the code is compiled for the --host,
and so executing that binary doesn't work.
further aggravating the problem is that libcpu/ code is also linked in to some
of the libraries which are wanted on the --host target. and the gendis binary
uses helper libraries outside of its subdir (libeu.a).
Roland is right in that autotools are fairly deficient in mixing --build and
--host binaries in a single configure, and their documentation still says the
only real way to support this is to run a second configure where --build and
--host are the same, and then use the binaries from that in the original
build. i'm guessing this solution isn't palpable to the elfutils maintainers
in general, so perhaps it goes into the "portable" branch ?
however, it should be fairly easy to mitigate this for the majority of people.
those dis.h headers should always be the same once a release is made, so it
would make sense to declare them as automake dist targets. that way automake
will include them in the release tarball and at build time on the end user's
machine, i386_gendis won't even be compiled or needed. this change would
simplify things a bit for all builders, not just cross-compiling. and maybe
we consider it a "good enough" solution to skip the automatic 2nd configure
step ...
-mike
12 years, 5 months
[PATCH] ignore more generated files
by Mike Frysinger
Signed-off-by: Mike Frysinger <vapier(a)gentoo.org>
---
.gitignore | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index cc1bae8..217b0f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,16 +6,22 @@
.glimpse_*
autom4te.*
*.o
+*.os
*.so
*.a
*.orig
*.patch
*.rej
+Makefile
Makefile.in
*/Makefile.in
aclocal.m4
INSTALL
+config.h
config.h.in
+config.log
+config.status
+backends/*.map
config/config.guess
config/config.sub
config/depcomp
@@ -23,9 +29,11 @@ config/install-sh
config/missing
config/ylwrap
configure
+stamp-h1
elfutils.spec
*.pot
*.gmo
po/en(a)boldquot.po
po/en(a)quot.po
libdw/known-dwarf.h
+.deps
--
1.7.6.1
12 years, 5 months
[PATCH] configure: fix handling of 3rd arg in AC_ARG_ENABLE
by Mike Frysinger
The 3rd arg to AC_ARG_ENABLE is "user has specified a value, and here
it is in $enableval". It is not "user has used --enable-foo". Most
of the AC_ARG_ENABLE calls are coded for the latter usage which is not
how things work. For example, using "--disable-foo" would execute the
3rd arg, but with an $enableval set to "no". These would incorrectly
set the relevant flags to "enable".
The thread-safety flag also seems to have a typo in its arg, so I've
changed it to what I think it was actually going for.
Signed-off-by: Mike Frysinger <vapier(a)gentoo.org>
---
configure.ac | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4c6248c..3b9738e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ AC_CANONICAL_HOST
AC_ARG_ENABLE([thread-safety],
AS_HELP_STRING([--enable-thread-safety], [enable thread safety of libraries]),
-use_tls=locks, use_locks=no)
+use_locks=$enableval, use_locks=no)
AM_CONDITIONAL(USE_LOCKS, test "$use_locks" = yes)
AS_IF([test "$use_locks" = yes], [AC_DEFINE(USE_LOCKS)])
@@ -143,15 +143,18 @@ fi
AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes)
dnl enable debugging of branch prediction.
-use_debugpred=0
AC_ARG_ENABLE([debugpred],
AS_HELP_STRING([--enable-debugpred],[build binaries with support to debug branch prediction]),
-[use_debugpred=1], [use_debugpred=0])
+[use_debugpred=$enableval], [use_debugpred=no])
+case $use_debugpred in
+ yes) use_debugpred=1 ;;
+ *) use_debugpred=0 ;;
+esac
AC_SUBST([DEBUGPRED], $use_debugpred)
dnl Enable gprof suport.
AC_ARG_ENABLE([gprof],
-AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=yes], [use_gprof=no])
+AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=$enableval], [use_gprof=no])
if test "$use_gprof" = yes; then
CFLAGS="$CFLAGS -pg"
LDFLAGS="$LDFLAGS -pg"
@@ -160,7 +163,7 @@ AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
# Enable gcov suport.
AC_ARG_ENABLE([gcov],
-AS_HELP_STRING([--enable-gcov],[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no])
+AS_HELP_STRING([--enable-gcov],[build binaries with gcov support]), [use_gcov=$enableval], [use_gcov=no])
if test "$use_gcov" = yes; then
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
LDFLAGS="$LDFLAGS -fprofile-arcs"
@@ -177,7 +180,7 @@ AM_CONDITIONAL(BUILD_WERROR, test "$enable_werror" = yes)
AC_ARG_ENABLE([tests-rpath],
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
- [tests_use_rpath=yes], [tests_use_rpath=no])
+ [tests_use_rpath=$enableval], [tests_use_rpath=no])
AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
LIBEBL_SUBDIR="$PACKAGE"
--
1.7.6.1
12 years, 5 months
[PATCH] configure: add --disable-werror flag
by Mike Frysinger
The -Werror flag is great for development, but not so great with releases.
Often times newer (or older) versions of gcc like to warn about different
things, or in different ways depending on the architecture (we don't think
that the maintainer is going to test building for every one out there).
So add a knob for distros to turn off -Werror in their builds.
Signed-off-by: Mike Frysinger <vapier(a)gentoo.org>
---
config/eu.am | 5 ++++-
configure.ac | 5 +++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/config/eu.am b/config/eu.am
index f259c5b..4c10f55 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -28,11 +28,14 @@
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
- $(if $($(*F)_no_Werror),,-Werror) \
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
$(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
$($(*F)_CFLAGS)
+if BUILD_WERROR
+AM_CFLAGS += $(if $($(*F)_no_Werror),,-Werror)
+endif
+
if MUDFLAP
AM_CFLAGS += -fmudflap
libmudflap = -lmudflap
diff --git a/configure.ac b/configure.ac
index a9f1fc9..4c6248c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,6 +170,11 @@ AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
AM_CONDITIONAL(BUILD_STATIC, [dnl
test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
+AC_ARG_ENABLE([werror],
+AS_HELP_STRING([--disable-werror],[do not build with -Werror]),
+ [enable_werror=$enableval], [enable_werror=yes])
+AM_CONDITIONAL(BUILD_WERROR, test "$enable_werror" = yes)
+
AC_ARG_ENABLE([tests-rpath],
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
[tests_use_rpath=yes], [tests_use_rpath=no])
--
1.7.6.1
12 years, 5 months
[PATCH] readelf.c: Assume the right size of an array
by Marek Polacek
In `register_info' we're taking the size of argument `name', which is wrong,
since we get just the size of a pointer, not size of the array. This patch
fixes it. Tested on x86_64 using trunk gcc.
I have trouble with git+ssh (Permission denied (publickey), although I have
my right pub key on fedorahosted.com), so I'd not be able to push this in case
it's fine. Thanks.
2011-10-04 Marek Polacek <mpolacek(a)redhat.com>
* readelf.c (register_info): Assume the right size of an array.
--- elfutils/src/readelf.c.mp 2011-08-30 10:51:27.869835636 +0200
+++ elfutils/src/readelf.c 2011-08-30 10:51:42.329960296 +0200
@@ -4787,7 +4787,7 @@ register_info (Ebl *ebl, unsigned int re
bits ?: &ignore, type ?: &ignore);
if (n <= 0)
{
- snprintf (name, sizeof name, "reg%u", loc->regno);
+ snprintf (name, REGNAMESZ, "reg%u", loc->regno);
if (bits != NULL)
*bits = loc->bits;
if (type != NULL)
Marek
12 years, 5 months
[PATCH] configure: replace bashisms with POSIX shell
by Mike Frysinger
The ${var/} pattern substitution is a bashism and not part of POSIX.
Convert it to use `tr` instead.
The $[...] syntax is also a bashism, so convert it to the POSIX way
of doing math with $(( ... )).
Signed-off-by: Mike Frysinger <vapier(a)gentoo.org>
---
configure.ac | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index f792d43..a9f1fc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,7 +252,7 @@ AC_SUBST([eu_version])
# 1.234<whatever> -> 1234<whatever>
case "$PACKAGE_VERSION" in
-[[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;;
+[[0-9]].*) eu_version=`echo "${PACKAGE_VERSION}" | tr -d .` ;;
*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
esac
case "$eu_version" in
@@ -281,6 +281,6 @@ case "$eu_version" in
esac
# Round up to the next release API (x.y) version.
-[eu_version=$[($eu_version + 999) / 1000]]
+eu_version=$(( (eu_version + 999) / 1000 ))
AC_OUTPUT
--
1.7.6.1
12 years, 5 months