[llvm-jitlink] Add a -slab-page-size option to override process page size.
authorLang Hames <lhames@gmail.com>
Tue, 28 Sep 2021 17:25:11 +0000 (10:25 -0700)
committerLang Hames <lhames@gmail.com>
Tue, 28 Sep 2021 17:43:46 +0000 (10:43 -0700)
commitab5e6e7434ebc67e89332d4401926978c8fb143b
tree27bfa09a4b3a449b082fa69671f1499e84b09a6d
parent9e7fdcbafed90e8946ecd4d8b118786b12905595
[llvm-jitlink] Add a -slab-page-size option to override process page size.

The slab allocator is frequently used in -noexec tests where we want a
consistent memory layout. In this context we also want to set the effective
page size, rather than using the page size of the host process, since not all
systems use the same page size. The -slab-page-size option allows us to set
the page size for such tests.

The -slab-page-size option will also be honored in exec mode when using the
slab allocator, but will trigger an error if the requested size is not a
multiple of the actual process page size.

This option was motivated by test failures on a ppc64 bot that was returning
zero from sys::Process::getPageSize(), so it also contains a check for errors
and zero results from that function if the -slab-page-size option is absent.

Existing slab allocator tests will be updated to use this option in a follow-up
commit so that we can point the failing bot at this commit and observe errors
associated with sys::Process::getPageSize().
llvm/tools/llvm-jitlink/llvm-jitlink.cpp