From: Maciej Hrebien <m_hrebien@wp.pl>
To: linux-assembly@vger.kernel.org
Subject: Re: Using gcc to compiler assembly
Date: Sun, 03 Nov 2002 19:26:30 +0100 [thread overview]
Message-ID: <3DC56A56.BCC83059@wp.pl> (raw)
In-Reply-To: F31en0bcaQUXPXF2aZc0000966c@hotmail.com
Andrew Haydon wrote:
>
> How to use GCC compiling assembly codes? I attached my example code and
> tried gcc -c -o foo.o foo.S. This line "typedef foo_bar_t int;" choked.
Yes, "typedef" isn't assembly directive nor asm instruction.
> I
> read the Makefiles for linux kernel and still could not understand how these
> assebmly codes were compiled by GCC.
Some of them are only preporcessed by gcc (-E flag) and then send to the
assembler, linker... Maybe asm code is passed to gcc streight, i don't
remember, but notice that the code isn't mixed in form Your example is.
If You mix C & assembly code try C's asm keyword, ie:
void foo()
{
double a;
/* ... */
asm("fsin" : "=st" (a));
}
For details on how to pass arguments to asm() see gcc's man page.
It's the first solution. The second one is to separate Your asm and C
code in their own files. Assemble Your low level code to *.o and then
pass it to the C compiler. I think it's better solution but of course
it's Your code.
Regards,
--
Maciej Hrebien
next prev parent reply other threads:[~2002-11-03 18:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-02 23:08 Using gcc to compiler assembly Andrew Haydon
2002-11-03 18:26 ` Maciej Hrebien [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-11-03 20:19 Joseph D. Wagner
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=3DC56A56.BCC83059@wp.pl \
--to=m_hrebien@wp.pl \
--cc=linux-assembly@vger.kernel.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).