This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Aligning function on a page boundary


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]