From: Jakub Jelinek <jakub@redhat.com>
To: Andreas Krebbel <krebbel@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix s390 backend with old binutils (PR target/89361)
Date: Sat, 16 Feb 2019 17:49:00 -0000 [thread overview]
Message-ID: <20190216174950.GC2135@tucnak> (raw)
Hi!
If S390_USE_TARGET_ATTRIBUTE is 0 (e.g. because of configuring against old
binutils or even with no binutils at all), then indirect jumps are emitted
unconditionally, no matter what is selected on the command line, including
the default options. The problem is that s390_indirect_branch_settings
is never called and only that function sets the flags the *.md macros test.
Fixed thusly, bootstrapped/regtested on s390x-linux (with recent binutils)
and tested on x86_64-linux -> s390x-linux cross (without any binutils).
Ok for trunk and after a while for release branches?
2019-02-16 Jakub Jelinek <jakub@redhat.com>
PR target/89361
* config/s390/s390.c (s390_indirect_branch_attrvalue,
s390_indirect_branch_settings): Define unconditionally.
(s390_set_current_function): Likewise, but guard the whole body except
the s390_indirect_branch_settings call with
#if S390_USE_TARGET_ATTRIBUTE.
(TARGET_SET_CURRENT_FUNCTION): Redefine unconditionally.
--- gcc/config/s390/s390.c.jj 2019-02-12 21:48:52.944076465 +0100
+++ gcc/config/s390/s390.c 2019-02-15 14:16:46.053206087 +0100
@@ -15462,6 +15462,7 @@ s390_can_inline_p (tree caller, tree cal
return ret;
}
+#endif
/* Set VAL to correct enum value according to the indirect-branch or
function-return attribute in ATTR. */
@@ -15535,6 +15536,7 @@ s390_indirect_branch_settings (tree fnde
s390_indirect_branch_attrvalue (attr, &cfun->machine->function_return_mem);
}
+#if S390_USE_TARGET_ATTRIBUTE
/* Restore targets globals from NEW_TREE and invalidate s390_previous_fndecl
cache. */
@@ -15550,6 +15552,7 @@ s390_activate_target_options (tree new_t
TREE_TARGET_GLOBALS (new_tree) = save_target_globals_default_opts ();
s390_previous_fndecl = NULL_TREE;
}
+#endif
/* Establish appropriate back-end context for processing the function
FNDECL. The argument might be NULL to indicate processing at top
@@ -15557,6 +15560,7 @@ s390_activate_target_options (tree new_t
static void
s390_set_current_function (tree fndecl)
{
+#if S390_USE_TARGET_ATTRIBUTE
/* Only change the context if the function changes. This hook is called
several times in the course of compiling a function, and we don't want to
slow things down too much or call target_reinit when it isn't safe. */
@@ -15588,10 +15592,9 @@ s390_set_current_function (tree fndecl)
if (old_tree != new_tree)
s390_activate_target_options (new_tree);
s390_previous_fndecl = fndecl;
-
+#endif
s390_indirect_branch_settings (fndecl);
}
-#endif
/* Implement TARGET_USE_BY_PIECES_INFRASTRUCTURE_P. */
@@ -16331,10 +16334,10 @@ s390_case_values_threshold (void)
#undef TARGET_ASM_FILE_END
#define TARGET_ASM_FILE_END s390_asm_file_end
-#if S390_USE_TARGET_ATTRIBUTE
#undef TARGET_SET_CURRENT_FUNCTION
#define TARGET_SET_CURRENT_FUNCTION s390_set_current_function
+#if S390_USE_TARGET_ATTRIBUTE
#undef TARGET_OPTION_VALID_ATTRIBUTE_P
#define TARGET_OPTION_VALID_ATTRIBUTE_P s390_valid_target_attribute_p
Jakub
next reply other threads:[~2019-02-16 17:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-16 17:49 Jakub Jelinek [this message]
2019-02-18 11:15 ` Andreas Krebbel
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=20190216174950.GC2135@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=krebbel@linux.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).