On Wed, Jul 7, 2021 at 11:56 AM Richard Biener
<richard.guent...@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
> >

Reply via email to