elfref - a tool to dump references in an ELF file
As an excercise in Linux system programming in C, I wrote a tool
called elfref that
helps to debug customer’s linking issues.
Given an ELF file, it interprets
all the relocation records and prints out everything that functions or data
refer to. For instance, this output means that that the
function main()
refers to the function process_args()
:
$ elfref a.o
elfref: Input (a.o) is a 64-bit little endian ELF relocatable file.
main (addr 0x00000000)
(+0x001c)-> process_args()-4
This information comes in handy when a customer complains about a link failure
and all you’ve given in the name of the missing symbol. elfref
will help to
locate the point in source code where that unsatisfied reference is made.
Full source code can be found on github.