xref: /rk3399_rockchip-uboot/include/asm-generic/sections.h (revision 1865286466a5d0c7f2e3c37632da56556c838e9e)
1*18652864SSimon Glass /*
2*18652864SSimon Glass  * Copyright (c) 2011 The Chromium OS Authors.
3*18652864SSimon Glass  *
4*18652864SSimon Glass  * This program is free software; you can redistribute it and/or
5*18652864SSimon Glass  * modify it under the terms of the GNU General Public License as
6*18652864SSimon Glass  * published by the Free Software Foundation; either version 2 of
7*18652864SSimon Glass  * the License, or (at your option) any later version.
8*18652864SSimon Glass  *
9*18652864SSimon Glass  * This program is distributed in the hope that it will be useful,
10*18652864SSimon Glass  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*18652864SSimon Glass  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*18652864SSimon Glass  * GNU General Public License for more details.
13*18652864SSimon Glass  *
14*18652864SSimon Glass  * You should have received a copy of the GNU General Public License
15*18652864SSimon Glass  * along with this program; if not, write to the Free Software
16*18652864SSimon Glass  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17*18652864SSimon Glass  * MA 02111-1307 USA
18*18652864SSimon Glass  */
19*18652864SSimon Glass 
20*18652864SSimon Glass /* Taken from Linux kernel, commit f56c3196 */
21*18652864SSimon Glass 
22*18652864SSimon Glass #ifndef _ASM_GENERIC_SECTIONS_H_
23*18652864SSimon Glass #define _ASM_GENERIC_SECTIONS_H_
24*18652864SSimon Glass 
25*18652864SSimon Glass /* References to section boundaries */
26*18652864SSimon Glass 
27*18652864SSimon Glass extern char _text[], _stext[], _etext[];
28*18652864SSimon Glass extern char _data[], _sdata[], _edata[];
29*18652864SSimon Glass extern char __bss_start[], __bss_stop[];
30*18652864SSimon Glass extern char __init_begin[], __init_end[];
31*18652864SSimon Glass extern char _sinittext[], _einittext[];
32*18652864SSimon Glass extern char _end[];
33*18652864SSimon Glass extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[];
34*18652864SSimon Glass extern char __kprobes_text_start[], __kprobes_text_end[];
35*18652864SSimon Glass extern char __entry_text_start[], __entry_text_end[];
36*18652864SSimon Glass extern char __initdata_begin[], __initdata_end[];
37*18652864SSimon Glass extern char __start_rodata[], __end_rodata[];
38*18652864SSimon Glass 
39*18652864SSimon Glass /* Start and end of .ctors section - used for constructor calls. */
40*18652864SSimon Glass extern char __ctors_start[], __ctors_end[];
41*18652864SSimon Glass 
42*18652864SSimon Glass /* function descriptor handling (if any).  Override
43*18652864SSimon Glass  * in asm/sections.h */
44*18652864SSimon Glass #ifndef dereference_function_descriptor
45*18652864SSimon Glass #define dereference_function_descriptor(p) (p)
46*18652864SSimon Glass #endif
47*18652864SSimon Glass 
48*18652864SSimon Glass /* random extra sections (if any).  Override
49*18652864SSimon Glass  * in asm/sections.h */
50*18652864SSimon Glass #ifndef arch_is_kernel_text
51*18652864SSimon Glass static inline int arch_is_kernel_text(unsigned long addr)
52*18652864SSimon Glass {
53*18652864SSimon Glass 	return 0;
54*18652864SSimon Glass }
55*18652864SSimon Glass #endif
56*18652864SSimon Glass 
57*18652864SSimon Glass #ifndef arch_is_kernel_data
58*18652864SSimon Glass static inline int arch_is_kernel_data(unsigned long addr)
59*18652864SSimon Glass {
60*18652864SSimon Glass 	return 0;
61*18652864SSimon Glass }
62*18652864SSimon Glass #endif
63*18652864SSimon Glass 
64*18652864SSimon Glass /* U-Boot-specific things begin here */
65*18652864SSimon Glass 
66*18652864SSimon Glass /* Start of U-Boot text region */
67*18652864SSimon Glass extern char __text_start[];
68*18652864SSimon Glass 
69*18652864SSimon Glass /* This marks the end of the text region which must be relocated */
70*18652864SSimon Glass extern char __image_copy_end[];
71*18652864SSimon Glass 
72*18652864SSimon Glass /*
73*18652864SSimon Glass  * This is the U-Boot entry point - prior to relocation it should be same
74*18652864SSimon Glass  * as __text_start
75*18652864SSimon Glass  */
76*18652864SSimon Glass extern void _start(void);
77*18652864SSimon Glass 
78*18652864SSimon Glass /*
79*18652864SSimon Glass  * ARM needs to use offsets for symbols, since the values of some symbols
80*18652864SSimon Glass  * are not resolved prior to relocation (and are just 0). Maybe this can be
81*18652864SSimon Glass  * resolved, or maybe other architectures are similar, iwc this should be
82*18652864SSimon Glass  * promoted to an architecture option.
83*18652864SSimon Glass  */
84*18652864SSimon Glass #ifdef CONFIG_ARM
85*18652864SSimon Glass #define CONFIG_SYS_SYM_OFFSETS
86*18652864SSimon Glass #endif
87*18652864SSimon Glass 
88*18652864SSimon Glass #ifdef CONFIG_SYS_SYM_OFFSETS
89*18652864SSimon Glass /* Start/end of the relocation entries, as an offset from _start */
90*18652864SSimon Glass extern ulong _rel_dyn_start_ofs;
91*18652864SSimon Glass extern ulong _rel_dyn_end_ofs;
92*18652864SSimon Glass 
93*18652864SSimon Glass /* Start/end of the relocation symbol table, as an offset from _start */
94*18652864SSimon Glass extern ulong _dynsym_start_ofs;
95*18652864SSimon Glass 
96*18652864SSimon Glass /* End of the region to be relocated, as an offset form _start */
97*18652864SSimon Glass extern ulong _image_copy_end_ofs;
98*18652864SSimon Glass 
99*18652864SSimon Glass extern ulong _bss_start_ofs;	/* BSS start relative to _start */
100*18652864SSimon Glass extern ulong _bss_end_ofs;		/* BSS end relative to _start */
101*18652864SSimon Glass extern ulong _end_ofs;		/* end of image relative to _start */
102*18652864SSimon Glass 
103*18652864SSimon Glass extern ulong _TEXT_BASE;	/* code start */
104*18652864SSimon Glass 
105*18652864SSimon Glass #else /* don't use offsets: */
106*18652864SSimon Glass 
107*18652864SSimon Glass /* Exports from the Linker Script */
108*18652864SSimon Glass extern ulong __data_end;
109*18652864SSimon Glass extern ulong __rel_dyn_start;
110*18652864SSimon Glass extern ulong __rel_dyn_end;
111*18652864SSimon Glass extern ulong __bss_end;
112*18652864SSimon Glass 
113*18652864SSimon Glass extern ulong _TEXT_BASE;	/* code start */
114*18652864SSimon Glass 
115*18652864SSimon Glass #endif
116*18652864SSimon Glass 
117*18652864SSimon Glass #endif /* _ASM_GENERIC_SECTIONS_H_ */
118