Calling Conventions

Where can I find documentation on how to interface asm routines with
C/C++ routines when linking with GCC?

I am interested in seeing how things should be pushed onto the stack
and how returned objects should be extracted from the stack.

Chris McKillop <cdm@qnx.com> wrote:
CM > Bill Caroselli <qtps@earthlink.net> wrote:

Where can I find documentation on how to interface asm routines with
C/C++ routines when linking with GCC?

I am interested in seeing how things should be pushed onto the stack
and how returned objects should be extracted from the stack.

CM > One of the easiest ways is to do “gcc -S” and take a look at the generated
CM > assembly code.

This is what I have done. And yes, it does work. I was just looking
for a more official method.

Bill Caroselli <qtps@earthlink.net> wrote:

Where can I find documentation on how to interface asm routines with
C/C++ routines when linking with GCC?

I am interested in seeing how things should be pushed onto the stack
and how returned objects should be extracted from the stack.

One of the easiest ways is to do “gcc -S” and take a look at the generated
assembly code.

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Take a peek at the ABI for the achitecture you’re interested in, that should
the offical way for call linkage (stack or not).

-Adam

Bill Caroselli <qtps@earthlink.net> wrote in message
news:b9okf6$cjj$1@inn.qnx.com

Chris McKillop <> cdm@qnx.com> > wrote:
CM > Bill Caroselli <> qtps@earthlink.net> > wrote:
Where can I find documentation on how to interface asm routines with
C/C++ routines when linking with GCC?

I am interested in seeing how things should be pushed onto the stack
and how returned objects should be extracted from the stack.


CM > One of the easiest ways is to do “gcc -S” and take a look at the
generated
CM > assembly code.

This is what I have done. And yes, it does work. I was just looking
for a more official method.

Are you trying to write straight assembly files or inline assembly? If
inline, this page might be helpful.

http://savannah.nongnu.org/download/avr-libc/doc/avr-libc-user-manual/inline_asm.html

There’s also one for DJGPP (a windows port of gcc) that is pretty good:

http://www.imm.dtu.dk/courses/02130/djasm.html

cheers,

Kris

“Bill Caroselli” <qtps@earthlink.net> wrote in message
news:b9ojgc$bf7$2@inn.qnx.com

Where can I find documentation on how to interface asm routines with
C/C++ routines when linking with GCC?

I am interested in seeing how things should be pushed onto the stack
and how returned objects should be extracted from the stack.