bfd_get_size cache
authorAlan Modra <amodra@gmail.com>
Wed, 19 Feb 2020 02:44:28 +0000 (13:14 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 19 Feb 2020 02:44:28 +0000 (13:14 +1030)
commitb03202e32c8235997b3485b0b4655926ad97a1cc
tree0697dbbcfdd4c7b08d717ce5fcc5b640872e0367
parent7c5fa58ea907c46817b915ec8b9b35a180e0e74c
bfd_get_size cache

We have calls to bfd_get_size when swapping in ELF section headers.
Since object files can have a large number of sections, it's worth
caching the file size rather than making lots of stat system calls.

* bfd.c (struct bfd): Move format and direction to other
bitfields.  Add "size".
* bfdio.c (bfd_get_size): Cache size when not writing file.
* opncls.c (bfd_get_debug_link_info_1): Allow for bfd_get_size
returning zero, ie. unknown.
(bfd_get_alt_debug_link_info): Likewise.
* bfd-in2.h: Regenerate.
bfd/ChangeLog
bfd/bfd-in2.h
bfd/bfd.c
bfd/bfdio.c
bfd/opncls.c