cc: Correctly treat PIE files as shared objects for symbols
authorSasha Goldshtein <goldshtn@gmail.com>
Thu, 9 Feb 2017 06:18:34 +0000 (01:18 -0500)
committerSasha Goldshtein <goldshtn@gmail.com>
Tue, 21 Feb 2017 09:30:43 +0000 (09:30 +0000)
commit7d8c29ce872fc4d9dceeb456f034b25b86ff9d2e
treebfabe87c4a55dee45ad74ada1bc723f80cd7a014
parent1e34f4e1613f3c4f47418157d776321b92883ccf
cc: Correctly treat PIE files as shared objects for symbols

When resolving symbols, ProcSyms would treat position-independent
executables (PIE files) incorrectly, resulting in symbol resolution
failures. Specifically, PIE files are treated like shared objects
for ASLR, which means all symbol addresses in the file need to be
taken relative to the executable load address at runtime, the same
as with dynamic library shared objects.

The fix is in the `is_so()` method on `ProcSyms::Module`, which
now uses the correct `bcc_elf_is_shared` helper for testing if a
file is a shared object rather than just looking at the extension
".so", which is very brittle -- and wrong.
src/cc/bcc_syms.cc
src/cc/syms.h