1OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")
2OUTPUT_ARCH(aarch64)
3
4PHDRS {
5	/*
6	 * Exec and rodata headers are hard coded to RX and RO
7	 * respectively. This is needed because the binary is relocatable
8	 * and the linker would automatically make any header writeable
9	 * that need to be updated during relocation.
10	 */
11	exec PT_LOAD FLAGS (5);		/* RX */
12	rodata PT_LOAD FLAGS (4);	/* RO */
13	rwdata PT_LOAD;
14	dyn PT_DYNAMIC;
15}
16
17SECTIONS {
18	.ta_head : {*(.ta_head)} :exec
19	.text : {
20		__text_start = .;
21		*(.text .text.*)
22		*(.stub)
23		*(.glue_7)
24		*(.glue_7t)
25		*(.gnu.linkonce.t.*)
26		/* Workaround for an erratum in ARM's VFP11 coprocessor */
27		*(.vfp11_veneer)
28		PROVIDE(__gnu_mcount_nc = __utee_mcount);
29		__text_end = .;
30	}
31        .plt : { *(.plt) }
32
33	.eh_frame : { *(.eh_frame) } :rodata
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	.rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
43	.rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
44	.rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
45	.rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
46	.rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
47	.rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
48	.rel.dyn : { *(.rel.dyn) }
49	.rel.got : { *(.rel.got) }
50	.rela.got : { *(.rela.got) }
51	.rel.ctors : { *(.rel.ctors) }
52	.rela.ctors : { *(.rela.ctors) }
53	.rel.dtors : { *(.rel.dtors) }
54	.rela.dtors : { *(.rela.dtors) }
55	.rel.init : { *(.rel.init) }
56	.rela.init : { *(.rela.init) }
57	.rel.fini : { *(.rel.fini) }
58	.rela.fini : { *(.rela.fini) }
59	.rel.bss : { *(.rel.bss) }
60	.rela.bss : { *(.rela.bss) }
61	.rel.plt : { *(.rel.plt) }
62	.rela.plt : { *(.rela.plt) }
63	.dynamic : { *(.dynamic) } :dyn :rodata
64	.dynsym : { *(.dynsym) } :rodata
65	.dynstr : { *(.dynstr) }
66	.hash : { *(.hash) }
67
68	/* Page align to allow dropping execute bit for RW data */
69	. = ALIGN(4096);
70
71	.data : { *(.data .data.* .gnu.linkonce.d.*) } :rwdata
72	.got : { *(.got.plt) *(.got) }
73	.bss : {
74		*(.bss .bss.* .gnu.linkonce.b.* COMMON)
75
76		/*
77		 * TA profiling with gprof
78		 * Reserve some space for the profiling buffer, only if the
79		 * TA is instrumented (i.e., some files were built with -pg).
80		 * Note that PROVIDE() above defines a symbol only if it is
81		 * referenced in the object files.
82		 * This also provides a way to detect at runtime if the TA is
83		 * instrumented or not.
84		 */
85		. = ALIGN(8);
86		__gprof_buf_start = .;
87		__gprof_buf_end = .;
88	}
89
90	/DISCARD/ : { *(.interp) }
91}
92
93