←back to thread

Driving Compilers

(fabiensanglard.net)
161 points ibobev | 2 comments | | HN request time: 0s | source
1. bregma ◴[] No.41085730[source]
I'm a maintainer of the compiler driver for a major commercial real-time embedded operating system and I can assert with some authority that this is an excellent basic introduction to how the C and C++ toolchain works in most environments today. It is clear, well presented, and mostly correct, although biased entirely towards Linux and other ELF-based platforms -- Mach-O and PE/COFF work essentially the same way but details differ and it's still essentially informative.

My biggest quibbles would be (and these are really quibbles) these.

- The name of the C++ standard library is not "the STL". The STL was a library that was partially included in the C++ standard library back in 1997. The part of the STL that was included makes up parts of the container, iterators, and algorithms sections of the C++ standard library. At this point (C++23) that's maybe 5 or 6 per cent of the entire library. The name of the C++ standard library is "The C++ Standard Library".

- In C++, ::operator new() is a part of the C++ language runtime. It's not just a template in the header <new>, although that header has to contain the (overloaded) function's declarations so they can be replaced.

- The article should distinguish between the loader (generally a part of the operating system kernel) and the dynamic loader (part of userspace), since it's common to build static binaries that do not use the dynamic loader at all. Also, the loader uses the PT_INTERP segment to find the dynamic loader, not the .interp section even though they point to the same offset because the entire section table can be stripped.

All in all an excellent introduction to what's going on under the hood when you build software using a compiled-to-machine-instructions language on a modern operating system.

replies(1): >>41100824 #
2. electroly ◴[] No.41100824[source]
Microsoft does officially call their implementation of the C++ Standard Library in MSVC "the STL." This is due to historical confusion, of course, but it persists to this very day in official materials. Check out the name of this repository and the way that they refer to it in the readme text. Always the acronym "STL" and never "Standard Template Library" so we can all pretend it simply stands for "C++ Standard Library" now.

https://github.com/microsoft/STL