[U-Boot] [PATCH v2] 85xx: Move to a common linker script

Kumar Gala galak at kernel.crashing.org
Tue Aug 11 22:51:19 CEST 2009


On Aug 11, 2009, at 2:58 PM, Wolfgang Denk wrote:

> Dear Kumar Gala,
>
> In message <1249997451-21265-1-git-send-email-galak at kernel.crashing.org 
> > you wrote:
>> There are really no differences between all the 85xx linker scripts  
>> so
>> we can just move to a single common one.  Board code is still able to
>> override the common one if need be.
>
> Are you sure there are no differences?

There are differences but the differences exist because the non  
Freescale specific boards haven't kept up with the changes.  If the  
following changes got made to the other linker scripts we'd be in sync:

commit c11528083ef6e55e76df742228c26e39d151813d
Author: Kumar Gala <galak at kernel.crashing.org>
Date:   Thu Aug 7 09:28:20 2008 -0500

     mpc85xx: workaround old binutils bug

     The recent change to move the .bss outside of the image gives older
     binutils (ld from eldk4.1/binutils-2.16) some headache:

     ppc_85xx-ld: u-boot: Not enough room for program headers  
(allocated 3, need 4)
     ppc_85xx-ld: final link failed: Bad value

     We workaround it by being explicit about the program headers and  
not
     assigning the .bss to a program header.

     Signed-off-by: Kumar Gala <galak at kernel.crashing.org>

commit f0ff885ca64655bee6540eb8a25eed90b1152686
Author: Kumar Gala <galak at kernel.crashing.org>
Date:   Wed Jul 30 14:13:30 2008 -0500

     mpc85xx: Update linker scripts for Freescale boards

     * Move to using absolute addressing always.  Makes the scripts a  
bit more
       portable and common
     * Moved .bss after the end of the image.  These allows us to have  
more
       room in the resulting binary image for code and data.
     * Removed .text object files that aren't really needed
     * Make sure _end is 4-byte aligned as the .bss init code expects  
this.
       (Its possible that the end of .bss isn't 4-byte aligned)

     Signed-off-by: Kumar Gala <galak at kernel.crashing.org>

> --- board/atum8548/u-boot.lds	2009-07-28 20:27:27.549470982 +0200
> +++ board/freescale/mpc8536ds/u-boot.lds	2009-07-28  
> 20:27:27.678455216 +0200
> @@ -1,5 +1,5 @@
> /*
> - * Copyright 2007 Freescale Semiconductor, Inc.
> + * Copyright 2008 Freescale Semiconductor, Inc.
>  *
>  * See file CREDITS for list of people who contributed to this
>  * project.
> @@ -23,18 +23,14 @@
> OUTPUT_ARCH(powerpc)
> /* Do we need any of these for elf?
>    __DYNAMIC = 0;    */
> -SECTIONS
> -{
> -  .resetvec 0xFFFFFFFC :
> +PHDRS
>   {
> -    *(.resetvec)
> -  } = 0xffff
> +  text PT_LOAD;
> +  bss PT_LOAD;
> +}
>
> -  .bootpg 0xFFFFF000 :
> +SECTIONS
>   {
> -    cpu/mpc85xx/start.o	(.bootpg)
> -  } = 0xffff
> -
>   /* Read-only sections, merged into text segment: */
>   . = + SIZEOF_HEADERS;
>   .interp : { *(.interp) }
> @@ -61,26 +57,17 @@
>   .plt : { *(.plt) }
>   .text      :
>   {
> -    cpu/mpc85xx/start.o	(.text)
> -    cpu/mpc85xx/traps.o (.text)
> -    cpu/mpc85xx/interrupts.o (.text)
> -    cpu/mpc85xx/cpu_init.o (.text)
> -    cpu/mpc85xx/cpu.o (.text)
> -    cpu/mpc85xx/speed.o (.text)
> -    lib_generic/crc32.o (.text)
> -    lib_ppc/extable.o (.text)
> -    lib_generic/zlib.o (.text)
>     *(.text)
>     *(.fixup)
>     *(.got1)
> -   }
> +   } :text
>     _etext = .;
>     PROVIDE (etext = .);
>     .rodata    :
>    {
>     *(.eh_frame)
>     *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
> -  }
> +  } :text
>   .fini      : { *(.fini)    } =0
>   .ctors     : { *(.ctors)   }
>   .dtors     : { *(.dtors)   }
> @@ -129,6 +116,18 @@
>   . = ALIGN(256);
>   __init_end = .;
>
> +  .bootpg ADDR(.text) + 0x7f000 :
> +  {
> +    cpu/mpc85xx/start.o	(.bootpg)
> +  } :text = 0xffff
> +
> +  .resetvec ADDR(.text) + 0x7fffc :
> +  {
> +    *(.resetvec)
> +  } :text = 0xffff
> +
> +  . = ADDR(.text) + 0x80000;
> +
>   __bss_start = .;
>   .bss (NOLOAD)       :
>   {
> @@ -136,8 +135,9 @@
>    *(.dynbss)
>    *(.bss)
>    *(COMMON)
> +  } :bss
> +
>    . = ALIGN(4);
> -  }
>   _end = . ;
>   PROVIDE (end = .);
> }
>
>
> ???
>
> Also, you're compressing a lot of different Copyrights into a single
> "Copyright 2007-2009 Freescale Semiconductor, Inc.".

Not sure how to handle this.  I used the mpc8572 or mpc8536ds u- 
boot.lds as the common one and maintained its copyright.  The other  
files are just removed.  If you have a better suggestion let me know.

- k



More information about the U-Boot mailing list