aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd-in2.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-02-19 13:14:28 +1030
committerAlan Modra <amodra@gmail.com>2020-02-19 13:14:28 +1030
commitb03202e32c8235997b3485b0b4655926ad97a1cc (patch)
tree0697dbbcfdd4c7b08d717ce5fcc5b640872e0367 /bfd/bfd-in2.h
parent7c5fa58ea907c46817b915ec8b9b35a180e0e74c (diff)
downloadgdb-b03202e32c8235997b3485b0b4655926ad97a1cc.zip
gdb-b03202e32c8235997b3485b0b4655926ad97a1cc.tar.gz
gdb-b03202e32c8235997b3485b0b4655926ad97a1cc.tar.bz2
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.
Diffstat (limited to 'bfd/bfd-in2.h')
-rw-r--r--bfd/bfd-in2.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 6b30f5f..2d56fda 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -6497,12 +6497,6 @@ struct bfd
/* A unique identifier of the BFD */
unsigned int id;
- /* The format which belongs to the BFD. (object, core, etc.) */
- ENUM_BITFIELD (bfd_format) format : 3;
-
- /* The direction with which the BFD was opened. */
- ENUM_BITFIELD (bfd_direction) direction : 2;
-
/* Format_specific flags. */
flagword flags;
@@ -6606,6 +6600,12 @@ struct bfd
| BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \
| BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON)
+ /* The format which belongs to the BFD. (object, core, etc.) */
+ ENUM_BITFIELD (bfd_format) format : 3;
+
+ /* The direction with which the BFD was opened. */
+ ENUM_BITFIELD (bfd_direction) direction : 2;
+
/* Is the file descriptor being cached? That is, can it be closed as
needed, and re-opened when accessed later? */
unsigned int cacheable : 1;
@@ -6695,7 +6695,7 @@ struct bfd
/* Symbol table for output BFD (with symcount entries).
Also used by the linker to cache input BFD symbols. */
- struct bfd_symbol **outsymbols;
+ struct bfd_symbol **outsymbols;
/* Used for input and output. */
unsigned int symcount;
@@ -6706,6 +6706,11 @@ struct bfd
/* Pointer to structure which contains architecture information. */
const struct bfd_arch_info *arch_info;
+ /* Cached length of file for bfd_get_size. 0 until bfd_get_size is
+ called, 1 if stat returns an error or the file size is too large to
+ return in ufile_ptr. Both 0 and 1 should be treated as "unknown". */
+ ufile_ptr size;
+
/* Stuff only useful for archives. */
void *arelt_data;
struct bfd *my_archive; /* The containing archive BFD. */