News for hackers. Stuff that matters.
Re:Say Hello to X64 Assembly Part 3 by pjmlp on Friday September 19, 2014 @04:13PM (#8342256)
Thankfully the article uses Intel syntax.

I had to port a code generation module from Intel syntax to AT&T. What a pain!

Gas is so limited compared with what PC macro assemblers are capable of.

Re:Say Hello to X64 Assembly Part 3 by MegaDeKay on Friday September 19, 2014 @11:38PM (#8343609)
I wrote a blog post a while back showing how Intel syntax can be used in gas, along with a number of examples.

http://madscientistlabs.blogspot.ca/2013/07/gas-problems.htm...

Re:Say Hello to X64 Assembly Part 3 by pjmlp on Saturday September 20, 2014 @01:10AM (#8343735)
If you check a sibling thread you'll see I also had some issues with Gas macro capabilities.

Has Gas understanding of Intel syntax meanwhile improved? It had a few bugs when I did this.

Re:Say Hello to X64 Assembly Part 3 by MegaDeKay on Saturday September 20, 2014 @10:28AM (#8344562)
I ported the five examples from an IBM Developerworks article on x86 assembler [0] and they all worked fine, but didn't fool around much beyond that.

[0] http://www.ibm.com/developerworks/library/l-gas-nasm/

Re:Say Hello to X64 Assembly Part 3 by jwr on Friday September 19, 2014 @05:15PM (#8342527)
I find AT&T syntax to be completely impractical to work with, and I'm surprised people put up with it.

But, as a side note, all PC assemblers are crap. They could do so much more. I don't know why I'm expected to handle register allocation, or think about inter-unit dependencies that cause stalls.

Re:Say Hello to X64 Assembly Part 3 by pjmlp on Friday September 19, 2014 @06:11PM (#8342767)
Personally I wouldn't like to have an Assembler re-arrange my code, specially since the issues you mention can even change between firmware revisions.

On the x86, starting with the 486 and Pentium it wasn't possible any longer to fit all variations on the head.

At least I can't.

The porting I mentioned above was to make a compiler depend only on binutils.

Other than that, my last 100% Assembly application was around 1995.

Re:Say Hello to X64 Assembly Part 3 by alecco on Friday September 19, 2014 @05:08PM (#8342498)
yasm -p gas?
Re:Say Hello to X64 Assembly Part 3 by pjmlp on Friday September 19, 2014 @06:26PM (#8342821)
That would mean still using the AT&T syntax.

I started coding x86 Assembly back when MS-DOS 3.3 was modern in PC world, so never got to love AT&T syntax.

Specially after my porting experiment.

I needed to change a compiler backend to depend only on binutils (gas & ld).

So the existing NASM code had to ported.

NASM macros couldn't be mapped to what Gas offers and I also had some issues getting my head around how to write the addressing modes.

I was using a common trick for code generation.

Generate bytecodes that are actually Assembler macros.

A simple way to get static binaries, even if the performance is not optimal.

In the end I gave up and made the backend generate the respective Assembly code directly.