altos/stm32f4: Place ARM.exidx sections after .text
[fw/altos] / src / stm32f4 / altos-raw.ld
1 /*
2  * Copyright © 2018 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18
19 MEMORY {
20         rom (rx) :   ORIGIN = 0x08000000, LENGTH = 1M
21         ram (!w) :   ORIGIN = 0x20000000, LENGTH = 256k - 256
22         stack (!w) : ORIGIN = 0x20000000 + 256k - 256, LENGTH = 256
23 }
24
25 INCLUDE registers.ld
26
27 EXTERN (stm_interrupt_vector)
28
29 SECTIONS {
30         /*
31          * Rom contents
32          */
33
34         .interrupt : {
35                 __text_start__ = .;
36                 *(.interrupt)   /* Interrupt vectors */
37         } > rom
38
39         .text : {
40                 *(.text*)       /* Executable code */
41                 *(.rodata*)     /* Constants */
42         } > rom
43
44         .exidx : {
45                 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
46         } > rom
47
48         __text_end__ = .;
49
50         /* Data -- relocated to RAM, but written to ROM
51          */
52         .data : {
53                 _start__ = .;
54                 *(.data)        /* initialized data */
55                 . = ALIGN(4);
56                 _end__ = .;
57         } >ram AT>rom
58
59         .bss : {
60                 __bss_start__ = .;
61                 *(.bss)
62                 *(COMMON)
63                 . = ALIGN(4);
64                 __bss_end__ = .;
65         } >ram
66
67         PROVIDE(end = .);
68
69         PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack));
70 }
71
72 ENTRY(start);
73
74