aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-sh.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-08-07 18:32:07 +0000
committerNick Clifton <nickc@redhat.com>2001-08-07 18:32:07 +0000
commit993e9275d7b78f1348bf658bc828748fccf8cbf1 (patch)
tree9f9b71ddaa11ebcc6d37c76bee0345f105e5d8c3 /bfd/coff-sh.c
parent38487616e6a63a8b646fa543a24ffcad25771129 (diff)
downloadgdb-993e9275d7b78f1348bf658bc828748fccf8cbf1.zip
gdb-993e9275d7b78f1348bf658bc828748fccf8cbf1.tar.gz
gdb-993e9275d7b78f1348bf658bc828748fccf8cbf1.tar.bz2
Support relocs for sh-coff targets as well as sh-pe.
Diffstat (limited to 'bfd/coff-sh.c')
-rw-r--r--bfd/coff-sh.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index c96d05e..3f41a2d 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
+#include "libiberty.h"
#include "libbfd.h"
#include "bfdlink.h"
#include "coff/sh.h"
@@ -460,6 +461,8 @@ coff_sh_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
return howto;
}
+#endif /* COFF_WITH_PE */
+
/* This structure is used to map BFD reloc codes to SH PE relocs. */
struct shcoff_reloc_map
{
@@ -486,16 +489,13 @@ sh_coff_reloc_type_lookup (abfd, code)
{
unsigned int i;
- for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct shcoff_reloc_map); i++)
- {
- if (sh_reloc_map[i].bfd_reloc_val == code)
- return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val];
- }
+ for (i = ARRAY_SIZE (sh_reloc_map); i--;)
+ if (sh_reloc_map[i].bfd_reloc_val == code)
+ return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val];
fprintf (stderr, "SH Error: unknown reloc type %d\n", code);
return NULL;
}
-#endif /* COFF_WITH_PE */
/* This macro is used in coffcode.h to get the howto corresponding to
an internal reloc. */