public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
@ 2024-01-26 13:08 jakub at gcc dot gnu.org
  2024-01-26 13:08 ` [Bug rtl-optimization/113617] " jakub at gcc dot gnu.org
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 13:08 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
@ 2024-01-26 13:08 ` jakub at gcc dot gnu.org
  2024-01-26 13:09 ` jakub at gcc dot gnu.org
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 13:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
  2024-01-26 13:08 ` [Bug rtl-optimization/113617] " jakub at gcc dot gnu.org
@ 2024-01-26 13:09 ` jakub at gcc dot gnu.org
  2024-01-26 13:09 ` jakub at gcc dot gnu.org
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57223
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57223&action=edit
1.ii.xz

Not reduced first source.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
  2024-01-26 13:08 ` [Bug rtl-optimization/113617] " jakub at gcc dot gnu.org
  2024-01-26 13:09 ` jakub at gcc dot gnu.org
@ 2024-01-26 13:09 ` jakub at gcc dot gnu.org
  2024-01-26 13:10 ` jakub at gcc dot gnu.org
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57224
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57224&action=edit
2.ii.xz

Unreduced second source.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-26 13:09 ` jakub at gcc dot gnu.org
@ 2024-01-26 13:10 ` jakub at gcc dot gnu.org
  2024-01-26 14:22 ` hjl.tools at gmail dot com
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com,
                   |                            |nickc at gcc dot gnu.org,
                   |                            |vmakarov at gcc dot gnu.org
   Last reconfirmed|                            |2024-01-26
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-26 13:10 ` jakub at gcc dot gnu.org
@ 2024-01-26 14:22 ` hjl.tools at gmail dot com
  2024-01-26 14:28 ` jakub at gcc dot gnu.org
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2024-01-26 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crazylht at gmail dot com

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Jakub Jelinek from comment #0)
> 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_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPToo
> ls_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_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTool
> s_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEE10_M_managerERSt9_
> Any_dataRKSH_St18_Manager_operation[_ZN26vtkStaticCellLinksTemplateIxE18Threa
> dedBuildLinksExxP12vtkCellArray]' of /tmp/ccEORVfz.o
> `_ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPToo
> ls_FunctorInternalIN12_GLOBAL__N_111InsertLinksIxEELb0EEExxxEEE10_M_managerER
> St9_Any_dataRKSH_St18_Manager_operation' referenced in section
> `.data.rel.ro.local' of /tmp/ccEORVfz.o: defined in discarded section
> `.text.
> _ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTool
> s_FunctorInternalIN12_GLOBAL__N_111InsertLinksIxEELb0EEExxxEEE10_M_managerERS
> t9_Any_dataRKSH_St18_Manager_operation[_ZN26vtkStaticCellLinksTemplateIxE18Th
> readedBuildLinksExxP12vtkCellArray]' of /tmp/ccEORVfz.o
> 
> That change adds quite a few changes like:
> 
> -       leaq   
> _ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTool
> s_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_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTool
> s_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEE9_M_invokeERKSt9_A
> ny_data(%rip), %rax
> -       movq    %rdx, %xmm3
> ...
> +       .section        .data.rel.ro.local,"aw"
> ...
> +.LC73:
> +       .quad  
> _ZNSt17_Function_handlerIFvvESt5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTool
> s_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.

LEA is changed to load through an indirection. Isn't it a regression?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-01-26 14:22 ` hjl.tools at gmail dot com
@ 2024-01-26 14:28 ` jakub at gcc dot gnu.org
  2024-01-26 14:39 ` hjl.tools at gmail dot com
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #3)
> LEA is changed to load through an indirection. Isn't it a regression?

