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

            Bug ID: 113617
           Summary: [14 Regression] Symbol ... referenced in section
                    `.data.rel.ro.local' of ...: defined in discarded
                    section ... since r14-4944
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r14-4944-gf55cdce3f8dd8503e080e35be59c5f5390f6d95e the following testcase
can't be linked anymore.
for i in 1 2; do ./cc1plus -quiet -O2 -std=c++11 -fPIC -fvisibility=hidden
-fvisibility-inlines-hidden $i.ii; done; g++ -shared -o 1.so 1.s 2.s
`_ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEE10_M_managerERSt9_Any_dataRKSH_St18_Manager_operation'
referenced in section `.data.rel.ro.local' of /tmp/ccEORVfz.o: defined in
discarded section
`.text._ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEE10_M_managerERSt9_Any_dataRKSH_St18_Manager_operation[_ZN26vtkStaticCellLinksTemplateIxE18ThreadedBuildLinksExxP12vtkCellArray]'
of /tmp/ccEORVfz.o
`_ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_111InsertLinksIxEELb0EEExxxEEE10_M_managerERSt9_Any_dataRKSH_St18_Manager_operation'
referenced in section `.data.rel.ro.local' of /tmp/ccEORVfz.o: defined in
discarded section
`.text._ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_111InsertLinksIxEELb0EEExxxEEE10_M_managerERSt9_Any_dataRKSH_St18_Manager_operation[_ZN26vtkStaticCellLinksTemplateIxE18ThreadedBuildLinksExxP12vtkCellArray]'
of /tmp/ccEORVfz.o

That change adds quite a few changes like:

-       leaq   
_ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEE10_M_managerERSt9_Any_dataRKSH
_St18_Manager_operation(%rip), %rdx
+       movq    .LC73(%rip), %xmm3
        movq    $0, (%rsp)
        movq    %rax, 32(%rsp)
        leaq   
_ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEE9_M_invokeERKSt9_Any_data(%rip),
%rax
-       movq    %rdx, %xmm3
...
+       .section        .data.rel.ro.local,"aw"
...
+.LC73:
+       .quad  
_ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEE10_M_managerERSt9_Any_dataRKSH_St18_Manager_operation
but as the symbol is defined in a comdat section, that results in the linker
error.
Dunno if this was just latent before, or whether we need to force such
constants also into comdat sections in the same comdat group, etc.

Reply via email to