From 3c7b98977c0b44c19630cb2d6b699e90ba294e52 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 26 Jul 2008 13:10:48 +0000 Subject: [PATCH] Support PowerPC single-precision float. --- bfd/ChangeLog | 5 +++++ bfd/elf32-ppc.c | 16 ++++++++++++++-- binutils/readelf.c | 3 +++ gas/ChangeLog | 4 ++++ gas/doc/as.texinfo | 4 +++- include/elf/ChangeLog | 4 ++++ include/elf/ppc.h | 5 +++-- ld/testsuite/ChangeLog | 15 +++++++++++++++ ld/testsuite/ld-powerpc/attr-gnu-4-03.d | 10 ++++++++++ ld/testsuite/ld-powerpc/attr-gnu-4-13.d | 2 +- ld/testsuite/ld-powerpc/attr-gnu-4-14.d | 6 ++++++ ld/testsuite/ld-powerpc/attr-gnu-4-23.d | 6 ++++++ ld/testsuite/ld-powerpc/attr-gnu-4-24.d | 6 ++++++ ld/testsuite/ld-powerpc/attr-gnu-4-31.d | 2 +- ld/testsuite/ld-powerpc/attr-gnu-4-32.d | 6 ++++++ ld/testsuite/ld-powerpc/attr-gnu-4-33.d | 10 ++++++++++ ld/testsuite/ld-powerpc/attr-gnu-4-34.d | 6 ++++++ ld/testsuite/ld-powerpc/attr-gnu-4-4.s | 1 + ld/testsuite/ld-powerpc/attr-gnu-4-41.d | 6 ++++++ ld/testsuite/ld-powerpc/powerpc.exp | 10 +++++++++- 20 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-03.d create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-14.d create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-23.d create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-24.d create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-32.d create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-33.d create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-34.d create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-4.s create mode 100644 ld/testsuite/ld-powerpc/attr-gnu-4-41.d diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 23b8d93d87a..02dbbb14e83 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2008-07-26 Michael Eager + + * elf32-ppc.c (ppc_elf_merge_obj_attributes): Check compatibility + between single-float, double-float, and soft-float. + 2008-07-24 Daniel Jacobowitz * elf32-mips.c (elf_backend_write_section): Define. diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 92f812fda30..22b90b26a4a 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3883,10 +3883,22 @@ ppc_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd) else if (out_attr->i == 1 && in_attr->i == 2) _bfd_error_handler (_("Warning: %B uses hard float, %B uses soft float"), obfd, ibfd); - else if (out_attr->i == 2 && in_attr->i == 1) + else if (out_attr->i == 1 && in_attr->i == 3) + _bfd_error_handler + (_("Warning: %B uses double-precision hard float, %B uses single-precision hard float"), + obfd, ibfd); + else if (out_attr->i == 3 && in_attr->i == 1) + _bfd_error_handler + (_("Warning: %B uses double-precision hard float, %B uses single-precision hard float"), + ibfd, obfd); + else if (out_attr->i == 3 && in_attr->i == 2) + _bfd_error_handler + (_("Warning: %B uses soft float, %B uses single-precision hard float"), + ibfd, obfd); + else if (out_attr->i == 2 && (in_attr->i == 1 || in_attr->i == 3)) _bfd_error_handler (_("Warning: %B uses hard float, %B uses soft float"), ibfd, obfd); - else if (in_attr->i > 2) + else if (in_attr->i > 3) _bfd_error_handler (_("Warning: %B uses unknown floating point ABI %d"), ibfd, in_attr->i); diff --git a/binutils/readelf.c b/binutils/readelf.c index 92b00f1b7ad..8b0e13ac8b5 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -9037,6 +9037,9 @@ display_power_gnu_attribute (unsigned char *p, int tag) case 2: printf ("Soft float\n"); break; + case 3: + printf ("Single-precision hard float\n"); + break; default: printf ("??? (%d)\n", val); break; diff --git a/gas/ChangeLog b/gas/ChangeLog index b8016c6c430..48a38348f8a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2008-07-26 Michael Eager + + * doc/as.texinfo: Add description of single-precision attribute. + 2008-07-24 Jie Zhang * config/bfin-parse.y (asm_1): Error if plain symbol is used diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 165eca7cc05..635b7074847 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -6513,9 +6513,11 @@ The floating-point ABI used by this object file. The value will be: @item 0 for files not affected by the floating-point ABI. @item -1 for files using the hardware floating-point ABI. +1 for files using double-precision hardware floating-point ABI. @item 2 for files using the software floating-point ABI. +@item +3 for files using single-precision hardware floating-point ABI. @end itemize @item Tag_GNU_Power_ABI_Vector (8) diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index 71a54cd912a..62bce3e6c90 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,7 @@ +2008-07-26 Michael Eager + + * ppc.h: Add description of single-precision. + 2008-07-21 Luis Machado * common.h: Define NT_PPC_VSX. diff --git a/include/elf/ppc.h b/include/elf/ppc.h index 5d4462b0694..95cccce2481 100644 --- a/include/elf/ppc.h +++ b/include/elf/ppc.h @@ -1,5 +1,5 @@ /* PPC ELF support for BFD. - Copyright 1995, 1996, 1998, 2000, 2001, 2002, 2003, 2005 + Copyright 1995, 1996, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc. By Michael Meissner, Cygnus Support, , from information @@ -177,7 +177,8 @@ 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 + soft-float, 3 for single=precision + hard-float; 0 for not tagged or not using any ABIs affected by the differences. */ diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 593c909b619..c9b18bc3dda 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2008-07-26 Michael Eager + + * ld-powerpc/powerpc.exp: Run new tests. + * ld-powerpc/attr-gnu-4-03.d: New file. + * ld-powerpc/attr-gnu-4-14.d: New file. + * ld-powerpc/attr-gnu-4-23.d: New file. + * ld-powerpc/attr-gnu-4-24.d: New file. + * ld-powerpc/attr-gnu-4-32.d: New file. + * ld-powerpc/attr-gnu-4-33.d: New file. + * ld-powerpc/attr-gnu-4-34.d: New file. + * ld-powerpc/attr-gnu-4-41.d: New file. + * ld-powerpc/attr-gnu-4-4.s: New file. + * ld-powerpc/attr-gnu-4-13.d: Adjust. + * ld-powerpc/attr-gnu-4-31.d: Adjust. + 2008-07-26 Alan Modra * ld-scripts/include.exp: Don't run test for aout. diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-03.d b/ld/testsuite/ld-powerpc/attr-gnu-4-03.d new file mode 100644 index 00000000000..03b0c3c76e2 --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-03.d @@ -0,0 +1,10 @@ +#source: attr-gnu-4-0.s +#source: attr-gnu-4-3.s +#as: -a32 +#ld: -r -melf32ppc +#readelf: -A +#target: powerpc*-*-* + +Attribute Section: gnu +File Attributes + Tag_GNU_Power_ABI_FP: Single-precision hard float diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-13.d b/ld/testsuite/ld-powerpc/attr-gnu-4-13.d index be1290e6570..6bc3de4a55e 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-4-13.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-13.d @@ -2,5 +2,5 @@ #source: attr-gnu-4-3.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses unknown floating point ABI 3 +#warning: Warning: .* uses double-precision hard float, .* uses single-precision hard float #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-14.d b/ld/testsuite/ld-powerpc/attr-gnu-4-14.d new file mode 100644 index 00000000000..3bb6661e949 --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-14.d @@ -0,0 +1,6 @@ +#source: attr-gnu-4-1.s +#source: attr-gnu-4-4.s +#as: -a32 +#ld: -r -melf32ppc +#warning: Warning: .* uses unknown floating point ABI 4 +#target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-23.d b/ld/testsuite/ld-powerpc/attr-gnu-4-23.d new file mode 100644 index 00000000000..f72c258d66a --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-23.d @@ -0,0 +1,6 @@ +#source: attr-gnu-4-2.s +#source: attr-gnu-4-3.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-24.d b/ld/testsuite/ld-powerpc/attr-gnu-4-24.d new file mode 100644 index 00000000000..fc17f918025 --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-24.d @@ -0,0 +1,6 @@ +#source: attr-gnu-4-2.s +#source: attr-gnu-4-4.s +#as: -a32 +#ld: -r -melf32ppc +#warning: Warning: .* uses unknown floating point ABI 4 +#target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-31.d b/ld/testsuite/ld-powerpc/attr-gnu-4-31.d index 9cf8f4f5930..8ee1874a105 100644 --- a/ld/testsuite/ld-powerpc/attr-gnu-4-31.d +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-31.d @@ -2,5 +2,5 @@ #source: attr-gnu-4-1.s #as: -a32 #ld: -r -melf32ppc -#warning: Warning: .* uses unknown floating point ABI 3 +#warning: Warning: .* uses double-precision hard float, .* uses single-precision hard float #target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-32.d b/ld/testsuite/ld-powerpc/attr-gnu-4-32.d new file mode 100644 index 00000000000..3b7cb2919bd --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-32.d @@ -0,0 +1,6 @@ +#source: attr-gnu-4-3.s +#source: attr-gnu-4-2.s +#as: -a32 +#ld: -r -melf32ppc +#warning: Warning: .* uses soft float, .* uses single-precision hard float +#target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-33.d b/ld/testsuite/ld-powerpc/attr-gnu-4-33.d new file mode 100644 index 00000000000..88367aef687 --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-33.d @@ -0,0 +1,10 @@ +#source: attr-gnu-4-3.s +#source: attr-gnu-4-3.s +#as: -a32 +#ld: -r -melf32ppc +#readelf: -A +#target: powerpc*-*-* + +Attribute Section: gnu +File Attributes + Tag_GNU_Power_ABI_FP: Single-precision hard float diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-34.d b/ld/testsuite/ld-powerpc/attr-gnu-4-34.d new file mode 100644 index 00000000000..6f6e1fe762d --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-34.d @@ -0,0 +1,6 @@ +#source: attr-gnu-4-3.s +#source: attr-gnu-4-4.s +#as: -a32 +#ld: -r -melf32ppc +#warning: Warning: .* uses unknown floating point ABI 4 +#target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-4.s b/ld/testsuite/ld-powerpc/attr-gnu-4-4.s new file mode 100644 index 00000000000..3ff129ae7a4 --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-4.s @@ -0,0 +1 @@ +.gnu_attribute 4,4 diff --git a/ld/testsuite/ld-powerpc/attr-gnu-4-41.d b/ld/testsuite/ld-powerpc/attr-gnu-4-41.d new file mode 100644 index 00000000000..b9094763ebf --- /dev/null +++ b/ld/testsuite/ld-powerpc/attr-gnu-4-41.d @@ -0,0 +1,6 @@ +#source: attr-gnu-4-4.s +#source: attr-gnu-4-1.s +#as: -a32 +#ld: -r -melf32ppc +#warning: Warning: .* uses unknown floating point ABI 4 +#target: powerpc*-*-* diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index b1ad367a88c..4e03cf6fb3c 100644 --- a/ld/testsuite/ld-powerpc/powerpc.exp +++ b/ld/testsuite/ld-powerpc/powerpc.exp @@ -1,5 +1,5 @@ # Expect script for ld-powerpc tests -# Copyright 2002, 2003, 2005, 2006, 2007 Free Software Foundation +# Copyright 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation # # This file is part of the GNU Binutils. # @@ -157,14 +157,22 @@ 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-03" 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-14" 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-23" +run_dump_test "attr-gnu-4-24" run_dump_test "attr-gnu-4-31" +run_dump_test "attr-gnu-4-32" +run_dump_test "attr-gnu-4-33" +run_dump_test "attr-gnu-4-34" +run_dump_test "attr-gnu-4-41" run_dump_test "attr-gnu-8-11" run_dump_test "attr-gnu-8-23" -- 2.30.2