flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > Inline assembly with gcc (C)

Author
Thread Post new topic Reply to topic
Nyrre



Joined: 26 Feb 2006
Posts: 13
Nyrre
Hey, I've just wondered, that how can I write inline assembly to c-code that is supposed to be compiled with gcc?
I've read an article that was about AT&T-syntax code, and how it should be written, but still it didn't work!

Do you know how to mix asm and c?
Post 29 Apr 2006, 10:08
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
The best way to mix Assembly and C is usually to write your assembly code as an external module - easier to re-use that way, you get the full power of the assembler of your choice, and you don't have to worry about quirks of inline assemblers.

That said, GCC supports .intel_syntax with recent versions, so it's a bit less atrocious to use inline assembly with it - but still Smile
Post 29 Apr 2006, 10:18
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
Agreed with f0dder
Post 01 May 2006, 14:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
anyway, someone has some interesting info or even example of using .intel_syntax? I would like to cover this topic little more and highlight this thread then.
Post 15 Dec 2006, 15:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf
Hi, not posted for a while (been busy and still am busy)

Here's an example how to use intel syntax.
http://www.reversing.be/article.php?story=20051203194931893

_________________
Raedwulf
Post 05 May 2007, 12:02
View user's profile Send private message MSN Messenger Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
Quote:
That said, GCC supports .intel_syntax with recent versions


GCC or GAS ?

Since when ?
Post 05 May 2007, 19:31
View user's profile Send private message Reply with quote
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf
For quite a while, just not commonly known.
Post 05 May 2007, 20:40
View user's profile Send private message MSN Messenger Reply with quote
dap



Joined: 01 Dec 2007
Posts: 61
Location: Belgium
dap
vid wrote:
anyway, someone has some interesting info or even example of using .intel_syntax? I would like to cover this topic little more and highlight this thread then.

Here is an example :
Code:
asm
(
   ".intel_syntax noprefix \n\t"
   "xchg eax, eax \n\t"
   ".att_syntax prefix \n\t"
);    


You can learn more about these features here and here.

_________________
(French only) http://dap.developpez.com
Post 02 Dec 2007, 22:38
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.