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