Hi Mark,

I want to ask you a question regarding elf internals.
How to calculate a symbol's file offset (which is kernel uprobe expects)
in an elf (executable or shared object)?

Some real world use case use either section header like libbpf:
  
https://github.com/libbpf/libbpf/blob/374036c9f1cdfe2a8df98d9d6a53c34fd02de14b/src/elf.c#L259-L270
Or use program header like BCC:
  
https://github.com/iovisor/bcc/blob/82f9d1cb633aa3b4ebcbbc5d8b809f48d3dfa222/src/cc/bcc_syms.cc#L767-L775

Which is correct ? Is there a unified way to get the file offset of a symbol ?

Thanks.
--
Hengqi

Reply via email to