Simon Glass | 1865286 | 2013-03-05 14:39:37 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 27 | extern char _text[], _stext[], _etext[]; |
| 28 | extern char _data[], _sdata[], _edata[]; |
| 29 | extern char __bss_start[], __bss_stop[]; |
| 30 | extern char __init_begin[], __init_end[]; |
| 31 | extern char _sinittext[], _einittext[]; |
Simon Glass | a733b06 | 2013-04-26 02:53:43 +0000 | [diff] [blame] | 32 | extern char _end[], _init[]; |
Simon Glass | 1865286 | 2013-03-05 14:39:37 +0000 | [diff] [blame] | 33 | extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; |
| 34 | extern char __kprobes_text_start[], __kprobes_text_end[]; |
| 35 | extern char __entry_text_start[], __entry_text_end[]; |
| 36 | extern char __initdata_begin[], __initdata_end[]; |
| 37 | extern char __start_rodata[], __end_rodata[]; |
| 38 | |
| 39 | /* Start and end of .ctors section - used for constructor calls. */ |
| 40 | extern 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 |
| 51 | static inline int arch_is_kernel_text(unsigned long addr) |
| 52 | { |
| 53 | return 0; |
| 54 | } |
| 55 | #endif |
| 56 | |
| 57 | #ifndef arch_is_kernel_data |
| 58 | static 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 */ |
| 67 | extern char __text_start[]; |
| 68 | |
| 69 | /* This marks the end of the text region which must be relocated */ |
| 70 | extern 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 | */ |
| 76 | extern 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 */ |
| 90 | extern ulong _rel_dyn_start_ofs; |
| 91 | extern ulong _rel_dyn_end_ofs; |
| 92 | |
Simon Glass | 1865286 | 2013-03-05 14:39:37 +0000 | [diff] [blame] | 93 | /* End of the region to be relocated, as an offset form _start */ |
| 94 | extern ulong _image_copy_end_ofs; |
| 95 | |
| 96 | extern ulong _bss_start_ofs; /* BSS start relative to _start */ |
| 97 | extern ulong _bss_end_ofs; /* BSS end relative to _start */ |
| 98 | extern ulong _end_ofs; /* end of image relative to _start */ |
| 99 | |
| 100 | extern ulong _TEXT_BASE; /* code start */ |
| 101 | |
| 102 | #else /* don't use offsets: */ |
| 103 | |
| 104 | /* Exports from the Linker Script */ |
| 105 | extern ulong __data_end; |
| 106 | extern ulong __rel_dyn_start; |
| 107 | extern ulong __rel_dyn_end; |
| 108 | extern ulong __bss_end; |
| 109 | |
| 110 | extern ulong _TEXT_BASE; /* code start */ |
| 111 | |
| 112 | #endif |
| 113 | |
| 114 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ |