This is a result of what I found during my work on https://bugs.llvm.org/show_bug.cgi?id=41679.
Previously LLVM readelf took the information about .dynamic section from its PT_DYNAMIC segment only.
GNU tools have a bit different logic. They also use the information from the .dynamic section header if it is available.
This patch changes the code to improve the compatibility with the GNU Binutils.
I also think it should resolve the problems from PR mentioned.