Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-30 Thread H.J. Lu
On Tue, Jan 30, 2024 at 4:58 AM H.J. Lu wrote: > > On Tue, Jan 30, 2024 at 4:51 AM Jakub Jelinek wrote: > > > > On Mon, Jan 29, 2024 at 06:05:25PM -0800, H.J. Lu wrote: > > > LRA may call forcce_const_mem on this insn in the function > > > > > > (gdb) call debug_tree (func_decl) > > > > >

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-30 Thread H.J. Lu
On Tue, Jan 30, 2024 at 4:51 AM Jakub Jelinek wrote: > > On Mon, Jan 29, 2024 at 06:05:25PM -0800, H.J. Lu wrote: > > LRA may call forcce_const_mem on this insn in the function > > > > (gdb) call debug_tree (func_decl) > > > type > type > align:8 warn_if_not_align:0

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-30 Thread Jakub Jelinek
On Mon, Jan 29, 2024 at 06:05:25PM -0800, H.J. Lu wrote: > LRA may call forcce_const_mem on this insn in the function > > (gdb) call debug_tree (func_decl) > type type align:8 warn_if_not_align:0 symtab:0 alias-set -1 > canonical-type 0x77690f18 >

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 3:12 PM H.J. Lu wrote: > > On Mon, Jan 29, 2024 at 2:51 PM Jakub Jelinek wrote: > > > > On Mon, Jan 29, 2024 at 11:29:22PM +0100, Jakub Jelinek wrote: > > > On Mon, Jan 29, 2024 at 11:22:44PM +0100, Jakub Jelinek wrote: > > > > On Mon, Jan 29, 2024 at 02:01:56PM -0800,

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 2:51 PM Jakub Jelinek wrote: > > On Mon, Jan 29, 2024 at 11:29:22PM +0100, Jakub Jelinek wrote: > > On Mon, Jan 29, 2024 at 11:22:44PM +0100, Jakub Jelinek wrote: > > > On Mon, Jan 29, 2024 at 02:01:56PM -0800, H.J. Lu wrote: > > > > > A function accesses a function symbol

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread Jakub Jelinek
On Mon, Jan 29, 2024 at 11:29:22PM +0100, Jakub Jelinek wrote: > On Mon, Jan 29, 2024 at 11:22:44PM +0100, Jakub Jelinek wrote: > > On Mon, Jan 29, 2024 at 02:01:56PM -0800, H.J. Lu wrote: > > > > A function accesses a function symbol defined in a comdat group. > > > > If the function symbol is

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread Jakub Jelinek
On Mon, Jan 29, 2024 at 11:22:44PM +0100, Jakub Jelinek wrote: > On Mon, Jan 29, 2024 at 02:01:56PM -0800, H.J. Lu wrote: > > > A function accesses a function symbol defined in a comdat group. > > > If the function symbol is public, any comdat definition of the same group > > > signature should

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread Jakub Jelinek
On Mon, Jan 29, 2024 at 02:01:56PM -0800, H.J. Lu wrote: > > A function accesses a function symbol defined in a comdat group. > > If the function symbol is public, any comdat definition of the same group > > signature should provide the function definition. If the function symbol > > is private

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 2:01 PM H.J. Lu wrote: > > On Mon, Jan 29, 2024 at 1:42 PM H.J. Lu wrote: > > > > On Mon, Jan 29, 2024 at 1:22 PM H.J. Lu wrote: > > > > > > On Mon, Jan 29, 2024 at 1:00 PM H.J. Lu wrote: > > > > > > > > On Mon, Jan 29, 2024 at 9:34 AM H.J. Lu wrote: > > > > > > > > >

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 1:42 PM H.J. Lu wrote: > > On Mon, Jan 29, 2024 at 1:22 PM H.J. Lu wrote: > > > > On Mon, Jan 29, 2024 at 1:00 PM H.J. Lu wrote: > > > > > > On Mon, Jan 29, 2024 at 9:34 AM H.J. Lu wrote: > > > > > > > > On Mon, Jan 29, 2024 at 9:00 AM Jakub Jelinek wrote: > > > > > >

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 1:22 PM H.J. Lu wrote: > > On Mon, Jan 29, 2024 at 1:00 PM H.J. Lu wrote: > > > > On Mon, Jan 29, 2024 at 9:34 AM H.J. Lu wrote: > > > > > > On Mon, Jan 29, 2024 at 9:00 AM Jakub Jelinek wrote: > > > > > > > > On Mon, Jan 29, 2024 at 08:45:45AM -0800, H.J. Lu wrote: > >

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 1:00 PM H.J. Lu wrote: > > On Mon, Jan 29, 2024 at 9:34 AM H.J. Lu wrote: > > > > On Mon, Jan 29, 2024 at 9:00 AM Jakub Jelinek wrote: > > > > > > On Mon, Jan 29, 2024 at 08:45:45AM -0800, H.J. Lu wrote: > > > > In this case, these are internal to the same comdat group:

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 9:34 AM H.J. Lu wrote: > > On Mon, Jan 29, 2024 at 9:00 AM Jakub Jelinek wrote: > > > > On Mon, Jan 29, 2024 at 08:45:45AM -0800, H.J. Lu wrote: > > > In this case, these are internal to the same comdat group: > > > > But that is only by accident, no? > > This may be by

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 9:00 AM Jakub Jelinek wrote: > > On Mon, Jan 29, 2024 at 08:45:45AM -0800, H.J. Lu wrote: > > In this case, these are internal to the same comdat group: > > But that is only by accident, no? This may be by luck. I don't know if gcc checks it when generating such

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread Jakub Jelinek
On Mon, Jan 29, 2024 at 08:45:45AM -0800, H.J. Lu wrote: > In this case, these are internal to the same comdat group: But that is only by accident, no? I mean, if you need to refer to such a symbol from non-comdat function or comdat function in a different comdat group and RA decides it wants the

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 8:34 AM Jakub Jelinek wrote: > > On Mon, Jan 29, 2024 at 08:23:21AM -0800, H.J. Lu wrote: > > > baz: > > > movq.LC0(%rip), %xmm0 > > > ret > > > > I don't think this is valid. We can't reference a non-public > > symbol outside of a COMDAT group. It is

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread Jakub Jelinek
On Mon, Jan 29, 2024 at 08:23:21AM -0800, H.J. Lu wrote: > > baz: > > movq.LC0(%rip), %xmm0 > > ret > > I don't think this is valid. We can't reference a non-public > symbol outside of a COMDAT group. It is OK to reference > foo or foo + 1, but not .LC0. But that is exactly

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 8:03 AM Jakub Jelinek wrote: > > On Mon, Jan 29, 2024 at 06:36:47AM -0800, H.J. Lu wrote: > > TARGET_ASM_SELECT_RTX_SECTION is for constant in RTL. > > It should have a non-public label reference which can't be used > > by other TUs. The same section can contain other

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread Jakub Jelinek
On Mon, Jan 29, 2024 at 06:36:47AM -0800, H.J. Lu wrote: > TARGET_ASM_SELECT_RTX_SECTION is for constant in RTL. > It should have a non-public label reference which can't be used > by other TUs. The same section can contain other constants. > If there is a COMAT issue, linker will catch it. Let

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread H.J. Lu
On Mon, Jan 29, 2024 at 3:03 AM Jakub Jelinek wrote: > > On Sat, Jan 27, 2024 at 07:10:55AM -0800, H.J. Lu wrote: > > For function symbol reference in readonly data section, instead of putting > > it in .data.rel.ro or .rodata.cst section, call function_rodata_section to > > get the read-only or

Re: [PATCH] Handle function symbol reference in readonly data section

2024-01-29 Thread Jakub Jelinek
On Sat, Jan 27, 2024 at 07:10:55AM -0800, H.J. Lu wrote: > For function symbol reference in readonly data section, instead of putting > it in .data.rel.ro or .rodata.cst section, call function_rodata_section to > get the read-only or relocated read-only data section associated with the > function

[PATCH] Handle function symbol reference in readonly data section

2024-01-27 Thread H.J. Lu
For function symbol reference in readonly data section, instead of putting it in .data.rel.ro or .rodata.cst section, call function_rodata_section to get the read-only or relocated read-only data section associated with the function DECL so that the COMDAT section will be used for a COMDAT