It can be done by manually remapping the relevant sections upon application startup.
Perhaps [1] is a good resource to start with (page nr. 7). Example code is here [2]. And [3] makes some experiments with it.
[1] https://www.kernel.org/doc/ols/2006/ols2006v2-pages-83-90.pd...
[2] https://github.com/intel/iodlr/blob/master/large_page-c/exam...
[3] https://easyperf.net/blog/2022/09/01/Utilizing-Huge-Pages-Fo...