Skip to contentSkip to conversation

85xx: Move to a common linker script

PATCH Superseded Kumar Gala 2 participants 4 messages Aug 11, 2009 – Sep 8, 2009

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH v2 1/1 85xx: Move to a common linker script

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.

---
* Forgot to remove the p1_p2_rdb u-boot.lds

- k

 board/atum8548/u-boot.lds             |  143 ------------------------------
 board/freescale/mpc8536ds/u-boot.lds  |  143 ------------------------------
 board/freescale/mpc8540ads/u-boot.lds |  146 -------------------------------
 board/freescale/mpc8541cds/u-boot.lds |  143 ------------------------------
 board/freescale/mpc8544ds/u-boot.lds  |  143 ------------------------------
 board/freescale/mpc8548cds/u-boot.lds |  143 ------------------------------
 board/freescale/mpc8555cds/u-boot.lds |  143 ------------------------------
 board/freescale/mpc8560ads/u-boot.lds |  146 -------------------------------
 board/freescale/mpc8568mds/u-boot.lds |  143 ------------------------------
 board/freescale/mpc8569mds/u-boot.lds |  143 ------------------------------
 board/freescale/mpc8572ds/u-boot.lds  |  143 ------------------------------
 board/freescale/p1_p2_rdb/u-boot.lds  |  143 ------------------------------
 board/freescale/p2020ds/u-boot.lds    |  143 ------------------------------
 board/mpc8540eval/u-boot.lds          |  151 --------------------------------
 board/pm854/u-boot.lds                |  146 -------------------------------
 board/pm856/u-boot.lds                |  146 -------------------------------
 board/sbc8548/u-boot.lds              |  145 -------------------------------
 board/sbc8560/u-boot.lds              |  151 --------------------------------
 board/socrates/u-boot.lds             |  149 -------------------------------
 board/stx/stxgp3/u-boot.lds           |  153 --------------------------------
 board/stx/stxssa/u-boot.lds           |  154 ---------------------------------
 board/tqc/tqm85xx/u-boot.lds          |  146 -------------------------------
 board/xes/xpedite5200/u-boot.lds      |  143 ------------------------------
 board/xes/xpedite5370/u-boot.lds      |  143 ------------------------------
 cpu/mpc85xx/config.mk                 |    3 +
 cpu/mpc85xx/u-boot.lds                |  143 ++++++++++++++++++++++++++++++
 26 files changed, 146 insertions(+), 3492 deletions(-)
 delete mode 100644 board/atum8548/u-boot.lds
 delete mode 100644 board/freescale/mpc8536ds/u-boot.lds
 delete mode 100644 board/freescale/mpc8540ads/u-boot.lds
 delete mode 100644 board/freescale/mpc8541cds/u-boot.lds
 delete mode 100644 board/freescale/mpc8544ds/u-boot.lds
 delete mode 100644 board/freescale/mpc8548cds/u-boot.lds
 delete mode 100644 board/freescale/mpc8555cds/u-boot.lds
 delete mode 100644 board/freescale/mpc8560ads/u-boot.lds
 delete mode 100644 board/freescale/mpc8568mds/u-boot.lds
 delete mode 100644 board/freescale/mpc8569mds/u-boot.lds
 delete mode 100644 board/freescale/mpc8572ds/u-boot.lds
 delete mode 100644 board/freescale/p1_p2_rdb/u-boot.lds
 delete mode 100644 board/freescale/p2020ds/u-boot.lds
 delete mode 100644 board/mpc8540eval/u-boot.lds
 delete mode 100644 board/pm854/u-boot.lds
 delete mode 100644 board/pm856/u-boot.lds
 delete mode 100644 board/sbc8548/u-boot.lds
 delete mode 100644 board/sbc8560/u-boot.lds
 delete mode 100644 board/socrates/u-boot.lds
 delete mode 100644 board/stx/stxgp3/u-boot.lds
 delete mode 100644 board/stx/stxssa/u-boot.lds
 delete mode 100644 board/tqc/tqm85xx/u-boot.lds
 delete mode 100644 board/xes/xpedite5200/u-boot.lds
 delete mode 100644 board/xes/xpedite5370/u-boot.lds
 create mode 100644 cpu/mpc85xx/u-boot.lds
