]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/powerpc/cpu/mpc85xx/u-boot.lds
PowerPC: Add relocation support for -fpic
[karo-tx-uboot.git] / arch / powerpc / cpu / mpc85xx / u-boot.lds
1 /*
2  * Copyright 2007-2009 Freescale Semiconductor, Inc.
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20  * MA 02111-1307 USA
21  */
22
23 #ifndef RESET_VECTOR_ADDRESS
24 #define RESET_VECTOR_ADDRESS    0xfffffffc
25 #endif
26
27 OUTPUT_ARCH(powerpc)
28
29 PHDRS
30 {
31   text PT_LOAD;
32   bss PT_LOAD;
33 }
34
35 SECTIONS
36 {
37   /* Read-only sections, merged into text segment: */
38   . = + SIZEOF_HEADERS;
39   .interp : { *(.interp) }
40   .text      :
41   {
42     *(.text*)
43    } :text
44     _etext = .;
45     PROVIDE (etext = .);
46     .rodata    :
47    {
48     *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
49   } :text
50
51   /* Read-write section, merged into data segment: */
52   . = (. + 0x00FF) & 0xFFFFFF00;
53   _erotext = .;
54   PROVIDE (erotext = .);
55   .reloc   :
56   {
57     _GOT2_TABLE_ = .;
58     KEEP(*(.got2))
59     KEEP(*(.got))
60     PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
61     _FIXUP_TABLE_ = .;
62     KEEP(*(.fixup))
63   }
64   __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
65   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
66
67   .data    :
68   {
69     *(.data*)
70     *(.sdata*)
71   }
72   _edata  =  .;
73   PROVIDE (edata = .);
74
75   . = .;
76   __u_boot_cmd_start = .;
77   .u_boot_cmd : { *(.u_boot_cmd) }
78   __u_boot_cmd_end = .;
79
80   . = .;
81   __start___ex_table = .;
82   __ex_table : { *(__ex_table) }
83   __stop___ex_table = .;
84
85   . = ALIGN(256);
86   __init_begin = .;
87   .text.init : { *(.text.init) }
88   .data.init : { *(.data.init) }
89   . = ALIGN(256);
90   __init_end = .;
91
92   .bootpg RESET_VECTOR_ADDRESS - 0xffc :
93   {
94     arch/powerpc/cpu/mpc85xx/start.o    (.bootpg)
95   } :text = 0xffff
96
97   .resetvec RESET_VECTOR_ADDRESS :
98   {
99     KEEP(*(.resetvec))
100   } :text = 0xffff
101
102   . = RESET_VECTOR_ADDRESS + 0x4;
103
104   /*
105    * Make sure that the bss segment isn't linked at 0x0, otherwise its
106    * address won't be updated during relocation fixups.  Note that
107    * this is a temporary fix.  Code to dynamically the fixup the bss
108    * location will be added in the future.  When the bss relocation
109    * fixup code is present this workaround should be removed.
110    */
111 #if (RESET_VECTOR_ADDRESS == 0xfffffffc)
112   . |= 0x10;
113 #endif
114
115   __bss_start = .;
116   .bss (NOLOAD)       :
117   {
118    *(.sbss*)
119    *(.bss*)
120    *(COMMON)
121   } :bss
122
123   . = ALIGN(4);
124   _end = . ;
125   PROVIDE (end = .);
126 }