]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
More fixes related to NONE relocs
authorAlan Modra <amodra@gmail.com>
Mon, 19 Jan 2015 07:45:30 +0000 (18:15 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 19 Jan 2015 09:07:45 +0000 (19:37 +1030)
* elf32-bfin.c (bfin_bfd_reloc_type_lookup): Correct loop iteration
to allow return of first howto.
* elf32-fr30.c (fr30_reloc_type_lookup): Likewise.
* elf32-m32c.c (m32c_reloc_type_lookup): Likewise.
* elf32-moxie.c (moxie_reloc_type_lookup): Likewise.
* elf32-or1k.c (or1k_reloc_type_lookup): Likewise.
* elf32-rl78.c (rl78_reloc_type_lookup): Likewise.
* elf32-rx.c (rx_reloc_type_lookup): Likewise.
* elf32-tilepro.c (tilepro_reloc_type_lookup): Likewise.
* elf32-xstormy16.c (xstormy16_reloc_type_lookup): Likewise.
* elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
* elf32-nios2.c (nios2_reloc_map): Add mapping for R_NIOS2_NONE.
* elf32-spu.c (spu_elf_bfd_to_reloc_type): Allow return of R_SPU_NONE.
(spu_elf_reloc_type_lookup): Adjust to suit.

13 files changed:
bfd/ChangeLog
bfd/elf32-bfin.c
bfd/elf32-fr30.c
bfd/elf32-m32c.c
bfd/elf32-moxie.c
bfd/elf32-nios2.c
bfd/elf32-or1k.c
bfd/elf32-rl78.c
bfd/elf32-rx.c
bfd/elf32-spu.c
bfd/elf32-tilepro.c
bfd/elf32-xstormy16.c
bfd/elfxx-tilegx.c

index b9c6c389e7fc94d304df24a441cf38ebefe91b1b..5b03d1c3678331e794e4075bb38eb86c6127e798 100644 (file)
@@ -1,3 +1,20 @@
+2015-01-19  Alan Modra  <amodra@gmail.com>
+
+       * elf32-bfin.c (bfin_bfd_reloc_type_lookup): Correct loop iteration
+       to allow return of first howto.
+       * elf32-fr30.c (fr30_reloc_type_lookup): Likewise.
+       * elf32-m32c.c (m32c_reloc_type_lookup): Likewise.
+       * elf32-moxie.c (moxie_reloc_type_lookup): Likewise.
+       * elf32-or1k.c (or1k_reloc_type_lookup): Likewise.
+       * elf32-rl78.c (rl78_reloc_type_lookup): Likewise.
+       * elf32-rx.c (rx_reloc_type_lookup): Likewise.
+       * elf32-tilepro.c (tilepro_reloc_type_lookup): Likewise.
+       * elf32-xstormy16.c (xstormy16_reloc_type_lookup): Likewise.
+       * elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
+       * elf32-nios2.c (nios2_reloc_map): Add mapping for R_NIOS2_NONE.
+       * elf32-spu.c (spu_elf_bfd_to_reloc_type): Allow return of R_SPU_NONE.
+       (spu_elf_reloc_type_lookup): Adjust to suit.
+
 2015-01-19  Alan Modra  <amodra@gmail.com>
 
        * bfd-in.h (bfd_get_section_limit_octets): New define, extracted from..
index 898010fbfd334b3fdbd10c21b0590f84fbd47a0c..80d20ca224f85f45374d0be10ae93beadcf7ae06 100644 (file)
@@ -1065,13 +1065,13 @@ bfin_bfd_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
                            bfd_reloc_code_real_type code)
 {
   unsigned int i;
-  unsigned int r_type = BFIN_RELOC_MIN;
+  unsigned int r_type = (unsigned int) -1;
 
-  for (i = sizeof (bfin_reloc_map) / sizeof (bfin_reloc_map[0]); --i;)
+  for (i = sizeof (bfin_reloc_map) / sizeof (bfin_reloc_map[0]); i--;)
     if (bfin_reloc_map[i].bfd_reloc_val == code)
       r_type = bfin_reloc_map[i].bfin_reloc_val;
 
-  if (r_type <= BFIN_RELOC_MAX && r_type > BFIN_RELOC_MIN)
+  if (r_type <= BFIN_RELOC_MAX)
     return &bfin_howto_table [r_type];
 
   else if (r_type >= BFIN_GNUEXT_RELOC_MIN && r_type <= BFIN_GNUEXT_RELOC_MAX)
index d7c326d36481589c8173fec4f36d73e678ff3f68..ba47a3d3f8a1f4a339c41f1025497a98413e007c 100644 (file)
@@ -343,7 +343,7 @@ fr30_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   unsigned int i;
 
   for (i = sizeof (fr30_reloc_map) / sizeof (fr30_reloc_map[0]);
-       --i;)
+       i--;)
     if (fr30_reloc_map [i].bfd_reloc_val == code)
       return & fr30_elf_howto_table [fr30_reloc_map[i].fr30_reloc_val];
 
