aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2013-07-15 15:07:30 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2013-07-15 15:07:30 +0000
commitd929bc19b96005d473ca4205725a4b9d218e6ba5 (patch)
treedc2f65fa83d1486b462dcbda8ef9de124f898de5
parent054e8d9e20cf24e4b4fea6f46f289cf0475746ea (diff)
downloadgdb-d929bc19b96005d473ca4205725a4b9d218e6ba5.zip
gdb-d929bc19b96005d473ca4205725a4b9d218e6ba5.tar.gz
gdb-d929bc19b96005d473ca4205725a4b9d218e6ba5.tar.bz2
include/elf/
* mips.h (Tag_GNU_MIPS_ABI_FP): Remove comment. (Val_GNU_MIPS_ABI_FP_ANY, Val_GNU_MIPS_ABI_FP_DOUBLE, Val_GNU_MIPS_ABI_FP_SINGLE, Val_GNU_MIPS_ABI_FP_SOFT, Val_GNU_MIPS_ABI_FP_64): New enum. bfd/ * elfxx-mips.c (mips_elf_merge_obj_attributes): Replace hardcoded magic numbers with enum values. binutils/ * readelf.c (display_mips_gnu_attribute): Replace hardcoded magic numbers with enum values. gdb/ * mips-tdep.c (mips_gdbarch_init): Replace hardcoded magic numbers with enum values.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfxx-mips.c46
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c10
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/mips-tdep.c10
-rw-r--r--include/elf/ChangeLog7
-rw-r--r--include/elf/mips.h29
8 files changed, 79 insertions, 38 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b4b3af6..153dc1f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-15 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * elfxx-mips.c (mips_elf_merge_obj_attributes): Replace hardcoded
+ magic numbers with enum values.
+
2013-07-12 Roland McGrath <mcgrathr@google.com>
* reloc.c: Add BFD_RELOC_390_PC12DBL, BFD_RELOC_390_PLT12DBL,
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index b7138cf..fd7900d 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -14316,7 +14316,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
abi_fp_bfd = mips_elf_tdata (obfd)->abi_fp_bfd;
in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
- if (!abi_fp_bfd && in_attr[Tag_GNU_MIPS_ABI_FP].i != 0)
+ if (!abi_fp_bfd && in_attr[Tag_GNU_MIPS_ABI_FP].i != Val_GNU_MIPS_ABI_FP_ANY)
mips_elf_tdata (obfd)->abi_fp_bfd = ibfd;
if (!elf_known_obj_attributes_proc (obfd)[0].i)
@@ -14337,27 +14337,27 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
if (in_attr[Tag_GNU_MIPS_ABI_FP].i != out_attr[Tag_GNU_MIPS_ABI_FP].i)
{
out_attr[Tag_GNU_MIPS_ABI_FP].type = 1;
- if (out_attr[Tag_GNU_MIPS_ABI_FP].i == 0)
+ if (out_attr[Tag_GNU_MIPS_ABI_FP].i == Val_GNU_MIPS_ABI_FP_ANY)
out_attr[Tag_GNU_MIPS_ABI_FP].i = in_attr[Tag_GNU_MIPS_ABI_FP].i;
- else if (in_attr[Tag_GNU_MIPS_ABI_FP].i != 0)
+ else if (in_attr[Tag_GNU_MIPS_ABI_FP].i != Val_GNU_MIPS_ABI_FP_ANY)
switch (out_attr[Tag_GNU_MIPS_ABI_FP].i)
{
- case 1:
+ case Val_GNU_MIPS_ABI_FP_DOUBLE:
switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
{
- case 2:
+ case Val_GNU_MIPS_ABI_FP_SINGLE:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd, "-mdouble-float", "-msingle-float");
break;
- case 3:
+ case Val_GNU_MIPS_ABI_FP_SOFT:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
break;
- case 4:
+ case Val_GNU_MIPS_ABI_FP_64:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd,
@@ -14374,22 +14374,22 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
}
break;
- case 2:
+ case Val_GNU_MIPS_ABI_FP_SINGLE:
switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
{
- case 1:
+ case Val_GNU_MIPS_ABI_FP_DOUBLE:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd, "-msingle-float", "-mdouble-float");
break;
- case 3:
+ case Val_GNU_MIPS_ABI_FP_SOFT:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
break;
- case 4:
+ case Val_GNU_MIPS_ABI_FP_64:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd,
@@ -14406,12 +14406,12 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
}
break;
- case 3:
+ case Val_GNU_MIPS_ABI_FP_SOFT:
switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
{
- case 1:
- case 2:
- case 4:
+ case Val_GNU_MIPS_ABI_FP_DOUBLE:
+ case Val_GNU_MIPS_ABI_FP_SINGLE:
+ case Val_GNU_MIPS_ABI_FP_64:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd, "-msoft-float", "-mhard-float");
@@ -14427,24 +14427,24 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
}
break;
- case 4:
+ case Val_GNU_MIPS_ABI_FP_64:
switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
{
- case 1:
+ case Val_GNU_MIPS_ABI_FP_DOUBLE:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd,
"-mips32r2 -mfp64", "-mdouble-float");
break;
- case 2:
+ case Val_GNU_MIPS_ABI_FP_SINGLE:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd,
"-mips32r2 -mfp64", "-msingle-float");
break;
- case 3:
+ case Val_GNU_MIPS_ABI_FP_SOFT:
_bfd_error_handler
(_("Warning: %B uses %s (set by %B), %B uses %s"),
obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
@@ -14463,7 +14463,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
default:
switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
{
- case 1:
+ case Val_GNU_MIPS_ABI_FP_DOUBLE:
_bfd_error_handler
(_("Warning: %B uses unknown floating point ABI %d "
"(set by %B), %B uses %s"),
@@ -14471,7 +14471,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
out_attr[Tag_GNU_MIPS_ABI_FP].i, "-mdouble-float");
break;
- case 2:
+ case Val_GNU_MIPS_ABI_FP_SINGLE:
_bfd_error_handler
(_("Warning: %B uses unknown floating point ABI %d "
"(set by %B), %B uses %s"),
@@ -14479,7 +14479,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
out_attr[Tag_GNU_MIPS_ABI_FP].i, "-msingle-float");
break;
- case 3:
+ case Val_GNU_MIPS_ABI_FP_SOFT:
_bfd_error_handler
(_("Warning: %B uses unknown floating point ABI %d "
"(set by %B), %B uses %s"),
@@ -14487,7 +14487,7 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
out_attr[Tag_GNU_MIPS_ABI_FP].i, "-msoft-float");
break;
- case 4:
+ case Val_GNU_MIPS_ABI_FP_64:
_bfd_error_handler
(_("Warning: %B uses unknown floating point ABI %d "
"(set by %B), %B uses %s"),
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0290e3f..3b36bc7 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-15 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * readelf.c (display_mips_gnu_attribute): Replace hardcoded magic
+ numbers with enum values.
+
2013-07-12 Maciej W. Rozycki <macro@codesourcery.com>
* readelf.c (get_machine_flags): Handle EF_MIPS_NAN2008.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index f73bb2f..16fec12 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -11735,19 +11735,19 @@ display_mips_gnu_attribute (unsigned char * p,
switch (val)
{
- case 0:
+ case Val_GNU_MIPS_ABI_FP_ANY:
printf (_("Hard or soft float\n"));
break;
- case 1:
+ case Val_GNU_MIPS_ABI_FP_DOUBLE:
printf (_("Hard float (double precision)\n"));
break;
- case 2:
+ case Val_GNU_MIPS_ABI_FP_SINGLE:
printf (_("Hard float (single precision)\n"));
break;
- case 3:
+ case Val_GNU_MIPS_ABI_FP_SOFT:
printf (_("Soft float\n"));
break;
- case 4:
+ case Val_GNU_MIPS_ABI_FP_64:
printf (_("Hard float (MIPS32r2 64-bit FPU)\n"));
break;
default:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9da4499..8143394 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-15 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * mips-tdep.c (mips_gdbarch_init): Replace hardcoded magic
+ numbers with enum values.
+
2013-07-15 Ali Anwar <ali_anwar@codesourcery.com>
PR threads/13217
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 3993f92..f60a844 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -7910,7 +7910,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
int i, num_regs;
enum mips_fpu_type fpu_type;
struct tdesc_arch_data *tdesc_data = NULL;
- int elf_fpu_type = 0;
+ int elf_fpu_type = Val_GNU_MIPS_ABI_FP_ANY;
const char **reg_names;
struct mips_regnum mips_regnum, *regnum;
enum mips_isa mips_isa;
@@ -8235,17 +8235,17 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (!mips_fpu_type_auto)
fpu_type = mips_fpu_type;
- else if (elf_fpu_type != 0)
+ else if (elf_fpu_type != Val_GNU_MIPS_ABI_FP_ANY)
{
switch (elf_fpu_type)
{
- case 1:
+ case Val_GNU_MIPS_ABI_FP_DOUBLE:
fpu_type = MIPS_FPU_DOUBLE;
break;
- case 2:
+ case Val_GNU_MIPS_ABI_FP_SINGLE:
fpu_type = MIPS_FPU_SINGLE;
break;
- case 3:
+ case Val_GNU_MIPS_ABI_FP_SOFT:
default:
/* Soft float or unknown. */
fpu_type = MIPS_FPU_NONE;
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index 6309d1c..8445e61 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,10 @@
+2013-07-15 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * mips.h (Tag_GNU_MIPS_ABI_FP): Remove comment.
+ (Val_GNU_MIPS_ABI_FP_ANY, Val_GNU_MIPS_ABI_FP_DOUBLE,
+ Val_GNU_MIPS_ABI_FP_SINGLE, Val_GNU_MIPS_ABI_FP_SOFT,
+ Val_GNU_MIPS_ABI_FP_64): New enum.
+
2013-07-12 Maciej W. Rozycki <macro@codesourcery.com>
* mips.h (EF_MIPS_NAN2008): New macro.
diff --git a/include/elf/mips.h b/include/elf/mips.h
index 84700b4..d25e773 100644
--- a/include/elf/mips.h
+++ b/include/elf/mips.h
@@ -1129,11 +1129,30 @@ extern void bfd_mips_elf64_swap_reginfo_out
enum
{
/* 0-3 are generic. */
- Tag_GNU_MIPS_ABI_FP = 4, /* Value 1 for hard-float -mdouble-float, 2
- for hard-float -msingle-float, 3 for
- soft-float, 4 for -mips32r2 -mfp64; 0 for
- not tagged or not using any ABIs affected
- by the differences. */
+
+ /* Floating-point ABI used by this object file. */
+ Tag_GNU_MIPS_ABI_FP = 4,
+};
+
+/* Object attribute values. */
+enum
+{
+ /* Values defined for Tag_GNU_MIPS_ABI_FP. */
+
+ /* Not tagged or not using any ABIs affected by the differences. */
+ Val_GNU_MIPS_ABI_FP_ANY = 0,
+
+ /* Using hard-float -mdouble-float. */
+ Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
+
+ /* Using hard-float -msingle-float. */
+ Val_GNU_MIPS_ABI_FP_SINGLE = 2,
+
+ /* Using soft-float. */
+ Val_GNU_MIPS_ABI_FP_SOFT = 3,
+
+ /* Using -mips32r2 -mfp64. */
+ Val_GNU_MIPS_ABI_FP_64 = 4,
};
#endif /* _ELF_MIPS_H */