Skip to content

Compiling glibc with 16 KiB page size

Jonas Haag edited this page Sep 14, 2023 · 3 revisions

macOS on Apple Silicon uses 16 KiB pages. To run some x86-64 programs that use shared libraries without -m, you need those libraries compiled for 16 KiB page size.

You can compile glibc for 16 KiB page size with a custom compiler wrapper:

cat > mycc <<EOF
> #!/bin/sh
set /usr/bin/gcc "$@" \
    -DEXEC_PAGESIZE=16384 \
    -Wl,-z,max-page-size=16384 \
    -Wl,-z,common-page-size=16384
printf '%s\n' "$*" >>/tmp/gcc.log
exec "$@"
EOF

chmod +x mycc
git clone https://sourceware.org/git/glibc.git -b release/2.38/master
cd glibc
./configure CC=~/mycc
make -j
Clone this wiki locally