News for hackers. Stuff that matters.
Re:Understanding the x64 code models (2012) by eqvinox on Tuesday July 19, 2022 @04:25PM (#32157474)
This article might benefit from a (reasonably visible) note somewhere that none of this is relevant to dynamically allocated memory. While it may be obvious/known to most of the target audience, it could easily be misunderstood by intermediate-level readers.
Re:Understanding the x64 code models (2012) by layer8 on Tuesday July 19, 2022 @04:40PM (#32157664)
The article doesn’t address what happens if you pick the wrong (too small) model. I guess the static linker will catch certain cases, and the dynamic linker/loader will catch certain other cases, but will all cases be caught by one of those two, or can the compiled instructions end up being executed, leading to incorrect memory accesses?
Re:Understanding the x64 code models (2012) by duskwuff on Tuesday July 19, 2022 @05:55PM (#32158487)
> The article doesn’t address what happens if you pick the wrong (too small) model.

The (static) linker will realize that an address won't fit, or that it can't generate a required relocation, and will fail to generate an executable.

Re:Understanding the x64 code models (2012) by chasil on Tuesday July 19, 2022 @10:33PM (#32160661)
Re:Understanding the x64 code models (2012) by layer8 on Tuesday July 19, 2022 @06:03PM (#32158575)
That’s only for non-shared (static) symbols though, if my understanding is correct.
Re:Understanding the x64 code models (2012) by kccqzy on Tuesday July 19, 2022 @04:50PM (#32157783)
I've never seen any real-world example where the large code model is being used on x64. Perhaps it's because I've seen programs where that's necessary. Perhaps the mythical 1.5GB Facebook binary (in 2012) that requires BitTorrent would use a non-small code model?
Re:Understanding the x64 code models (2012) by jamesfinlayson on Wednesday July 20, 2022 @02:45AM (#32162339)
Re:Understanding the x64 code models (2012) by shadowofneptune on Wednesday July 20, 2022 @02:57AM (#32162416)
Reminds me of the various models for the original 8086. Far pointers are gone, but having to use registers is a similar tradeoff.
Re:Understanding the x64 code models (2012) by johnklos on Tuesday July 19, 2022 @04:51PM (#32157787)
Minor nitpick: the author uses "Linux" as a keyword and uses gcc for examples but refers to the architecture as x64, which is a very Microsoft thing and a bit of a misnomer.
Re:Understanding the x64 code models (2012) by binarycrusader on Tuesday July 19, 2022 @07:54PM (#32159524)
...refers to the architecture as x64, which is a very Microsoft thing and a bit of a misnomer.

No, it is not. Various Linux distributions even refer to it as "x64" in various places:

https://access.redhat.com/ecosystem/software/1474383 https://developers.redhat.com/products/openjdk/download https://support.quest.com/download-install-detail/6109808

With that said, I personally use "amd64" which coincidentally, is the same thing Microsoft refers to it various places including Windows packaging itself:

https://docs.microsoft.com/en-us/windows/win32/midl/-amd64

This is definitely not a Microsoft thing.

Re:Understanding the x64 code models (2012) by chrisseaton on Tuesday July 19, 2022 @04:53PM (#32157822)
> but refers to the architecture as x64

What do you think the correct name is? I call it AMD64, as that's the name the authors gave it. But they also previously called it x86-64, so maybe that's valid.

x86_64, x64, etc, no idea why people had to come up with their own names beyond AMD64 or x86-64!

Re:Understanding the x64 code models (2012) by chasil on Tuesday July 19, 2022 @10:41PM (#32160715)
While I default to AMD64, Intel 64 is the latest variant from the eponymous manufacturer.

There is some justification for Intel 64, as AMD suffered a series of mistakes and bad decisions, starting with the "Barcelona" Opterons, only recently emerging from these problems.

Intel has been the best-performing AMD64 implementation for much of this standard's time on the market, so a little revisionism must be excused.

Re:Understanding the x64 code models (2012) by hulitu on Wednesday July 20, 2022 @12:04PM (#32167742)
Intel 64 ? You mean the Itanic ?
Re:Understanding the x64 code models (2012) by chasil on Wednesday July 20, 2022 @01:19PM (#32169035)
"Various names are used for the instruction set. Prior to the launch, x86-64 and x86_64 were used, while upon the release AMD named it AMD64. Intel initially used the names IA-32e and EM64T before finally settling on 'Intel 64' for its implementation. Some in the industry, including Apple, use x86-64 and x86_64, while others, notably Sun Microsystems (now Oracle Corporation) and Microsoft, use x64. The BSD family of OSs and several Linux distributions use AMD64, as does Microsoft Windows internally."

"The x86-64 architecture is distinct from the Intel Itanium architecture (formerly IA-64). The architectures are not compatible on the native instruction set level, and operating systems and applications compiled for one cannot be run on the other."

https://en.wikipedia.org/wiki/X86-64#cite_note-11

Re:Understanding the x64 code models (2012) by chrisseaton on Wednesday July 20, 2022 @12:06PM (#32167784)
No that's IA-64 - that's something else entirely. Intel 64 != IA-64.
Re:Understanding the x64 code models (2012) by Joker_vD on Tuesday July 19, 2022 @05:08PM (#32157996)
What are you talking about? It's either Intel 64 or IA-32e, anything else is a misnomer! /s
Re:Understanding the x64 code models (2012) by moonchild on Tuesday July 19, 2022 @06:08PM (#32158613)
Don't forget EM64T!
Re:Understanding the x64 code models (2012) by aicez on Wednesday July 20, 2022 @07:59AM (#32164460)
ชวน3ผม