[LLVMdev] question about the alignment of the .text section

Mark Seaborn mseaborn at chromium.org
Tue Mar 4 15:11:58 PST 2014


On 26 February 2014 14:56, Katya Romanova <
katya_romanova at playstation.sony.com> wrote:

> Joerg Sonnenberger <joerg <at> britannica.bec.de> writes:
>
> >
> > On Tue, Feb 25, 2014 at 07:13:35PM +0000, Romanova, Katya wrote:
> > > Is there a reason why the alignment of the .text section should be 4
> > > when we are optimizing for size (-Os or -Oz)?
> >
> > Which target architecture?
> >
> > Joerg
>
> Hi Joerg,
>
> x86_64 Linux. I see 4 byte alignment for .text section when the compiler is
> optimizing for size.
>

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.

Other than that, I don't know of any requirements for function addresses to
be aligned on x86.

Cheers,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140304/2257c98c/attachment.html>


More information about the llvm-dev mailing list