Aligning function on a page boundary
Sam Ravnborg
sam@ravnborg.org
Wed Feb 27 14:00:00 GMT 2008
On Wed, Feb 27, 2008 at 01:51:10PM +0100, Igor Bukanov wrote:
> Hi,
>
> is it possible with GCC 4.1 to align one single function on a CPU page
> boundary for ELF targets? This is very desired since the function in
> question is an interpreter loop . It has 50K of code and is executed
> very often. Aligning it on the page boundary should reduce TLB misses.
>
> It seems the forthcoming GCC 4.3 allows that as it supports the align
> attribute for functions, but it would be nice to do that with GCC
> 4.1.
One way is to use the section attribute to tell gcc to put the
function in a specific section and then in the linker script
page align said section.
This is used extensively in the linux kernel.
Sam
More information about the Gcc-help
mailing list