<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 26 February 2014 14:56, Katya Romanova <span dir="ltr"><<a href="mailto:katya_romanova@playstation.sony.com" target="_blank">katya_romanova@playstation.sony.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">Joerg Sonnenberger <joerg <at> <a href="http://britannica.bec.de" target="_blank">britannica.bec.de</a>> writes:<br>

<br>
><br>
> On Tue, Feb 25, 2014 at 07:13:35PM +0000, Romanova, Katya wrote:<br>
> > Is there a reason why the alignment of the .text section should be 4<br>
> > when we are optimizing for size (-Os or -Oz)?<br>
><br>
> Which target architecture?<br>
><br>
> Joerg<br>
<br>
</div>Hi Joerg,<br>
<br>
x86_64 Linux. I see 4 byte alignment for .text section when the compiler is<br>
optimizing for size.<br></blockquote><div><br></div><div>The C++ ABI for method pointers on x86 requires that function pointers are at least 2 byte aligned.  ARM's C++ ABI doesn't have the same requirement (because Thumb function addresses have the bottom bit set).  See UseARMMethodPtrABI in Clang's ItaniumCXXABI.cpp, if you're interested.</div>
<div><br></div><div>Other than that, I don't know of any requirements for function addresses to be aligned on x86.</div><div><br></div><div>Cheers,</div><div>Mark</div><div><br></div></div></div></div>