Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / coff-we32k.c
index 1ba62007cf0e8c963e47e4a38d758a1cea3972c2..98b54c938a9efc9ac0be31f84c98a0d16467fad2 100644 (file)
@@ -1,6 +1,5 @@
 /* BFD back-end for we32k COFF files.
-   Copyright 1992, 1993, 1994, 1999, 2000, 2002, 2003, 2007, 2008
-   Free Software Foundation, Inc.
+   Copyright (C) 1992-2017 Free Software Foundation, Inc.
    Contributed by Brendan Kehoe (brendan@cs.widener.edu).
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -37,7 +36,7 @@ static reloc_howto_type howto_table[] =
     EMPTY_HOWTO (3),
     EMPTY_HOWTO (4),
     EMPTY_HOWTO (5),
-  HOWTO(R_DIR32,              0,  2,   32, FALSE, 0,complain_overflow_bitfield, 0, "dir32",    TRUE, 0xffffffff,0xffffffff, FALSE),
+  HOWTO(R_DIR32,              0,  2,   32, FALSE, 0,complain_overflow_bitfield, 0, "dir32",    TRUE, 0xffffffff,0xffffffff, FALSE),
     EMPTY_HOWTO (7),
     EMPTY_HOWTO (010),
     EMPTY_HOWTO (011),
@@ -46,22 +45,27 @@ static reloc_howto_type howto_table[] =
     EMPTY_HOWTO (014),
     EMPTY_HOWTO (015),
     EMPTY_HOWTO (016),
-  HOWTO(R_RELBYTE,            0,  0,   8,  FALSE, 0, complain_overflow_bitfield, 0, "8",       TRUE, 0x000000ff,0x000000ff, FALSE),
-  HOWTO(R_RELWORD,            0,  1,   16, FALSE, 0, complain_overflow_bitfield, 0, "16",      TRUE, 0x0000ffff,0x0000ffff, FALSE),
-  HOWTO(R_RELLONG,            0,  2,   32, FALSE, 0, complain_overflow_bitfield, 0, "32",      TRUE, 0xffffffff,0xffffffff, FALSE),
-  HOWTO(R_PCRBYTE,            0,  0,   8,  TRUE,  0, complain_overflow_signed, 0, "DISP8",    TRUE, 0x000000ff,0x000000ff, FALSE),
-  HOWTO(R_PCRWORD,            0,  1,   16, TRUE,  0, complain_overflow_signed, 0, "DISP16",   TRUE, 0x0000ffff,0x0000ffff, FALSE),
-  HOWTO(R_PCRLONG,            0,  2,   32, TRUE,  0, complain_overflow_signed, 0, "DISP32",   TRUE, 0xffffffff,0xffffffff, FALSE),
+  HOWTO(R_RELBYTE,            0,  0,   8,  FALSE, 0, complain_overflow_bitfield, 0, "8",       TRUE, 0x000000ff,0x000000ff, FALSE),
+  HOWTO(R_RELWORD,            0,  1,   16, FALSE, 0, complain_overflow_bitfield, 0, "16",      TRUE, 0x0000ffff,0x0000ffff, FALSE),
+  HOWTO(R_RELLONG,            0,  2,   32, FALSE, 0, complain_overflow_bitfield, 0, "32",      TRUE, 0xffffffff,0xffffffff, FALSE),
+  HOWTO(R_PCRBYTE,            0,  0,   8,  TRUE,  0, complain_overflow_signed, 0, "DISP8",    TRUE, 0x000000ff,0x000000ff, FALSE),
+  HOWTO(R_PCRWORD,            0,  1,   16, TRUE,  0, complain_overflow_signed, 0, "DISP16",   TRUE, 0x0000ffff,0x0000ffff, FALSE),
+  HOWTO(R_PCRLONG,            0,  2,   32, TRUE,  0, complain_overflow_signed, 0, "DISP32",   TRUE, 0xffffffff,0xffffffff, FALSE),
 };
 
+#define NUM_HOWTOS (sizeof (howto_table) / sizeof (howto_table[0]))
+
 /* Turn a howto into a reloc  nunmber */
 
 #define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
 #define BADMAG(x) WE32KBADMAG(x)
 #define WE32K  1
 
-#define RTYPE2HOWTO(cache_ptr, dst) \
-           (cache_ptr)->howto = howto_table + (dst)->r_type;
+#define RTYPE2HOWTO(cache_ptr, dst)                            \
+  ((cache_ptr)->howto =                                                \
+   ((dst)->r_type < NUM_HOWTOS                                 \
+    ? howto_table + (dst)->r_type                              \
+    : NULL))
 
 #ifndef bfd_pe_print_pdata
 #define bfd_pe_print_pdata     NULL
@@ -71,4 +75,4 @@ static reloc_howto_type howto_table[] =
 
 #define coff_write_armap bsd_write_armap
 
-CREATE_BIG_COFF_TARGET_VEC (we32kcoff_vec, "coff-we32k", 0, 0, 0, NULL, COFF_SWAP_TABLE)
+CREATE_BIG_COFF_TARGET_VEC (we32k_coff_vec, "coff-we32k", 0, 0, 0, NULL, COFF_SWAP_TABLE)
This page took 0.029113 seconds and 4 git commands to generate.