From 0c09613c8f47903e53c14d8cb0fc51c05b847551 Mon Sep 17 00:00:00 2001 From: Gunther Nikl Date: Fri, 15 May 2015 19:22:06 +0000 Subject: [PATCH] Fix RELRELOC32 reading and decoding. AmigaOS 3.x expects short data. * bfd/amigaos.c (parse_archive_units): Add support for HUNK_RELOC32SHORT. Parse HUNK_RELRELOC32 the same way. (amiga_handle_rest): Check for HUNK_RELRELOC32 when reading short data. (read_raw_relocs): Likewise. --- bfd/amigaos.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/bfd/amigaos.c b/bfd/amigaos.c index 88a1d43..f946423 100644 --- a/bfd/amigaos.c +++ b/bfd/amigaos.c @@ -602,7 +602,6 @@ parse_archive_units (abfd, n_units, filesize, one, syms, symcount) case HUNK_DREL32: case HUNK_DREL16: case HUNK_DREL8: - case HUNK_RELRELOC32: case HUNK_ABSRELOC16: case HUNK_RELRELOC26: for (;;) { @@ -616,6 +615,21 @@ parse_archive_units (abfd, n_units, filesize, one, syms, symcount) return FALSE; } break; + case HUNK_RELOC32SHORT: + case HUNK_RELRELOC32: + for (;;) { + /* read offsets count */ + if (!get_word (abfd, &no)) + return FALSE; + if (!no) + break; + /* skip hunk+offsets */ + if (bfd_seek (abfd, (no+1)<<1, SEEK_CUR)) + return FALSE; + } + if ((bfd_tell (abfd) & 2) && bfd_seek (abfd, 2, SEEK_CUR)) + return FALSE; + break; case HUNK_EXT: defsym_pos = 0; if (!get_long (abfd, &n)) @@ -1126,7 +1140,7 @@ amiga_handle_rest (abfd, current_section, isload) asect->relocs = relp; relp->pos = bfd_tell (abfd) - 4; relp->num = 0; - if (hunk_value != HUNK_RELOC32SHORT) { + if (hunk_value != HUNK_RELOC32SHORT && hunk_value != HUNK_RELRELOC32) { for (;;) { if (!get_long (abfd, &no)) return FALSE; @@ -2624,7 +2638,7 @@ read_raw_relocs (abfd, section, d_offset, count) } /* read reloc count, hunk number and offsets */ - if (howto->type != H_ABS32SHORT) + if (type != HUNK_RELOC32SHORT && type != HUNK_RELRELOC32) { for (;;) { /* read offsets and hunk number */