limits.h: define PAGE_SIZE/PAGESIZE like musl, fixing the gdb build
Commit 487af1498 ("drop __pagesize, make _dl_pagesize the single source
of truth") removed the compile-time PAGE_SIZE / PAGE_MASK macros from
<bits/uClibc_page.h> (and from i386 <sys/user.h>) so that libc internals
can no longer use a fixed page size before _dl_pagesize is initialised.
That is correct for libc-internal code, but PAGE_SIZE is also a public
compile-time macro that third-party software relies on: glibc exposes it
from <sys/user.h>, musl from <limits.h>. gdb's gdb/nat/linux-btrace.c,
for example, uses PAGE_SIZE with no fallback, so gdbserver no longer
builds on uClibc-ng:
linux-btrace.c:549:34: error: 'PAGE_SIZE' was not declared in this scope
Restore it the way musl does. PAGE_SIZE (and PAGESIZE) are now defined
centrally in <limits.h>, gated on _GNU_SOURCE / _BSD_SOURCE /
_XOPEN_SOURCE, and derived from the per-architecture PAGE_SHIFT that
<bits/uClibc_page.h> still provides. The page headers keep only
PAGE_SHIFT as the single source of truth, so the macro never reaches the
libc-internal code that includes <bits/uClibc_page.h> -- the init-order
trap that 487af1498 closed stays closed -- while public, feature-test
gated code gets the constant back.
As part of the same move the competing per-arch PAGE_SIZE / PAGE_MASK
definitions are dropped, and the obsolete BFD trad-core block
(NBPG / UPAGES / HOST_*_ADDR / SUNOS_CORE_MAGIC) is removed from the
remaining sys/user.h files (alpha, m68k, microblaze, mips, nds32, sh,
sparc, sparc64, x86_64). This completes commit 62cb84000
("sys/user.h: remove obsolete BFD trad-core NBPG/UPAGES defines"), which
did i386/nios2/ia64/bfin; the symbols have no in-tree users.
Verified with the preprocessor: with _GNU_SOURCE (and with the default
_BSD_SOURCE, and with _XOPEN_SOURCE) PAGE_SIZE expands to (1UL << 12) on
i386/x86_64/arm and to (1UL << 13) on cris/alpha; under -ansi it is
absent.
Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>