summaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorCatherine Moore <clm@redhat.com>2011-03-30 16:09:39 +0000
committerCatherine Moore <clm@redhat.com>2011-03-30 16:09:39 +0000
commitc7038a05a2294278bfbd062c89c72155b521b4aa (patch)
treee25498c15e2081ec9de90aa13bbec3e47a7ed561 /binutils
parentc66ed437489902a4cb4bb216d94c6eb2fecbd5f1 (diff)
downloadbinutils-redhat-c7038a05a2294278bfbd062c89c72155b521b4aa.tar.gz
2011-03-30 Catherine Moore <clm@codesourcery.com>
* addr2line.c (translate_addresses): Sign extend the pc if sign_extend_vma is enabled.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/addr2line.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f9d8457750..2ffd99bc6c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-30 Catherine Moore <clm@codesourcery.com>
+
+ * addr2line.c (translate_addresses): Sign extend the pc
+ if sign_extend_vma is enabled.
+
2011-03-30 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
* readelf.c (process_gnu_liblist): Stop memory leak.
diff --git a/binutils/addr2line.c b/binutils/addr2line.c
index 10c6cde62e..1ece80aecd 100644
--- a/binutils/addr2line.c
+++ b/binutils/addr2line.c
@@ -37,6 +37,7 @@
#include "libiberty.h"
#include "demangle.h"
#include "bucomm.h"
+#include "elf-bfd.h"
static bfd_boolean unwind_inlines; /* -i, unwind inlined functions. */
static bfd_boolean with_addresses; /* -a, show addresses. */
@@ -195,6 +196,8 @@ find_offset_in_section (bfd *abfd, asection *section)
static void
translate_addresses (bfd *abfd, asection *section)
{
+ const struct elf_backend_data * bed;
+
int read_stdin = (naddr == 0);
for (;;)
@@ -215,6 +218,12 @@ translate_addresses (bfd *abfd, asection *section)
pc = bfd_scan_vma (*addr++, NULL, 16);
}
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
+ && (bed = get_elf_backend_data (abfd)) != NULL
+ && bed->sign_extend_vma
+ && (pc & (bfd_vma) 1 << (bed->s->arch_size - 1)))
+ pc |= ((bfd_vma) -1) << bed->s->arch_size;
+
if (with_addresses)
{
printf ("0x");