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]

how to use macro in assemble language embedded in C?


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,@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=============




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