--use-dynamic is a prehistoric option (available at "19990502 sourceware import") supports. The intention may be to defeat malware's cheating of the location of the dynamic table.
If SHT_DYNSYM and PT_DYNAMIC disagree with the location, llvm-readelf --dyn-syms has a warning:
warning: 'a1.o': SHT_DYNAMIC section header and PT_DYNAMIC program header disagree about the location of the dynamic table
Additionally, there are several other warnings. Some may be applicable to GNU readelf, some may not:
warning: '[[FILE]]': invalid PT_DYNAMIC size (0x1)
warning: '[[FILE]]': no valid dynamic table was found
warning: '[[FILE]]': The SHT_DYNAMIC section '.dynamic' is not at the start of PT_DYNAMIC segment
warning: '[[FILE]]': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used
I am quite sure they will learn lots of new stuff here than anybody else! http://s3.amazonaws.com/subwaysurfers/index.html
The master branch has been updated by Nick Clifton <email@example.com>:
Author: H.J. Lu <firstname.lastname@example.org>
Date: Tue May 19 16:47:12 2020 +0100
Allow readelf to issue warnings if checking is enabled and there are discrepancies between the dynamic tags and the dynamic sections.
* readelf.c (process_program_headers): Warn if the PT_DYNAMIC
segment doesn't match the .dynamic section and checks are
(struct filedata): Add dynamic_symtab_section and
(process_section_headers): Set dynamic_symtab_section to the
.dynsym section. Set dynamic_strtab_section to the .dynstr
(process_dynamic_section): Warn if the .dynsym section doesn't
match DT_SYMTAB and DT_SYMENT or the .dynstr section doesn't
DT_STRTAB and DT_STRSZ. But only if checks are enabled.
I have applied H.J.'s patch, modified slightly to put the new variables into the filedata structure and to make the warnings only happen if checks are enabled (ie via --enable-checks).