Page 1 of 1

inline asm ?

Posted: Mon Oct 12, 2009 12:56 am
by coze
hello,
first of all, thanks for the great work put into codelite :D
it's really a superb IDE as I've seen so far.
my question is can codelite do inline asm ?

Re: inline asm ?

Posted: Mon Oct 12, 2009 1:02 am
by eranif
With the upgrade to the latest scintilla editing component, I believe we can achieve 'read-only-inline-asm' using the 'annotations'

See here how they used for compiler/error warning:
http://codelite.org/ComingRelease/NewFeatures

With the correct settings (i.e. using proper background colour / font / forgound color) we can simulate an inline asm, however there will be some limitations:
- the code is not editable
So it will be mainly for debugging purpose (similar to what VS does today)

My Question:
- Do you need to be able to edit C/C++/asm on the same source file?, if this is the case, then I am afraid that atm, this is not feasible. For 'read only' it is very much possible using the method I described above

Eran

Re: inline asm ?

Posted: Mon Oct 12, 2009 1:23 am
by coze
thanks for the quick reply !
yes, I need to edit C++/asm on the same source file.
actually I'm trying to recompile a project that's been done on VC with inline assembly.
it has stuff like this :
_asm
{
mov esp, exceptionstack
}

#ifdef PREFETCH
_asm
{
pushad
mov edx, dword ptr [pc]
call prefetch_fillASM
popad
jmp dword ptr [exceptionbackdooraddress]
}
#endif
now I've checked and GCC support of inline assembly is very different. MS uses the Intel convention while GCC uses AT&T style.

http://www.ibiblio.org/gferg/ldp/GCC-In ... TO.html#s2

GCC inline assembly looks something like this
__asm__ ("movl %eax, %ebx\n\t"
"movl $56, %esi\n\t"
"movl %ecx, $label(%edx,%ebx,$4)\n\t"
"movb %ah, (%ebx)");
well I can change the intel asm in my source to AT&T style but of course without codelite somehow passing it to GCC it won't be much good.
what do you think ? could it be posible ?

Re: inline asm ?

Posted: Mon Oct 12, 2009 1:34 am
by eranif
codelite is just a "pipe" to GCC, it generates a makefile and simply runs it.

So all you need to understand is what are the flags that you need.

In most cases, this "template" is good for compilation of code which includes inline assembly:

Code: Select all

gcc -O2 -fomit-frame-pointer -W -Wall
To translate it into the codelite language:
In the project settings, (right click on your project and select settings), in the 'General' tab make sure that the g++ or gcc compilers are selected.
Next, in the 'Compiler' add this line (if not already there):

Code: Select all

-O2;-fomit-frame-pointer;-W;-Wall
Note that I am using semi-colon to separate the different flags, since this is the codelite way of doing it.

Other than that codelite should be able to generate a makefile with the correct compilation line to compile your code.

EDIT:
here is a good link:
http://tldp.org/HOWTO/Assembly-HOWTO/gcc.html
Eran