public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC arc port defaults to -fcommon
@ 2021-07-07  8:59 Florian Weimer
  2021-07-07  9:56 ` Richard Biener
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2021-07-07  8:59 UTC (permalink / raw)
  To: gcc; +Cc: gnu, claziss

It seems to me that the arc port still defaults to -fcommon, presumably
due to this in gcc/common/config/arc/arc-common.c:

static void
arc_option_init_struct (struct gcc_options *opts)
{
  opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */

  /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
  arc_cpu = PROCESSOR_NONE;
}

Is that really necessary?  Is -fno-common broken on arc?

I plan to switch glibc to build with -fno-common unconditionally, for
all GCC versions and architectures, and I wonder if that would be a
blocker.

Thanks,
Florian


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

* Re: GCC arc port defaults to -fcommon
  2021-07-07  8:59 GCC arc port defaults to -fcommon Florian Weimer
@ 2021-07-07  9:56 ` Richard Biener
  2021-07-07  9:58   ` Richard Biener
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2021-07-07  9:56 UTC (permalink / raw)
  To: Florian Weimer
  Cc: GCC Development, Joern Wolfgang Rennecke, Claudiu Zissulescu

On Wed, Jul 7, 2021 at 11:00 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
>
> It seems to me that the arc port still defaults to -fcommon, presumably
> due to this in gcc/common/config/arc/arc-common.c:
>
> static void
> arc_option_init_struct (struct gcc_options *opts)
> {
>   opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
>
>   /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
>   arc_cpu = PROCESSOR_NONE;
> }
>
> Is that really necessary?  Is -fno-common broken on arc?

It seems arc has -fcommon dependent on !TARGET_NO_SDATA_SET
but it should use global_options_set.x_flag_no_common instead of
such magic value.

> I plan to switch glibc to build with -fno-common unconditionally, for
> all GCC versions and architectures, and I wonder if that would be a
> blocker.
>
> Thanks,
> Florian
>

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

* Re: GCC arc port defaults to -fcommon
  2021-07-07  9:56 ` Richard Biener
@ 2021-07-07  9:58   ` Richard Biener
  2021-07-07 10:06     ` Florian Weimer
  2021-07-07 10:06     ` Claudiu Zissulescu
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Biener @ 2021-07-07  9:58 UTC (permalink / raw)
  To: Florian Weimer
  Cc: GCC Development, Joern Wolfgang Rennecke, Claudiu Zissulescu

On Wed, Jul 7, 2021 at 11:56 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Wed, Jul 7, 2021 at 11:00 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
> >
> > It seems to me that the arc port still defaults to -fcommon, presumably
> > due to this in gcc/common/config/arc/arc-common.c:
> >
> > static void
> > arc_option_init_struct (struct gcc_options *opts)
> > {
> >   opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
> >
> >   /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
> >   arc_cpu = PROCESSOR_NONE;
> > }
> >
> > Is that really necessary?  Is -fno-common broken on arc?
>
> It seems arc has -fcommon dependent on !TARGET_NO_SDATA_SET
> but it should use global_options_set.x_flag_no_common instead of
> such magic value.

So sth like this (untested):

diff --git a/gcc/common/config/arc/arc-common.c
b/gcc/common/config/arc/arc-common.c
index 6a119029616..c8ac7471744 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -32,8 +32,6 @@ along with GCC; see the file COPYING3.  If not see
 static void
 arc_option_init_struct (struct gcc_options *opts)
 {
-  opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
-
   /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
   arc_cpu = PROCESSOR_NONE;
 }
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 69f6ae464e1..b9097b11835 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -1440,7 +1440,7 @@ arc_override_options (void)
   if (flag_pic)
     target_flags |= MASK_NO_SDATA_SET;

-  if (flag_no_common == 255)
+  if (!global_options_set.x_flag_no_common)
     flag_no_common = !TARGET_NO_SDATA_SET;

   /* Check for small data option */


> > I plan to switch glibc to build with -fno-common unconditionally, for
> > all GCC versions and architectures, and I wonder if that would be a
> > blocker.
> >
> > Thanks,
> > Florian
> >

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

* Re: GCC arc port defaults to -fcommon
  2021-07-07  9:58   ` Richard Biener