LEA + moving a GPR register to SSE register.
So bet it depends on how costly the moving from GPR to SSE register is (and how
costly we represent it in costs).

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-01-26 14:28 ` jakub at gcc dot gnu.org
@ 2024-01-26 14:39 ` hjl.tools at gmail dot com
  2024-01-26 15:52 ` jakub at gcc dot gnu.org
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2024-01-26 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Jakub Jelinek from comment #4)
> (In reply to H.J. Lu from comment #3)
> > LEA is changed to load through an indirection. Isn't it a regression?
> 
> LEA + moving a GPR register to SSE register.
> So bet it depends on how costly the moving from GPR to SSE register is (and
> how costly we represent it in costs).

This makes senses.  In any case, we shouldn't reference a symbol defined
a different comdat group.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-01-26 14:39 ` hjl.tools at gmail dot com
@ 2024-01-26 15:52 ` jakub at gcc dot gnu.org
  2024-01-26 15:52 ` jakub at gcc dot gnu.org
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 15:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57226
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57226&action=edit
pr113617.h

Reduced testcase:
./cc1plus -quiet -O2 -std=c++11 -fPIC pr113617.C; ./cc1plus -quiet -O2
-std=c++11 -fPIC pr113617-aux.cc; g++ -shared -o pr113617.so pr113617.s
pr113617-aux.s
`_ZN4blah17_Function_handlerIFvvENS_5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEEE10_M_managerERNS_9_Any_dataERKSI_NS_18_Manager_operationE'
referenced in section `.data.rel.ro.local' of /tmp/ccecCY2H.o: defined in
discarded section
`.text._ZN4blah17_Function_handlerIFvvENS_5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEEE10_M_managerERNS_9_Any_dataERKSI_NS_18_Manager_operationE[_ZN26vtkStaticCellLinksTemplateIxE18ThreadedBuildLinksExxP12vtkCellArray]'
of /tmp/ccecCY2H.o
collect2: error: ld returned 1 exit status

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-01-26 15:52 ` jakub at gcc dot gnu.org
@ 2024-01-26 15:52 ` jakub at gcc dot gnu.org
  2024-01-26 15:52 ` jakub at gcc dot gnu.org
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 15:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57227
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57227&action=edit
pr113617.C

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-01-26 15:52 ` jakub at gcc dot gnu.org
@ 2024-01-26 15:52 ` jakub at gcc dot gnu.org
  2024-01-26 15:55 ` sjames at gcc dot gnu.org
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 15:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57228
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57228&action=edit
pr113617-aux.cc

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-01-26 15:52 ` jakub at gcc dot gnu.org
@ 2024-01-26 15:55 ` sjames at gcc dot gnu.org
  2024-01-26 16:13 ` jakub at gcc dot gnu.org
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-01-26 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Sam James <sjames at gcc dot gnu.org> ---
Ah, this explains a failure I started seeing recently with folly/watchman/etc
too. I just hadn't looked at it yet.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2024-01-26 15:55 ` sjames at gcc dot gnu.org
@ 2024-01-26 16:13 ` jakub at gcc dot gnu.org
  2024-01-26 20:44 ` hjl.tools at gmail dot com
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-26 16:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The difference with that revision is
--- pr113617-aux.s1     2024-01-26 11:00:05.532246309 -0500
+++ pr113617-aux.s      2024-01-26 11:00:36.291552459 -0500
@@ -80,22 +80,21 @@ _ZN3vtk6detail3smp15vtkSMPToolsImplILi1E
        pushq   %r12
 .LCFI3:
        movq    %rdx, %r12
-       leaq   
_ZN4blah17_Function_handlerIFvvENS_5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEEE10_M_managerERNS_9_Any_dataERKSI_NS_18_Manager_operationE(%rip),
%rdx
        pushq   %rbp
 .LCFI4:
-       movq    %rdx, %xmm0
        movq    %r8, %rbp
        pushq   %rbx
 .LCFI5:
-       punpcklqdq      %xmm1, %xmm0
        movq    %rcx, %rbx
        subq    $40, %rsp
 .LCFI6:
        movq    For_threadNumber@GOTPCREL(%rip), %rax
+       movq    .LC0(%rip), %xmm0
        leaq    31(%rsp), %r13
-       movaps  %xmm0, (%rsp)
        movl    (%rax), %esi
+       punpcklqdq      %xmm1, %xmm0
        movq    %r13, %rdi
+       movaps  %xmm0, (%rsp)
        call    _ZN3vtk6detail3smp16vtkSMPThreadPoolC1Ei@PLT
        movq    (%rsp), %r14
        .p2align 4,,10