index 988aa2a7fdebc11854d1876bbc218f504c774832..cbc17659e85a345528c0e22cd5c3d0494fabd705 100644 (file)
@@ -264,7 +264,7 @@ m32c_reloc_type_lookup
 {
   unsigned int i;
 
-  for (i = ARRAY_SIZE (m32c_reloc_map); --i;)
+  for (i = ARRAY_SIZE (m32c_reloc_map); i--;)
     if (m32c_reloc_map [i].bfd_reloc_val == code)
       return & m32c_elf_howto_table [m32c_reloc_map[i].m32c_reloc_val];
 
index a8584230a42be1707e8a0fe690f6aa2fbc2b7de3..7123ac10411182d6710fec2551e5c9731718120d 100644 (file)
@@ -99,7 +99,7 @@ moxie_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   unsigned int i;
 
   for (i = sizeof (moxie_reloc_map) / sizeof (moxie_reloc_map[0]);
-       --i;)
+       i--;)
     if (moxie_reloc_map [i].bfd_reloc_val == code)
       return & moxie_elf_howto_table [moxie_reloc_map[i].moxie_reloc_val];
 
index 55a3f60da7bf174b3166580b5c3b2dd010c41d68..c72c460770bb15cc3a4c1153b4a56503f8581d3a 100644 (file)
@@ -764,6 +764,7 @@ struct elf_reloc_map
 };
 
 static const struct elf_reloc_map nios2_reloc_map[] = {
+  {BFD_RELOC_NONE, R_NIOS2_NONE},
   {BFD_RELOC_NIOS2_S16, R_NIOS2_S16},
   {BFD_RELOC_NIOS2_U16, R_NIOS2_U16},
   {BFD_RELOC_16_PCREL, R_NIOS2_PCREL16},
index 0d2ebf0cb2fb796573691d23026bca56c038a237..fa2e9859bab31d195c8a929037865094a5f8cab3 100644 (file)
@@ -704,7 +704,7 @@ or1k_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
 {
   unsigned int i;
 
-  for (i = ARRAY_SIZE (or1k_reloc_map); --i;)
+  for (i = ARRAY_SIZE (or1k_reloc_map); i--;)
     if (or1k_reloc_map[i].bfd_reloc_val == code)
       return & or1k_elf_howto_table[or1k_reloc_map[i].or1k_reloc_val];
 
index 5901ed873f4ed3348abb24021a4f8309d62ac5c7..3230c8c059ad1d48bf9c5f892669a116ffd19ad7 100644 (file)
@@ -246,7 +246,7 @@ rl78_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
   if (code == BFD_RELOC_RL78_32_OP)
     return rl78_elf_howto_table + R_RL78_DIR32;
 
-  for (i = ARRAY_SIZE (rl78_reloc_map); --i;)
+  for (i = ARRAY_SIZE (rl78_reloc_map); i--;)
     if (rl78_reloc_map [i].bfd_reloc_val == code)
       return rl78_elf_howto_table + rl78_reloc_map[i].rl78_reloc_val;
 
index 058e086008fa173338492b319ef2053d3a4d3cb7..beb4e09d7c1297f135c862448d20bd48daec20d0 100644 (file)
@@ -277,7 +277,7 @@ rx_reloc_type_lookup (bfd *                    abfd ATTRIBUTE_UNUSED,
   if (code == BFD_RELOC_RX_32_OP)
     return rx_elf_howto_table + R_RX_DIR32;
 
-  for (i = ARRAY_SIZE (rx_reloc_map); --i;)
+  for (i = ARRAY_SIZE (rx_reloc_map); i--;)
     if (rx_reloc_map [i].bfd_reloc_val == code)
       return rx_elf_howto_table + rx_reloc_map[i].rx_reloc_val;
 
index a806c5de1dc2b3f3e13f67c31c4921e2c3a994fe..82032864157180806d7127c8613ac6a3866e86da 100644 (file)
@@ -105,6 +105,8 @@ spu_elf_bfd_to_reloc_type (bfd_reloc_code_real_type code)
   switch (code)
     {
     default:
+      return (enum elf_spu_reloc_type) -1;
+    case BFD_RELOC_NONE:
       return R_SPU_NONE;
     case BFD_RELOC_SPU_IMM10W:
       return R_SPU_ADDR10;
@@ -168,7 +170,7 @@ spu_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 {
   enum elf_spu_reloc_type r_type = spu_elf_bfd_to_reloc_type (code);
 
-  if (r_type == R_SPU_NONE)
+  if (r_type == (enum elf_spu_reloc_type) -1)
     return NULL;
 
   return elf_howto_table + r_type;
index b8c9586de32e069c64e11051d27296b6a46df5ea..f5739781abb61a88b32b030897a120ba699733c8 100644 (file)
@@ -774,7 +774,7 @@ tilepro_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
 {
   unsigned int i;
 
-  for (i = ARRAY_SIZE (tilepro_reloc_map); --i;)
+  for (i = ARRAY_SIZE (tilepro_reloc_map); i--;)
     {
       const reloc_map * entry;
 
index 8f47df5d571fe37ca560f5cad205116f25bb6d5d..6bf277cb120d0f1ec942d9af0a61b092b8c6883d 100644 (file)
@@ -334,7 +334,7 @@ xstormy16_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
 {
   unsigned int i;
 
-  for (i = ARRAY_SIZE (xstormy16_reloc_map); --i;)
+  for (i = ARRAY_SIZE (xstormy16_reloc_map); i--;)
     {
       const reloc_map * entry;
 
index e747fad18c6e7c2811de49adab92910015a28fc1..df1fe418d570ce0f26337d06c25da341ed75db66 100644 (file)
@@ -921,7 +921,7 @@ tilegx_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
 {
   unsigned int i;
 
-  for (i = ARRAY_SIZE (tilegx_reloc_map); --i;)
+  for (i = ARRAY_SIZE (tilegx_reloc_map); i--;)
     {
       const reloc_map * entry;