how to use macro in assemble language embedded in C?

kerler kerler at newmail.net
Tue Dec 26 12:41:09 EST 2000


hello,

When i use the assemble language embedded in C, how can i use the macro?

in the following code, i want to use the macro PT_R16 defined in
asm\ptrace.h.

=========temp.c==========
asm("#include <asm\\ptrace.h>\n\t");
void dummy (void)
{
    asm("stwu   %r1, -PT_R16(%r1)");             /* stack */
}
=========end of temp.c===

when i
      gcc -c temp.c
error message:
/tmp/cc8ztvPf.s: Assembler messages:
/tmp/cc8ztvPf.s:13: Error: Negative of non-absolute symbol PT_R16

if use
      gcc -S temp.c
the file temp.s is:

=========temp.s==========
        .file   "temp.c"
gcc2_compiled.:
        #include <asm\ptrace.h>

        .section        ".text"
        .align 2
        .globl dummy
        .type    dummy, at function
dummy:
        stwu 1,-16(1)
        stw 31,12(1)
        mr 31,1
        stwu   %r1, -PT_R16(%r1)
.L2:
        lwz 11,0(1)
        lwz 31,-4(11)
        mr 1,11
        blr
.Lfe1:
        .size    dummy,.Lfe1-dummy
        .ident  "GCC: (GNU) 2.95.2 20000220 (Debian GNU/Linux)"
======end of temp.s=============


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list