{
struct bfd_link_hash_entry *bh;
struct elf_link_hash_entry *elfh;
- const char *name;
+ char *name;
+ bfd_boolean res;
if (ELF_ST_IS_MICROMIPS (h->root.other))
value |= 1;
/* Create a new symbol. */
- name = ACONCAT ((prefix, h->root.root.root.string, NULL));
+ name = concat (prefix, h->root.root.root.string, NULL);
bh = NULL;
- if (!_bfd_generic_link_add_one_symbol (info, s->owner, name,
- BSF_LOCAL, s, value, NULL,
- TRUE, FALSE, &bh))
+ res = _bfd_generic_link_add_one_symbol (info, s->owner, name,
+ BSF_LOCAL, s, value, NULL,
+ TRUE, FALSE, &bh);
+ free (name);
+ if (! res)
return FALSE;
/* Make it a local function. */
{
struct bfd_link_hash_entry *bh;
struct elf_link_hash_entry *elfh;
- const char *name;
+ char *name;
asection *s;
bfd_vma value;
+ bfd_boolean res;
/* Read the symbol's value. */
BFD_ASSERT (h->root.root.type == bfd_link_hash_defined
value = h->root.root.u.def.value;
/* Create a new symbol. */
- name = ACONCAT ((prefix, h->root.root.root.string, NULL));
+ name = concat (prefix, h->root.root.root.string, NULL);
bh = NULL;
- if (!_bfd_generic_link_add_one_symbol (info, s->owner, name,
- BSF_LOCAL, s, value, NULL,
- TRUE, FALSE, &bh))
+ res = _bfd_generic_link_add_one_symbol (info, s->owner, name,
+ BSF_LOCAL, s, value, NULL,
+ TRUE, FALSE, &bh);
+ free (name);
+ if (! res)
return FALSE;
/* Make it local and copy the other attributes from H. */
/* Switch between a 5-bit register index and its 3-bit shorthand. */
-#define BZ16_REG(opcode) ((((((opcode) >> 7) & 7) + 0x1e) & 0x17) + 2)
-#define BZ16_REG_FIELD(r) \
- (((2 <= (r) && (r) <= 7) ? (r) : ((r) - 16)) << 7)
+#define BZ16_REG(opcode) ((((((opcode) >> 7) & 7) + 0x1e) & 0xf) + 2)
+#define BZ16_REG_FIELD(r) (((r) & 7) << 7)
/* 32-bit instructions with a delay slot. */
}
/* Merge Tag_compatibility attributes and any common GNU ones. */
- _bfd_elf_merge_object_attributes (ibfd, obfd);
+ return _bfd_elf_merge_object_attributes (ibfd, obfd);
+}
+
+/* Merge object ABI flags from IBFD into OBFD. Raise an error if
+ there are conflicting settings. */
+
+static bfd_boolean
+mips_elf_merge_obj_abiflags (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
+ struct mips_elf_obj_tdata *out_tdata = mips_elf_tdata (obfd);
+ struct mips_elf_obj_tdata *in_tdata = mips_elf_tdata (ibfd);
+
+ /* Update the output abiflags fp_abi using the computed fp_abi. */
+ out_tdata->abiflags.fp_abi = out_attr[Tag_GNU_MIPS_ABI_FP].i;
+
+#define max(a, b) ((a) > (b) ? (a) : (b))
+ /* Merge abiflags. */
+ out_tdata->abiflags.isa_level = max (out_tdata->abiflags.isa_level,
+ in_tdata->abiflags.isa_level);
+ out_tdata->abiflags.isa_rev = max (out_tdata->abiflags.isa_rev,
+ in_tdata->abiflags.isa_rev);
+ out_tdata->abiflags.gpr_size = max (out_tdata->abiflags.gpr_size,
+ in_tdata->abiflags.gpr_size);
+ out_tdata->abiflags.cpr1_size = max (out_tdata->abiflags.cpr1_size,
+ in_tdata->abiflags.cpr1_size);
+ out_tdata->abiflags.cpr2_size = max (out_tdata->abiflags.cpr2_size,
+ in_tdata->abiflags.cpr2_size);
+#undef max
+ out_tdata->abiflags.ases |= in_tdata->abiflags.ases;
+ out_tdata->abiflags.flags1 |= in_tdata->abiflags.flags1;
return TRUE;
}
struct mips_elf_obj_tdata *in_tdata;
bfd_boolean null_input_bfd = TRUE;
asection *sec;
- obj_attribute *out_attr;
+ bfd_boolean ok;
/* Check if we have the same endianness. */
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
in_tdata->abiflags_valid = TRUE;
}
- if (!mips_elf_merge_obj_attributes (ibfd, obfd))
- return FALSE;
-
if (!out_tdata->abiflags_valid)
{
/* Copy input abiflags if output abiflags are not already valid. */
update_mips_abiflags_isa (obfd, &out_tdata->abiflags);
}
- return TRUE;
+ ok = TRUE;
}
+ else
+ ok = mips_elf_merge_obj_e_flags (ibfd, obfd);
- /* Update the output abiflags fp_abi using the computed fp_abi. */
- out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
- out_tdata->abiflags.fp_abi = out_attr[Tag_GNU_MIPS_ABI_FP].i;
+ ok = mips_elf_merge_obj_attributes (ibfd, obfd) && ok;
-#define max(a,b) ((a) > (b) ? (a) : (b))
- /* Merge abiflags. */
- out_tdata->abiflags.isa_level = max (out_tdata->abiflags.isa_level,
- in_tdata->abiflags.isa_level);
- out_tdata->abiflags.isa_rev = max (out_tdata->abiflags.isa_rev,
- in_tdata->abiflags.isa_rev);
- out_tdata->abiflags.gpr_size = max (out_tdata->abiflags.gpr_size,
- in_tdata->abiflags.gpr_size);
- out_tdata->abiflags.cpr1_size = max (out_tdata->abiflags.cpr1_size,
- in_tdata->abiflags.cpr1_size);
- out_tdata->abiflags.cpr2_size = max (out_tdata->abiflags.cpr2_size,
- in_tdata->abiflags.cpr2_size);
-#undef max
- out_tdata->abiflags.ases |= in_tdata->abiflags.ases;
- out_tdata->abiflags.flags1 |= in_tdata->abiflags.flags1;
+ ok = mips_elf_merge_obj_abiflags (ibfd, obfd) && ok;
- if (!mips_elf_merge_obj_e_flags (ibfd, obfd))
+ if (!ok)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
if (mips_elf_tdata (abfd)->abiflags.fp_abi == Val_GNU_MIPS_ABI_FP_64
|| mips_elf_tdata (abfd)->abiflags.fp_abi == Val_GNU_MIPS_ABI_FP_64A)
i_ehdrp->e_ident[EI_ABIVERSION] = 3;
+
+ if (elf_stack_flags (abfd) && !(elf_stack_flags (abfd) & PF_X))
+ i_ehdrp->e_ident[EI_ABIVERSION] = 5;
}
int