This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Don't align text/data/bss sections in x86 assembler
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: "Roland McGrath" <mcgrathr at google dot com>, "Binutils" <binutils at sourceware dot org>
- Date: Tue, 04 Jun 2013 08:09:13 +0100
- Subject: Re: PATCH: Don't align text/data/bss sections in x86 assembler
- References: <20130531173241 dot GA30259 at intel dot com> <51AC6EFE02000078000DA75F at nat28 dot tlf dot novell dot com> <CAMe9rOpNY_h4CSnf1Wnkr-aqd3ExUHmFwxXR7AQ4NK8boNsXPQ at mail dot gmail dot com>
>>> On 03.06.13 at 17:27, "H.J. Lu" <hjl.tools@gmail.com> wrote:
> On Mon, Jun 3, 2013 at 1:25 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>> On 31.05.13 at 19:32, "H.J. Lu" <hongjiu.lu@intel.com> wrote:
>>> There is no need to align text/data/bss sections for ELF in x86
>>> assembler. The alignment directive should be used if a symbol needs
>>> a specfic alignment. I checked in this patch to avoid align
>>> text/data/bss sections in x86 assembler.
>>
>> Are you reasonably sure that this will not result in regressions?
>> While conceptionally I agree with the change (and never
>> understood why the alignment was being enforced), I think such
>> a change should only be done by providing a command line option
>> to suppress the automatic alignment.
>>
>
> I thought about it and decided against it. The section
> alignment is very arbitrary:
>
> 1. Many arches don't do it.
> 2. Only x86 ELF did it.
> 3. It only aligned text/data/bss sections and there are many
> other sections with code and data which aren't aligned.
> 4. Neither gABI nor psABI require it.
These are all valid points, but neglect the (from my pov) most
important aspect here: Assembly code is bound to the arch (i.e.
point 1 isn't really meaningful), often also bound to the object
format (i.e. point 2 isn't very meaningful either). And people
doing simple things with as little code as possible are likely to be
at risk the most (largely voiding 3 and 4): Having got used to
simply write ".data" or ".bss" followed by simple data items would
automatically take care of minimal alignment, I would bet many
aren't even aware of the need to put in some form of ".align".
For text this likely is less of an issue, but you never know.
Jan