bfd: Define pagesize variables only for mmap

Define _bfd_pagesize, _bfd_pagesize_m1 and _bfd_minimum_mmap_size only
if HAVE_MMAP is defined.

	* libbfd-in.h (_bfd_pagesize): Declare only if HAVE_MMAP is
	defined.
	(_bfd_pagesize_m1): Likewise.
	(_bfd_minimum_mmap_size): Likewise.
	* libbfd.c (_bfd_pagesize): Define only if HAVE_MMAP is defined.
	(_bfd_pagesize_m1): Likewise.
	(_bfd_minimum_mmap_size): Likewise.
	(bfd_init_pagesize): Likewise.
	* lynx-core.c (lynx_core_file_p): Replace _bfd_pagesize with
	getpagesize.
This commit is contained in:
H.J. Lu 2024-04-08 19:39:23 -07:00
parent cd714ac07c
commit 56756c571e
4 changed files with 7 additions and 1 deletions

View File

@ -848,9 +848,11 @@ extern bfd_byte * _bfd_write_unsigned_leb128
extern struct bfd_link_info *_bfd_get_link_info (bfd *)
ATTRIBUTE_HIDDEN;
#ifdef HAVE_MMAP
extern uintptr_t _bfd_pagesize ATTRIBUTE_HIDDEN;
extern uintptr_t _bfd_pagesize_m1 ATTRIBUTE_HIDDEN;
extern uintptr_t _bfd_minimum_mmap_size ATTRIBUTE_HIDDEN;
#endif
#if GCC_VERSION >= 7000
#define _bfd_mul_overflow(a, b, res) __builtin_mul_overflow (a, b, res)

View File

@ -1572,6 +1572,7 @@ _bfd_generic_init_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
return true;
}
#ifdef HAVE_MMAP
uintptr_t _bfd_pagesize;
uintptr_t _bfd_pagesize_m1;
uintptr_t _bfd_minimum_mmap_size;
@ -1587,3 +1588,4 @@ bfd_init_pagesize (void)
/* The minimum section size to use mmap. */
_bfd_minimum_mmap_size = _bfd_pagesize * 4;
}
#endif

View File

@ -854,9 +854,11 @@ extern bfd_byte * _bfd_write_unsigned_leb128
extern struct bfd_link_info *_bfd_get_link_info (bfd *)
ATTRIBUTE_HIDDEN;
#ifdef HAVE_MMAP
extern uintptr_t _bfd_pagesize ATTRIBUTE_HIDDEN;
extern uintptr_t _bfd_pagesize_m1 ATTRIBUTE_HIDDEN;
extern uintptr_t _bfd_minimum_mmap_size ATTRIBUTE_HIDDEN;
#endif
#if GCC_VERSION >= 7000
#define _bfd_mul_overflow(a, b, res) __builtin_mul_overflow (a, b, res)

View File

@ -96,7 +96,7 @@ lynx_core_file_p (bfd *abfd)
asection *newsect;
size_t amt;
pagesize = _bfd_pagesize; /* Serious cross-target issue here... This
pagesize = getpagesize (); /* Serious cross-target issue here... This
really needs to come from a system-specific
header file. */