linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "kerler" <kerler@newmail.net>
To: "Kaoru Fukui" <k_fukui@highway.ne.jp>
Cc: <gcc@gcc.gnu.org>, <linuxppc-dev@lists.linuxppc.org>
Subject: Re: how to use macro in assemble language embedded in C?
Date: Wed, 27 Dec 2000 11:33:41 +0800	[thread overview]
Message-ID: <023e01c06fb5$dfe05a80$5ef1d092@chn.agilent.com> (raw)
In-Reply-To: 20001226221757.Postino-028251@smtp01.highway.ne.jp


Hi,

(NOTE: when reply this mail, please cc: kerler@newmail.net , 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 <k_fukui@highway.ne.jp>
To: kerler <kerler@newmail.net>
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" <kerler@newmail.net>
> To: <linuxppc-dev@lists.linuxppc.org>
> Subject: how to use macro in assemble language embedded in C?
> Date: Tue, 26 Dec 2000 09:41:09 +0800
> Cc: <gcc@gcc.gnu.org>
>
> >
> > 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/

  parent reply	other threads:[~2000-12-27  3:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-23  5:52 kerne-2.4.0-test13pre3 with gcc-2.97 Kaoru Fukui
     [not found] ` <20001223142145.T5858@coruscant.gnumonks.org>
2000-12-23 13:30   ` Kaoru Fukui
2000-12-24  3:29 ` Alexandre Oliva
2000-12-24 13:53   ` Kaoru Fukui
2000-12-24 15:20     ` Thomas Sailer
2000-12-24 15:19   ` Thomas Sailer
2000-12-24 18:08     ` Alexandre Oliva
2000-12-26  1:41       ` how to use macro in assemble language embedded in C? kerler
     [not found]         ` <20001226221757.Postino-028251@smtp01.highway.ne.jp>
2000-12-27  3:33           ` kerler [this message]
2000-12-27 15:50             ` Alexandre Oliva
2000-12-27 23:37       ` kerne-2.4.0-test13pre3 with gcc-2.97 Richard Henderson
2000-12-24 15:16 ` Thomas Sailer
  -- strict thread matches above, loose matches on Subject: below --
2000-12-27 11:04 how to use macro in assemble language embedded in C? Kaoru Fukui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='023e01c06fb5$dfe05a80$5ef1d092@chn.agilent.com' \
    --to=kerler@newmail.net \
    --cc=gcc@gcc.gnu.org \
    --cc=k_fukui@highway.ne.jp \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).