xref: /optee_os/ta/arch/arm/ta.ld.S (revision 41e5aa8f18c4d48083341ff3df9e75f0c77cf703)
1#ifdef ARM32
2OUTPUT_FORMAT("elf32-littlearm")
3OUTPUT_ARCH(arm)
4#define MCOUNT_SYM __gnu_mcount_nc
5/*
6 * This magic value corresponds to the size requested by
7 * libutee/arch/arm/gprof/gprof.c
8 */
9#define GPROF_BUF_MULT(x) ((x) * 136) / 100
10#endif
11#ifdef ARM64
12OUTPUT_FORMAT("elf64-littleaarch64")
13OUTPUT_ARCH(aarch64)
14#define MCOUNT_SYM _mcount
15#define GPROF_BUF_MULT(x) ((x) * 177) / 100
16#endif
17
18SECTIONS {
19	.ta_head : {*(.ta_head)}
20	.text : {
21		__text_start = .;
22		*(.text .text.*)
23		*(.stub)
24		*(.glue_7)
25		*(.glue_7t)
26		*(.gnu.linkonce.t.*)
27		/* Workaround for an erratum in ARM's VFP11 coprocessor */
28		*(.vfp11_veneer)
29		__text_end = .;
30	}
31        .plt : { *(.plt) }
32
33	.eh_frame : { *(.eh_frame) }
34	.rodata : {
35		*(.gnu.linkonce.r.*)
36		*(.rodata .rodata.*)
37	}
38	/* .ARM.exidx is sorted, so has to go in its own output section.  */
39	.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
40        .ctors : { *(.ctors) }
41        .dtors : { *(.dtors) }
42	.dynsym : { *(.dynsym) }
43	.dynstr : { *(.dynstr) }
44	.hash : { *(.hash) }
45
46	/* Page align to allow dropping execute bit for RW data */
47	. = ALIGN(4096);
48
49	.got : { *(.got.plt) *(.got) }
50	.rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
51	.rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
52	.rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
53	.rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
54	.rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
55	.rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
56	.rel.dyn : { *(.rel.dyn) }
57	.rel.got : { *(.rel.got) }
58	.rela.got : { *(.rela.got) }
59	.rel.ctors : { *(.rel.ctors) }
60	.rela.ctors : { *(.rela.ctors) }
61	.rel.dtors : { *(.rel.dtors) }
62	.rela.dtors : { *(.rela.dtors) }
63	.rel.init : { *(.rel.init) }
64	.rela.init : { *(.rela.init) }
65	.rel.fini : { *(.rel.fini) }
66	.rela.fini : { *(.rela.fini) }
67	.rel.bss : { *(.rel.bss) }
68	.rela.bss : { *(.rela.bss) }
69	.rel.plt : { *(.rel.plt) }
70	.rela.plt : { *(.rela.plt) }
71	.dynamic : { *(.dynamic) }
72
73	.data : { *(.data .data.* .gnu.linkonce.d.*) }
74	.bss : {
75		*(.bss .bss.* .gnu.linkonce.b.* COMMON)
76
77		/*
78		 * TA profiling with gprof
79		 * Reserve some space for the profiling buffer, only if the
80		 * TA is instrumented (i.e., some files were built with -pg).
81		 * This also provides a way to detect at runtime if the TA is
82		 * instrumented or not.
83		 */
84		. = ALIGN(8);
85		__gprof_buf_start = .;
86		. += DEFINED(MCOUNT_SYM) ?
87			GPROF_BUF_MULT(__text_end - __text_start) : 0;
88		__gprof_buf_end = .;
89	}
90
91	/DISCARD/ : { *(.interp) }
92}
93
94