[HN Gopher] Driving Compilers
       ___________________________________________________________________
        
       Driving Compilers
        
       Author : fredoralive
       Score  : 66 points
       Date   : 2023-05-03 18:54 UTC (4 hours ago)
        
 (HTM) web link (fabiensanglard.net)
 (TXT) w3m dump (fabiensanglard.net)
        
       | genpfault wrote:
       | Ah, yes, the Platform[1] platform, the one that uses DLLs and the
       | PE executable format :)
       | 
       | [1]:
       | https://github.com/fabiensanglard/dc/blob/1b9cbd081fcc530488...
        
         | intelVISA wrote:
         | Ahh I think know that one actually. EEE Platform right? Candy
         | crush main menu? Don't think people use it willingly these
         | days...
        
           | rcoveson wrote:
           | Between Stockholm syndrome, sunk-cost fallacy, and the
           | psychological inertia of arguing repeatedly on the Internet
           | in the 2000's that it was more 1337 than the Macintosh, it's
           | hard to tell what "willing" even means in that context. May
           | as well try to figure out if people who drink alcohol do so
           | "willingly".
        
           | delta_p_delta_x wrote:
           | > Don't think people use it willingly these days
           | 
           | I do. There isn't a viable competitor to productivity tools
           | like Office 365 (and _no_ , LibreOffice and Thunderbird,
           | while decent, do not cut it), ease of gaming (I'd rather play
           | games natively, than fiddle with Wine), HiDPI support,
           | PowerShell, Visual Studio (sue me: it's better than gcc +
           | painful array of binutils + perf), etc.
           | 
           |  _Maybe_ it 's Stockholm syndrome, but I have Arch installed
           | too (on its own dedicated drive to boot), and I use it a lot
           | less than I do Platform(tm).
        
         | heinrich5991 wrote:
         | Three different pull requests were opened to fix this typo
         | already, presumably in response to this Hacker News post.
        
       | _trackno5 wrote:
       | Nice series!
       | 
       | One comment though:
       | 
       | > The compiler ingests one .c and outputs one .o. It has a low
       | memory footprint. The linker on the other side, must use all the
       | .o files at once to generate the executable. Keeping all these .o
       | in memory would stress the system too much on big projects.
       | 
       | This is a really weak argument that does not make a lot of sense.
       | 
       | The major advantage of separate object files is avoiding
       | recompilation of modules that haven't changed.
       | 
       | In fact, compilers like Jonathan Blow's Jai seem to get massive
       | performance improvements by treating everything as a single
       | compilation unit and avoiding writing a bunch of object files
       | only to call the linker on all of them.
        
         | masfuerte wrote:
         | It's probably the main reason historically that compiling and
         | linking are separate steps. Back in the day, you might not have
         | had enough memory to even load all of the source at the same
         | time. But yeah, that was decades ago.
        
       | mshockwave wrote:
       | Glad that the concept of compiler driver gets more exposures.
       | "The `gcc` program itself is actually not a compiler...but a
       | compiler driver" [1] is one of my favorite things to tell newbie
       | compiler engineers.
       | 
       | [1]: Clang, on the other hand, is not the case (at least the
       | modern one). The `clang` program is a compiler driver and
       | compiler AND assembler for majority of the platforms.
        
         | jcranmer wrote:
         | > [1]: Clang, on the other hand, is not the case (at least the
         | modern one). The `clang` program is a compiler driver and
         | compiler AND assembler for majority of the platforms.
         | 
         | This framing is more likely to cause confusion than not, I
         | think. `clang` is a compiler driver. `clang -cc1` is the
         | compiler, and `clang -cc1as` is the assembler. They may all be
         | the same executable, but the distinction between the tools is
         | basically the first thing that happens. (Also note that the
         | -cc1/-cc1as option has to be the very first option, it's not
         | recognized in any other position).
        
         | zabzonk wrote:
         | > he `clang` program is a compiler driver and compiler AND
         | assembler
         | 
         | um, gcc does all those things.
        
           | jcranmer wrote:
           | gcc uses gas (from binutils) as its assembler, unlike clang.
        
         | fooker wrote:
         | clang is the gcc-compatible compiler driver. You can access the
         | actual compiler frontend with clang -cc1.
        
       | argulane wrote:
       | That is a pretty good introduction to the steps that happen when
       | you compile C code.
        
       ___________________________________________________________________
       (page generated 2023-05-03 23:00 UTC)