What Happens After The Compiler in C++ (How Linking Works) - Anders Schau Knatten - C++ on Sea 2023

Published: 01 January 1970
on channel: cpponsea
12,722
432

https://cpponsea.uk/
---

What Happens After The Compiler in C++ (How Linking Works) - Anders Schau Knatten - C++ on Sea 2023

We all know roughly what the compiler does, it translates your source code into machine code. Thanks to Compiler Explorer, many of us now even look at the generated Assembly code.

But wait a minute, that code is full of labels and function names, the CPU knows of no such things! Most of these are also defined in different compilation units, how can we jump to code we don't know where comes from? And even for our own compilation unit, how can the compiler know where in memory the machine code will eventually be loaded, so it can generate the right jumps? Even worse, what if that function comes from a dynamic shared object?

This talk gives an introduction to how the compiler, linker, loader and operating system cooperates to get from a compilation unit to a running process. We'll look at static and dynamic linking, relocations, position independent code, sections and segments and virtual memory. The talk covers Linux only, but similar principles apply on Windows and Mac.
---

Slides: https://github.com/philsquared/cppons...
Sponsored By think-cell: https://www.think-cell.com/en/
---

Anders Schau Knatten

Anders started programming in Turbo Pascal in 1995, and has been programming professionally in various languages since 2001. He's currently a principal developer at Ascenium, working on a new general-purpose CPU design. He's the author of cppquiz.org and the blog C++ on a Friday.
---

C++ on Sea is an annual C++ and coding conference, in Folkestone, in the UK.
Annual C++ on Sea, C++ conference: https://cpponsea.uk/
2023 Program: https://cpponsea.uk/2023/schedule/
Twitter:   / cpponsea  
---

YouTube Videos Filmed, Edited & Optimised by Digital Medium: https://events.digital-medium.co.uk

#cpp​ #cpponsea​ #compiler


Watch video What Happens After The Compiler in C++ (How Linking Works) - Anders Schau Knatten - C++ on Sea 2023 online without registration, duration hours minute second in high quality. This video was added by user cpponsea 01 January 1970, don't forget to share it with your friends and acquaintances, it has been viewed on our site 12,72 once and liked it 43 people.