Prepare v2023.10
[platform/kernel/u-boot.git] / arch / powerpc / cpu / mpc85xx / u-boot.lds
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2007-2009, 2011 Freescale Semiconductor, Inc.
4  */
5
6 #include "config.h"
7
8 #ifdef CFG_RESET_VECTOR_ADDRESS
9 #define RESET_VECTOR_ADDRESS    CFG_RESET_VECTOR_ADDRESS
10 #else
11 #define RESET_VECTOR_ADDRESS    0xfffffffc
12 #endif
13
14 OUTPUT_ARCH(powerpc)
15 ENTRY(_start)
16
17 SECTIONS
18 {
19   /* Optional boot sector */
20 #if defined(CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR) && !defined(CONFIG_SPL)
21   .bootsect CONFIG_TEXT_BASE - CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR_DATA * 512 : {
22     KEEP(arch/powerpc/cpu/mpc85xx/start.o (.bootsect))
23     . = CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR_DATA * 512;
24   }
25 #endif
26
27   /* Read-only sections, merged into text segment: */
28   .text      :
29   {
30 #if CONFIG_IS_ENABLED(SYS_MPC85XX_NO_RESETVEC)
31     KEEP(arch/powerpc/cpu/mpc85xx/start.o (.bootpg))
32 #endif
33     *(.text*)
34   }
35     _etext = .;
36     PROVIDE (etext = .);
37     .rodata    :
38    {
39     *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
40   }
41
42   /* Read-write section, merged into data segment: */
43   . = (. + 0x00FF) & 0xFFFFFF00;
44   _erotext = .;
45   PROVIDE (erotext = .);
46   .reloc   :
47   {
48     _GOT2_TABLE_ = .;
49     KEEP(*(.got2))
50     KEEP(*(.got))
51     _FIXUP_TABLE_ = .;
52     KEEP(*(.fixup))
53   }
54   __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
55   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
56
57   .data    :
58   {
59     *(.data*)
60     *(.sdata*)
61   }
62   _edata  =  .;
63   PROVIDE (edata = .);
64
65   . = .;
66
67   . = ALIGN(4);
68   __u_boot_list : {
69         KEEP(*(SORT(__u_boot_list*)));
70   }
71
72   . = .;
73   __start___ex_table = .;
74   __ex_table : { *(__ex_table) }
75   __stop___ex_table = .;
76
77   . = ALIGN(4);
78   __init_begin = .;
79   .text.init : { *(.text.init) }
80   .data.init : { *(.data.init) }
81   . = ALIGN(4);
82   __init_end = .;
83   _end = .;
84
85 #if !CONFIG_IS_ENABLED(SYS_MPC85XX_NO_RESETVEC)
86   .bootpg RESET_VECTOR_ADDRESS - 0xffc :
87   {
88     arch/powerpc/cpu/mpc85xx/start.o    (.bootpg)
89   } = 0xffff
90
91   .resetvec RESET_VECTOR_ADDRESS :
92   {
93     KEEP(*(.resetvec))
94   } = 0xffff
95
96   . = RESET_VECTOR_ADDRESS + 0x4;
97
98   /*
99    * Make sure that the bss segment isn't linked at 0x0, otherwise its
100    * address won't be updated during relocation fixups.  Note that
101    * this is a temporary fix.  Code to dynamically the fixup the bss
102    * location will be added in the future.  When the bss relocation
103    * fixup code is present this workaround should be removed.
104    */
105 #if (RESET_VECTOR_ADDRESS == 0xfffffffc)
106   . |= 0x10;
107 #endif
108 #endif
109
110   __bss_start = .;
111   .bss (NOLOAD)       :
112   {
113    *(.sbss*)
114    *(.bss*)
115    *(COMMON)
116   }
117
118   . = ALIGN(4);
119   __bss_end = . ;
120   PROVIDE (end = .);
121 }