Hi Sam, I have tried to use __attribute__((section("xxx")), but it seems there are no linker options to force a particular alignment for a section for ELF. All those nice alignment options refers to Windows: --section-alignment Sets the section alignment. Sections in memory will always begin at addresses which are a multiple of this number. Defaults to 0x1000. [This option is specific to the i386 PE targeted port of the linker] I can only force the section to start on a particular address when loaded. Then it works. But this is not what as I have no idea what the address should be. Have I missed something? Regards, Igor On 27/02/2008, Sam Ravnborg <sam@xxxxxxxxxxxx> wrote: > 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 >