←back to thread

95 points ingve | 1 comments | | HN request time: 0.212s | source
Show context
nephanth ◴[] No.44568300[source]
From my noobish standpoint, it feels like most code shounldn't care what the page size is? Why does it need te be recompiled?

What typically tends to break when changing it?

replies(6): >>44568475 #>>44568482 #>>44568492 #>>44568560 #>>44568984 #>>44569166 #
1. okanat ◴[] No.44568492[source]
Because the final ELF binary is linked to contain page aligned segments. Segments define how should the binary be loaded into memory and what permissions they require.

If you have a 4KB segment that is marked Read-Write followed immediately by a Read-Execute, naively loading it will open a can of security issues.

Moreover many platform data structures like Global Object Table of the dynamic executable uses addresses. You cannot simply bump things around.

On top of that libraries like C++ standard library (or abseil from Google) rely on the page size to optimize data structures like hash maps (i.e. unordered_map).