https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123259

            Bug ID: 123259
           Summary: Allow more control over CTF generation
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: david.faust at oracle dot com, ibhagat at gcc dot gnu.org
  Target Milestone: ---

I've recently been working on a patch to support Solaris CTF, which proved easy
due to Ali Bahrami's work.  It can be done just in specs.  I've introduce a new
-gsctf, which doesn't do more than pass -gctf for compilation and -z ctf when
linking.

To put this through its paces, I tried a full GCC bootstrap with -gsctf added
via a boot config file.  It only sets STAGE[23]_[CT]FLAGS to -gsctf.  While
this
worked mostly fine, I ran into an issue that also affects GNU CTF:

For all non-C languages, I get warnings like

cc1plus: note: CTF debug info requested, but not supported for ‘GNU C++17’
frontend

This happens because CFLAGS is often passed for non-C languages, with no way
to restrict it.

While that warning is perfectly benign, it has unfortunate consequences on the
bootstrap and test run: libstdc++ testing is utterly confused by that warning,
leading to tons of failures.

I believe this issue extends to all mixed-language projects, not just GCC, so
it may warrant a general solution.  For the time being, I've restricted passing
-gctf in the specs like

  %{,c:%{gsctf:-gctf}}

i.e. silently ignoring -gsctf for non-C compilations.  While this works (except
for Ada), doing this behind the user's back isn't optimal.

I can thing of two solutions:

* Introduce -Wctf (on by default), so one could suppress the warning with 
  -Wno-ctf.

* Alternatively (or in addition), one could provide more flexibility by
  allowing -gctf more control over which languages it applies to, something
like

  -gctf[=[c,supported,all]

This may well be overkill and the issue considered build-system only.

Thoughts?

Reply via email to