More fixes related to NONE relocs

* 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.
This commit is contained in:
Alan Modra 2015-01-19 18:15:30 +10:30
parent 6346d5ca43
commit 0ba38529f2
13 changed files with 33 additions and 13 deletions

View 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..

View 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)

View 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];

View 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];

View 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];

View 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},

View 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];

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;