This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB 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] S390: Fix compiler invocation with "compile" command


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

commit 60abeae4f219a7a445d11ebaf72d2939413ffe80
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date:   Fri Feb 27 10:47:54 2015 +0100

    S390: Fix compiler invocation with "compile" command
    
    On 64-bit S390 platforms the "compile" command always failed because
    gcc was not invoked correctly.  This patch fixes the compiler
    invocation.
    
    gdb/ChangeLog:
    
    	* s390-linux-tdep.c (s390_gcc_target_options): Not just handle
    	31-bit targets, but 64-bit targets as well.
    	(s390_gnu_triplet_regexp): New function.
    	(s390_gdbarch_init): Set the gcc_target_options gdbarch method for
    	64-bit targets as well.  Set the gnu_triplet_regexp gdbarch
    	method.

Diff:
---
 gdb/ChangeLog         |  9 +++++++++
 gdb/s390-linux-tdep.c | 19 ++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4f7f8b6..7d3b1ce 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2015-02-27  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+	* s390-linux-tdep.c (s390_gcc_target_options): Not just handle
+	31-bit targets, but 64-bit targets as well.
+	(s390_gnu_triplet_regexp): New function.
+	(s390_gdbarch_init): Set the gcc_target_options gdbarch method for
+	64-bit targets as well.  Set the gnu_triplet_regexp gdbarch
+	method.
+
 2015-02-27  Jon TURNEY  <jon.turney@dronecode.org.uk>  (tiny patch)
 
 	* windows-nat.c (CONTEXT_DEBUGGER): Remove.
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 9bd25fe..803779c 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -2808,12 +2808,24 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch,
     return 0;
 }
 
-/* Implement gdbarch_gcc_target_options.  GCC does not know "-m32".  */
+/* Implement gdbarch_gcc_target_options.  GCC does not know "-m32" or
+   "-mcmodel=large".  */
 
 static char *
 s390_gcc_target_options (struct gdbarch *gdbarch)
 {
-  return xstrdup ("-m31");
+  return xstrdup (gdbarch_ptr_bit (gdbarch) == 64 ? "-m64" : "-m31");
+}
+
+/* Implement gdbarch_gnu_triplet_regexp.  Target triplets are "s390-*"
+   for 31-bit and "s390x-*" for 64-bit, while the BFD arch name is
+   always "s390".  Note that an s390x compiler supports "-m31" as
+   well.  */
+
+static const char *
+s390_gnu_triplet_regexp (struct gdbarch *gdbarch)
+{
+  return "s390x?";
 }
 
 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
@@ -3112,7 +3124,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     {
     case ABI_LINUX_S390:
       set_gdbarch_addr_bits_remove (gdbarch, s390_addr_bits_remove);
-      set_gdbarch_gcc_target_options (gdbarch, s390_gcc_target_options);
       set_solib_svr4_fetch_link_map_offsets
 	(gdbarch, svr4_ilp32_fetch_link_map_offsets);
 
@@ -3152,6 +3163,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_stap_register_indirection_suffixes (gdbarch,
 					  stap_register_indirection_suffixes);
   set_gdbarch_stap_is_single_operand (gdbarch, s390_stap_is_single_operand);
+  set_gdbarch_gcc_target_options (gdbarch, s390_gcc_target_options);
+  set_gdbarch_gnu_triplet_regexp (gdbarch, s390_gnu_triplet_regexp);
 
   return gdbarch;
 }


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