public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hedayat.fwd at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/101010] New: Feature request: add builtins to provide mangled symbols, optionally with a prefix
Date: Thu, 10 Jun 2021 08:28:57 +0000	[thread overview]
Message-ID: <bug-101010-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101010
           Summary: Feature request: add builtins to provide mangled
                    symbols, optionally with a prefix
           Product: gcc
           Version: 11.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hedayat.fwd at gmail dot com
  Target Milestone: ---

Currently, there is no method to generate mangled symbol as an string or as a
symbol. 

A mangled symbol as string is useful in many cases for GCC itself, e.g. to use
with alias or ifunc attributes. Currently, you should find the mangled name
yourself and use it there, which is both inconvenient and also might change in
future (or it might be even different for example when compiled with mingw). 

Having a mangled symbol with a prefix (not as a string), is useful when using
the '--wrap' option to ld, to generate __real_SYMBOL and __wrap_SYMBOLs.
Actually, I'm more interested in this one, but found that the former one
(mangled name as string) is also useful. 

Sample intended usage:
void __builtin_mangled_symbol(__wrap_, &MyClass::member)(MyClass *mc_this, int
a)
{
   if (call_real)
       __builtin_mangled_symbol(__real_, &MyClass::member)(mc_this, a);
   else
   {...}
}

             reply	other threads:[~2021-06-10  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  8:28 hedayat.fwd at gmail dot com [this message]
2021-06-10  8:36 ` [Bug c++/101010] " pinskia at gcc dot gnu.org
2021-06-10 17:39 ` msebor at gcc dot gnu.org
2021-06-10 21:08 ` hedayat.fwd at gmail dot com

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=bug-101010-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).