This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] target/37283: Fix -fno-unit-at-a-time and ?-fno-toplevel-reorder handling
- From: Samuel Tardieu <sam at rfc1149 dot net>
- To: Janis Johnson <janis187 at us dot ibm dot com>
- Cc: Ian Lance Taylor <iant at google dot com>, Paul Brook <paul at codesourcery dot com>, gcc-patches at gcc dot gnu dot org, Andrew Pinski <pinskia at gmail dot com>
- Date: Tue, 2 Sep 2008 22:53:51 +0200
- Subject: Re: [PATCH] target/37283: Fix -fno-unit-at-a-time and ?-fno-toplevel-reorder handling
- References: <20080829230112.26798.87632.stgit@dawn.rfc1149.net> <de8d50360808291624s121d079fmbb80e6416a72972c@mail.gmail.com> <m3wshuz8o1.fsf@google.com> <1220385009.6577.15.camel@janis-laptop>
* Janis Johnson <janis187@us.ibm.com> [2008-09-02 12:50:09 -0700]
| The comment was moved and now describes the code to which it is
| attached, but I think that code is wrong. It doesn't disable
| section anchors for no toplevel reorder, and from what I've heard
| in this group before, section anchors should be disabled with
| no toplevel reorder. At least that's the case for powerpc-linux
| which is now broken again for PR target/36756.
The code I moved now does what it describes indeed, while before the
patch it had a bogus effect. That being said, I have no idea of whether it
makes sense to implicitely use "-fno-toplevel-reorder -fsection-anchors"
as is currently done at -O0.
As you note, the code found a few lines below prohibits this
combination when the user asks for it explicitely:
else if (!flag_toplevel_reorder)
{
if (flag_section_anchors == 1)
error ("section anchors must be disabled when toplevel reorder is disabled");
flag_section_anchors = 0;
}
Does the following patch fix target/36756 for you?
diff --git a/gcc/opts.c b/gcc/opts.c
index 9bae6ea..d694a59 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1009,16 +1009,11 @@ decode_options (unsigned int argc, const char **argv)
handle_options (argc, argv, lang_mask);
/* -fno-unit-at-a-time and -fno-toplevel-reorder handling. */
- if (!flag_unit_at_a_time)
+ if (!flag_unit_at_a_time || (!optimize && flag_toplevel_reorder == 2))
{
flag_section_anchors = 0;
flag_toplevel_reorder = 0;
}
- else if (!optimize && flag_toplevel_reorder == 2)
- /* We disable toplevel reordering at -O0 to disable transformations that
- might be surprising to end users and to get -fno-toplevel-reorder
- tested, but we keep section anchors. */
- flag_toplevel_reorder = 0;
else if (!flag_toplevel_reorder)
{
if (flag_section_anchors == 1)