ELF relocations

Hi,
In the include/llvm/Support/ELFRelocs directory, there is a bunch of .def files defining enums that are to be included in ELF.h. For example, in ARM.def, there is this record:

ELF_RELOC(R_ARM_PC24, 0x01)

What does ‘R_ARM_PC24’ mean and where does the value 0x01 come from?
I’m trying to define a backend for a custom cpu and I have to provide a .def file but I don’t know what these records mean.

Best,

Hassan Elmadi

See for a general description of ELF relocations. The names, values, and meanings are all CPU-specific because it depends on the instruction encoding. For commonly used CPUs, there are standard ELF relocations, so different compilers and linkers for a given CPU are compatible. For example, the ARM ELF relocations are defined in . If you’re defining your own CPU architecture, it doesn’t really matter what the names or values are, as long as the compiler and linker agree what they mean. -Eli