static reloc_howto_type *
MY (reloc_howto) (bfd *abfd ATTRIBUTE_UNUSED,
struct reloc_std_external *rel,
- int *r_index,
+ unsigned int *r_index,
int *r_extern,
int *r_pcrel)
{
unsigned int r_length;
- int r_ns32k_type;
+ unsigned int r_ns32k_type;
*r_index = ((rel->r_index[2] << 16)
| (rel->r_index[1] << 8)
>> RELOC_STD_BITS_LENGTH_SH_LITTLE);
r_ns32k_type = ((rel->r_type[0] & RELOC_STD_BITS_NS32K_TYPE_LITTLE)
>> RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE);
+ if (r_length > 2 || r_ns32k_type > 2)
+ return NULL;
return (MY (howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type);
}
asymbol **symbols,
bfd_size_type symcount ATTRIBUTE_UNUSED)
{
- int r_index;
+ unsigned int r_index;
int r_extern;
int r_pcrel;
struct aoutdata *su = &(abfd->tdata.aout_data->a);
if (r_extern) \
{ \
/* Undefined symbol. */ \
- cache_ptr->sym_ptr_ptr = symbols + r_index; \
+ if (r_index < bfd_get_symcount (abfd)) \
+ cache_ptr->sym_ptr_ptr = symbols + r_index; \
cache_ptr->addend = ad; \
} \
else \
for (; rel < rel_end; rel++)
{
bfd_vma r_addr;
- int r_index;
+ unsigned int r_index;
int r_extern;
int r_pcrel;
int r_baserel = 0;
map. */
r_index = symbol_map[r_index];
- if (r_index == -1)
+ if (r_index == -1u)
{
if (h != NULL)
{
for (; rel < rel_end; rel++)
{
bfd_vma r_addr;
- int r_index;
+ unsigned int r_index;
int r_extern;
unsigned int r_type;
bfd_vma r_addend;
map. */
r_index = symbol_map[r_index];
- if (r_index == -1)
+ if (r_index == -1u)
{
if (h != NULL)
{
#define MOVE_ADDRESS(ad) \
if (r_extern) \
{ \
- /* undefined symbol */ \
- cache_ptr->sym_ptr_ptr = symbols + r_index; \
- cache_ptr->addend = ad; \
+ /* undefined symbol */ \
+ if (r_index < bfd_get_symcount (abfd)) \
+ cache_ptr->sym_ptr_ptr = symbols + r_index; \
+ cache_ptr->addend = ad; \
} \
else \
{ \
- /* defined, section relative. replace symbol with pointer to \
- symbol which points to section */ \
- switch (r_index) { \
- case N_TEXT: \
- case N_TEXT | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_textsec(abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->textsec->vma; \
- break; \
- case N_DATA: \
- case N_DATA | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_datasec(abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->datasec->vma; \
- break; \
- case N_BSS: \
- case N_BSS | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_bsssec(abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->bsssec->vma; \
- break; \
- default: \
- case N_ABS: \
- case N_ABS | N_EXT: \
- cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \
- cache_ptr->addend = ad; \
- break; \
+ /* defined, section relative. replace symbol with pointer to \
+ symbol which points to section */ \
+ switch (r_index) \
+ { \
+ case N_TEXT: \
+ case N_TEXT | N_EXT: \
+ cache_ptr->sym_ptr_ptr = obj_textsec(abfd)->symbol_ptr_ptr; \
+ cache_ptr->addend = ad - su->textsec->vma; \
+ break; \
+ case N_DATA: \
+ case N_DATA | N_EXT: \
+ cache_ptr->sym_ptr_ptr = obj_datasec(abfd)->symbol_ptr_ptr; \
+ cache_ptr->addend = ad - su->datasec->vma; \
+ break; \
+ case N_BSS: \
+ case N_BSS | N_EXT: \
+ cache_ptr->sym_ptr_ptr = obj_bsssec(abfd)->symbol_ptr_ptr; \
+ cache_ptr->addend = ad - su->bsssec->vma; \
+ break; \
+ default: \
+ case N_ABS: \
+ case N_ABS | N_EXT: \
+ cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \
+ cache_ptr->addend = ad; \
+ break; \
+ } \
} \
- } \
static void
NAME(lynx,swap_ext_reloc_in) (bfd *abfd,
asymbol **symbols,
bfd_size_type symcount ATTRIBUTE_UNUSED)
{
- int r_index;
+ unsigned int r_index;
int r_extern;
unsigned int r_type;
struct aoutdata *su = &(abfd->tdata.aout_data->a);
asymbol **symbols,
bfd_size_type symcount ATTRIBUTE_UNUSED)
{
- int r_index;
+ unsigned int r_index;
int r_extern;
unsigned int r_length;
int r_pcrel;