@ 2021-07-07 10:06     ` Florian Weimer
  2021-07-07 12:18       ` Claudiu Zissulescu
  2021-07-07 10:06     ` Claudiu Zissulescu
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2021-07-07 10:06 UTC (permalink / raw)
  To: Richard Biener
  Cc: GCC Development, Joern Wolfgang Rennecke, Claudiu Zissulescu

* Richard Biener:

> On Wed, Jul 7, 2021 at 11:56 AM Richard Biener
> <richard.guenther@gmail.com> wrote:
>>
>> On Wed, Jul 7, 2021 at 11:00 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
>> >
>> > It seems to me that the arc port still defaults to -fcommon, presumably
>> > due to this in gcc/common/config/arc/arc-common.c:
>> >
>> > static void
>> > arc_option_init_struct (struct gcc_options *opts)
>> > {
>> >   opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
>> >
>> >   /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
>> >   arc_cpu = PROCESSOR_NONE;
>> > }
>> >
>> > Is that really necessary?  Is -fno-common broken on arc?
>>
>> It seems arc has -fcommon dependent on !TARGET_NO_SDATA_SET
>> but it should use global_options_set.x_flag_no_common instead of
>> such magic value.
>
> So sth like this (untested):
>
> diff --git a/gcc/common/config/arc/arc-common.c
> b/gcc/common/config/arc/arc-common.c
> index 6a119029616..c8ac7471744 100644
> --- a/gcc/common/config/arc/arc-common.c
> +++ b/gcc/common/config/arc/arc-common.c
> @@ -32,8 +32,6 @@ along with GCC; see the file COPYING3.  If not see
>  static void
>  arc_option_init_struct (struct gcc_options *opts)
>  {
> -  opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
> -
>    /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
>    arc_cpu = PROCESSOR_NONE;
>  }
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 69f6ae464e1..b9097b11835 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -1440,7 +1440,7 @@ arc_override_options (void)
>    if (flag_pic)
>      target_flags |= MASK_NO_SDATA_SET;
>
> -  if (flag_no_common == 255)
> +  if (!global_options_set.x_flag_no_common)
>      flag_no_common = !TARGET_NO_SDATA_SET;
>
>    /* Check for small data option */

But this means that arc still defaults to -fcommon with this change,
right?

Thanks,
Florian


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

* Re: GCC arc port defaults to -fcommon
  2021-07-07  9:58   ` Richard Biener
  2021-07-07 10:06     ` Florian Weimer
@ 2021-07-07 10:06     ` Claudiu Zissulescu
  1 sibling, 0 replies; 6+ messages in thread
From: Claudiu Zissulescu @ 2021-07-07 10:06 UTC (permalink / raw)
  To: Richard Biener, Florian Weimer; +Cc: GCC Development, Joern Wolfgang Rennecke

The fno-common option is indeed related to the use of small-data. However, the small data is only used for baremetal applications, and it shouldn't be used for  linux toolchain.

To me Richard's patch looks alright.
Thanks,
Claudiu

________________________________
From: Richard Biener <richard.guenther@gmail.com>
Sent: Wednesday, July 7, 2021 12:58 PM
To: Florian Weimer <fweimer@redhat.com>
Cc: GCC Development <gcc@gcc.gnu.org>; Joern Wolfgang Rennecke <gnu@amylaar.uk>; Claudiu Zissulescu <claziss@synopsys.com>
Subject: Re: GCC arc port defaults to -fcommon

On Wed, Jul 7, 2021 at 11:56 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Wed, Jul 7, 2021 at 11:00 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
> >
> > It seems to me that the arc port still defaults to -fcommon, presumably
> > due to this in gcc/common/config/arc/arc-common.c:
> >
> > static void
> > arc_option_init_struct (struct gcc_options *opts)
> > {
> >   opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
> >
> >   /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
> >   arc_cpu = PROCESSOR_NONE;
> > }
> >
> > Is that really necessary?  Is -fno-common broken on arc?
>
> It seems arc has -fcommon dependent on !TARGET_NO_SDATA_SET
> but it should use global_options_set.x_flag_no_common instead of
> such magic value.

So sth like this (untested):

diff --git a/gcc/common/config/arc/arc-common.c
b/gcc/common/config/arc/arc-common.c
index 6a119029616..c8ac7471744 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -32,8 +32,6 @@ along with GCC; see the file COPYING3.  If not see
 static void
 arc_option_init_struct (struct gcc_options *opts)
 {
-  opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
-
   /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
   arc_cpu = PROCESSOR_NONE;
 }
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 69f6ae464e1..b9097b11835 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -1440,7 +1440,7 @@ arc_override_options (void)
   if (flag_pic)
     target_flags |= MASK_NO_SDATA_SET;

-  if (flag_no_common == 255)
+  if (!global_options_set.x_flag_no_common)
     flag_no_common = !TARGET_NO_SDATA_SET;

   /* Check for small data option */


