support parsing of dynamic ELFs w/out section headers

At runtime, ELFs do not use the section headers at all. Instead, only
the program segments and dynamic tags get used. This means you can
strip the section table completely from an ELF and have it still work.

In practice, people rarely do this, but it's not unheard of. Make the
Dynamic tags work even in these cases by loading the strings table the
same way the runtime loader does:
- parse the symtab address from DT_STRTAB
- locate the file offset via the program segments

In order to avoid circular deps (parsing a dyntag requires walking parsed
dyntags), add a set of internal funcs for returning the raw values.

TEST=lddtree w/build_image works on heavily stripped files (like netflix)

Change-Id: Ia5dd61bcce701cb52a275c8cb67b274e4feda88f
Reviewed-by: David James <>
Commit-Queue: Mike Frysinger <>
Tested-by: Mike Frysinger <>
1 file changed