@@ -218,6 +217,10 @@ _Z34vtkPolyDataPlaneClipperRequestDatav:
        .size   _Z34vtkPolyDataPlaneClipperRequestDatav,
.-_Z34vtkPolyDataPlaneClipperRequestDatav
        .local  _ZN12_GLOBAL__N_117GenerateCap_linesE
        .comm   _ZN12_GLOBAL__N_117GenerateCap_linesE,1,1
+       .section        .data.rel.ro.local,"aw"
+       .align 8
+.LC0:
+       .quad  
_ZN4blah17_Function_handlerIFvvENS_5_BindIFPFvPvxxxEPN3vtk6detail3smp27vtkSMPTools_FunctorInternalIN12_GLOBAL__N_19CountUsesIxEELb0EEExxxEEEE10_M_managerERNS_9_Any_dataERKSI_NS_18_Manager_operationE
        .section        .eh_frame,"aw",@progbits
 .Lframe1:
        .long   .LECIE1-.LSCIE1
(pretty much the same as in the other assembler file).

I must say I'm completely lost in where symbols defined in comdat sections may
be referenced and where not, can one reference them in code sections and not
data sections, or only comdat code sections or what?  I thought it is pretty
much a normal thing to reference comdat functions in both code and data/rodata
sections, how else
could one do say:
__attribute__((noinline, noipa)) inline void foo () {}
void bar () { foo (); }
void (*p) () = foo;
void (*const q) () = foo;
void (*const *r) () = &q;

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2024-01-26 16:13 ` jakub at gcc dot gnu.org
@ 2024-01-26 20:44 ` hjl.tools at gmail dot com
  2024-01-27  5:53 ` hjl.tools at gmail dot com
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2024-01-26 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 57233
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57233&action=edit
An untested patch

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2024-01-26 20:44 ` hjl.tools at gmail dot com
@ 2024-01-27  5:53 ` hjl.tools at gmail dot com
  2024-01-27 15:13 ` hjl.tools at gmail dot com
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2024-01-27  5:53 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #57233|0                           |1
        is obsolete|                            |

--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 57237
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57237&action=edit
An updated patch

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2024-01-27  5:53 ` hjl.tools at gmail dot com
@ 2024-01-27 15:13 ` hjl.tools at gmail dot com
  2024-01-30 12:45 ` jakub at gcc dot gnu.org
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2024-01-27 15:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at

https://patchwork.sourceware.org/project/gcc/list/?series=30277

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2024-01-27 15:13 ` hjl.tools at gmail dot com
@ 2024-01-30 12:45 ` jakub at gcc dot gnu.org
  2024-02-14  3:20 ` orion at nwra dot com
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-30 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The huge names make the assembly quite unreadable, so I've tried to reduce it a
little bit further:
pr113617.h:
namespace {
template <int V> struct J { static constexpr int value = V; };
template <bool V> using K = J<V>;
using M = K<true>;
template <int> struct L { template <typename _Tp, typename> using type = _Tp;
};
template <bool _Cond, typename _If, typename _Else> using N = typename
L<_Cond>::type<_If, _Else>;
M k;
template <typename _Tp> struct O { using type = _Tp; };
template <typename _Up>
struct P : N<M ::value, O<_Up>, _Up> {};
template <typename _Tp> struct Q { using type = typename P<_Tp>::type; };
}
namespace R {
struct H;
enum G {};
template <typename> class S;
struct T { using U = bool (*) (H &, const H &, G); U F; };
template <typename, typename> class B;
template <typename _R, typename _F, typename... _A>
struct B<_R(_A...), _F> {
  static bool F(H &, const H &, G) { return false; }
  __attribute__((noipa)) static _R bar(const H &) {}
};
template <typename _R, typename... _A>
struct S<_R(_A...)> : T {
  template <typename _F> using AH = B<_R(), _F>;
  template <typename _F> S(_F) {
    using AG = AH<_F>;
    barr = AG::bar;
    F = AG::F;
  }
  using AF = _R (*)(const H &);
  AF barr;
};
template <typename> class I;
template <typename _F, typename... _B>
struct I<_F(_B...)> {};
template <typename> using W = decltype(k);
template <int, typename _F, typename... _B> struct V {
  typedef I<typename Q<_F>::type(typename Q<_B>::type...)> type;
};
template <typename _F, typename... _B>
__attribute__((noipa)) typename V<W<_F>::value, _F, _B...>::type
baz(_F, _B...) { return typename V<W<_F>::value, _F, _B...>::type (); }
template <typename _Tp> struct AJ {
  template <typename _Up> struct _Ptr { using type = _Up *; };
  using AI = typename _Ptr<_Tp>::type;
};
template <typename _Tp> struct Y {
  using AI = typename AJ<_Tp>::AI;
  AI operator->();
};
}
extern int z;
namespace N1 {
namespace N2 {
namespace N3 {
enum Z { Z1, Z2 };
template <int> struct X {
  template <typename _F>
  __attribute__((noipa)) void boo(long long, long long, long long, _F &) {}
};
struct AC {
  AC(int);
  void m1(R::S<void()>);
};
template <typename>
__attribute__((noipa)) void garply(void *, long long, long long, long long) {}
template <>
template <typename _F>
void X<Z2>::boo(long long, long long x, long long y, _F &fi) {
  AC pool(z);
  for (;;) {
    auto job = R::baz(garply<_F>, &fi, y, y, x);
    pool.m1(job);
  }
}
struct AB {
  static AB &bleh();
  template <typename _F>
  void boo(long first, long x, long y, _F fi) {
    switch (ab1) {
    case Z1:
      ab2->boo(first, x, y, fi);
    case Z2:
      ab3->boo(first, x, y, fi);
    }
  }
  Z ab1;
  R::Y<X<Z1>> ab2;
  R::Y<X<Z2>> ab3;
};
template <typename, bool> struct C;
template <typename _F> struct C<_F, false> {
  __attribute__((noipa)) C(_F) {}
  void boo(long first, long x, long y) {
    auto u = AB::bleh();
    u.boo(first, x, y, *this);
  }
};
template <typename _F> struct AA { typedef C<_F, 0> type; };
}
}
}
struct AD {
  template <typename _F>
  static void boo(long first, long x, long y, _F f) {
    typename N1::N2::N3::AA<_F>::type fi(f);
    fi.boo(first, x, y);
  }
  template <typename _F>
  static void boo(long first, long x, _F f) {
    boo(first, x, 0, f);
  }
};
template <typename> struct A {
  void foo(long long, long long);
  int *c;
};
namespace {
template <typename> struct D { __attribute__((noipa)) D(int *) {} };
}
template <typename T>
void A<T>::foo(long long x, long long y)
{
  int e;
  D<T> d(&e);
  AD::boo(0, y, d);
  long p;
  for (p = 0; p < x; p++)
    c[p] = c[p - 1];
}
pr113617.C:
#include "pr113617.h"
int z;
long xx1;
void corge() {
  A<long long> a;
  a.foo(xx1, 0);
}
pr113617-aux.cc:
#include "pr113617.h"
void qux() {
  A<long long> a;
  a.foo(0, 0);
}

From what I can see, there is just one comdat group, _ZN1AIxE3fooExx, in the
whole testcase, which contains everything instantiated because of the foo
instantiation.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2024-01-30 12:45 ` jakub at gcc dot gnu.org
@ 2024-02-14  3:20 ` orion at nwra dot com
  2024-02-14  8:20 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: orion at nwra dot com @ 2024-02-14  3:20 UTC (permalink / raw)
  To: gcc-bugs

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

Orion Poplawski <orion at nwra dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |orion at nwra dot com

