Don't exclude ET_EXEC files for -dynamic-reloc/-R as they may also contain dynamic relocations. This matches the behavior of objdump from binutils.
As sh_offset is usually different from sh_addr in ET_EXEC files, this also fixes a bug where section lookup was done by matching the value of DT_REL*/DT_JMPREL (which is a VMA) and the section's file offset.
I don't think this should be an error. If a client requests dynamic relocations on ET_REL, for example, they should just get no dynamic relocations. The client code should decide whether or not it requires dynamic relocations for there to be no error. Beware that this code could be used by other clients than llvm-objdump that might rely on other behaviour than what you are doing here.