Master the fundamental concepts of binary formats through this focused micro-challenge.
You have read the whole brief, and the concepts above stay free on every task. Writing and running the code needs a plan.
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it worksSymbols are the names that linkers use to connect references between object files. The symbol table maps names to addresses, sizes, and types. Without symbols, you see raw addresses; with them, you see function and variable names.
Each Elf64_Sym entry contains:
st_name: String table offset for the symbol namest_info: Type and binding packed togetherst_value: Address or offset of the symbolst_size: Size in bytesst_shndx: Section index where definedSymbol types (from st_info & 0x0F):
STT_FUNC (2): Function (for example main)STT_OBJECT (1): Data object (for example a global variable)STT_NOTYPE (0): UnspecifiedBindings: STB_LOCAL is visible only in its object file, STB_GLOBAL is visible to all files being linked.
You will parse symbol entries from .symtab, resolve names via .strtab, and print each symbol's type and binding. This is the same data nm and objdump -t display, and it is essential for understanding what a binary exports and imports.
The .dynsym table lists symbols needed for runtime linking: imported functions like printf and exported entry points. The full .symtab includes local symbols stripped from release builds. Undefined global functions show st_value = 0 until the dynamic linker resolves them at load time. Parsing both tables tells you what a binary calls and what it exposes to other modules.
Decode an ELF64 symbol table. Each Elf64_Sym is 24 bytes, all fields little-endian:
| Offset | Field | Size |
|---|---|---|
| 0 | st_name, an offset into the string table | 4 |
| 4 | st_info: binding = st_info >> 4, type = st_info & 0xF | 1 |
| 5 | st_other | 1 |
| 6 | st_shndx, the section index | 2 |
| 8 | st_value | 8 |
| 16 | st_size | 8 |
? if st_name is past its end.LOCAL, 1 GLOBAL, 2 WEAK, other OTHER.NOTYPE, 1 OBJECT, 2 FUNC, 3 SECTION, 4 FILE, other OTHER.UND (an undefined, imported symbol), 0xFFF1 is ABS (an absolute value), anything else sec.cLoading…
then one row per symbol with the C format "%-16s 0x%08llX %-8llu %-8s %-7s %s\n", for example
cLoading…
and finally Summary: 3 functions, 2 objects, 4 globals, 2 undefined, counting FUNC types, OBJECT types, GLOBAL bindings and UND symbols.