aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-09-08 10:47:49 +0000
committerAlan Modra <amodra@gmail.com>2009-09-08 10:47:49 +0000
commit5aeb0469da312427d2939d1a2a7ad1b2bde49275 (patch)
tree8936d7818f41c3b4afcacd746541031e7c50f224 /binutils
parent27936895e619c9c63a844f8dd420d00c8b405999 (diff)
downloadgdb-5aeb0469da312427d2939d1a2a7ad1b2bde49275.zip
gdb-5aeb0469da312427d2939d1a2a7ad1b2bde49275.tar.gz
gdb-5aeb0469da312427d2939d1a2a7ad1b2bde49275.tar.bz2
* dwarf.c (byte_get_little_endian): Handle size of 3.
(byte_get_big_endian): Likewise. * readelf.c (byte_put_little_endian): Likewise. (byte_put_big_endian): Likewise. (is_24bit_abs_reloc): New function. (is_none_reloc): Formatting. (apply_relocations): Use is_24bit_abs_reloc. Handle pj and xtensa reloc peculiarity. 2009-09-07 Jan Kratochvil <jan.kratochvil@redhat.com> * readelf.c (is_none_reloc <EM_XTENSA_OLD>, is_none_reloc <EM_XTENSA>): New. 2009-09-07 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf.c (process_debug_info): Support section padding abbrev codes.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog20
-rw-r--r--binutils/dwarf.c25
-rw-r--r--binutils/readelf.c45
3 files changed, 86 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e256bae..09f53e0 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,23 @@
+2009-09-08 Alan Modra <amodra@bigpond.net.au>
+
+ * dwarf.c (byte_get_little_endian): Handle size of 3.
+ (byte_get_big_endian): Likewise.
+ * readelf.c (byte_put_little_endian): Likewise.
+ (byte_put_big_endian): Likewise.
+ (is_24bit_abs_reloc): New function.
+ (is_none_reloc): Formatting.
+ (apply_relocations): Use is_24bit_abs_reloc. Handle pj and xtensa
+ reloc peculiarity.
+
+2009-09-07 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * readelf.c (is_none_reloc <EM_XTENSA_OLD>, is_none_reloc <EM_XTENSA>):
+ New.
+
+2009-09-07 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwarf.c (process_debug_info): Support section padding abbrev codes.
+
2009-09-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.am (sysdump.o): Depend on sysroff.c.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 9c7c9a8..6c9a1a6 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -72,6 +72,11 @@ byte_get_little_endian (unsigned char *field, int size)
return ((unsigned int) (field[0]))
| (((unsigned int) (field[1])) << 8);
+ case 3:
+ return ((unsigned long) (field[0]))
+ | (((unsigned long) (field[1])) << 8)
+ | (((unsigned long) (field[2])) << 16);
+
case 4:
return ((unsigned long) (field[0]))
| (((unsigned long) (field[1])) << 8)
@@ -114,6 +119,11 @@ byte_get_big_endian (unsigned char *field, int size)
case 2:
return ((unsigned int) (field[1])) | (((int) (field[0])) << 8);
+ case 3:
+ return ((unsigned long) (field[2]))
+ | (((unsigned long) (field[1])) << 8)
+ | (((unsigned long) (field[0])) << 16);
+
case 4:
return ((unsigned long) (field[3]))
| (((unsigned long) (field[2])) << 8)
@@ -1985,9 +1995,22 @@ process_debug_info (struct dwarf_section *section,
abbrev_number = read_leb128 (tags, & bytes_read, 0);
tags += bytes_read;
- /* A null DIE marks the end of a list of siblings. */
+ /* A null DIE marks the end of a list of siblings or it may also be
+ a section padding. */
if (abbrev_number == 0)
{
+ /* Check if it can be a section padding for the last CU. */
+ if (level == 0 && start == end)
+ {
+ unsigned char *chk;
+
+ for (chk = tags; chk < start; chk++)
+ if (*chk != 0)
+ break;
+ if (chk == start)
+ break;
+ }
+
--level;
if (level < 0)
{
diff --git a/binutils/readelf.c b/binutils/readelf.c
index a8c1691..590c70d 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -342,6 +342,8 @@ byte_put_little_endian (unsigned char * field, bfd_vma value, int size)
/* Fall through. */
case 4:
field[3] = (value >> 24) & 0xff;
+ /* Fall through. */
+ case 3:
field[2] = (value >> 16) & 0xff;
/* Fall through. */
case 2:
@@ -505,8 +507,11 @@ byte_put_big_endian (unsigned char * field, bfd_vma value, int size)
/* Fall through. */
case 4:
field[3] = value & 0xff;
- field[2] = (value >> 8) & 0xff;
- value >>= 16;
+ value >>= 8;
+ /* Fall through. */
+ case 3:
+ field[2] = value & 0xff;
+ value >>= 8;
/* Fall through. */
case 2:
field[1] = value & 0xff;
@@ -8100,6 +8105,22 @@ is_64bit_pcrel_reloc (unsigned int reloc_type)
}
/* Like is_32bit_abs_reloc except that it returns TRUE iff RELOC_TYPE is
+ a 24-bit absolute RELA relocation used in DWARF debug sections. */
+
+static bfd_boolean
+is_24bit_abs_reloc (unsigned int reloc_type)
+{
+ switch (elf_header.e_machine)
+ {
+ case EM_CYGNUS_MN10200:
+ case EM_MN10200:
+ return reloc_type == 4; /* R_MN10200_24. */
+ default:
+ return FALSE;
+ }
+}
+
+/* Like is_32bit_abs_reloc except that it returns TRUE iff RELOC_TYPE is
a 16-bit absolute RELA relocation used in DWARF debug sections. */
static bfd_boolean
@@ -8163,6 +8184,12 @@ is_none_reloc (unsigned int reloc_type)
case EM_MN10300: /* R_MN10300_NONE. */
case EM_M32R: /* R_M32R_NONE. */
return reloc_type == 0;
+ case EM_XTENSA_OLD:
+ case EM_XTENSA:
+ return (reloc_type == 0 /* R_XTENSA_NONE. */
+ || reloc_type == 17 /* R_XTENSA_DIFF8. */
+ || reloc_type == 18 /* R_XTENSA_DIFF16. */
+ || reloc_type == 19 /* R_XTENSA_DIFF32. */);
}
return FALSE;
}
@@ -8244,6 +8271,8 @@ apply_relocations (void * file,
else if (is_64bit_abs_reloc (reloc_type)
|| is_64bit_pcrel_reloc (reloc_type))
reloc_size = 8;
+ else if (is_24bit_abs_reloc (reloc_type))
+ reloc_size = 3;
else if (is_16bit_abs_reloc (reloc_type))
reloc_size = 2;
else
@@ -8287,7 +8316,17 @@ apply_relocations (void * file,
continue;
}
- addend = is_rela ? rp->r_addend : byte_get (loc, reloc_size);
+ addend = 0;
+ if (is_rela)
+ addend += rp->r_addend;
+ /* R_XTENSA_32 and R_PJ_DATA_DIR32 are partial_inplace. */
+ if (!is_rela
+ || (elf_header.e_machine == EM_XTENSA
+ && reloc_type == 1)
+ || ((elf_header.e_machine == EM_PJ
+ || elf_header.e_machine == EM_PJ_OLD)
+ && reloc_type == 1))
+ addend += byte_get (loc, reloc_size);
if (is_32bit_pcrel_reloc (reloc_type)
|| is_64bit_pcrel_reloc (reloc_type))