Page 1 of 1
Why can't nasm replace gas, in *bsd or linux?
Posted: Sat Feb 07, 2009 1:36 am
by jronald
In my opinion, assembly language is essentially mnemonics,
so it will not bring incompatibility problem, also, the clearer the better.
Is it true?
So could you tell me why gas is not out?
Because habit?
http://www.nasm.us/doc/nasmdoc1.html#section-1.1.1
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Sat Feb 07, 2009 3:58 am
by AndrewAPrice
GAS uses AT&T syntax, while NASM, FASM, and the majority of other assemblers use Intel syntax. The majority of OSS tools that use GAS (including GCC) are still relying on AT&T syntax.
GCC can generate Intel syntax though (and there's nothing really stopping you from replacing GAS with your own assembler), and also GAS also works with Intel syntax (not TRUE Intel syntax as I found out the hard way, but close to it).
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Sat Feb 07, 2009 4:39 am
by Solar
MessiahAndrw wrote:GAS uses AT&T syntax, while NASM, FASM, and the majority of other assemblers use Intel syntax.
Some people (like me)
prefer the AT&T syntax. It feels "weird" to anyone who's learned Assembler from the usual suspects nowadays (Intel manuals, AoA etc.), but "natural" to dinosaurs like me.
The majority of OSS tools that use GAS (including GCC) are still relying on AT&T syntax.
Actually GCC doesn't feed GAS
assembler source. The handover between GCC and GAS is done in form of a binary representation, which can be
disassembled by the -S option.
And there are more dependencies between GCC and the binutils package than just GAS, so I wouldn't bet on any other assembler replacing GAS in binutils...
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Sat Feb 07, 2009 5:06 am
by Combuster
There's still YASM which can assemble both proper intel syntax, as well as AT&T syntax. But as Solar pointed out, there are a lot of hidden dependencies between gcc an binutils forcing you pretty much use them together.
I won't bite the AT&T vs intel syntax troll.
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Sun Feb 08, 2009 9:47 pm
by earlz
[troll]
Intel for the win! Intel syntax is the form used by the official intel manuals and the form used by the opcode format itself.
backwards operands and random % and $ signs everywhere doesn't help readability either.
[/troll]
I think it'd be pretty nifty if pcc targeted the 8086 and such with yasm as it's backend assembler.. but many people would argue its an obsolete architecture to develop in C for.
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Sun Feb 08, 2009 11:37 pm
by Love4Boobies
MessiahAndrw wrote:GCC can generate Intel syntax though (and there's nothing really stopping you from replacing GAS with your own assembler), and also GAS also works with Intel syntax (not TRUE Intel syntax as I found out the hard way, but close to it).
I hear it's not really maintained that well so it doesn't always produce optimal code and sometimes it can even produce wrong code. I'm not sure exactly why this is.
earlz wrote:[troll]
Intel for the win! Intel syntax is the form used by the official intel manuals and the form used by the opcode format itself.
backwards operands and random % and $ signs everywhere doesn't help readability either.
[/troll]
Believe it or not, however official the Intel manuals might be, AT&T came up with the original assembly syntax (for the x86?). And the signs you're talking about aren't thar random, they are a safety feature (for separating registers from labels and so on). I'm sure AT&T fans have things they too find weird about the Intel syntax. I am an Intel fan, myself. I just thought I should mention this.
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Mon Feb 09, 2009 1:40 am
by Solar
Love4Boobies wrote:I hear [GAS intel mode] is not really maintained that well so it doesn't always produce optimal code and sometimes it can even produce wrong code. I'm not sure exactly why this is.
From the binutils / GAS manual:
as is primarily intended to assemble the output of the gnu C compiler gcc for use by the linker ld.
It's a compiler backend first, and a standalone assembler second.
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Mon Feb 09, 2009 7:19 am
by Love4Boobies
Solar wrote:It's a compiler backend first, and a standalone assembler second.
I can understand that but they could, at least for the sake of inline assembly, do something about this whole mess...
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Mon Feb 09, 2009 8:05 am
by Solar
I just don't think they consider intel-style inline assembly - a highly implementation-specific construct of very limited usefulness in user space - to be that much of a priority, given that they still haven't nailed all of the language standards yet...
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Mon Feb 09, 2009 7:42 pm
by iammisc
probably because gas is the GNU assembler and gcc is the GNU compiler collection.
Notice the parallels....
Re: Why can't nasm replace gas, in *bsd or linux?
Posted: Tue Feb 10, 2009 1:03 pm
by qw
Being a GCC and NASM fan, I would love GCC to produce NASM-style assembly output.
As far as I know, David Lindauer's CC386 is the only C compiler that produces NASM output. But with all due respect, CC386 is not half as good as GCC is.
Roel