Further reading
To get a better grasp on the overall design of the machine code (MC) layer, you can read the blog post that Chris Lattner wrote when this layer was first introduced in 2010, at https://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html.
To go beyond the guidelines established in this chapter, you can follow Simon Cook’s Implementing LLVM Integrated Assembler tutorial at https://www.embecosm.com/appnotes/ean10/ean10-howto-llvmas-1.0.html. This tutorial gives some color around the implementation of the MCAsmBackend
class and the related classes.
Finally, if you are curious about the Mach-O specifications, look at this document: https://github.com/aidansteele/osx-abi-macho-file-format-reference?tab=readme-ov-file. In particular, it has a section that explains the semantics of the fields of the relocation_info
structure.