This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: why C++ cannot alias an inline function, C can ?


(should have been on gcc-help I believe)

On Sun, 1 Apr 2018, Max Filippov wrote:

On Sun, Apr 1, 2018 at 5:33 AM, Jason Vas Dias <jason.vas.dias@gmail.com> wrote:
Aha!  But how to determine the mangled name beforehand ?

Even if I compile the object without the alias, then inspect
the object with objdump, there is no mangled symbol
_ZL3foov defined in the object file .

So I must run some name mangler /  generator as a
pre-processing step to get the correct mangled name
string ?

I guess so. Or you could define foo with C linkage:

    extern "C" {
         static inline __attribute__((always_inline))
         void foo(void){}
    };

    static inline __attribute__((always_inline,alias("foo")))
    void bar(void);

Or you can use an asm label to specify some arbitrary name.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]