Subject: Re: how to use macro in assemble language embedded in C?

From: "kerler" <[email-masked]>
Date: Wed, 27 Dec 2000 11:33:41 +0800

Hi,

(NOTE: when reply this mail, please cc: [email-masked] , thanks)

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

failed when:
    gcc -c temp.c
error message:
    /tmp/cc06t5DZ.s: Assembler messages:
    /tmp/cc06t5DZ.s:13: Error: Negative of non-absolute symbol PT_R16
but when use:
    gcc -S temp.c -o temp.S    (note: here is temp.S, not temp.s)
    gcc -c -D_ASSEMBLY__ temp.S
success!

so I know the question is that gcc do pre-process when "gcc -c temp.S",
but not do per-process when "gcc -c temp.s"

so if i want use only one command line to compile temp.c,
such as "gcc -c -other-option temp.c", which other-option should I add to
make
gcc creat a temporal assemble file /tmp/xxxx.S (not /tmp/xxxx.s) ?

----- Original Message -----
From: Kaoru Fukui <[email-masked]>
To: kerler <[email-masked]>
Sent: Tuesday, December 26, 2000 9:17 PM
Subject: Re: how to use macro in assemble language embedded in C?

> Hi!
>
> Look at linux/arch/kernel/entry.S or else
>
> Kaoru
>
>
> From: "kerler" <[email-masked]>
> To: <[email-masked]>
> Subject: how to use macro in assemble language embedded in C?
> Date: Tue, 26 Dec 2000 09:41:09 +0800
> Cc: <[email-masked]>
>
> >
> > 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=============
> >
> >
> >
> >
>

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