summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--Makefile.am4
-rw-r--r--NEWS15
-rw-r--r--config/ChangeLog9
-rw-r--r--config/Makefile.am21
-rw-r--r--config/elfutils.spec.in14
-rw-r--r--config/version.h.in58
-rw-r--r--configure.ac15
-rw-r--r--libcpu/ChangeLog42
-rw-r--r--libcpu/defs/i3865
-rw-r--r--libcpu/i386_disasm.c202
-rw-r--r--libcpu/i386_parse.y31
-rw-r--r--libdw/libdw.map14
-rw-r--r--libdwfl/ChangeLog12
-rw-r--r--libdwfl/derelocate.c21
-rw-r--r--libdwfl/dwfl_module_build_id.c21
-rw-r--r--tests/ChangeLog21
-rw-r--r--tests/testfile44.S.bz2bin16435 -> 17113 bytes
-rw-r--r--tests/testfile44.expect.bz2bin54232 -> 56405 bytes
-rw-r--r--tests/testfile45.S.bz2bin22725 -> 23547 bytes
-rw-r--r--tests/testfile45.expect.bz2bin75086 -> 77778 bytes
21 files changed, 445 insertions, 75 deletions
diff --git a/ChangeLog b/ChangeLog
index 01f61eb3..9a90de7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2008-12-30 Ulrich Drepper <[email protected]>
+
+ * configure.ac: We need automake 1.8 now.
+
+2008-12-24 Roland McGrath <[email protected]>
+
+ * configure.ac: Use automake flags dist-bzip2 no-dist-gzip,
+ distribute only in .tar.bz2 form now.
+
+2008-12-16 Roland McGrath <[email protected]>
+
+ * Makefile.am (pkginclude_HEADERS): New variable, install version.h.
+ * configure.ac: Create it, substituting @eu_version@ with
+ PACKAGE_VERSION canonicalized to four digits of decimal.
+
2008-08-25 Roland McGrath <[email protected]>
* configure.ac (--enable-tls): Set AM_CONDITIONAL USE_TLS too.
diff --git a/Makefile.am b/Makefile.am
index 9306fe69..44d67d50 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
## Process this file with automake to create Makefile.in
## Configure input file for elfutils.
##
-## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
+## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2008 Red Hat, Inc.
## This file is part of Red Hat elfutils.
##
## Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -27,6 +27,8 @@
##
ACLOCAL_AMFLAGS = -I m4
+pkginclude_HEADERS = version.h
+
# Add doc back when we have some real content.
SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
src po tests
diff --git a/NEWS b/NEWS
index ad7b004b..baa9d59c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,18 @@
+Version 0.138:
+
+Install <elfutils/version.h> header file for applications to use in source
+version compatibility checks.
+
+libebl: backend fixes for i386 TLS relocs; backend support for NT_386_IOPERM
+
+libcpu: disassembler fixes
+
+libdwfl: bug fixes
+
+libelf: bug fixes
+
+nm: bug fixes for handling corrupt input files
+
Version 0.137:
Minor fixes for unreleased 0.136 release.
diff --git a/config/ChangeLog b/config/ChangeLog
index e580747a..0c503736 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,12 @@
+2008-12-24 Roland McGrath <[email protected]>
+
+ * Makefile.am ($(srcdir)/elfutils.spec.in): Rewrite awk magic.
+ Put the target inside [if MAINTAINER_MODE].
+
+2008-12-16 Roland McGrath <[email protected]>
+
+ * version.h.in: New file.
+
2008-01-12 Ulrich Drepper <[email protected]>
* elfutils.spec.in: Add m4 to build requirements.
diff --git a/config/Makefile.am b/config/Makefile.am
index 60e9bfe6..f2db4efb 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
## Configure input file for elfutils.
##
-## Copyright (C) 2004, 2005 Red Hat, Inc.
+## Copyright (C) 2004, 2005, 2008 Red Hat, Inc.
## This file is part of Red Hat elfutils.
##
## Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -27,21 +27,22 @@
##
EXTRA_DIST = elfutils.spec.in
+if MAINTAINER_MODE
$(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS
@tmpname=$$(mktemp $${TMPDIR:-/tmp}/elfutils.XXXXXX); \
date +'* %a %b %e %Y' | tr '[\n]' '[ ]' > $$tmpname; \
getent passwd "$$(whoami)" | \
awk 'BEGIN {FS=":"} { printf $$5; exit 0}' >> $$tmpname; \
echo -n " <$$(whoami)@redhat.com> " >> $$tmpname; \
- sed 's/Version \(.*\):$$/\1-1/;q' $(top_srcdir)/NEWS >> $$tmpname; \
- sed '2,/^Version /p;d' $(top_srcdir)/NEWS | \
- head -n -1 | \
- awk '{ if ($$0 == "") { if (line != "") { printf "- "; fflush(); system("echo \"" line "\" | fold -w 70"); line=""; } } else { line=line $$0; }} END { if (line != "") { printf "- "; system("echo \"" line "\" | fold -w 70")}}' >> $$tmpname; \
- echo >> $$tmpname; \
+ awk '\
+ $$1 == "Version" && started { exit } \
+ $$1 == "Version" { started=1; line=""; sub(/:/,"",$$2); \
+ print $$2 "-1"; next } \
+ NF > 0 { line = (line != "") ? (line " " $$0) : ("- " $$0) } \
+ NF == 0 && line != "" { print line; line="" } \
+ END { if (line != "") print line; print "" }' $< \
+ | fold -s -w 70 | sed '1!s/^[^-]/ &/' >> $$tmpname; \
sed "/^%changelog/r $$tmpname" $@ > [email protected]; \
rm -f $$tmpname; \
- -@if [ -d $(srcdir)/CVS ]; then \
- cd $(srcdir); \
- cvs ci -m "Added changelog." $(@F); \
- fi
+endif
diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in
index 222a9e63..55be54c3 100644
--- a/config/elfutils.spec.in
+++ b/config/elfutils.spec.in
@@ -5,7 +5,7 @@ Version: @PACKAGE_VERSION@
Release: 1
License: GPLv2 with exceptions
Group: Development/Tools
-Source: elfutils-%{version}.tar.gz
+Source: elfutils-%{version}.tar.bz2
Obsoletes: libelf libelf-devel
Requires: elfutils-libelf = %{version}-%{release}
Requires: glibc >= 2.7
@@ -182,6 +182,16 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.a
%changelog
+* Wed Dec 31 2008 Roland McGrath <[email protected]> 0.138-1
+- Install <elfutils/version.h> header file for applications to use in
+ source version compatibility checks.
+- libebl: backend fixes for i386 TLS relocs; backend support for
+ NT_386_IOPERM
+- libcpu: disassembler fixes
+- libdwfl: bug fixes
+- libelf: bug fixes
+- nm: bug fixes for handling corrupt input files
+
* Tue Aug 26 2008 Ulrich Drepper <[email protected]> 0.137-1
- Minor fixes for unreleased 0.136 release.
@@ -214,7 +224,7 @@ rm -rf ${RPM_BUILD_ROOT}
- libdw: DW_FORM_ref_addr support; dwarf_formref entry point now depreca
ted; bug fixes for oddly-formatted DWARF
- libdwfl: bug fixes in offline archive support, symbol table handling;
- apply partial relocations for dwfl_module_address_section on
+ apply partial relocations for dwfl_module_address_section on
ET_REL
- libebl: powerpc backend support for Altivec registers
diff --git a/config/version.h.in b/config/version.h.in
new file mode 100644
index 00000000..82c846e9
--- /dev/null
+++ b/config/version.h.in
@@ -0,0 +1,58 @@
+/* Version information about elfutils development libraries.
+ Copyright (C) 2008 Red Hat, Inc.
+ This file is part of Red Hat elfutils.
+
+ Red Hat elfutils is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by the
+ Free Software Foundation; version 2 of the License.
+
+ Red Hat elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Red Hat elfutils; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+ In addition, as a special exception, Red Hat, Inc. gives You the
+ additional right to link the code of Red Hat elfutils with code licensed
+ under any Open Source Initiative certified open source license
+ (http://www.opensource.org/licenses/index.php) which requires the
+ distribution of source code with any binary distribution and to
+ distribute linked combinations of the two. Non-GPL Code permitted under
+ this exception must only link to the code of Red Hat elfutils through
+ those well defined interfaces identified in the file named EXCEPTION
+ found in the source code files (the "Approved Interfaces"). The files
+ of Non-GPL Code may instantiate templates or use macros or inline
+ functions from the Approved Interfaces without causing the resulting
+ work to be covered by the GNU General Public License. Only Red Hat,
+ Inc. may make changes or additions to the list of Approved Interfaces.
+ Red Hat's grant of this exception is conditioned upon your not adding
+ any new exceptions. If you wish to add a new Approved Interface or
+ exception, please contact Red Hat. You must obey the GNU General Public
+ License in all respects for all of the Red Hat elfutils code and other
+ code used in conjunction with Red Hat elfutils except the Non-GPL Code
+ covered by this exception. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do
+ so. If you do not wish to provide this exception without modification,
+ you must delete this exception statement from your version and license
+ this file solely under the GPL without exception.
+
+ Red Hat elfutils is an included package of the Open Invention Network.
+ An included package of the Open Invention Network is a package for which
+ Open Invention Network licensees cross-license their patents. No patent
+ license is granted, either expressly or impliedly, by designation as an
+ included package. Should you wish to participate in the Open Invention
+ Network licensing program, please visit www.openinventionnetwork.com
+ <http://www.openinventionnetwork.com>. */
+
+#ifndef _ELFUTILS_VERSION_H
+#define _ELFUTILS_VERSION_H 1
+
+#define _ELFUTILS_VERSION @eu_version@
+
+#define _ELFUTILS_PREREQ(major, minor) \
+ (_ELFUTILS_VERSION >= ((major) * 1000 + (minor)))
+
+#endif /* elfutils/version.h */
diff --git a/configure.ac b/configure.ac
index 2723046e..25804a8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software Foundation,
dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
dnl
-AC_INIT([Red Hat elfutils],[0.137],[http://bugzilla.redhat.com/bugzilla/],
+AC_INIT([Red Hat elfutils],[0.138],[http://bugzilla.redhat.com/bugzilla/],
[elfutils])
AC_CONFIG_AUX_DIR([config])
@@ -26,7 +26,7 @@ AC_COPYRIGHT([Copyright (C) 1996-2007, 2008 Red Hat, Inc.])
AC_PREREQ(2.59) dnl Minimum Autoconf version required.
dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
-AM_INIT_AUTOMAKE([gnits 1.7 -Wno-portability])
+AM_INIT_AUTOMAKE([gnits 1.8 -Wno-portability dist-bzip2 no-dist-gzip])
AM_MAINTAINER_MODE
dnl Unique ID for this build.
@@ -229,4 +229,15 @@ dnl Appended to the config.h file.
dnl We hide all kinds of configuration magic in lib/eu-config.h.
AH_BOTTOM([#include <eu-config.h>])
+dnl Version compatibility header.
+AC_CONFIG_FILES([version.h:config/version.h.in])
+AC_SUBST([eu_version])
+case $PACKAGE_VERSION in
+0.???) eu_version=${PACKAGE_VERSION#0.} ;;
+?.???) eu_version=${PACKAGE_VERSION/./} ;;
+?.??) eu_version=${PACKAGE_VERSION/./}0 ;;
+?.?) eu_version=${PACKAGE_VERSION/./}00 ;;
+*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
+esac
+
AC_OUTPUT
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
index ff642de1..5bc89f9f 100644
--- a/libcpu/ChangeLog
+++ b/libcpu/ChangeLog
@@ -1,3 +1,45 @@
+2008-12-31 Ulrich Drepper <[email protected]>
+
+ * i386_disasm.c (i386_disasm): Correct resizing of buffer.
+
+ * i386_parse.y (struct argstring): Add off element.
+ (off_op_str): New global variable.
+ (print_op_str): Print strings as concatenated strings. Keep track
+ of index and length. Update ->off element.
+ (print_op_str_idx): New function.
+ (instrtable_out): Mark op%d_fct as const.
+ Emit two tables for the strings: the string itself (op%d_str) and the
+ index table (op%d_str_idx).
+ * i386_disasm.c (i386_disasm): Adjust for new op%d_str definition.
+
+ * i386_disasm.c [X86_64] (i386_disasm): Handle rex prefix when
+ printing only prefix.
+
+ * i386_disasm.c (i386_disasm): Minor optimizations.
+
+ * i386_parse.y (instrtable_out): No need to emit index, the reader can
+ keep track.
+ * i386_disasm.c (i386_disasm): The index is not emitted anymore, no
+ need to skip it.
+
+ * i386_disasm.c (amd3dnow): Mark as const.
+
+ * defs/i386: Add blendvpd and blendvps opcodes.
+
+2008-12-30 Ulrich Drepper <[email protected]>
+
+ * defs/i386: Add blendpd and blendps opcodes.
+
+2008-12-19 Ulrich Drepper <[email protected]>
+
+ * defs/i386: Add entry for AMD 3DNOW.
+ * i386_disasm.c: Implement AMD 3DNOW disassembly.
+
+2008-12-17 Ulrich Drepper <[email protected]>
+
+ * i386_disasm.c (i386_disasm): If instruction matches prefix,
+ undoing the prefix match finishes the instruction.
+
2008-01-21 Roland McGrath <[email protected]>
* defs/i386: Fix typo in comment.
diff --git a/libcpu/defs/i386 b/libcpu/defs/i386
index 4abbc261..d928a4d8 100644
--- a/libcpu/defs/i386
+++ b/libcpu/defs/i386
@@ -911,6 +911,11 @@ ifdef(`i386',
00001111,10101110,11110000:mfence
00001111,10101110,11111000:sfence
00001111,10101110,{mod}111{r_m}:clflush {mod}{r_m}
+00001111,00001111,{MOD}{mmxreg}{R_M}:INVALID {MOD}{R_M},{mmxreg}
+01100110,00001111,00111010,00001100,{Mod}{xmmreg}{R_m},{imm8}:blendps {imm8},{Mod}{R_m},{xmmreg}
+01100110,00001111,00111010,00001101,{Mod}{xmmreg}{R_m},{imm8}:blendpd {imm8},{Mod}{R_m},{xmmreg}
+01100110,00001111,00111000,00010100,{Mod}{xmmreg}{R_m}:blendvps %xmm0,{Mod}{R_m},{xmmreg}
+01100110,00001111,00111000,00010101,{Mod}{xmmreg}{R_m}:blendvpd %xmm0,{Mod}{R_m},{xmmreg}
# ORDER:
dnl Many previous entries depend on this being last.
000{sreg2}111:pop {sreg2}
diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
index 843fd749..76b5a393 100644
--- a/libcpu/i386_disasm.c
+++ b/libcpu/i386_disasm.c
@@ -184,6 +184,73 @@ static const char *prefix_str[] =
#endif
+static const char amd3dnowstr[] =
+#define MNE_3DNOW_PAVGUSB 1
+ "pavgusb\0"
+#define MNE_3DNOW_PFADD (MNE_3DNOW_PAVGUSB + 8)
+ "pfadd\0"
+#define MNE_3DNOW_PFSUB (MNE_3DNOW_PFADD + 6)
+ "pfsub\0"
+#define MNE_3DNOW_PFSUBR (MNE_3DNOW_PFSUB + 6)
+ "pfsubr\0"
+#define MNE_3DNOW_PFACC (MNE_3DNOW_PFSUBR + 7)
+ "pfacc\0"
+#define MNE_3DNOW_PFCMPGE (MNE_3DNOW_PFACC + 6)
+ "pfcmpge\0"
+#define MNE_3DNOW_PFCMPGT (MNE_3DNOW_PFCMPGE + 8)
+ "pfcmpgt\0"
+#define MNE_3DNOW_PFCMPEQ (MNE_3DNOW_PFCMPGT + 8)
+ "pfcmpeq\0"
+#define MNE_3DNOW_PFMIN (MNE_3DNOW_PFCMPEQ + 8)
+ "pfmin\0"
+#define MNE_3DNOW_PFMAX (MNE_3DNOW_PFMIN + 6)
+ "pfmax\0"
+#define MNE_3DNOW_PI2FD (MNE_3DNOW_PFMAX + 6)
+ "pi2fd\0"
+#define MNE_3DNOW_PF2ID (MNE_3DNOW_PI2FD + 6)
+ "pf2id\0"
+#define MNE_3DNOW_PFRCP (MNE_3DNOW_PF2ID + 6)
+ "pfrcp\0"
+#define MNE_3DNOW_PFRSQRT (MNE_3DNOW_PFRCP + 6)
+ "pfrsqrt\0"
+#define MNE_3DNOW_PFMUL (MNE_3DNOW_PFRSQRT + 8)
+ "pfmul\0"
+#define MNE_3DNOW_PFRCPIT1 (MNE_3DNOW_PFMUL + 6)
+ "pfrcpit1\0"
+#define MNE_3DNOW_PFRSQIT1 (MNE_3DNOW_PFRCPIT1 + 9)
+ "pfrsqit1\0"
+#define MNE_3DNOW_PFRCPIT2 (MNE_3DNOW_PFRSQIT1 + 9)
+ "pfrcpit2\0"
+#define MNE_3DNOW_PMULHRW (MNE_3DNOW_PFRCPIT2 + 9)
+ "pmulhrw";
+
+#define AMD3DNOW_LOW_IDX 0x0d
+#define AMD3DNOW_HIGH_IDX (sizeof (amd3dnow) + AMD3DNOW_LOW_IDX - 1)
+#define AMD3DNOW_IDX(val) ((val) - AMD3DNOW_LOW_IDX)
+static const unsigned char amd3dnow[] =
+ {
+ [AMD3DNOW_IDX (0xbf)] = MNE_3DNOW_PAVGUSB,
+ [AMD3DNOW_IDX (0x9e)] = MNE_3DNOW_PFADD,
+ [AMD3DNOW_IDX (0x9a)] = MNE_3DNOW_PFSUB,
+ [AMD3DNOW_IDX (0xaa)] = MNE_3DNOW_PFSUBR,
+ [AMD3DNOW_IDX (0xae)] = MNE_3DNOW_PFACC,
+ [AMD3DNOW_IDX (0x90)] = MNE_3DNOW_PFCMPGE,
+ [AMD3DNOW_IDX (0xa0)] = MNE_3DNOW_PFCMPGT,
+ [AMD3DNOW_IDX (0xb0)] = MNE_3DNOW_PFCMPEQ,
+ [AMD3DNOW_IDX (0x94)] = MNE_3DNOW_PFMIN,
+ [AMD3DNOW_IDX (0xa4)] = MNE_3DNOW_PFMAX,
+ [AMD3DNOW_IDX (0x0d)] = MNE_3DNOW_PI2FD,
+ [AMD3DNOW_IDX (0x1d)] = MNE_3DNOW_PF2ID,
+ [AMD3DNOW_IDX (0x96)] = MNE_3DNOW_PFRCP,
+ [AMD3DNOW_IDX (0x97)] = MNE_3DNOW_PFRSQRT,
+ [AMD3DNOW_IDX (0xb4)] = MNE_3DNOW_PFMUL,
+ [AMD3DNOW_IDX (0xa6)] = MNE_3DNOW_PFRCPIT1,
+ [AMD3DNOW_IDX (0xa7)] = MNE_3DNOW_PFRSQIT1,
+ [AMD3DNOW_IDX (0xb6)] = MNE_3DNOW_PFRCPIT2,
+ [AMD3DNOW_IDX (0xb7)] = MNE_3DNOW_PMULHRW
+ };
+
+
struct output_data
{
GElf_Addr addr;
@@ -289,6 +356,9 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
prefixes |= ((*data++) & 0xf) | has_rex;
#endif
+ bufcnt = 0;
+ size_t cnt = 0;
+
const uint8_t *curr = match_data;
const uint8_t *const match_end = match_data + sizeof (match_data);
@@ -302,41 +372,16 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
goto do_ret;
}
- if (0)
- {
- /* Resize the buffer. */
- char *oldbuf;
- enomem:
- oldbuf = buf;
- if (buf == initbuf)
- buf = malloc (2 * bufsize);
- else
- buf = realloc (buf, 2 * bufsize);
- if (buf == NULL)
- {
- buf = oldbuf;
- retval = ENOMEM;
- goto do_ret;
- }
- bufsize *= 2;
-
- output_data.bufp = buf;
- output_data.bufsize = bufsize;
- }
- bufcnt = 0;
-
- size_t cnt = 0;
+ next_match:
while (curr < match_end)
{
- const uint8_t *start = curr;
-
uint_fast8_t len = *curr++;
+ const uint8_t *start = curr;
assert (len > 0);
- assert (curr + 2 * len + 2 <= match_end);
+ assert (curr + 2 * len <= match_end);
const uint8_t *codep = data;
- size_t avail = len;
int correct_prefix = 0;
int opoff = 0;
@@ -344,38 +389,32 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
{
/* We match a prefix byte. This is exactly one byte and
is matched exactly, without a mask. */
- --avail;
-
--len;
start += 2;
opoff = 8;
curr += 2;
- assert (avail > 0);
assert (last_prefix_bit != 0);
correct_prefix = last_prefix_bit;
}
- do
+ size_t avail = len;
+ while (avail > 0)
{
uint_fast8_t masked = *codep++ & *curr++;
if (masked != *curr++)
- break;
+ {
+ not:
+ curr = start + 2 * len;
+ ++cnt;
+ goto next_match;
+ }
--avail;
if (codep == end && avail > 0)
goto do_ret;
}
- while (avail > 0);
-
- if (avail != 0)
- {
- not:
- curr = start + 1 + 2 * len + 2;
- ++cnt;
- continue;
- }
if (len > end - data)
/* There is not enough data for the entire instruction. The
@@ -387,6 +426,41 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
|| (prefixes & correct_prefix) != 0);
prefixes ^= correct_prefix;
+ if (0)
+ {
+ /* Resize the buffer. */
+ char *oldbuf;
+ enomem:
+ oldbuf = buf;
+ if (buf == initbuf)
+ buf = malloc (2 * bufsize);
+ else
+ buf = realloc (buf, 2 * bufsize);
+ if (buf == NULL)
+ {
+ buf = oldbuf;
+ retval = ENOMEM;
+ goto do_ret;
+ }
+ bufsize *= 2;
+
+ output_data.bufp = buf;
+ output_data.bufsize = bufsize;
+ bufcnt = 0;
+
+ if (data == end)
+ {
+ assert (prefixes != 0);
+ goto print_prefix;
+ }
+
+ /* gcc is not clever enough to see the following variables
+ are not used uninitialized. */
+ asm (""
+ : "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep),
+ "=mr" (start), "=mr" (len));
+ }
+
size_t prefix_size = 0;
// XXXonly print as prefix if valid?
@@ -460,6 +534,23 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
case prefix_lock:
ADD_STRING ("lock");
break;
+#ifdef X86_64
+ case 0x40 ... 0x4f:
+ ADD_STRING ("rex");
+ if (byte != 0x40)
+ {
+ ADD_CHAR ('.');
+ if (byte & 0x8)
+ ADD_CHAR ('w');
+ if (byte & 0x4)
+ ADD_CHAR ('r');
+ if (byte & 0x3)
+ ADD_CHAR ('x');
+ if (byte & 0x1)
+ ADD_CHAR ('b');
+ }
+ break;
+#endif
default:
/* Cannot happen. */
puts ("unknown prefix");
@@ -625,6 +716,24 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
break;
case 0x0f:
+ if (data[1] == 0x0f)
+ {
+ /* AMD 3DNOW. We need one more byte. */
+ if (param_start >= end)
+ goto not;
+ if (*param_start < AMD3DNOW_LOW_IDX
+ || *param_start > AMD3DNOW_HIGH_IDX)
+ goto not;
+ unsigned int idx
+ = amd3dnow[AMD3DNOW_IDX (*param_start)];
+ if (idx == 0)
+ goto not;
+ str = amd3dnowstr + idx - 1;
+ /* Eat the immediate byte indicating the
+ operation. */
+ ++param_start;
+ break;
+ }
#ifdef X86_64
if (data[1] == 0xc7)
{
@@ -765,7 +874,8 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
{
/* First parameter. */
if (instrtab[cnt].str1 != 0)
- ADD_STRING (op1_str[instrtab[cnt].str1]);
+ ADD_STRING (op1_str
+ + op1_str_idx[instrtab[cnt].str1 - 1]);
output_data.opoff1 = (instrtab[cnt].off1_1
+ OFF1_1_BIAS - opoff);
@@ -785,7 +895,8 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
{
/* Second parameter. */
if (instrtab[cnt].str2 != 0)
- ADD_STRING (op2_str[instrtab[cnt].str2]);
+ ADD_STRING (op2_str
+ + op2_str_idx[instrtab[cnt].str2 - 1]);
output_data.opoff1 = (instrtab[cnt].off2_1
+ OFF2_1_BIAS - opoff);
@@ -805,7 +916,8 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
{
/* Third parameter. */
if (instrtab[cnt].str3 != 0)
- ADD_STRING (op3_str[instrtab[cnt].str3]);
+ ADD_STRING (op3_str
+ + op3_str_idx[instrtab[cnt].str3 - 1]);
output_data.opoff1 = (instrtab[cnt].off3_1
+ OFF3_1_BIAS - opoff);
diff --git a/libcpu/i386_parse.y b/libcpu/i386_parse.y
index ceeb12ad..b3a684d6 100644
--- a/libcpu/i386_parse.y
+++ b/libcpu/i386_parse.y
@@ -145,6 +145,7 @@ struct argstring
{
char *str;
int idx;
+ int off;
};
@@ -1066,19 +1067,33 @@ compare_suf (const void *p1, const void *p2)
static int count_op_str;
+static int off_op_str;
static void
print_op_str (const void *nodep, VISIT value,
int level __attribute__ ((unused)))
{
if (value == leaf || value == postorder)
{
- fprintf (outfile, " \"%s\",\n", (*(struct argstring **) nodep)->str);
+ const char *str = (*(struct argstring **) nodep)->str;
+ fprintf (outfile, "%s\n \"%s",
+ count_op_str == 0 ? "" : "\\0\"", str);
(*(struct argstring **) nodep)->idx = ++count_op_str;
+ (*(struct argstring **) nodep)->off = off_op_str;
+ off_op_str += strlen (str) + 1;
}
}
static void
+print_op_str_idx (const void *nodep, VISIT value,
+ int level __attribute__ ((unused)))
+{
+ if (value == leaf || value == postorder)
+ printf (" %d,\n", (*(struct argstring **) nodep)->off);
+}
+
+
+static void
print_op_fct (const void *nodep, VISIT value,
int level __attribute__ ((unused)))
{
@@ -1149,7 +1164,8 @@ instrtable_out (void)
{
/* Functions. */
count_op_str = 0;
- fprintf (outfile, "static opfct_t op%d_fct[] =\n{\n NULL,\n", i + 1);
+ fprintf (outfile, "static const opfct_t op%d_fct[] =\n{\n NULL,\n",
+ i + 1);
twalk (fct_names[i], print_op_fct);
fputs ("};\n", outfile);
@@ -1157,9 +1173,14 @@ instrtable_out (void)
if (nbitstr[i] != 0)
{
count_op_str = 0;
- fprintf (outfile, "static const char *op%d_str[] =\n{\n NULL,\n",
- i + 1);
+ off_op_str = 0;
+ fprintf (outfile, "static const char op%d_str[] =", i + 1);
twalk (strs[i], print_op_str);
+ fputs ("\";\n", outfile);
+
+ fprintf (outfile, "static const uint8_t op%d_str_idx[] = {\n",
+ i + 1);
+ twalk (strs[i], print_op_str_idx);
fputs ("};\n", outfile);
}
}
@@ -1296,7 +1317,7 @@ instrtable_out (void)
b = b->next;
}
- fprintf (outfile, " %#zx, %#zx,\n", cnt & 0xff, cnt >> 8);
+ fputc_unlocked ('\n', outfile);
}
fputs ("};\n", outfile);
}
diff --git a/libdw/libdw.map b/libdw/libdw.map
index b53918c6..1195109a 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -1,6 +1,7 @@
ELFUTILS_0 { };
ELFUTILS_0.122 {
- global: dwarf_abbrevhaschildren;
+ global:
+ dwarf_abbrevhaschildren;
dwarf_addrdie;
dwarf_arrayorder;
dwarf_attr;
@@ -185,6 +186,15 @@ ELFUTILS_0.136 {
*;
} ELFUTILS_0.130;
+ELFUTILS_0.138 {
+ global:
+ # Replaced ELFUTILS_0.130 version, which has bug-compatibility wrapper.
+ dwfl_module_build_id;
+
+ local:
+ *;
+} ELFUTILS_0.136;
+
ELFUTILS_0.138_UNWIND {
global:
# XXX new unwind stuff not decided yet
@@ -199,4 +209,4 @@ ELFUTILS_0.138_UNWIND {
dwarf_frame_return_address_register;
dwfl_addrframe;
dwfl_module_getcfi;
-} ELFUTILS_0.136;
+} ELFUTILS_0.138;
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 46d1836e..60ff209a 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -6,6 +6,18 @@
* dwfl_addrframe.c: New file.
* Makefile.am (libdwfl_a_SOURCES): Add them.
+2008-12-16 Roland McGrath <[email protected]>
+
+ * dwfl_module_build_id.c (dwfl_module_build_id): Define with alias and
+ symver magic to bind to ELFUTILS_0.138.
+ (_BUG_COMPAT_dwfl_module_build_id): New function, bug compatible
+ wrapper for ELFUTILS_0.130 version set.
+
+2008-12-18 Roland McGrath <[email protected]>
+
+ * derelocate.c (dwfl_module_relocate_address): Fix last fix: ET_DYN
+ addresses are taken as relative to MOD->low_addr.
+
2008-12-15 Roland McGrath <[email protected]>
* derelocate.c (dwfl_module_relocate_address): Apply main.bias, not
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
index 7f390c75..f2a64675 100644
--- a/libdwfl/derelocate.c
+++ b/libdwfl/derelocate.c
@@ -238,6 +238,7 @@ dwfl_module_relocations (Dwfl_Module *mod)
return 1;
case ET_EXEC:
+ assert (mod->main.bias == 0);
assert (mod->debug.bias == 0);
break;
}
@@ -353,16 +354,26 @@ find_section (Dwfl_Module *mod, Dwarf_Addr *addr)
int
dwfl_module_relocate_address (Dwfl_Module *mod, Dwarf_Addr *addr)
{
- if (check_module (mod))
+ if (unlikely (check_module (mod)))
return -1;
- if (mod->e_type != ET_REL)
+ switch (mod->e_type)
{
- *addr -= mod->main.bias;
- return 0;
+ case ET_REL:
+ return find_section (mod, addr);
+
+ case ET_DYN:
+ /* All relative to first and only relocation base: module start. */
+ *addr -= mod->low_addr;
+ break;
+
+ default:
+ /* Already absolute, dwfl_module_relocations returned zero. We
+ shouldn't really have been called, but it's a harmless no-op. */
+ break;
}
- return find_section (mod, addr);
+ return 0;
}
INTDEF (dwfl_module_relocate_address)
diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c
index 8725afbc..d1e0eb05 100644
--- a/libdwfl/dwfl_module_build_id.c
+++ b/libdwfl/dwfl_module_build_id.c
@@ -140,8 +140,8 @@ __libdwfl_find_build_id (Dwfl_Module *mod, bool set, Elf *elf)
}
int
-dwfl_module_build_id (Dwfl_Module *mod,
- const unsigned char **bits, GElf_Addr *vaddr)
+__dwfl_module_build_id (Dwfl_Module *mod,
+ const unsigned char **bits, GElf_Addr *vaddr)
{
if (mod == NULL)
return -1;
@@ -164,4 +164,19 @@ dwfl_module_build_id (Dwfl_Module *mod,
*vaddr = mod->build_id_vaddr;
return mod->build_id_len;
}
-INTDEF (dwfl_module_build_id)
+extern __typeof__ (dwfl_module_build_id) INTUSE(dwfl_module_build_id)
+ __attribute__ ((alias ("__dwfl_module_build_id")));
+asm (".symver "
+ "__dwfl_module_build_id, dwfl_module_build_id@@ELFUTILS_0.138");
+
+int
+_BUG_COMPAT_dwfl_module_build_id (Dwfl_Module *mod,
+ const unsigned char **bits, GElf_Addr *vaddr)
+{
+ int result = INTUSE(dwfl_module_build_id) (mod, bits, vaddr);
+ if (result > 0)
+ *vaddr += (result + 3) & -4;
+ return result;
+}
+asm (".symver "
+ "_BUG_COMPAT_dwfl_module_build_id, dwfl_module_build_id@ELFUTILS_0.130");
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 876ae24b..442aa29c 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -4,6 +4,27 @@
* Makefile.am (noinst_PROGRAMS): Add it.
(addrcfi_LDADD): New variable.
+2008-12-31 Ulrich Drepper <[email protected]>
+
+ * testfile44.S.bz2: Add tests for blendvpd and blendvps.
+ * testfile45.S.bz2: Likewise.
+ * testfile44.expect.bz2: Adjust accordingly.
+ * testfile45.expect.bz2: Likewise.
+
+2008-12-30 Ulrich Drepper <[email protected]>
+
+ * testfile44.S.bz2: Add tests for blendpd and blendps.
+ * testfile45.S.bz2: Likewise.
+ * testfile44.expect.bz2: Adjust accordingly.
+ * testfile45.expect.bz2: Likewise.
+
+2008-12-19 Ulrich Drepper <[email protected]>
+
+ * testfile44.S.bz2: Add tests for AMD 3DNOW.
+ * testfile45.S.bz2: Likewise.
+ * testfile44.expect.bz2: Adjust accordingly.
+ * testfile45.expect.bz2: Likewise.
+
2008-11-26 Roland McGrath <[email protected]>
* dwfl-bug-getmodules.c: New file.
diff --git a/tests/testfile44.S.bz2 b/tests/testfile44.S.bz2
index cbd0da3d..fb401e52 100644
--- a/tests/testfile44.S.bz2
+++ b/tests/testfile44.S.bz2
Binary files differ
diff --git a/tests/testfile44.expect.bz2 b/tests/testfile44.expect.bz2
index 2347aea1..9e504621 100644
--- a/tests/testfile44.expect.bz2
+++ b/tests/testfile44.expect.bz2
Binary files differ
diff --git a/tests/testfile45.S.bz2 b/tests/testfile45.S.bz2
index 91b47955..58bb16b8 100644
--- a/tests/testfile45.S.bz2
+++ b/tests/testfile45.S.bz2
Binary files differ
diff --git a/tests/testfile45.expect.bz2 b/tests/testfile45.expect.bz2
index 06b4d9bd..2cf60b77 100644
--- a/tests/testfile45.expect.bz2
+++ b/tests/testfile45.expect.bz2
Binary files differ