public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101010] New: Feature request: add builtins to provide mangled symbols, optionally with a prefix
@ 2021-06-10  8:28 hedayat.fwd at gmail dot com
  2021-06-10  8:36 ` [Bug c++/101010] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hedayat.fwd at gmail dot com @ 2021-06-10  8:28 UTC (permalink / raw)
  To: gcc-bugs

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
   {...}
}

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

end of thread, other threads:[~2021-06-10 21:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  8:28 [Bug c++/101010] New: Feature request: add builtins to provide mangled symbols, optionally with a prefix hedayat.fwd at gmail dot com
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

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).