Add bfd_get_file_size to get archive element size
We can't use stat() to get archive element size. Add bfd_get_file_size to get size for both normal files and archive elements. bfd/ PR binutils/21519 * bfdio.c (bfd_get_file_size): New function. * bfd-in2.h: Regenerated. binutils/ PR binutils/21519 * objdump.c (dump_relocs_in_section): Replace get_file_size with bfd_get_file_size to get archive element size. * testsuite/binutils-all/objdump.exp (test_objdump_f): New proc. (test_objdump_h): Likewise. (test_objdump_t): Likewise. (test_objdump_r): Likewise. (test_objdump_s): Likewise. Add objdump tests on archive.
This commit is contained in:
parent
08c3f6d234
commit
8e2f54bcee
6 changed files with 170 additions and 54 deletions
|
@ -3382,7 +3382,7 @@ dump_relocs_in_section (bfd *abfd,
|
|||
}
|
||||
|
||||
if ((bfd_get_file_flags (abfd) & (BFD_IN_MEMORY | BFD_LINKER_CREATED)) == 0
|
||||
&& relsize > get_file_size (bfd_get_filename (abfd)))
|
||||
&& relsize > bfd_get_file_size (abfd))
|
||||
{
|
||||
printf (" (too many: 0x%x)\n", section->reloc_count);
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue