libdwfl: dwfl_module_getdwarf.c (open_elf) only (re)set mod->e_type once.

As noted in https://sourceware.org/bugzilla/show_bug.cgi?id=16676#c2 for
systemtap, the heuristic used by open_elf to set the kernel Dwfl_Module
type to ET_DYN, even if the underlying ELF file e_type was set to
ET_EXEC, could trigger erroneously for non-kernel/non-main (debug or
aux) files.  Make sure we only set the e_type of the module once when
processing the main file (when the phdrs can be trusted).
2 files changed