Master the fundamental concepts of linkers & loaders through this focused micro-challenge.
.so FilesShared libraries let many processes map one physical copy of libc. Compile with -fPIC, link with -shared. Export symbols with default visibility; hide internals. LD_LIBRARY_PATH and rpath control search paths at runtime.
Build the shared object first, then link the main program against it. The dynamic linker resolves libfoo.so at startup using DT_NEEDED entries and search paths baked into the executable.
bashLoading…
libfoo.so.1) supports versioned ABInm -D shows dynamic symbols-Wl,--export-dynamic exports symbols for dlsymProduction 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 create and use shared libraries. This exercise requires building a PIC shared object, exporting functions, and linking an executable that calls into the library at runtime.
Implement shared library creation and usage.
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