aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/obj-elf.c10
-rw-r--r--gas/config/tc-arc.c16
-rw-r--r--gas/config/tc-arm.c8
-rw-r--r--gas/config/tc-csky.c110
-rw-r--r--gas/config/tc-mips.c6
-rw-r--r--gas/config/tc-msp430.c37
-rw-r--r--gas/config/tc-riscv.c15
-rw-r--r--gas/config/tc-sparc.c12
-rw-r--r--gas/config/tc-tic6x.c4
9 files changed, 137 insertions, 81 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 681e75f..eaf2d6a 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -2100,20 +2100,24 @@ obj_elf_vendor_attribute (int vendor)
}
record_attribute (vendor, tag);
+ bool ok = false;
switch (type & 3)
{
case 3:
- bfd_elf_add_obj_attr_int_string (stdoutput, vendor, tag, i, s);
+ ok = bfd_elf_add_obj_attr_int_string (stdoutput, vendor, tag, i, s);
break;
case 2:
- bfd_elf_add_obj_attr_string (stdoutput, vendor, tag, s);
+ ok = bfd_elf_add_obj_attr_string (stdoutput, vendor, tag, s);
break;
case 1:
- bfd_elf_add_obj_attr_int (stdoutput, vendor, tag, i);
+ ok = bfd_elf_add_obj_attr_int (stdoutput, vendor, tag, i);
break;
default:
abort ();
}
+ if (!ok)
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
demand_empty_rest_of_line ();
return tag;
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index d9b13a0..5f6f346 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -4941,7 +4941,9 @@ arc_set_attribute_int (int tag, int value)
if (tag < 1
|| tag >= NUM_KNOWN_OBJ_ATTRIBUTES
|| !attributes_set_explicitly[tag])
- bfd_elf_add_proc_attr_int (stdoutput, tag, value);
+ if (!bfd_elf_add_proc_attr_int (stdoutput, tag, value))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
static void
@@ -4950,7 +4952,9 @@ arc_set_attribute_string (int tag, const char *value)
if (tag < 1
|| tag >= NUM_KNOWN_OBJ_ATTRIBUTES
|| !attributes_set_explicitly[tag])
- bfd_elf_add_proc_attr_string (stdoutput, tag, value);
+ if (!bfd_elf_add_proc_attr_string (stdoutput, tag, value))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
/* Allocate and concatenate two strings. s1 can be NULL but not
@@ -5020,7 +5024,9 @@ arc_set_public_attributes (void)
&& (base != bfd_elf_get_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
Tag_ARC_CPU_base)))
as_warn (_("Overwrite explicitly set Tag_ARC_CPU_base"));
- bfd_elf_add_proc_attr_int (stdoutput, Tag_ARC_CPU_base, base);
+ if (!bfd_elf_add_proc_attr_int (stdoutput, Tag_ARC_CPU_base, base))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
/* Tag_ARC_ABI_osver. */
if (attributes_set_explicitly[Tag_ARC_ABI_osver])
@@ -5069,7 +5075,9 @@ arc_set_public_attributes (void)
{
as_warn (_("Overwrite explicitly set Tag_ARC_ABI_rf16 to full "
"register file"));
- bfd_elf_add_proc_attr_int (stdoutput, Tag_ARC_ABI_rf16, 0);
+ if (!bfd_elf_add_proc_attr_int (stdoutput, Tag_ARC_ABI_rf16, 0))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
}
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index f912fb2..56345ea 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -32984,7 +32984,9 @@ aeabi_set_attribute_int (int tag, int value)
if (tag < 1
|| tag >= NUM_KNOWN_OBJ_ATTRIBUTES
|| !attributes_set_explicitly[tag])
- bfd_elf_add_proc_attr_int (stdoutput, tag, value);
+ if (!bfd_elf_add_proc_attr_int (stdoutput, tag, value))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
static void
@@ -32993,7 +32995,9 @@ aeabi_set_attribute_string (int tag, const char *value)
if (tag < 1
|| tag >= NUM_KNOWN_OBJ_ATTRIBUTES
|| !attributes_set_explicitly[tag])
- bfd_elf_add_proc_attr_string (stdoutput, tag, value);
+ if (!bfd_elf_add_proc_attr_string (stdoutput, tag, value))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
/* Return whether features in the *NEEDED feature set are available via
diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c
index 41205e7..8f2d29f 100644
--- a/gas/config/tc-csky.c
+++ b/gas/config/tc-csky.c
@@ -1541,79 +1541,95 @@ md_show_usage (FILE *fp)
-mvdsp enable vector DSP instructions\n"));
}
-static void set_csky_attribute (void)
+static bool
+set_csky_attribute (void)
{
if (mach_flag & CSKY_ARCH_DSP)
{
if (dsp_flag & CSKY_DSP_FLAG_V2)
{
/* Set DSPV2. */
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_DSP_VERSION,
- VAL_CSKY_DSP_VERSION_2);
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_DSP_VERSION,
+ VAL_CSKY_DSP_VERSION_2))
+ return false;
}
else if (isa_flag & CSKY_ISA_DSP)
{
/* Set DSP extension. */
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_DSP_VERSION,
- VAL_CSKY_DSP_VERSION_EXTENSION);
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_DSP_VERSION,
+ VAL_CSKY_DSP_VERSION_EXTENSION))
+ return false;
}
/* Set VDSP attribute. */
if (isa_flag & CSKY_ISA_VDSP)
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_VDSP_VERSION,
- VAL_CSKY_VDSP_VERSION_1);
-
+ {
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_VDSP_VERSION,
+ VAL_CSKY_VDSP_VERSION_1))
+ return false;
+ }
else if (isa_flag & CSKY_ISA_VDSP_2)
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_VDSP_VERSION,
- VAL_CSKY_VDSP_VERSION_2);
-
+ {
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_VDSP_VERSION,
+ VAL_CSKY_VDSP_VERSION_2))
+ return false;
+ }
}
if (mach_flag & CSKY_ARCH_FLOAT)
{
unsigned int val = VAL_CSKY_FPU_HARDFP_SINGLE;
- if (IS_CSKY_ARCH_V1 (mach_flag)) {
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_FPU_VERSION,
- VAL_CSKY_FPU_VERSION_1);
- }
+ if (IS_CSKY_ARCH_V1 (mach_flag))
+ {
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_FPU_VERSION,
+ VAL_CSKY_FPU_VERSION_1))
+ return false;
+ }
else
{
if (isa_flag & CSKY_ISA_FLOAT_3E4)
{
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_FPU_VERSION,
- VAL_CSKY_FPU_VERSION_2);
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_FPU_VERSION,
+ VAL_CSKY_FPU_VERSION_2))
+ return false;
val |= VAL_CSKY_FPU_HARDFP_DOUBLE;
}
else
{
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_FPU_VERSION,
- VAL_CSKY_FPU_VERSION_2);
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_FPU_VERSION,
+ VAL_CSKY_FPU_VERSION_2))
+ return false;
}
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_FPU_HARDFP,
- val);
- bfd_elf_add_obj_attr_string (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_FPU_NUMBER_MODULE,
- "IEEE 754");
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_FPU_ABI,
- float_abi);
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_FPU_HARDFP, val))
+ return false;
+ if (!bfd_elf_add_obj_attr_string (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_FPU_NUMBER_MODULE,
+ "IEEE 754"))
+ return false;
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_FPU_ABI,
+ float_abi))
+ return false;
}
}
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_ISA_FLAGS, isa_flag))
+ return false;
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_ISA_FLAGS, isa_flag);
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_ISA_EXT_FLAGS, (isa_flag >> 32)))
+ return false;
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_ISA_EXT_FLAGS, (isa_flag >> 32));
+ return true;
}
/* Target-specific initialization and option handling. */
@@ -1676,8 +1692,10 @@ md_begin (void)
for (p_arch = csky_archs; p_arch->arch_flag != 0; p_arch++)
if ((mach_flag & CSKY_ARCH_MASK) == (p_arch->arch_flag & CSKY_ARCH_MASK))
{
- bfd_elf_add_obj_attr_string (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_ARCH_NAME, p_arch->name);
+ if (!bfd_elf_add_obj_attr_string (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_ARCH_NAME, p_arch->name))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
bfd_mach_flag = p_arch->bfd_mach_flag;
break;
}
@@ -1686,8 +1704,10 @@ md_begin (void)
for (p_cpu = csky_cpus; p_cpu->arch_flag != 0; p_cpu++)
if ((mach_flag & CPU_ARCH_MASK) == p_cpu->arch_flag)
{
- bfd_elf_add_obj_attr_string (stdoutput, OBJ_ATTR_PROC,
- Tag_CSKY_CPU_NAME, p_cpu->name);
+ if (!bfd_elf_add_obj_attr_string (stdoutput, OBJ_ATTR_PROC,
+ Tag_CSKY_CPU_NAME, p_cpu->name))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
isa_flag |= p_cpu->isa_flag;
break;
}
@@ -1856,7 +1876,9 @@ md_begin (void)
/* Set bfd_mach to bfd backend data. */
bfd_set_arch_mach (stdoutput, bfd_arch_csky, bfd_mach_flag);
- set_csky_attribute ();
+ if (!set_csky_attribute ())
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
/* The C-SKY assembler emits mapping symbols $t and $d to mark the
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index d6aae66..24cef90 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -20626,8 +20626,10 @@ mips_md_finish (void)
}
}
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
- Tag_GNU_MIPS_ABI_FP, fpabi);
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
+ Tag_GNU_MIPS_ABI_FP, fpabi))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
}
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index c160451..e3c66a3 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -5130,24 +5130,27 @@ msp430_md_finish (void)
/* We have already emitted an error if any of the following attributes
disagree with the attributes in the input assembly file. See
msp430_object_attribute. */
- bfd_elf_add_proc_attr_int (stdoutput, OFBA_MSPABI_Tag_ISA,
- target_is_430x () ? OFBA_MSPABI_Val_ISA_MSP430X
- : OFBA_MSPABI_Val_ISA_MSP430);
-
- bfd_elf_add_proc_attr_int (stdoutput, OFBA_MSPABI_Tag_Code_Model,
- large_model ? OFBA_MSPABI_Val_Code_Model_LARGE
- : OFBA_MSPABI_Val_Code_Model_SMALL);
-
- bfd_elf_add_proc_attr_int (stdoutput, OFBA_MSPABI_Tag_Data_Model,
- large_model ? OFBA_MSPABI_Val_Code_Model_LARGE
- : OFBA_MSPABI_Val_Code_Model_SMALL);
-
+ if (!bfd_elf_add_proc_attr_int (stdoutput, OFBA_MSPABI_Tag_ISA,
+ target_is_430x ()
+ ? OFBA_MSPABI_Val_ISA_MSP430X
+ : OFBA_MSPABI_Val_ISA_MSP430)
+ || !bfd_elf_add_proc_attr_int (stdoutput, OFBA_MSPABI_Tag_Code_Model,
+ large_model
+ ? OFBA_MSPABI_Val_Code_Model_LARGE
+ : OFBA_MSPABI_Val_Code_Model_SMALL)
+ || !bfd_elf_add_proc_attr_int (stdoutput, OFBA_MSPABI_Tag_Data_Model,
+ large_model
+ ? OFBA_MSPABI_Val_Code_Model_LARGE
+ : OFBA_MSPABI_Val_Code_Model_SMALL)
/* The data region GNU attribute is ignored for the small memory model. */
- if (large_model)
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
- Tag_GNU_MSP430_Data_Region, lower_data_region_only
- ? Val_GNU_MSP430_Data_Region_Lower
- : Val_GNU_MSP430_Data_Region_Any);
+ || (large_model
+ && !bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
+ Tag_GNU_MSP430_Data_Region,
+ lower_data_region_only
+ ? Val_GNU_MSP430_Data_Region_Lower
+ : Val_GNU_MSP430_Data_Region_Any)))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
/* Returns FALSE if there is a msp430 specific reason why the
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 3b520ad..0b8ecf9 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -4902,7 +4902,9 @@ riscv_write_out_attrs (void)
/* Re-write architecture elf attribute. */
arch_str = riscv_rps_as.subset_list->arch_str;
- bfd_elf_add_proc_attr_string (stdoutput, Tag_RISCV_arch, arch_str);
+ if (!bfd_elf_add_proc_attr_string (stdoutput, Tag_RISCV_arch, arch_str))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
/* For the file without any instruction, we don't set the default_priv_spec
according to the privileged elf attributes since the md_assemble isn't
@@ -4937,9 +4939,14 @@ riscv_write_out_attrs (void)
versions[i] = number;
/* Re-write privileged elf attributes. */
- bfd_elf_add_proc_attr_int (stdoutput, Tag_RISCV_priv_spec, versions[0]);
- bfd_elf_add_proc_attr_int (stdoutput, Tag_RISCV_priv_spec_minor, versions[1]);
- bfd_elf_add_proc_attr_int (stdoutput, Tag_RISCV_priv_spec_revision, versions[2]);
+ if (!bfd_elf_add_proc_attr_int (stdoutput, Tag_RISCV_priv_spec,
+ versions[0])
+ || !bfd_elf_add_proc_attr_int (stdoutput, Tag_RISCV_priv_spec_minor,
+ versions[1])
+ || !bfd_elf_add_proc_attr_int (stdoutput, Tag_RISCV_priv_spec_revision,
+ versions[2]))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
/* Add the default contents for the .riscv.attributes section. */
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index c273bd7..587c159 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -1125,10 +1125,14 @@ sparc_md_finish (void)
hwcaps = hwcap_seen & U0xffffffff;
hwcaps2 = hwcap_seen >> 32;
- if (hwcaps)
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU, Tag_GNU_Sparc_HWCAPS, hwcaps);
- if (hwcaps2)
- bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU, Tag_GNU_Sparc_HWCAPS2, hwcaps2);
+ if ((hwcaps
+ && !bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
+ Tag_GNU_Sparc_HWCAPS, hwcaps))
+ || (hwcaps2
+ && !bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
+ Tag_GNU_Sparc_HWCAPS2, hwcaps2)))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
#endif
}
diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c
index 7cf4d94..6ed61ea 100644
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -4381,7 +4381,9 @@ tic6x_set_attribute_int (int tag, int value)
|| tag >= NUM_KNOWN_OBJ_ATTRIBUTES)
abort ();
if (!tic6x_attributes_set_explicitly[tag])
- bfd_elf_add_proc_attr_int (stdoutput, tag, value);
+ if (!bfd_elf_add_proc_attr_int (stdoutput, tag, value))
+ as_fatal (_("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
/* Set object attributes deduced from the input file and command line