/plushcap/analysis/cloudflare/how-to-execute-an-object-file-part-3

How to execute an object file: Part 3

What's this blog post about?

In this text, the author discusses how to deal with external libraries when processing object files and resolving dependencies. They add a new function to their toy object file that depends on the puts function from the C standard library. The compiler generates a relocation for the puts invocation, which is resolved by creating a jumptable for external code using Procedure Linkage Table (PLT) and Global Offset Table (GOT). They implement a simplified PLT/GOT in their loader to resolve external references when the object file is loaded and parsed. The author also demonstrates how to "hook" any external function call and divert the code to a custom implementation, which might be useful in some cases like malware research.

Company
Cloudflare

Date published
Sept. 10, 2021

Author(s)
Ignat Korchagin

Word count
2651

Hacker News points
4

Language
English


By Matt Makai. 2021-2024.