News for hackers. Stuff that matters.
Re:AT&T Syntax versus Intel Syntax by jart on Sunday November 13, 2022 @02:40PM (#33586558)
AT&T syntax is the most elite syntax. I've used it to write some famous hacks, like Actually Portable Executable, which is a 16-bit BIOS bootloader shell script ELF / Mach-O / PE executable. What makes AT&T syntax so powerful is its tight cooperation with the GNU linker. I don't think it would have been possible for me to invent APE had I been using tools like NASM and YASM. https://raw.githubusercontent.com/jart/cosmopolitan/master/a...
Re:AT&T Syntax versus Intel Syntax by chrisseaton on Sunday November 13, 2022 @03:08PM (#33586793)
Isn't this a function of the tools you were using, not the syntax? Couldn't any of these tools support any syntax and do the same thing?
Re:AT&T Syntax versus Intel Syntax by JonChesterfield on Sunday November 13, 2022 @04:02PM (#33587313)
The line between syntax and functionality is pretty thin for an assembler.

I've definitely had code that some assemblers accepted and others didn't on the same arch, so even if they could be equally expressive in practice they aren't. Fairly sure that's also true of inline assembly on clang x64, had to change between intel and at&t for something a while ago.

Re:AT&T Syntax versus Intel Syntax by throwawaylinux on Sunday November 13, 2022 @06:08PM (#33588342)
Not really. Intel vs AT&T syntax is about how to generate machine code from mnemonics.

Cooperation with the linker comes with other directives and options. gas has tight cooperation with GNU ld via directives, not instruction syntax. It can actually be set to accept either AT&T or Intel syntax, without losing any support for other features.

Re:AT&T Syntax versus Intel Syntax by JonChesterfield on Monday November 14, 2022 @04:44AM (#33591891)
The case that comes to mind was emitting a (correct) relocation for one mode and raising an error for the other. That was more likely to be llvm-mc than gas though, so results from on assembler may not apply to all assemblers.
Re:AT&T Syntax versus Intel Syntax by throwawaylinux on Monday November 14, 2022 @06:08AM (#33592480)
Emitting a relocation with .reloc directive? Definitely sounds like an llvm-as bug.
Re:AT&T Syntax versus Intel Syntax by JonChesterfield on Monday November 14, 2022 @08:12AM (#33593444)
No, it was an arithmetic expression related to labels. And yes I'd agree that it working in... I want to say intel and not at&t (might be the other way around) is a bug/missing feature. Didn't bother fixing or reporting it at the time though.
Re:AT&T Syntax versus Intel Syntax by fingleberry on Sunday November 13, 2022 @05:47PM (#33588193)
I’m sorry, no. This is incredibly misleading. Even if the linker step and assembly are completely separated, everything you’ve built in Cosmopolitan and APE is 100% buildable in other tools. It might take more effort in some cases, but there’s more to a native stack than choice of tooling and syntax; if you genuinely know your stack and architecture, anything is possible.

Your accomplishments have zero to do with the ‘elite’ tooling you use (why are you gatekeeping and creating class distinctions out of assemblers?), and more that you’ve taken the time to really think about how memory is laid out and how the architecture works - which most of us who started out writing operating systems instead of Rails understand perfectly fine. Nothing about the relationship between gas and ld achieves uniqueness not seen in other native stacks. That’s just made up.

There are multiple operating systems built with hand written NASM. Arguing about assemblers like they matter for more than five seconds is tiring 1990s IRC stuff. They turn syntax into a byte layout. It’s like realizing oh, this assembler sucks at ELF, why don’t I just hand lay one out? and boom, you’re on the way to APE. And really, if you don’t like your assembler, an “elite” programmer would write their own, but that fell out of fashion before most of us were alive.

Given the knowledge it takes to write something like APE I know you know what I’m saying, too, so why are you misleading like this? It comes across like an overstretched attempt to promote your work for a reader who knows the stuff you’re talking about.

Re:AT&T Syntax versus Intel Syntax by DiggyJohnson on Sunday November 13, 2022 @07:04PM (#33588710)
The amount of disagreement this individual testimony is generating is fascinating and frustrating to me.

I didn’t think it ever really makes sense to disagree with a comment like this, unless one is claiming that the content of your comment is intentionally untrue. Anyways, appreciate your perspective.

Re:AT&T Syntax versus Intel Syntax by jart on Sunday November 13, 2022 @07:40PM (#33588937)
It's rare that I post unpopular opinions, but when I see an HN thread full of people talking about how terrible the tools are which helped me be successful, I just can't help but speak up.
Re:AT&T Syntax versus Intel Syntax by fingleberry on Sunday November 13, 2022 @10:47PM (#33590014)
That’s a much different lens on the point you were making before. One could argue it’s an entirely different comment and, more importantly, that it yields an entire spectrum of conclusions that weren’t your original point. Before, you were saying “people don’t like AT&T because,” and a bunch of other pronouncements that made my triple-decade native eyebrow raise because they didn’t match my experiences, even squinting really hard. You’re also introducing ideas that are just completely wrong, like syntax having anything to do with the ld integration in gas (it doesn’t; read nearby).

Now you’re saying you were swayed by the idea that one shouldn’t use gas directly, which is an entirely different premise — and much more understandable.

You found a stack that worked for you to build APE. Those are your experiences. Pivoting those experiences to absolute observations about what is good or bad or elite is the error, here. And it’s ironic: you’re lamenting believing “the consensus” in your own journey while simultaneously influencing the consensus with conclusions that your available data didn’t earn. Passively responding to negative feedback toward positive replies suggests bad faith, too, so I’d ask if your contribution to the consensus is harmful, like those were that steered you another way.

I also bristle at a niche field having terms like “elite” used casually to influence people entering it, just like you were once upon a time, and I note you ignored that feedback in responding here. That’s also ironic because APE is challenging the idea of how native software is packaged and distributed, which itself requires outside the box thinking, and you’re using language and absolutist pronouncements to create a different box that has a right and wrong.

Your commentary here suggests to me that the loads of people waiting on you to change the world with APE might be waiting a while. That’s unfortunate and directly motivational.

Re:AT&T Syntax versus Intel Syntax by haberman on Monday November 14, 2022 @01:40AM (#33590860)
I am curious to hear some specifics of why APE did not work with nasm or fasm. Your earlier comment mentioned "tight cooperation with the linker" -- I don't know what this means. My mental model is that all assemblers ultimately produce an object file. It's not clear to me what would make one object file integrate better with a linker than another, unless there are certain .o outputs that nasm or fasm were not capable of generating.
Re:AT&T Syntax versus Intel Syntax by pubby on Monday November 14, 2022 @03:36AM (#33591508)
I don't think much hate is directed at the tools per say, but rather it's at the syntax. It's like how people complain about all the idiosyncrasies of English, without denying it's an important, useful language.

As Stroustrup put it: “There are only two kinds of languages: the ones people complain about and the ones nobody uses.”

Re:AT&T Syntax versus Intel Syntax by int_19h on Sunday November 13, 2022 @08:41PM (#33589324)
Did any of those advantages that you relied on depend on AT&T syntax, though?