All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: robert song <robertsong.linux@gmail.com>
Cc: linux-mips@linux-mips.org
Subject: Re: MIPS section alignment of object file
Date: Fri, 22 Feb 2008 12:29:26 +0000	[thread overview]
Message-ID: <20080222122926.GB17312@linux-mips.org> (raw)
In-Reply-To: <3e004f8e0802210812k723a11f5ve9fa816d83bb082b@mail.gmail.com>

On Fri, Feb 22, 2008 at 01:12:01AM +0900, robert song wrote:

> But in other architectures like arm, .data section is aligned to 4
> bytes alignment,
> and  now I test the object file generated by gas, and found that the
> size of .data section sometimes is a little bigger than the situation
> of 4 bytes alignments because of the amount of padding.
> 
> There are some comments in the tc-mips.c as bellows:
>          On a native system other than VxWorks, sections must be aligned
> 	 to 16 byte boundaries.  When configured for an embedded ELF
> 	 target, we don't bother.
> 
> I want to know whether some mips architecture requires that the
> sections of elf object file specifies to be aligned to 16 bytes,  or
> else 16-bytes alignment will get a good performance than other
> alignments just like 4 bytes????
> 
> I recompiled  the binutils by changing the alignment to 4 bytes, and
> compiled some
> test files, and ran on my mips target(TX4937). There is no problem.
> 
> I am really puzzled and any help will be appreciated.

The minimum alignment technically required is the largest alignment of
any type contained in a section.  Due to the possibility of relocatable
links the assembler can't know what the largest aligment is, so it has
to make a reasonable guess which would be 8 bytes, the size of a double
floating point.  For performance reasons an alignment of the size of a
primary cache line (typically 32 byte these days but could be as much as
128 bytes) could make sense.

  Ralf

  reply	other threads:[~2008-02-22 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-21 16:12 MIPS section alignment of object file robert song
2008-02-22 12:29 ` Ralf Baechle [this message]
2008-02-22 19:02   ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080222122926.GB17312@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    --cc=robertsong.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.