public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH v2] Handle private COMDAT function symbol reference in readonly data section
Date: Wed, 31 Jan 2024 18:09:59 +0100	[thread overview]
Message-ID: <Zbp+52AiNrQMgbpx@tucnak> (raw)
In-Reply-To: <CAMe9rOqmFg1QpyrvsXdwK5R+v_CrL0djqXMQeUmR5gkRV6CuLA@mail.gmail.com>

On Wed, Jan 31, 2024 at 08:48:33AM -0800, H.J. Lu wrote:
> Which function (target hook) can I use to generate
> 
>  .section        .data.rel.ro.local,"awG",@progbits,_ZN1AIxE3fooExx,comdat

Just
      if (decl)
	return get_section (reloc == 1
			    ? ".data.rel.ro.local" : ".data.rel.ro",
			    SECTION_WRITE | SECTION_RELRO | SECTION_LINKONCE,
			    decl);
for the first hunk and
  else if (decl)
    return get_section (".rodata", SECTION_LINKONCE, decl);
in the second case?

Haven't tried it though, maybe the get_section section conflict stuff
isn't able to handle it (and perhaps that is the reason why we simply don't
emit functions into
	.section	.text,"axG",@progbits,whatever,comdat
sections instead of
	.section	.text.function_name,"axG",@progbits,whatever,comdat
In such case, we could append something to those section names,
like const.pool (or whatever else that couldn't clash with function names,
so needs probably a dot somewhere).  Could be
.data.rel.ro.local.const.pool
.data.rel.ro.const.pool
or
.data.rel.ro.local..shared
.data.rel.ro..shared
or something similar, but .data.rel.ro.local.shared would not be ok,
because it could clash with .data.rel.ro.local section for shared function.
    
> > Another question is if we need to do anything about the
> > DECL_COMDAT_GROUP (decl) && DECL_SECTION_NAME (decl)
> > && startswith (DECL_SECTION_NAME (decl), ".gnu.linkonce.t.")
> > case (older linkers) (i.e. when using years old GNU linkers).
> >
> 
> Should we support such targets? It is not easy for me to test it.

Perhaps let's wait if somebody files an issue with such configuration.

	Jakub


  reply	other threads:[~2024-01-31 17:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31  2:21 H.J. Lu
2024-01-31 16:30 ` Jakub Jelinek
2024-01-31 16:48   ` H.J. Lu
2024-01-31 17:09     ` Jakub Jelinek [this message]
2024-01-31 17:39       ` H.J. Lu
2024-01-31 18:11         ` Jakub Jelinek
2024-01-31 18:58           ` [PATCH] varasm, v3: Handle private COMDAT function symbol reference in readonly data section [PR113617] Jakub Jelinek
2024-02-01  8:23             ` Jakub Jelinek
2024-01-31 19:31           ` [PATCH v2] Handle private COMDAT function symbol reference in readonly data section H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zbp+52AiNrQMgbpx@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).