public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, rs6000] Add ppc64_linux_gcc_target_options method
@ 2021-07-27 15:35 will schmidt
  2021-07-29  7:16 ` Ulrich Weigand
  2021-07-30 13:52 ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: will schmidt @ 2021-07-27 15:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand, rogerio, Carl E. Love

[gdb] [rs6000] Add ppc64_linux_gcc_target_options method.
    
Hi,
 Add a method to set the gcc target options for powerpc.
This change explicitly sets mcmodel=medium, which matches the gcc
default setting for this target; versus the -mcmodel=large
setting which is set by default_gcc_target_options.
    
OK for trunk?
Thanks
-Will
    
gdb/Changelog:
	yyyy-mm-dd  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* gdb/rs6000-tdep.c (linux_gcc_target_options): New method.
	(rs6000_gdbarch_init):  Hook in the new method.

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 826f0266ed8..a14366e778b 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -822,10 +822,17 @@ rs6000_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   return rs6000_in_function_epilogue_frame_p (get_current_frame (),
 					      gdbarch, pc);
 }
 
+/* Implement the linux_gcc_target_options method.  */
+static std::string
+ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
+{
+        return "-mcmodel=medium";
+}
+
 /* Get the ith function argument for the current function.  */
 static CORE_ADDR
 rs6000_fetch_pointer_argument (struct frame_info *frame, int argi, 
 			       struct type *type)
 {
@@ -7129,10 +7136,13 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Trampoline.  */
   set_gdbarch_in_solib_return_trampoline
     (gdbarch, rs6000_in_solib_return_trampoline);
   set_gdbarch_skip_trampoline_code (gdbarch, rs6000_skip_trampoline_code);
 
+  /* Set GCC target options.  */
+  set_gdbarch_gcc_target_options (gdbarch, ppc64_linux_gcc_target_options);
+
   /* Hook in the DWARF CFI frame unwinder.  */
   dwarf2_append_unwinders (gdbarch);
   dwarf2_frame_set_adjust_regnum (gdbarch, rs6000_adjust_frame_regnum);
 
   /* Frame handling.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH, rs6000] Add ppc64_linux_gcc_target_options method
  2021-07-27 15:35 [PATCH, rs6000] Add ppc64_linux_gcc_target_options method will schmidt
@ 2021-07-29  7:16 ` Ulrich Weigand
  2021-08-03 18:56   ` will schmidt
  2021-07-30 13:52 ` Tom Tromey
  1 sibling, 1 reply; 6+ messages in thread
From: Ulrich Weigand @ 2021-07-29  7:16 UTC (permalink / raw)
  To: will schmidt; +Cc: Carl E. Love, gdb-patches, rogerio



"will schmidt" <will_schmidt@vnet.ibm.com> wrote on 27.07.2021 17:35:42:

> +/* Implement the linux_gcc_target_options method.  */
> +static std::string
> +ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
> +{
> +        return "-mcmodel=medium";
> +}

The default version of this hook passes -m32 if the inferior
is a 32-bit process.  Don't we still need this on PowerPC
(at least on big-endian)?

Also, if -mcmodel=medium is the default, we don't actually
have to explicitly specify it.  Just omitting the
-mcmodel=large should be sufficient.

Bye,
Ulrich

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH, rs6000] Add ppc64_linux_gcc_target_options method
  2021-07-27 15:35 [PATCH, rs6000] Add ppc64_linux_gcc_target_options method will schmidt
  2021-07-29  7:16 ` Ulrich Weigand
@ 2021-07-30 13:52 ` Tom Tromey
  2021-08-05 20:43   ` [PATCH, rs6000] [V2] " will schmidt
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2021-07-30 13:52 UTC (permalink / raw)
  To: will schmidt via Gdb-patches; +Cc: will schmidt, Ulrich Weigand, rogerio

>>>>> ">" == will schmidt via Gdb-patches <gdb-patches@sourceware.org> writes:

>>  Add a method to set the gcc target options for powerpc.
>> This change explicitly sets mcmodel=medium, which matches the gcc
>> default setting for this target; versus the -mcmodel=large
>> setting which is set by default_gcc_target_options.
    
Hi.  Thanks for the patch.

>> +/* Implement the linux_gcc_target_options method.  */
>> +static std::string
>> +ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
>> +{
>> +        return "-mcmodel=medium";

The indentation is incorrect here.

thanks,
Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH, rs6000] Add ppc64_linux_gcc_target_options method
  2021-07-29  7:16 ` Ulrich Weigand
@ 2021-08-03 18:56   ` will schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: will schmidt @ 2021-08-03 18:56 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: Carl E. Love, gdb-patches, rogerio

On Thu, 2021-07-29 at 09:16 +0200, Ulrich Weigand wrote:
> "will schmidt" <will_schmidt@vnet.ibm.com> wrote on 27.07.2021
> 17:35:42:
> 
> > +/* Implement the linux_gcc_target_options method.  */
> > +static std::string
> > +ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
> > +{
> > +        return "-mcmodel=medium";
> > +}
> 
> The default version of this hook passes -m32 if the inferior

For reference, the default version of the hook is gdb/arch-utils.c:
default_gcc_target_options() , which reads as:

] std::string
] default_gcc_target_options (struct gdbarch *gdbarch)
] {
]   return string_printf ("-m%d%s", gdbarch_ptr_bit (gdbarch),
] 			(gdbarch_ptr_bit (gdbarch) == 64
] 			 ? " -mcmodel=large" : ""));
] }


> is a 32-bit process.  Don't we still need this on PowerPC
> (at least on big-endian)?

Possibly/probably.

  I have tried my gdb-compile patches on BE, and can confirm that
the gdb-compile support needs some work there too.  I will need to
double-check to ensure that this proposed change did not self-inflict
some of that trouble when I tried on BE.   It's possible I both fixed
and broke myself within the one patch set.


> Also, if -mcmodel=medium is the default, we don't actually
> have to explicitly specify it.  Just omitting the
> -mcmodel=large should be sufficient.

Thats a good point, so I'll likely change this to just return "".
> +        return "-mcmodel=medium";

I'll rework/repost.  Thanks for the review.  

Thanks,
-Will



> 
> Bye,
> Ulrich
> 
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH, rs6000] [V2] Add ppc64_linux_gcc_target_options method
  2021-07-30 13:52 ` Tom Tromey
