aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-ppc.c59
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/readelf.c61
-rw-r--r--include/elf/ChangeLog4
-rw-r--r--include/elf/ppc.h11
-rw-r--r--ld/testsuite/ChangeLog12
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-0.s1
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-00.d7
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-01.d10
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-02.d10
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-1.s1
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-10.d10
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-11.d10
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-12.d6
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-13.d6
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-2.s1
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-20.d10
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-21.d6
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-22.d10
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-3.s1
-rw-r--r--ld/testsuite/ld-powerpc/attr-gnu-4-31.d6
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp12
23 files changed, 265 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 92de3e5..bd2a82c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2007-06-29 Joseph Myers <joseph@codesourcery.com>
+ * elf32-ppc.c (ppc_elf_merge_obj_attributes): New.
+ (ppc_elf_merge_private_bfd_data): Call it.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
* elfxx-mips.c (mips_elf_merge_obj_attributes): New.
(_bfd_mips_elf_merge_private_bfd_data): Call it.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index b84f0af..d67ad86 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -3594,6 +3594,62 @@ ppc_elf_check_relocs (bfd *abfd,
return TRUE;
}
+
+/* Merge object attributes from IBFD into OBFD. Raise an error if
+ there are conflicting attributes. */
+static bfd_boolean
+ppc_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *in_attr;
+ obj_attribute *out_attr;
+
+ if (!elf_known_obj_attributes_proc (obfd)[0].i)
+ {
+ /* This is the first object. Copy the attributes. */
+ _bfd_elf_copy_obj_attributes (ibfd, obfd);
+
+ /* Use the Tag_null value to indicate the attributes have been
+ initialized. */
+ elf_known_obj_attributes_proc (obfd)[0].i = 1;
+
+ return TRUE;
+ }
+
+ /* Check for conflicting Tag_GNU_Power_ABI_FP attributes and merge
+ non-conflicting ones. */
+ in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
+ out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
+ if (in_attr[Tag_GNU_Power_ABI_FP].i != out_attr[Tag_GNU_Power_ABI_FP].i)
+ {
+ out_attr[Tag_GNU_Power_ABI_FP].type = 1;
+ if (out_attr[Tag_GNU_Power_ABI_FP].i == 0)
+ out_attr[Tag_GNU_Power_ABI_FP].i = in_attr[Tag_GNU_Power_ABI_FP].i;
+ else if (in_attr[Tag_GNU_Power_ABI_FP].i == 0)
+ ;
+ else if (out_attr[Tag_GNU_Power_ABI_FP].i == 1
+ && in_attr[Tag_GNU_Power_ABI_FP].i == 2)
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"), obfd, ibfd);
+ else if (out_attr[Tag_GNU_Power_ABI_FP].i == 2
+ && in_attr[Tag_GNU_Power_ABI_FP].i == 1)
+ _bfd_error_handler
+ (_("Warning: %B uses hard float, %B uses soft float"), ibfd, obfd);
+ else if (in_attr[Tag_GNU_Power_ABI_FP].i > 2)
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), ibfd,
+ in_attr[Tag_GNU_Power_ABI_FP].i);
+ else
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d"), obfd,
+ out_attr[Tag_GNU_Power_ABI_FP].i);
+ }
+
+ /* Merge Tag_compatibility attributes and any common GNU ones. */
+ _bfd_elf_merge_object_attributes (ibfd, obfd);
+
+ return TRUE;
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -3612,6 +3668,9 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
return FALSE;
+ if (!ppc_elf_merge_obj_attributes (ibfd, obfd))
+ return FALSE;
+
new_flags = elf_elfheader (ibfd)->e_flags;
old_flags = elf_elfheader (obfd)->e_flags;
if (!elf_flags_init (obfd))
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 76e0b68..4096ba2 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,11 @@
2007-06-29 Joseph Myers <joseph@codesourcery.com>
+ * readelf.c (display_power_gnu_attribute, process_power_specific):
+ New.
+ (process_arch_specific): Call process_power_specific.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
* readelf.c (display_mips_gnu_attribute): New.
(process_mips_specific): Call process_attributes.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index c20fcd6..ab41e28 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -8347,6 +8347,57 @@ display_gnu_attribute (unsigned char *p,
}
static unsigned char *
+display_power_gnu_attribute (unsigned char *p, int tag)
+{
+ int type;
+ unsigned int len;
+ int val;
+
+ if (tag == Tag_GNU_Power_ABI_FP)
+ {
+ val = read_uleb128 (p, &len);
+ p += len;
+ printf (" Tag_GNU_Power_ABI_FP: ");
+ switch (val)
+ {
+ case 0:
+ printf ("Hard or soft float\n");
+ break;
+ case 1:
+ printf ("Hard float\n");
+ break;
+ case 2:
+ printf ("Soft float\n");
+ break;
+ default:
+ printf ("??? (%d)\n", val);
+ break;
+ }
+ return p;
+ }
+
+ if (tag & 1)
+ type = 1; /* String. */
+ else
+ type = 2; /* uleb128. */
+ printf (" Tag_unknown_%d: ", tag);
+
+ if (type == 1)
+ {
+ printf ("\"%s\"\n", p);
+ p += strlen ((char *)p) + 1;
+ }
+ else
+ {
+ val = read_uleb128 (p, &len);
+ p += len;
+ printf ("%d (0x%x)\n", val, val);
+ }
+
+ return p;
+}
+
+static unsigned char *
display_mips_gnu_attribute (unsigned char *p, int tag)
{
int type;
@@ -8540,6 +8591,13 @@ process_arm_specific (FILE *file)
}
static int
+process_power_specific (FILE *file)
+{
+ return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
+ display_power_gnu_attribute);
+}
+
+static int
process_mips_specific (FILE *file)
{
Elf_Internal_Dyn *entry;
@@ -9317,6 +9375,9 @@ process_arch_specific (FILE *file)
case EM_MIPS_RS3_LE:
return process_mips_specific (file);
break;
+ case EM_PPC:
+ return process_power_specific (file);
+ break;
default:
break;
}
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index d690ad4..ba08331 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,5 +1,9 @@
2007-06-29 Joseph Myers <joseph@codesourcery.com>
+ * ppc.h (Tag_GNU_Power_ABI_FP): Define.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
* mips.h (Tag_GNU_MIPS_ABI_FP): Define.
2007-06-29 Joseph Myers <joseph@codesourcery.com>
diff --git a/include/elf/ppc.h b/include/elf/ppc.h
index ca50352..fe48814 100644
--- a/include/elf/ppc.h
+++ b/include/elf/ppc.h
@@ -171,4 +171,15 @@ END_RELOC_NUMBERS (R_PPC_max)
builds when those objects \
are not to be furhter \
relocated. */
+
+/* Object attribute tags. */
+enum
+{
+ /* 0-3 are generic. */
+ Tag_GNU_Power_ABI_FP = 4, /* Value 1 for hard-float, 2 for
+ soft-float; 0 for not tagged or not
+ using any ABIs affected by the
+ differences. */
+};
+
#endif /* _ELF_PPC_H */
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 5271fcf..28099e9 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,17 @@
2007-06-29 Joseph Myers <joseph@codesourcery.com>
+ * ld-powerpc/attr-gnu-4-0.s, ld-powerpc/attr-gnu-4-00.d,
+ ld-powerpc/attr-gnu-4-01.d, ld-powerpc/attr-gnu-4-02.d,
+ ld-powerpc/attr-gnu-4-1.s, ld-powerpc/attr-gnu-4-10.d,
+ ld-powerpc/attr-gnu-4-11.d, ld-powerpc/attr-gnu-4-12.d,
+ ld-powerpc/attr-gnu-4-13.d, ld-powerpc/attr-gnu-4-2.s,
+ ld-powerpc/attr-gnu-4-20.d, ld-powerpc/attr-gnu-4-21.d,
+ ld-powerpc/attr-gnu-4-22.d, ld-powerpc/attr-gnu-4-3.s,
+ ld-powerpc/attr-gnu-4-31.d: New.
+ * ld-powerpc/powerpc.exp: Run these new tests.
+
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
* ld-mips-elf/attr-gnu-4-0.s, ld-mips-elf/attr-gnu-4-00.d,
ld-mips-elf/attr-gnu-4-01.d, ld-mips-elf/attr-gnu-4-02.d,
ld-mips-elf/attr-gnu-4-03.d, ld-mips-elf/attr-gnu-4-1.s,
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-0.s b/ld/testsuite/ld-powerpc/attr-gnu-4-0.s
new file mode 100644
index 0000000..a143746
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-0.s
@@ -0,0 +1 @@
+.gnu_attribute 4,0
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-00.d b/ld/testsuite/ld-powerpc/attr-gnu-4-00.d
new file mode 100644
index 0000000..a4751a1
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-00.d
@@ -0,0 +1,7 @@
+#source: attr-gnu-4-0.s
+#source: attr-gnu-4-0.s
+#as: -a32
+#ld: -r -melf32ppc
+#readelf: -A
+#target: powerpc*-*-*
+
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-01.d b/ld/testsuite/ld-powerpc/attr-gnu-4-01.d
new file mode 100644
index 0000000..212e0c4
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-01.d
@@ -0,0 +1,10 @@
+#source: attr-gnu-4-0.s
+#source: attr-gnu-4-1.s
+#as: -a32
+#ld: -r -melf32ppc
+#readelf: -A
+#target: powerpc*-*-*
+
+Attribute Section: gnu
+File Attributes
+ Tag_GNU_Power_ABI_FP: Hard float
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-02.d b/ld/testsuite/ld-powerpc/attr-gnu-4-02.d
new file mode 100644
index 0000000..9bd42b5
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-02.d
@@ -0,0 +1,10 @@
+#source: attr-gnu-4-0.s
+#source: attr-gnu-4-2.s
+#as: -a32
+#ld: -r -melf32ppc
+#readelf: -A
+#target: powerpc*-*-*
+
+Attribute Section: gnu
+File Attributes
+ Tag_GNU_Power_ABI_FP: Soft float
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-1.s b/ld/testsuite/ld-powerpc/attr-gnu-4-1.s
new file mode 100644
index 0000000..e985a56
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-1.s
@@ -0,0 +1 @@
+.gnu_attribute 4,1
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-10.d b/ld/testsuite/ld-powerpc/attr-gnu-4-10.d
new file mode 100644
index 0000000..93297c2
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-10.d
@@ -0,0 +1,10 @@
+#source: attr-gnu-4-1.s
+#source: attr-gnu-4-0.s
+#as: -a32
+#ld: -r -melf32ppc
+#readelf: -A
+#target: powerpc*-*-*
+
+Attribute Section: gnu
+File Attributes
+ Tag_GNU_Power_ABI_FP: Hard float
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-11.d b/ld/testsuite/ld-powerpc/attr-gnu-4-11.d
new file mode 100644
index 0000000..fb2b76e
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-11.d
@@ -0,0 +1,10 @@
+#source: attr-gnu-4-1.s
+#source: attr-gnu-4-1.s
+#as: -a32
+#ld: -r -melf32ppc
+#readelf: -A
+#target: powerpc*-*-*
+
+Attribute Section: gnu
+File Attributes
+ Tag_GNU_Power_ABI_FP: Hard float
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-12.d b/ld/testsuite/ld-powerpc/attr-gnu-4-12.d
new file mode 100644
index 0000000..b7ffba0
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-12.d
@@ -0,0 +1,6 @@
+#source: attr-gnu-4-1.s
+#source: attr-gnu-4-2.s
+#as: -a32
+#ld: -r -melf32ppc
+#warning: Warning: .* uses hard float, .* uses soft float
+#target: powerpc*-*-*
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-13.d b/ld/testsuite/ld-powerpc/attr-gnu-4-13.d
new file mode 100644
index 0000000..be1290e
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-13.d
@@ -0,0 +1,6 @@
+#source: attr-gnu-4-1.s
+#source: attr-gnu-4-3.s
+#as: -a32
+#ld: -r -melf32ppc
+#warning: Warning: .* uses unknown floating point ABI 3
+#target: powerpc*-*-*
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-2.s b/ld/testsuite/ld-powerpc/attr-gnu-4-2.s
new file mode 100644
index 0000000..54ebf4e
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-2.s
@@ -0,0 +1 @@
+.gnu_attribute 4,2
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-20.d b/ld/testsuite/ld-powerpc/attr-gnu-4-20.d
new file mode 100644
index 0000000..3d83893
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-20.d
@@ -0,0 +1,10 @@
+#source: attr-gnu-4-2.s
+#source: attr-gnu-4-0.s
+#as: -a32
+#ld: -r -melf32ppc
+#readelf: -A
+#target: powerpc*-*-*
+
+Attribute Section: gnu
+File Attributes
+ Tag_GNU_Power_ABI_FP: Soft float
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-21.d b/ld/testsuite/ld-powerpc/attr-gnu-4-21.d
new file mode 100644
index 0000000..b38f248
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-21.d
@@ -0,0 +1,6 @@
+#source: attr-gnu-4-2.s
+#source: attr-gnu-4-1.s
+#as: -a32
+#ld: -r -melf32ppc
+#warning: Warning: .* uses hard float, .* uses soft float
+#target: powerpc*-*-*
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-22.d b/ld/testsuite/ld-powerpc/attr-gnu-4-22.d
new file mode 100644
index 0000000..f6bd198
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-22.d
@@ -0,0 +1,10 @@
+#source: attr-gnu-4-2.s
+#source: attr-gnu-4-2.s
+#as: -a32
+#ld: -r -melf32ppc
+#readelf: -A
+#target: powerpc*-*-*
+
+Attribute Section: gnu
+File Attributes
+ Tag_GNU_Power_ABI_FP: Soft float
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-3.s b/ld/testsuite/ld-powerpc/attr-gnu-4-3.s
new file mode 100644
index 0000000..32e5f5d
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-3.s
@@ -0,0 +1 @@
+.gnu_attribute 4,3
diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-31.d b/ld/testsuite/ld-powerpc/attr-gnu-4-31.d
new file mode 100644
index 0000000..9cf8f4f
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/attr-gnu-4-31.d
@@ -0,0 +1,6 @@
+#source: attr-gnu-4-3.s
+#source: attr-gnu-4-1.s
+#as: -a32
+#ld: -r -melf32ppc
+#warning: Warning: .* uses unknown floating point ABI 3
+#target: powerpc*-*-*
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 927c4b8..ad224b0 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -147,3 +147,15 @@ if [ supports_ppc64 ] then {
}
run_dump_test "plt1"
+
+run_dump_test "attr-gnu-4-00"
+run_dump_test "attr-gnu-4-01"
+run_dump_test "attr-gnu-4-02"
+run_dump_test "attr-gnu-4-10"
+run_dump_test "attr-gnu-4-11"
+run_dump_test "attr-gnu-4-12"
+run_dump_test "attr-gnu-4-13"
+run_dump_test "attr-gnu-4-20"
+run_dump_test "attr-gnu-4-21"
+run_dump_test "attr-gnu-4-22"
+run_dump_test "attr-gnu-4-31"