[lug] C++ inline asm on g++
Kelly Brock
kbrock at spamcop.net
Thu Jan 10 16:11:59 MST 2002
Hi All,
> I'm going to be at the BLUG meeting this evening, maybe
> someone can give
> me some hints while there. I'm trying to find out what is
> needed for g++
> using recent g++ releases will need to add inline asm with
> C++ linkage?
> If wrapped extern "C", I know it won't be an issue, but if for example
> one wants to create asm based functions that are overloaded
> or within a
> separate namespace, what hoops must be jumped through? Is
> there asm name
> mangling that must be dealt with, or can g++ take care of it? My asm
> abilities are rather limited, maybe someone has a URL with samples of
> basic C++ linkage asm. Now if the asm requires some sort of name
> mangling scheme that g++ itself does not take care of, I assume one
> version is required for g++ 2.95 or below, another for redhat's 2.96,
> and yet one more for 3.x versions of g++? The name mangling scheme is
> apparently one of the reasons one can't mix binary object files across
> these compiler versions (among many reasons), I certainly hope it is
> possible to handle this without detailed knowledge of the actual
> mangling.
Just want to add something to this since it's part of a discussion Dan and
I are having.
The reason that this came up is not because using the inline assembly is a
problem, it's because I can't figure out how to turn off the prolog and
epilog code for the function in question. I need the function to do it's
own stack manipulation because it's a rather exotic little thing. In VC I
do this quite simply with the following:
void __declspec(naked) Function(void)
{
__asm
{
.. yada yada ..
}
}
Is there a variation of this usable in GCC? I tried the __attribute__
(naked) thing but couldn't get it to work. An answer to either case would
be wonderful.
Regards,
Kelly Brock
The Sims Online
Maxis - Electronic Arts
More information about the LUG
mailing list