Chapter 20 Further Reading: Calling C from Assembly and Assembly from C


1. System V Application Binary Interface — AMD64 Architecture Processor Supplement H.J. Lu et al., maintained at https://gitlab.com/x86-psABIs/x86-64-ABI — free

The definitive specification for the System V AMD64 ABI. Chapter 3 covers the calling convention (register usage, stack alignment, argument passing). Chapter 4 covers object files and linking. Section 3.2.3 covers struct/union passing rules. Essential reference for writing correct assembly-C interfaces.


2. "Linkers and Loaders" by John R. Levine Morgan Kaufmann, 1999 — older but still accurate for ELF fundamentals

Chapter 3 covers object files. Chapter 5 covers the linking process including symbol resolution and relocation. Chapter 10 covers shared libraries and the dynamic linker. The PLT/GOT mechanism is explained in detail. Available free online at iecc.com/linker.


3. "Position Independent Code (PIC) in Shared Libraries" — Eli Bendersky https://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries

An excellent tutorial on how PIC (Position-Independent Code) works: GOT-relative variable access, PLT stubs for function calls, and the lazy binding mechanism. Includes disassembly and worked examples. Read this after Chapter 24 to reinforce the concepts.


4. "Writing Assembly in Gcc's Inline Assembler" — Official GCC Documentation https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html

Documents inline assembly syntax (Chapter 22 topic) and the C/assembly interface at the instruction level. The section on calling conventions in inline asm is relevant here: how the compiler respects (or doesn't) the ABI when you mix inline assembly with C code.


5. musl libc Source Code https://git.musl-libc.org

musl is a clean, minimal C library. Its implementation of printf (in src/stdio/printf.c and related files) shows what actually happens when your assembly code calls printf. Following the call chain from printf → vprintf → fwrite → write gives you the complete picture.


6. "How C Calling Conventions Work on x86-64" — GBlog https://github.com/0xAX/linux-insides — related content

A blog post with GDB session traces showing argument passing in registers, callee-saved register preservation, and return values, all at the assembly level. Complements this chapter with visual register traces.


7. "Practical Binary Analysis" by Dennis Andriesse (Chapter 2) No Starch Press, 2018

Chapter 2 covers ELF binary format. Chapter 6 covers disassembly including PLT analysis. Chapter 10 covers dynamic analysis including ltrace and strace. Relevant to the Case Study 20-2 content (tracing printf through the PLT).


8. GCC Assembly Interfacing — NASM Tutorial https://www.nasm.us/doc — Chapter 9

NASM's official documentation chapter on interfacing with C programs. Covers global, extern, the CDECL calling convention, struct passing, and common pitfalls. Written specifically for NASM users.


9. "Understanding the x86-64 System V ABI" — CTF Writeup Collections Various CTF writeup sites (pwnable.kr, picoCTF writeups)

CTF (Capture The Flag) writeups for pwn challenges often include detailed ABI analysis. Reading how exploit developers reason about the calling convention — which registers are safe to use, where return addresses live, how to set up fake stack frames — is a valuable complement to formal ABI documentation.


10. CRC32C Hardware Instruction — Intel Intrinsics Guide https://www.intel.com/content/www/us/en/docs/intrinsics-guide

The _mm_crc32_u64 intrinsic corresponds to the CRC32 rax, qword [ptr] assembly instruction from Case Study 20-1. The Intrinsics Guide provides latency, throughput, and port usage data for every SSE/AVX instruction, including CRC32. Useful for estimating performance before benchmarking.