--- Comment #15 from Orion Poplawski <orion at nwra dot com> ---
Just a comment that a fix for this would be nice to have as it's currently
blocking builds of vtk and paraview in Fedora.  Thanks!

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2024-02-14  3:20 ` orion at nwra dot com
@ 2024-02-14  8:20 ` jakub at gcc dot gnu.org
  2024-02-26 17:06 ` cvs-commit at gcc dot gnu.org
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-14  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is waiting for review
https://gcc.gnu.org/pipermail/gcc-patches/2024-January/644580.html

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2024-02-14  8:20 ` jakub at gcc dot gnu.org
@ 2024-02-26 17:06 ` cvs-commit at gcc dot gnu.org
  2024-02-26 17:25 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-26 17:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:1931c40364bb9fb0a7c4b650917e3ac0e88bf6f4

commit r14-9185-g1931c40364bb9fb0a7c4b650917e3ac0e88bf6f4
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Feb 26 17:55:07 2024 +0100

    varasm: Handle private COMDAT function symbol reference in readonly data
section [PR113617]

    If default_elf_select_rtx_section is called to put a reference to some
    local symbol defined in a comdat section into memory, which happens more
often
    since the r14-4944 RA change, linking might fail.
    default_elf_select_rtx_section puts such constants into .data.rel.ro.local
    etc. sections and if linker chooses comdat sections from some other TU
    and discards the one to which a relocation in .data.rel.ro.local remains,
    linker diagnoses error.  References to private comdat symbols can only
appear
    from functions or data objects in the same comdat group, so the following
    patch arranges using .data.rel.ro.local.pool.<comdat_name> and similar
sections.

    2024-02-26  Jakub Jelinek  <jakub@redhat.com>
                H.J. Lu  <hjl.tools@gmail.com>

            PR rtl-optimization/113617
            * varasm.cc (default_elf_select_rtx_section): For
            references to private symbols in comdat sections
            use .data.relro.local.pool.<comdat>, .data.relro.pool.<comdat>
            or .rodata.<comdat> comdat sections.

            * g++.dg/other/pr113617.C: New test.
            * g++.dg/other/pr113617.h: New test.
            * g++.dg/other/pr113617-aux.cc: New test.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (18 preceding siblings ...)
  2024-02-26 17:06 ` cvs-commit at gcc dot gnu.org
@ 2024-02-26 17:25 ` jakub at gcc dot gnu.org
  2024-03-07 13:31 ` fxcoudert at gcc dot gnu.org
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-26 17:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (19 preceding siblings ...)
  2024-02-26 17:25 ` jakub at gcc dot gnu.org
@ 2024-03-07 13:31 ` fxcoudert at gcc dot gnu.org
  2024-03-07 14:03 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2024-03-07 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu.org

--- Comment #19 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
The testcase introduced fails on darwin, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114233

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (20 preceding siblings ...)
  2024-03-07 13:31 ` fxcoudert at gcc dot gnu.org
@ 2024-03-07 14:03 ` jakub at gcc dot gnu.org
  2024-03-07 14:07 ` fxcoudert at gcc dot gnu.org
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-07 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57645
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57645&action=edit
gcc14-pr113617-test.patch

Does this fix that?  Tried to define everything I saw in nm -u on the result on
Linux and verified if I revert the varasm.cc change it still expectedly FAILs
and with it it passes.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (21 preceding siblings ...)
  2024-03-07 14:03 ` jakub at gcc dot gnu.org
@ 2024-03-07 14:07 ` fxcoudert at gcc dot gnu.org
  2024-03-07 14:08 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2024-03-07 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
That reduces a lot, but it's still missing main:

Excess errors:
Undefined symbols for architecture x86_64:
  "_main", referenced from:
      <initial-undefines>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (22 preceding siblings ...)
  2024-03-07 14:07 ` fxcoudert at gcc dot gnu.org
@ 2024-03-07 14:08 ` jakub at gcc dot gnu.org
  2024-03-07 14:11 ` fxcoudert at gcc dot gnu.org
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-07 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #21)
> That reduces a lot, but it's still missing main:
> 
> Excess errors:
> Undefined symbols for architecture x86_64:
>   "_main", referenced from:
>       <initial-undefines>

This is a shared library, so why should it have main?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (23 preceding siblings ...)
  2024-03-07 14:08 ` jakub at gcc dot gnu.org
@ 2024-03-07 14:11 ` fxcoudert at gcc dot gnu.org
  2024-03-07 14:13 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2024-03-07 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