board/atum8548/u-boot.lds deleted +0 -143
deleted file mode 100644
index 3067846..0000000
@@ -1,143 +0,0 @@
-/*
- * Copyright 2007 Freescale Semiconductor, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-OUTPUT_ARCH(powerpc)
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;    */
-SECTIONS
-{
-  .resetvec 0xFFFFFFFC :
-  {
-    *(.resetvec)
-  } = 0xffff
-
-  .bootpg 0xFFFFF000 :
-  {
-    cpu/mpc85xx/start.o	(.bootpg)
-  } = 0xffff
-
-  /* Read-only sections, merged into text segment: */
-  . = + SIZEOF_HEADERS;
-  .interp : { *(.interp) }
-  .hash          : { *(.hash)		}
-  .dynsym        : { *(.dynsym)		}
-  .dynstr        : { *(.dynstr)		}
-  .rel.text      : { *(.rel.text)		}
-  .rela.text     : { *(.rela.text)	}
-  .rel.data      : { *(.rel.data)		}
-  .rela.data     : { *(.rela.data)	}
-  .rel.rodata    : { *(.rel.rodata)	}
-  .rela.rodata   : { *(.rela.rodata)	}
-  .rel.got       : { *(.rel.got)		}
-  .rela.got      : { *(.rela.got)		}
-  .rel.ctors     : { *(.rel.ctors)	}
-  .rela.ctors    : { *(.rela.ctors)	}
-  .rel.dtors     : { *(.rel.dtors)	}
-  .rela.dtors    : { *(.rela.dtors)	}
-  .rel.bss       : { *(.rel.bss)		}
-  .rela.bss      : { *(.rela.bss)		}
-  .rel.plt       : { *(.rel.plt)		}
-  .rela.plt      : { *(.rela.plt)		}
-  .init          : { *(.init)	}
-  .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)
-   }
-    _etext = .;
-    PROVIDE (etext = .);
-    .rodata    :
-   {
-    *(.eh_frame)
-    *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
-  }
-  .fini      : { *(.fini)    } =0
-  .ctors     : { *(.ctors)   }
-  .dtors     : { *(.dtors)   }
-
-  /* Read-write section, merged into data segment: */
-  . = (. + 0x00FF) & 0xFFFFFF00;
-  _erotext = .;
-  PROVIDE (erotext = .);
-  .reloc   :
-  {
-    *(.got)
-    _GOT2_TABLE_ = .;
-    *(.got2)
-    _FIXUP_TABLE_ = .;
-    *(.fixup)
-  }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
-  __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
-
-  .data    :
-  {
-    *(.data)
-    *(.data1)
-    *(.sdata)
-    *(.sdata2)
-    *(.dynamic)
-    CONSTRUCTORS
-  }
-  _edata  =  .;
-  PROVIDE (edata = .);
-
-  . = .;
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-  . = .;
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) }
-  __stop___ex_table = .;
-
-  . = ALIGN(256);
-  __init_begin = .;
-  .text.init : { *(.text.init) }
-  .data.init : { *(.data.init) }
-  . = ALIGN(256);
-  __init_end = .;
-
-  __bss_start = .;
-  .bss (NOLOAD)       :
-  {
-   *(.sbss) *(.scommon)
-   *(.dynbss)
-   *(.bss)
-   *(COMMON)
-   . = ALIGN(4);
-  }
-  _end = . ;
-  PROVIDE (end = .);
-}
board/freescale/mpc8536ds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/mpc8540ads/u-boot.lds deleted +0 -146

146 lines not on this page · raw message

board/freescale/mpc8541cds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/mpc8544ds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/mpc8548cds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/mpc8555cds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/mpc8560ads/u-boot.lds deleted +0 -146

146 lines not on this page · raw message

board/freescale/mpc8568mds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/mpc8569mds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/mpc8572ds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/p1_p2_rdb/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/freescale/p2020ds/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/mpc8540eval/u-boot.lds deleted +0 -151

151 lines not on this page · raw message

board/pm854/u-boot.lds deleted +0 -146

146 lines not on this page · raw message

