public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marcin Kościelnicki" <koriakin@0x04.net>
To: Andreas Krebbel <krebbel@linux.vnet.ibm.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/5] s390: Fix missing .size directives.
Date: Thu, 21 Jan 2016 10:10:00 -0000	[thread overview]
Message-ID: <56A0AE6B.6000208@0x04.net> (raw)
In-Reply-To: <56A0ABDF.7050106@linux.vnet.ibm.com>

On 21/01/16 10:58, Andreas Krebbel wrote:
> On 01/20/2016 02:16 PM, Andreas Krebbel wrote:
>> On 01/02/2016 08:16 PM, Marcin Kościelnicki wrote:
>>> It seems at some point the .size hook was hijacked to emit some
>>> machine-specific directives, and the actual .size directive was
>>> forgotten.  This caused problems for split-stack support, since
>>> linker couldn't scan the function body for non-split-stack calls.
>>>
>>> gcc/ChangeLog:
>>>
>>> 	* config/s390/s390.c (s390_asm_declare_function_size): Add code
>>> 	to actually emit the .size directive.
>>
>> ...
>>
>>>   s390_asm_declare_function_size (FILE *asm_out_file,
>>> -				const char *fnname ATTRIBUTE_UNUSED, tree decl)
>>> +				const char *fnname, tree decl)
>>>   {
>>> +  if (!flag_inhibit_size_directive)
>>> +    ASM_OUTPUT_MEASURED_SIZE (asm_out_file, fnname);
>>>     if (DECL_FUNCTION_SPECIFIC_TARGET (decl) == NULL)
>>>       return;
>>>     fprintf (asm_out_file, "\t.machine pop\n");
>>
>> It would be good to use the original ASM_DECLARE_FUNCTION_SIZE macro from config/elfos.h here.  This
>> probably would require to change its name in s390.h first and then use it from
>> s390_asm_declare_function_size. Not really beautiful but at least changes to the original macro
>> would not require adjusting our backend.
>
> I've looked into how the other archs are doing this and didn't find anything better than just
> including the code from the original macro. The real fix probably would be to turn this into a
> target hook instead.
>
> I've committed the patch now since it fixes a real problem not only with split-stack.
>
> Thanks!
>
> -Andreas-
>

I did a version that reincludes elfos.h, but it didn't finish testing 
(it made it through bootstrap) before you applied the patch:

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 21a5687..c56b909 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -6832,10 +6832,17 @@ s390_asm_output_function_prefix (FILE *asm_out_file,

  /* Write an extra function footer after the very end of the function.  */

+/* Get elfos.h's original ASM_DECLARE_FUNCTION_SIZE, so that we can 
delegate
+   to it below.  */
+
+#undef ASM_DECLARE_FUNCTION_SIZE
+#include "../elfos.h"
+
  void
  s390_asm_declare_function_size (FILE *asm_out_file,
-                               const char *fnname ATTRIBUTE_UNUSED, 
tree decl)
+                               const char *fnname, tree decl)
  {
+  ASM_DECLARE_FUNCTION_SIZE(asm_out_file, fnname, decl);
    if (DECL_FUNCTION_SPECIFIC_TARGET (decl) == NULL)
      return;
    fprintf (asm_out_file, "\t.machine pop\n");


But, this is much uglier, and the macro is very unlikely to change in 
the first place.  I guess we should stay with the applied patch.

Thanks,

Marcin

  reply	other threads:[~2016-01-21 10:10 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-02 19:16 [RFC] [PR 68191] s390: Add -fsplit-stack support Marcin Kościelnicki
2016-01-02 19:16 ` [PATCH 2/5] s390: Fix missing .size directives Marcin Kościelnicki
2016-01-20 13:16   ` Andreas Krebbel
2016-01-20 14:01     ` Dominik Vogt
2016-01-21  9:59     ` Andreas Krebbel
2016-01-21 10:10       ` Marcin Kościelnicki [this message]
2016-01-02 19:16 ` [PATCH 4/5] Don't mark targets of unconditional jumps with side effects as FALLTHRU Marcin Kościelnicki
2016-01-21 10:05   ` Andreas Krebbel
2016-01-21 10:10     ` Marcin Kościelnicki
2016-01-21 23:10     ` Jeff Law
2016-01-22  7:44       ` Andreas Krebbel
2016-01-22 16:39         ` Marcin Kościelnicki
2016-01-27  7:11         ` Jeff Law
2016-04-17 21:24   ` Jeff Law
2016-01-02 19:16 ` [PATCH 3/5] Fix NOTE_INSN_PROLOGUE_END after unconditional jump Marcin Kościelnicki
2016-04-17 21:25   ` Jeff Law
2016-01-02 19:17 ` [PATCH 5/5] s390: Add -fsplit-stack support Marcin Kościelnicki
2016-01-15 18:39   ` Andreas Krebbel
2016-01-15 21:08     ` Marcin Kościelnicki
2016-01-21 10:12       ` Andreas Krebbel
2016-01-21 13:04         ` Marcin Kościelnicki
2016-01-16 13:46     ` [PATCH] " Marcin Kościelnicki
2016-01-29 13:33       ` Andreas Krebbel
2016-01-29 15:43         ` Marcin Kościelnicki
2016-01-29 16:17           ` Andreas Krebbel
2016-02-02 14:52             ` Marcin Kościelnicki
2016-02-02 15:19               ` Andreas Krebbel
2016-02-02 15:31                 ` Marcin Kościelnicki
2016-02-02 18:34                   ` Ulrich Weigand
2016-02-02 20:11                     ` Marcin Kościelnicki
2016-02-03 18:40                       ` Marcin Kościelnicki
2016-02-04 15:06                         ` Ulrich Weigand
2016-02-04 15:20                           ` Marcin Kościelnicki
2016-02-04 16:27                             ` Ulrich Weigand
2016-02-05 21:13                               ` Marcin Kościelnicki
2016-02-05 22:02                                 ` Ulrich Weigand
2016-02-03  0:20                     ` Marcin Kościelnicki
2016-02-03 17:03                       ` Ulrich Weigand
2016-02-03 17:18                         ` Marcin Kościelnicki
2016-02-03 17:27                           ` Ulrich Weigand
2016-02-04 12:44                             ` Marcin Kościelnicki
2016-02-10 13:14                               ` Marcin Kościelnicki
2016-02-14 16:01                                 ` Marcin Kościelnicki
2016-02-15 10:21                                   ` Andreas Krebbel
2016-02-15 10:44                                     ` Marcin Kościelnicki
2016-02-07 12:22             ` [PATCH] testsuite/s390: Add __morestack test Marcin Kościelnicki
2016-02-19 10:21               ` Andreas Krebbel
2016-01-02 19:17 ` [PATCH 1/5] s390: Use proper read-only data section for literals Marcin Kościelnicki
2016-01-20 13:11   ` Andreas Krebbel
2016-01-21  6:56     ` Marcin Kościelnicki
2016-01-21  8:17       ` Mike Stump
2016-01-21  9:46       ` Andreas Krebbel
2016-01-03  3:21 ` [RFC] [PR 68191] s390: Add -fsplit-stack support Ian Lance Taylor
2016-01-03 10:32   ` Marcin Kościelnicki
2016-01-04  7:35   ` Marcin Kościelnicki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A0AE6B.6000208@0x04.net \
    --to=koriakin@0x04.net \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).