This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix PR gas/22738 (.dc.a directive has wrong size on SPARC 64-bit).


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d85815e2d16f7c042d7912f1fa85bf1b9c28ca44

commit d85815e2d16f7c042d7912f1fa85bf1b9c28ca44
Author: Eric Botcazou <ebotcazou@gcc.gnu.org>
Date:   Tue Jan 30 00:13:51 2018 +0100

    Fix PR gas/22738 (.dc.a directive has wrong size on SPARC 64-bit).
    
    The .dc.a directive has wrong size (32 bits) on SPARC 64-bit because
    the assembler sets the correct BFD architecture only at the very end
    of the processing and it's too late for the directive.  It's fixed by
    defining TARGET_MACH and making it return a sensible default value.
    
    gas/
    	* config/tc-sparc.h (sparc_mach): Declare.
    	(TARGET_MACH): Define to above.
    	* config/tc-sparc.c (sparc_mach): New function.
    	(sparc_md_end): Minor tweak.
    ld/
    	* testsuite/ld-elf/pr22450.d: Remove reference to SPARC64.

Diff:
---
 gas/ChangeLog                 |  8 ++++++++
 gas/config/tc-sparc.c         | 17 +++++++++++++++--
 gas/config/tc-sparc.h         |  3 +++
 ld/ChangeLog                  |  4 ++++
 ld/testsuite/ld-elf/pr22450.d |  2 +-
 5 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index e7a288f..4fc81fa 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2018-01-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+	PR gas/22738
+	* config/tc-sparc.h (sparc_mach): Declare.
+	(TARGET_MACH): Define to above.
+	* config/tc-sparc.c (sparc_mach): New function.
+	(sparc_md_end): Minor tweak.
+
 2018-01-29  Nick Clifton  <nickc@redhat.com>
 
 	* po/ru.po: Updated Russian translation.
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 69a8e52..c21192a 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -325,6 +325,19 @@ init_default_arch (void)
   default_arch_type = sa->arch_type;
 }
 
+/* Called by TARGET_MACH.  */
+
+unsigned long
+sparc_mach (void)
+{
+  /* We don't get a chance to initialize anything before we're called,
+     so handle that now.  */
+  if (! default_init_p)
+    init_default_arch ();
+
+  return sparc_arch_size == 64 ? bfd_mach_sparc_v9 : bfd_mach_sparc;
+}
+
 /* Called by TARGET_FORMAT.  */
 
 const char *
@@ -1148,7 +1161,7 @@ md_begin (void)
 void
 sparc_md_end (void)
 {
-  unsigned long mach = bfd_mach_sparc;
+  unsigned long mach;
 #if defined(OBJ_ELF) && !defined(TE_SOLARIS)
   int hwcaps, hwcaps2;
 #endif
@@ -1182,7 +1195,7 @@ sparc_md_end (void)
       /* The sparclite is treated like a normal sparc.  Perhaps it shouldn't
 	 be but for now it is (since that's the way it's always been
 	 treated).  */
-      default: break;
+      default: mach = bfd_mach_sparc; break;
       }
   bfd_set_arch_mach (stdoutput, bfd_arch_sparc, mach);
 
diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h
index 7ff7613..e3db1fb 100644
--- a/gas/config/tc-sparc.h
+++ b/gas/config/tc-sparc.h
@@ -30,6 +30,9 @@ struct frag;
 
 #define TARGET_ARCH bfd_arch_sparc
 
+extern unsigned long sparc_mach (void);
+#define TARGET_MACH sparc_mach ()
+
 #ifdef TE_FreeBSD
 #define ELF_TARGET_FORMAT	"elf32-sparc"
 #define ELF64_TARGET_FORMAT	"elf64-sparc-freebsd"
diff --git a/ld/ChangeLog b/ld/ChangeLog
index d9e0c4f..c806643 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-29  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* testsuite/ld-elf/pr22450.d: Remove reference to SPARC64.
+
 2018-01-29  Maciej W. Rozycki  <macro@mips.com>
 
 	* testsuite/ld-mips-elf/comm-data.exp: Correct support for
diff --git a/ld/testsuite/ld-elf/pr22450.d b/ld/testsuite/ld-elf/pr22450.d
index 26853bc..5b219b7 100644
--- a/ld/testsuite/ld-elf/pr22450.d
+++ b/ld/testsuite/ld-elf/pr22450.d
@@ -2,7 +2,7 @@
 #readelf: --notes --wide
 #ld: -r
 # Fails on H8300 because it does not generate the correct relocs for the size fields.
-# Fails on AVR, IP2K, M68HC11, SPARC64, XC16C because the assembler does not calculate the correct values for the differences of local symbols.
+# Fails on AVR, IP2K, M68HC11, XC16C because the assembler does not calculate the correct values for the differences of local symbols.
 # Fails on CRX because readelf does not know how to apply CRX reloc number 20 (R_CRX_SWITCH32).
 
 #...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]