board/pm856/u-boot.lds deleted +0 -146

146 lines not on this page · raw message

board/sbc8548/u-boot.lds deleted +0 -145

145 lines not on this page · raw message

board/sbc8560/u-boot.lds deleted +0 -151

151 lines not on this page · raw message

board/socrates/u-boot.lds deleted +0 -149

149 lines not on this page · raw message

board/stx/stxgp3/u-boot.lds deleted +0 -153

153 lines not on this page · raw message

board/stx/stxssa/u-boot.lds deleted +0 -154

94 lines not on this page · raw message

board/tqc/tqm85xx/u-boot.lds deleted +0 -146

146 lines not on this page · raw message

board/xes/xpedite5200/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

board/xes/xpedite5370/u-boot.lds deleted +0 -143

143 lines not on this page · raw message

cpu/mpc85xx/config.mk +3 -0
index 2da4d53..beb3514 100644

Lines of this file are not shown. View the raw message.

cpu/mpc85xx/u-boot.lds new file +143 -0

143 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.0.6

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH v2 1/1 85xx: Move to a common linker script

Dear Kumar Gala,

Quoted 3 lines · In message <[email protected]> you…

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?

freescale/mpc8536ds/u-boot.lds renamed from atum8548/u-boot.lds +22 -22
@@ -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.".

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Our business is run on trust.  We trust you will pay in advance.
author
#2 lore raw

PATCH v2 1/1 85xx: Move to a common linker script

Quoted 10 lines · Wolfgang Denk

Dear Kumar Gala,

In message <[email protected]

Quoted 5 lines

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 <[email protected]>
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.

commit f0ff885ca64655bee6540eb8a25eed90b1152686

Author: Kumar Gala <[email protected]>
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)

Quoted 95 lines
freescale/mpc8536ds/u-boot.lds renamed from atum8548/u-boot.lds +0 -0

20:27:27.678455216 +0200

freescale/mpc8536ds/u-boot.lds renamed from atum8548/u-boot.lds +22 -22
@@ -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 = .);
 }
Quoted 4 lines

???

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

#3 lore raw

PATCH v2 1/1 85xx: Move to a common linker script

In reply to Kumar Gala

Dear Kumar Gala,

Quoted 6 lines · In message <[email protected]> you…

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.

---

This commit breaks building TQM85xx boards.

Before this commit:

	-> git-describe
	v2009.08-rc3-56-g87c7661
	-> ./MAKEALL TQM8555
	... TQM8555 (MPC8555)
	Configuring for TQM85xx board...
	   text    data     bss     dec     hex filename
	 220096   16140   34552  270788   421c4 ./u-boot

After this commit:

	-> git-describe
	v2009.08-rc3-57-gec79d33
	-> ./MAKEALL TQM8555
	... TQM8555 (MPC8555)
	Configuring for TQM85xx board...
	ppc_6xx-ld: u-boot: section .text lma 0xfffc0000 overlaps previous sections
	ppc_6xx-ld: u-boot: section .rodata lma 0xfffebe3c overlaps previous sections
	ppc_6xx-ld: u-boot: section .reloc lma 0xffff5a00 overlaps previous sections
	ppc_6xx-ld: u-boot: section .data lma 0xffff6fe8 overlaps previous sections
	ppc_6xx-ld: u-boot: section .data.rel.ro.local lma 0xffff7cbc overlaps previous sections
	ppc_6xx-ld: u-boot: section .data.rel lma 0xffff7d1c overlaps previous sections
	ppc_6xx-ld: u-boot: section .data.rel.local lma 0xffff86b8 overlaps previous sections
	ppc_6xx-ld: u-boot: section .u_boot_cmd lma 0xffff93e8 overlaps previous sections
	   text    data     bss     dec     hex filename
	 220096   16140   34552  270788   421c4 ./u-boot

Please help.

Best regards,

Wolfgang Denk

Signature · 8 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In the beginning, I was made. I didn't ask to be made. No one consul-
ted with me or considered my feelings  in  this  matter.  But  if  it
brought  some  passing fancy to some lowly humans as they haphazardly
pranced their way through life's mournful jungle, then so be it.
- Marvin the Paranoid Android