@ 2021-08-05 20:43   ` will schmidt
  2021-08-16 12:12     ` Ulrich Weigand
  0 siblings, 1 reply; 6+ messages in thread
From: will schmidt @ 2021-08-05 20:43 UTC (permalink / raw)
  To: Tom Tromey, will schmidt via Gdb-patches; +Cc: Ulrich Weigand, rogerio

[gdb] [rs6000] Add ppc64_linux_gcc_target_options method.

Hi, 
V2, updated per feedback, indentation and whitespace corrected
and an empty string is used instead of duplicating the default
mcmodel gcc option for this target.
Thanks for the reviews.

Add a method to set the gcc target options for the ppc64 targets.
This change sets an empty value, which allows the gcc
default (-mcmodel=medium) value be used, instead of -mcmodel=large
which is set by the default_gcc_target_options hook.
    
    OK for trunk?
    Thanks
    -Will

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 826f0266ed8..30230aa41da 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -822,10 +822,18 @@ rs6000_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   return rs6000_in_function_epilogue_frame_p (get_current_frame (),
 					      gdbarch, pc);
 }
 
+/* Implement the linux_gcc_target_options method.  */
+
+static std::string
+ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
+{
+  return "";
+}
+
 /* Get the ith function argument for the current function.  */
 static CORE_ADDR
 rs6000_fetch_pointer_argument (struct frame_info *frame, int argi, 
 			       struct type *type)
 {
@@ -7129,10 +7137,14 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Trampoline.  */
   set_gdbarch_in_solib_return_trampoline
     (gdbarch, rs6000_in_solib_return_trampoline);
   set_gdbarch_skip_trampoline_code (gdbarch, rs6000_skip_trampoline_code);
 
+  /* Set GCC target options.  */
+  if (wordsize == 8)
+    set_gdbarch_gcc_target_options (gdbarch, ppc64_linux_gcc_target_options);
+
   /* Hook in the DWARF CFI frame unwinder.  */
   dwarf2_append_unwinders (gdbarch);
   dwarf2_frame_set_adjust_regnum (gdbarch, rs6000_adjust_frame_regnum);
 
   /* Frame handling.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH, rs6000] [V2] Add ppc64_linux_gcc_target_options method
  2021-08-05 20:43   ` [PATCH, rs6000] [V2] " will schmidt
@ 2021-08-16 12:12     ` Ulrich Weigand
  0 siblings, 0 replies; 6+ messages in thread
From: Ulrich Weigand @ 2021-08-16 12:12 UTC (permalink / raw)
  To: will schmidt; +Cc: will schmidt via Gdb-patches, rogerio, Tom Tromey



"will schmidt" <will_schmidt@vnet.ibm.com> wrote on 05.08.2021 22:43:02:

> diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
> index 826f0266ed8..30230aa41da 100644
> --- a/gdb/rs6000-tdep.c
> +++ b/gdb/rs6000-tdep.c
> @@ -822,10 +822,18 @@ rs6000_stack_frame_destroyed_p (struct gdbarch
> *gdbarch, CORE_ADDR pc)
>  {
>    return rs6000_in_function_epilogue_frame_p (get_current_frame (),
>                       gdbarch, pc);
>  }
>
> +/* Implement the linux_gcc_target_options method.  */
> +
> +static std::string
> +ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
> +{
> +  return "";
> +}
> +
>  /* Get the ith function argument for the current function.  */
>  static CORE_ADDR
>  rs6000_fetch_pointer_argument (struct frame_info *frame, int argi,
>                  struct type *type)
>  {
> @@ -7129,10 +7137,14 @@ rs6000_gdbarch_init (struct gdbarch_info
> info, struct gdbarch_list *arches)
>    /* Trampoline.  */
>    set_gdbarch_in_solib_return_trampoline
>      (gdbarch, rs6000_in_solib_return_trampoline);
>    set_gdbarch_skip_trampoline_code (gdbarch,
rs6000_skip_trampoline_code);
>
> +  /* Set GCC target options.  */
> +  if (wordsize == 8)
> +    set_gdbarch_gcc_target_options (gdbarch,
ppc64_linux_gcc_target_options);

Linux-specific gdbarch callbacks should live in ppc-linux-tdep.c
and be installed from ppc_linux_init_abi.   Otherwise this looks OK.

Bye,
Ulrich

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-16 12:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 15:35 [PATCH, rs6000] Add ppc64_linux_gcc_target_options method will schmidt
2021-07-29  7:16 ` Ulrich Weigand
2021-08-03 18:56   ` will schmidt
2021-07-30 13:52 ` Tom Tromey
2021-08-05 20:43   ` [PATCH, rs6000] [V2] " will schmidt
2021-08-16 12:12     ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).