aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-04-11 15:12:08 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-04-11 15:12:08 -0700
commit2c008f9a5b65fe8d9379e761b056fabeb34a5da6 (patch)
treedb51903ac2ae178cb5dbdb4942c8e3a592de44a7 /bfd
parentfd5a150943c9a99a568ea6459a5d70a24dee3755 (diff)
downloadgdb-2c008f9a5b65fe8d9379e761b056fabeb34a5da6.zip
gdb-2c008f9a5b65fe8d9379e761b056fabeb34a5da6.tar.gz
gdb-2c008f9a5b65fe8d9379e761b056fabeb34a5da6.tar.bz2
Initialize pagesize_m1 in bfd_cache_init
There is no need to check and initialize pagesize_m1 in cache_bmmap. * cache.c (cache_bmmap): Move pagesize_m1 ... to (pagesize_m1): Here. (bfd_cache_init): Initialize pagesize_m1.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/cache.c11
2 files changed, 13 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 207884a..8935574 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2015-04-11 H.J. Lu <hongjiu.lu@intel.com>
+ * cache.c (cache_bmmap): Move pagesize_m1 ... to
+ (pagesize_m1): Here.
+ (bfd_cache_init): Initialize pagesize_m1.
+
+2015-04-11 H.J. Lu <hongjiu.lu@intel.com>
+
* elf32-i386.c (elf_i386_relocate_section): Replace SYMBOLIC_BIND
with SYMBOL_REFERENCES_LOCAL when checking R_386_GOTOFF against
protected data symbol when building shared library.
diff --git a/bfd/cache.c b/bfd/cache.c
index 94a82da..67d3d17 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -418,6 +418,10 @@ cache_bstat (struct bfd *abfd, struct stat *sb)
return sts;
}
+#ifdef HAVE_MMAP
+static uintptr_t pagesize_m1;
+#endif
+
static void *
cache_bmmap (struct bfd *abfd ATTRIBUTE_UNUSED,
void *addr ATTRIBUTE_UNUSED,
@@ -435,7 +439,6 @@ cache_bmmap (struct bfd *abfd ATTRIBUTE_UNUSED,
#ifdef HAVE_MMAP
else
{
- static uintptr_t pagesize_m1;
FILE *f;
file_ptr pg_offset;
bfd_size_type pg_len;
@@ -444,9 +447,6 @@ cache_bmmap (struct bfd *abfd ATTRIBUTE_UNUSED,
if (f == NULL)
return ret;
- if (pagesize_m1 == 0)
- pagesize_m1 = getpagesize () - 1;
-
/* Handle archive members. */
if (abfd->my_archive != NULL)
offset += abfd->origin;
@@ -496,6 +496,9 @@ bfd_cache_init (bfd *abfd)
if (! close_one ())
return FALSE;
}
+#ifdef HAVE_MMAP
+ pagesize_m1 = getpagesize () - 1;
+#endif
abfd->iovec = &cache_iovec;
insert (abfd);
++open_files;