/* Get the MIPS ELF linker hash table from a link_info structure. */
#define mips_elf_hash_table(p) \
- (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
- == MIPS_ELF_DATA ? ((struct mips_elf_link_hash_table *) ((p)->hash)) : NULL)
+ ((is_elf_hash_table ((p)->hash) \
+ && elf_hash_table_id (elf_hash_table (p)) == MIPS_ELF_DATA) \
+ ? (struct mips_elf_link_hash_table *) (p)->hash : NULL)
/* A structure used to communicate with htab_traverse callbacks. */
struct mips_htab_traverse_info
/* These are the constants used to swap the bitfields in a crinfo. */
-#define CRINFO_CTYPE (0x1)
+#define CRINFO_CTYPE (0x1U)
#define CRINFO_CTYPE_SH (31)
-#define CRINFO_RTYPE (0xf)
+#define CRINFO_RTYPE (0xfU)
#define CRINFO_RTYPE_SH (27)
-#define CRINFO_DIST2TO (0xff)
+#define CRINFO_DIST2TO (0xffU)
#define CRINFO_DIST2TO_SH (19)
-#define CRINFO_RELVADDR (0x7ffff)
+#define CRINFO_RELVADDR (0x7ffffU)
#define CRINFO_RELVADDR_SH (0)
/* A compact relocation info has long (3 words) or short (2 words)
if (mips16_reloc_p (r_type)
&& (((x >> 22) & 0x3ff) == 0x3d3 /* LW */
|| ((x >> 22) & 0x3ff) == 0x3c7)) /* LD */
- x = (0x3cd << 22) | (x & (7 << 16)) << 3; /* LI */
+ x = (0x3cdU << 22) | (x & (7 << 16)) << 3; /* LI */
else if (micromips_reloc_p (r_type)
&& ((x >> 26) & 0x37) == 0x37) /* LW/LD */
x = (0xc << 26) | (x & (0x1f << 21)); /* ADDIU */
s->contents));
/* Clean up a dummy stub function entry in .text. */
- if (htab->sstubs != NULL)
+ if (htab->sstubs != NULL
+ && htab->sstubs->contents != NULL)
{
file_ptr dummy_offset;
definiton of the symbol. */
void
_bfd_mips_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
- const Elf_Internal_Sym *isym,
+ unsigned int st_other,
bfd_boolean definition,
bfd_boolean dynamic ATTRIBUTE_UNUSED)
{
- if ((isym->st_other & ~ELF_ST_VISIBILITY (-1)) != 0)
+ if ((st_other & ~ELF_ST_VISIBILITY (-1)) != 0)
{
unsigned char other;
- other = (definition ? isym->st_other : h->other);
+ other = (definition ? st_other : h->other);
other &= ~ELF_ST_VISIBILITY (-1);
h->other = other | ELF_ST_VISIBILITY (h->other);
}
if (!definition
- && ELF_MIPS_IS_OPTIONAL (isym->st_other))
+ && ELF_MIPS_IS_OPTIONAL (st_other))
h->other |= STO_OPTIONAL;
}