[PATCH] Fix --enable-gather-detailed-mem-stats build.

Richard Biener richard.guenther@gmail.com
Mon Jan 4 12:33:29 GMT 2021


On Wed, Dec 16, 2020 at 10:52 AM Martin Liška <mliska@suse.cz> wrote:
>
> On 12/16/20 10:38 AM, Rainer Orth wrote:
> > Hi Jakub,
> >
> >> On Wed, Dec 16, 2020 at 10:20:09AM +0100, Martin Liška wrote:
> >>> So vec_mem_desc is not initialized before a static member in module.cc.
> >>> We can fix it by using constructor attribute.
> > [...]
> >>> +   of all static variables.  */
> >>> +
> >>> +static void
> >>> +__attribute__((constructor (101)))
> >>
> >> I think this needs to be guarded based on which compiler is used to compile
> >> GCC.  Perhaps we could say that we don't support
> >> --enable-gather-detailed-mem-stats when the compiler isn't built by GCC (or
> >> other compiler that supports the constructor attribute) and #error on that.
> >
> > not only that: if a target doesn't support constructor priorities (like
> > Solaris 11.3, unlike 11.4), this makes gcc error out.
> >
> >       Rainer
> >
>
> I see, I'm then suggesting version 3 of the patch that does not depend
> on a constructor.
>
> Thoughts?

I guess that works.  Note we're trying to limit the number of dynamic
initializers so the new loc_spans one would be another candidate to
dynamically allocate instead.

But OK.

Thanks,
Richard.

> Thanks,
> Martin
>
> Martin


More information about the Gcc-patches mailing list