> > I plan to switch glibc to build with -fno-common unconditionally, for
> > all GCC versions and architectures, and I wonder if that would be a
> > blocker.
> >
> > Thanks,
> > Florian
> >

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

* Re: GCC arc port defaults to -fcommon
  2021-07-07 10:06     ` Florian Weimer
@ 2021-07-07 12:18       ` Claudiu Zissulescu
  0 siblings, 0 replies; 6+ messages in thread
From: Claudiu Zissulescu @ 2021-07-07 12:18 UTC (permalink / raw)
  To: Florian Weimer, Richard Biener; +Cc: GCC Development, Joern Wolfgang Rennecke

Hi,

I have quickly tested the next patch, and it looks like everything is alright. In the end we don't really need to temper with fcommon.


diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
index 6a1190296167..3b36d09997c7 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -30,10 +30,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "flags.h"

 static void
-arc_option_init_struct (struct gcc_options *opts)
+arc_option_init_struct (struct gcc_options *opts ATTRIBUTE_UNUSED)
 {
-  opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
-
   /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
   arc_cpu = PROCESSOR_NONE;
 }
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 584783f2fb88..5f1d2ffd3995 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -1449,9 +1449,6 @@ arc_override_options (void)
       target_flags |= MASK_NO_SDATA_SET;
     }

-  if (flag_no_common == 255)
-    flag_no_common = !TARGET_NO_SDATA_SET;
-
   /* Check for small data option */
   if (!global_options_set.x_g_switch_value && !TARGET_NO_SDATA_SET)
     g_switch_value = TARGET_LL64 ? 8 : 4;



________________________________
From: Florian Weimer <fweimer@redhat.com>
Sent: Wednesday, July 7, 2021 1:06 PM
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Development <gcc@gcc.gnu.org>; Joern Wolfgang Rennecke <gnu@amylaar.uk>; Claudiu Zissulescu <claziss@synopsys.com>
Subject: Re: GCC arc port defaults to -fcommon

* Richard Biener:

> On Wed, Jul 7, 2021 at 11:56 AM Richard Biener
> <richard.guenther@gmail.com> wrote:
>>
>> On Wed, Jul 7, 2021 at 11:00 AM Florian Weimer via Gcc <gcc@gcc.gnu.org> wrote:
>> >
>> > It seems to me that the arc port still defaults to -fcommon, presumably
>> > due to this in gcc/common/config/arc/arc-common.c:
>> >
>> > static void
>> > arc_option_init_struct (struct gcc_options *opts)
>> > {
>> >   opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
>> >
>> >   /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
>> >   arc_cpu = PROCESSOR_NONE;
>> > }
>> >
>> > Is that really necessary?  Is -fno-common broken on arc?
>>
>> It seems arc has -fcommon dependent on !TARGET_NO_SDATA_SET
>> but it should use global_options_set.x_flag_no_common instead of
>> such magic value.
>
> So sth like this (untested):
>
> diff --git a/gcc/common/config/arc/arc-common.c
> b/gcc/common/config/arc/arc-common.c
> index 6a119029616..c8ac7471744 100644
> --- a/gcc/common/config/arc/arc-common.c
> +++ b/gcc/common/config/arc/arc-common.c
> @@ -32,8 +32,6 @@ along with GCC; see the file COPYING3.  If not see
>  static void
>  arc_option_init_struct (struct gcc_options *opts)
>  {
> -  opts->x_flag_no_common = 255; /* Mark as not user-initialized.  */
> -
>    /* Which cpu we're compiling for (ARC600, ARC601, ARC700, ARCv2).  */
>    arc_cpu = PROCESSOR_NONE;
>  }
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 69f6ae464e1..b9097b11835 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -1440,7 +1440,7 @@ arc_override_options (void)
>    if (flag_pic)
>      target_flags |= MASK_NO_SDATA_SET;
>
> -  if (flag_no_common == 255)
> +  if (!global_options_set.x_flag_no_common)
>      flag_no_common = !TARGET_NO_SDATA_SET;
>
>    /* Check for small data option */

But this means that arc still defaults to -fcommon with this change,
right?

Thanks,
Florian


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07  8:59 GCC arc port defaults to -fcommon Florian Weimer
2021-07-07  9:56 ` Richard Biener
2021-07-07  9:58   ` Richard Biener
2021-07-07 10:06     ` Florian Weimer
2021-07-07 12:18       ` Claudiu Zissulescu
2021-07-07 10:06     ` Claudiu Zissulescu

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).