[Bug target/104936] New: [nvptx] Handle weak decl/def distinction in common code

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 15 16:01:14 GMT 2022


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

            Bug ID: 104936
           Summary: [nvptx] Handle weak decl/def distinction in common
                    code
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

At docs for ASM_WEAKEN_LABEL (stream, name) we find:
...
If you don’t define this macro or ASM_WEAKEN_DECL, GCC will not support weak
symbols and you should not define the SUPPORTS_WEAK macro. 
...

However, we have:
...
$ grep define.*WEAKEN gcc/config/nvptx/*
$ 
...
but still:
...
$ grep SUPPORTS_WEAK gcc/config/nvptx/*
gcc/config/nvptx/nvptx.h:#define SUPPORTS_WEAK 1
...

I think an argument for the discrepancy is made here:
...
  /*  We support weak defintions, and hence have the right                      
      ASM_WEAKEN_DECL definition.  Diagnose the problem here.  */
  if (DECL_WEAK (decl))
    error_at (DECL_SOURCE_LOCATION (decl),
              "PTX does not support weak declarations"
              " (only weak definitions)");
...
where it's my understanding that the "right ASM_WEAKEN_DECL" is meant to refer
to ASM_WEAKEN_DECL not being defined.

It would be nice to solve this somehow in the common code instead of deviating
from prescribed target macro usage.


More information about the Gcc-bugs mailing list