[HN Gopher] Understanding the x64 code models (2012)
       ___________________________________________________________________
        
       Understanding the x64 code models (2012)
        
       Author : dosshell
       Score  : 23 points
       Date   : 2022-07-19 19:39 UTC (3 hours ago)
        
 (HTM) web link (eli.thegreenplace.net)
 (TXT) w3m dump (eli.thegreenplace.net)
        
       | eqvinox wrote:
       | 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.
        
       | kccqzy wrote:
       | 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?
        
       | johnklos wrote:
       | 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.
        
         | chrisseaton wrote:
         | > 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!
        
           | Joker_vD wrote:
           | What are you talking about? It's either Intel 64 or IA-32e,
           | anything else is a misnomer! /s
        
           | moonchild wrote:
           | Don't forget EM64T!
        
       | layer8 wrote:
       | 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?
        
         | duskwuff wrote:
         | > 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.
        
           | layer8 wrote:
           | That's only for non-shared (static) symbols though, if my
           | understanding is correct.
        
       ___________________________________________________________________
       (page generated 2022-07-19 23:01 UTC)