[lug] C++ inline asm on g++

Tom Tromey tromey at redhat.com
Thu Jan 10 17:34:24 MST 2002


>>>>> ">" == D Stimits <stimits at idcomm.com> writes:

>> I'm trying to find out what is needed for g++ using recent g++
>> releases will need to add inline asm with C++ linkage?

Nothing really.  Just put your asm inside a function with C++ linkage.

For instance, here is a simple example from libgcj:

    inline static void
    keep_live(obj_addr_t p)
    {
	__asm__ __volatile__("" : : "rm"(p) : "memory");
    }

This is a function with C++ linkage, which you can see by looking at
the mangling in the .o file:

    creche. nm java/lang/natObject.o | grep keep_live
    000017b8 t _Z9keep_livej

Tom



More information about the LUG mailing list