Re: [tip:x86/urgent] x86: linker script: avoid ALIGN statements inside output sections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 28, 2009 at 10:14:55AM +0200, Ingo Molnar wrote:
> 
> * tip-bot for H. Peter Anvin <hpa@xxxxxxxxxxx> wrote:
> 
> > Commit-ID:  c707f31e2e6af2d37bc742c31be0c7e96946c71f
> > Gitweb:     http://git.kernel.org/tip/c707f31e2e6af2d37bc742c31be0c7e96946c71f
> > Author:     H. Peter Anvin <hpa@xxxxxxxxxxx>
> > AuthorDate: Mon, 27 Apr 2009 13:09:45 -0700
> > Committer:  H. Peter Anvin <hpa@xxxxxxxxxxx>
> > CommitDate: Mon, 27 Apr 2009 13:09:45 -0700
> > 
> > x86: linker script: avoid ALIGN statements inside output sections
> > 
> > ALIGN statements inside output sections means that the alignment 
> > padding ends up part of the section.  This causes real problems 
> > when the section is otherwise empty.  ALIGN can be done either 
> > before the output section or as part of the output section header; 
> > the latter has the advantage that the alignment information is 
> > propagated into the appropriate ELF headers.
> > 
> > Without this patch, we produce invalid kernels in certain 
> > configurations involving X86_VSMP.
> > 
> > Reported-and-tested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
> > Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
> > 
> > 
> > ---
> >  arch/x86/kernel/vmlinux_32.lds.S |   45 +++++++++++++++-----------------
> >  arch/x86/kernel/vmlinux_64.lds.S |   52 +++++++++++++++++--------------------
> >  2 files changed, 45 insertions(+), 52 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
> > index 62ad500..7197db8 100644
> > --- a/arch/x86/kernel/vmlinux_32.lds.S
> > +++ b/arch/x86/kernel/vmlinux_32.lds.S
> > @@ -37,8 +37,7 @@ SECTIONS
> >    } :text = 0x9090
> >  
> >    /* read-only */
> > -  .text : AT(ADDR(.text) - LOAD_OFFSET) {
> > -	. = ALIGN(PAGE_SIZE); /* not really needed, already page aligned */
> > +  .text : AT(ADDR(.text) - LOAD_OFFSET) ALIGN(PAGE_SIZE) {
> >  	*(.text.page_aligned)
> >  	TEXT_TEXT
> >  	SCHED_TEXT
> > @@ -52,8 +51,8 @@ SECTIONS
> >  
> >    NOTES :text :note
> >  
> > -  . = ALIGN(16);		/* Exception table */
> > -  __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
> > +  /* Exception table */
> > +  __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) ALIGN(16) {
> 
> 
> this construct breaks older toolchains:
> 
> /opt/crosstool/gcc-4.2.3-glibc-2.3.6/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld:arch/x86/kernel/vmlinux.lds:138: 
> parse error
> 
> titan:~/tip> 
> /opt/crosstool/gcc-4.2.3-glibc-2.3.6/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-ld -v
> GNU ld version 2.16.1
> 
> this is what it does not like:
> 
>  __ex_table : AT(ADDR(__ex_table) - 0xffffffff80000000) ALIGN(16) {

Good to know. I was yesterday wondering why we did not use this.
As part of the .lds file cleanups I move ALIGN() out of the
output section as this is where it should be.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux