C Compiler & Assembler
C Compiler & Assembler
I need a C compiler and an assembler. I don't want to use gcc because it uses gas (which uses the AT&T syntax). Is there a way to use nasm as inline asm? Or is there another compiler which uses an intel-syntax assembler?
Re:C Compiler & Assembler
Check this out: (This is exactly what you want but I dont know how to get it and dont know if anybody uses it...)
http://www.intel.com/software/products/ ... /index.htm
http://www.intel.com/software/products/ ... /index.htm
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:C Compiler & Assembler
you can use intel syntax within nasm, using something like ".syntax intel noprefix" -- dive into the search (should have been discussed last summer or something alike) to learn more about it...
that's an undocumented feature, but it seems to works pretty well ... And i doubt you can find a better free C compiler than GCC
that's an undocumented feature, but it seems to works pretty well ... And i doubt you can find a better free C compiler than GCC
Re:C Compiler & Assembler
Looks good ...This is exactly what you want ..
... but I dont know how to get it ...
do you mean within gas? nasm uses intel syntax does'nt it?you can use intel syntax within nasm
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:C Compiler & Assembler
err yes. Typo from me ... must have been a girl walking in the hall nextby The trick is for using Intel syntax in GAS and GCC inline asm...
Re:C Compiler & Assembler
Personally I do not like inline asm at all. I much prefer to have ASM code in a seperate file and incure the cost of a function call. There are a few reasons for this. You can switch to a different C compiler at any time without worry of inline asm support, and the ASM code is much more readable when written correctly in its own file. I also find it much easier to debug.
That said, I've been using NASM and BCC for real mode and NASM and GCC for 32 bit mode.
Just my 2 cents
_mark()
That said, I've been using NASM and BCC for real mode and NASM and GCC for 32 bit mode.
Just my 2 cents
_mark()
Re:C Compiler & Assembler
Hi this might be some kind of off topic but I have heard people using perl for building os. How is it and why is it used? I mean why do you need perl interpreter for building os stuff? Thanx... BTW, I also donot like inline assembly->this is ontopic ;D
Re:C Compiler & Assembler
I use a Perl script as part of my build process, to extract PE DLL base addresses from the central COFFBASE.TXT and give them to ld.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:C Compiler & Assembler
@ perl : it may make sense if you need to do some custom pre-processing on your source code to make it in perl as it is the best language for text manipulation (afaik). For instance, you can quickly write a perl script that will look up your C files and find a sequence like
and group initializor functions by increasing level in an array, so that all your kernel_init() function has to do to startup every component is
@ inline asm:
it should usually be avoided everytime possible. However, there is one case where it can be very interresting: when you declare inline functions to perform some common operations (like reading one of the CRx register, for instance, or perform input/output operations).
If you have these operations as real asm function in a separated file, all the compiler can do is pushing arguments, and calling the asm function -- which can lead to severe performances penalties is the code is called repeatedly.
Using an inline function, the compiler can emit the asm code directly in your caller function, and it can perform some automatic registers allocation, so that the performances of the resulting code will approach what you would have if you had inserted the ASM code manually ...
Code: Select all
initializor(<level>) <function name>( ... ) { ... }
Code: Select all
#include "autoinit.c"
for (i=0;i<INITIALIZORS;i++) initializors[i].init()
@ inline asm:
it should usually be avoided everytime possible. However, there is one case where it can be very interresting: when you declare inline functions to perform some common operations (like reading one of the CRx register, for instance, or perform input/output operations).
If you have these operations as real asm function in a separated file, all the compiler can do is pushing arguments, and calling the asm function -- which can lead to severe performances penalties is the code is called repeatedly.
Using an inline function, the compiler can emit the asm code directly in your caller function, and it can perform some automatic registers allocation, so that the performances of the resulting code will approach what you would have if you had inserted the ASM code manually ...
Re:C Compiler & Assembler
Is it expecially perl that is great for text manipulation, or is it just that a flexible scripting language with powerfull regex functionality is great for text manipulation (which perl is one of)?
Re:C Compiler & Assembler
Yes perl is a good scripting lang that has powerful regex and string functions.
Personally I have always been an awk & sed kind of man. That is only because old habbits are hard to break though.
_mark()
Personally I have always been an awk & sed kind of man. That is only because old habbits are hard to break though.
_mark()