Master the fundamental concepts of linkers & loaders through this focused micro-challenge.
Link-Time Optimization (LTO) compiles to LLVM bitcode in .o files, then runs the full optimization pipeline at link. Clang -flto enables cross-module inlining and devirtualization invisible to separate compilation.
Each translation unit emits IR bitcode in a special section. The linker invokes the compiler backend as a plugin to merge modules, optimize globally, then codegen once.
bashLoading…
Production compilers embed this step inside a longer pipeline. GCC flows through cpp, cc1, assembly, and ld; Clang uses the driver, Sema, LLVM IR passes, and a target backend. LLVM bitcode, JVM bytecode, and WASM are other familiar IRs at the same layer. The exercise isolates one pass so you can test it alone before chaining it to the next stage.
You will understand and apply link-time optimization concepts. This exercise asks you to explain how LTO defers codegen and what cross-module wins it enables over separate compilation.
Implement link-time optimization simulation.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github