It's not being passed -shared on darwin:

Executing on host: /Users/fx/ibin-20240306/gcc/testsuite/g++/../../xg++
-B/Users/fx/ibin-20240306/gcc/testsuite/g++/../../ 
/Users/fx/gcc-upstream/gcc/testsuite/g++.dg/other/pr113617.C
    -fdiagnostics-plain-output  -nostdinc++
-I/Users/fx/ibin-20240306/x86_64-apple-darwin23/libstdc++-v3/include/x86_64-apple-darwin23
-I/Users/fx/ibin-20240306/x86_64-apple-darwin23/l
ibstdc++-v3/include -I/Users/fx/gcc-upstream/libstdc++-v3/libsupc++
-I/Users/fx/gcc-upstream/libstdc++-v3/include/backward
-I/Users/fx/gcc-upstream/libstdc++-v3/testsuite/util -fmessag
e-length=0  -std=gnu++20 -O2 -fPIC  
/Users/fx/gcc-upstream/gcc/testsuite/g++.dg/other/pr113617-aux.cc -dumpbase "" 
 -L/Users/fx/ibin-20240306/x86_64-apple-darwin23/./libstdc++-v3/src
/.libs 
-B/Users/fx/ibin-20240306/x86_64-apple-darwin23/./libstdc++-v3/src/.libs 
-L/Users/fx/ibin-20240306/x86_64-apple-darwin23/./libstdc++-v3/src/.libs 
-L/Users/fx/ibin-20240306/x8
6_64-apple-darwin23/./libstdc++-v3/src/experimental/.libs
-B/Users/fx/ibin-20240306/x86_64-apple-darwin23/./libitm/
-L/Users/fx/ibin-20240306/x86_64-apple-darwin23/./libitm/.libs -lm  
-o pr113617.exe    (timeout = 300)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (24 preceding siblings ...)
  2024-03-07 14:11 ` fxcoudert at gcc dot gnu.org
@ 2024-03-07 14:13 ` jakub at gcc dot gnu.org
  2024-03-07 14:20 ` fxcoudert at gcc dot gnu.org
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-07 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #23)
> It's not being passed -shared on darwin:

Then that means the shared effective target doesn't work properly on darwin
then.
It even has hacks for darwin in it though:
    # Darwin's linker defaults to error on undefined (which makes it look as
    # if we do not support shared) but we can tell it to allow the symbols used
    # here to be undefined.
    set extra_flags ""
    if { [istarget *-*-darwin\[912\]*] } {
      set extra_flags "-Wl,-U,_foo,-U,_bar"
    }
...

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (25 preceding siblings ...)
  2024-03-07 14:13 ` jakub at gcc dot gnu.org
@ 2024-03-07 14:20 ` fxcoudert at gcc dot gnu.org
  2024-03-07 14:23 ` fxcoudert at gcc dot gnu.org
  2024-03-08 14:19 ` cvs-commit at gcc dot gnu.org
  28 siblings, 0 replies; 30+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2024-03-07 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #25 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Yes, that test in check_effective_target_shared actually works with C, but not
with C++, because:

Undefined symbols for architecture arm64:
  "__Z3foov", referenced from:
      __Z3bazv in ccCj5plO.o

Why have we not seen it before? Because most of the use of that check is in {
dg-require-effective-target shared } so we're effectively skipping tests, and
that is silent.

As far as I can tell, your addition is the first time { target shared } is used
as a conditional in something like { dg-additional-options } in the C++
testsuite.

Thanks for helping me figuring it out, that's definitely at least a darwin
issue, which I'll take care of.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (26 preceding siblings ...)
  2024-03-07 14:20 ` fxcoudert at gcc dot gnu.org
@ 2024-03-07 14:23 ` fxcoudert at gcc dot gnu.org
  2024-03-08 14:19 ` cvs-commit at gcc dot gnu.org
  28 siblings, 0 replies; 30+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2024-03-07 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #26 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
PS: I can confirm two things:

1. Your patch above is still necessary
2. In conjunction with the darwin-specific fix below, the testcase now passes:

diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index ae33c4f1e3a..467b539b20d 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1390,7 +1390,7 @@ proc check_effective_target_shared { } {
     # here to be undefined.
     set extra_flags ""
     if { [istarget *-*-darwin\[912\]*] } {
-      set extra_flags "-Wl,-U,_foo,-U,_bar"
+      set extra_flags "-Wl,-U,_foo,-U,_bar,-U,__Z3foov"
     }
     # Note that M68K has a multilib that supports -fpic but not
     # -fPIC, so we need to check both.  We test with a program that

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/113617] [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944
  2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
                   ` (27 preceding siblings ...)
  2024-03-07 14:23 ` fxcoudert at gcc dot gnu.org
@ 2024-03-08 14:19 ` cvs-commit at gcc dot gnu.org
  28 siblings, 0 replies; 30+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-08 14:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #27 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:8263a4b6505f84973c2ed2fb8d4f2036ca335ff3

commit r14-9392-g8263a4b6505f84973c2ed2fb8d4f2036ca335ff3
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Mar 8 15:18:56 2024 +0100

    testsuite: Fix up pr113617 test for darwin [PR113617]

    The test attempts to link a shared library, and apparently Darwin doesn't
    allow by default for shared libraries to contain undefined symbols.

    The following patch just adds dummy definitions for the symbols, so that
    the library no longer has any undefined symbols at least in my linux
    testing.
    Furthermore, for target { !shared } targets (like darwin until the it is
    fixed in target-supports.exp), because we then link a program rather than
    shared library, the patch also adds a dummy main definition so that it
    can link.

    2024-03-08  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/113617
            PR target/114233
            * g++.dg/other/pr113617.C: Define -DSHARED when linking with
-shared.
            * g++.dg/other/pr113617-aux.cc: Add definitions for used methods
and
            templates not defined elsewhere.

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2024-03-08 14:20 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26 13:08 [Bug rtl-optimization/113617] New: [14 Regression] Symbol ... referenced in section `.data.rel.ro.local' of ...: defined in discarded section ... since r14-4944 jakub at gcc dot gnu.org
2024-01-26 13:08 ` [Bug rtl-optimization/113617] " jakub at gcc dot gnu.org
2024-01-26 13:09 ` jakub at gcc dot gnu.org
2024-01-26 13:09 ` jakub at gcc dot gnu.org
2024-01-26 13:10 ` jakub at gcc dot gnu.org
2024-01-26 14:22 ` hjl.tools at gmail dot com
2024-01-26 14:28 ` jakub at gcc dot gnu.org
2024-01-26 14:39 ` hjl.tools at gmail dot com
2024-01-26 15:52 ` jakub at gcc dot gnu.org
2024-01-26 15:52 ` jakub at gcc dot gnu.org
2024-01-26 15:52 ` jakub at gcc dot gnu.org
2024-01-26 15:55 ` sjames at gcc dot gnu.org
2024-01-26 16:13 ` jakub at gcc dot gnu.org
2024-01-26 20:44 ` hjl.tools at gmail dot com
2024-01-27  5:53 ` hjl.tools at gmail dot com
2024-01-27 15:13 ` hjl.tools at gmail dot com
2024-01-30 12:45 ` jakub at gcc dot gnu.org
2024-02-14  3:20 ` orion at nwra dot com
2024-02-14  8:20 ` jakub at gcc dot gnu.org
2024-02-26 17:06 ` cvs-commit at gcc dot gnu.org
2024-02-26 17:25 ` jakub at gcc dot gnu.org
2024-03-07 13:31 ` fxcoudert at gcc dot gnu.org
2024-03-07 14:03 ` jakub at gcc dot gnu.org
2024-03-07 14:07 ` fxcoudert at gcc dot gnu.org
2024-03-07 14:08 ` jakub at gcc dot gnu.org
2024-03-07 14:11 ` fxcoudert at gcc dot gnu.org
2024-03-07 14:13 ` jakub at gcc dot gnu.org
2024-03-07 14:20 ` fxcoudert at gcc dot gnu.org
2024-03-07 14:23 ` fxcoudert at gcc dot gnu.org
2024-03-08 14:19 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).