1/*
2Copyright (c) 2017, The Linux Foundation. All rights reserved.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions are
6met:
7    * Redistributions of source code must retain the above copyright
8      notice, this list of conditions and the following disclaimer.
9    * Redistributions in binary form must reproduce the above
10      copyright notice, this list of conditions and the following
11      disclaimer in the documentation and/or other materials provided
12      with the distribution.
13    * Neither the name of The Linux Foundation nor the names of its
14      contributors may be used to endorse or promote products derived
15      from this software without specific prior written permission.
16
17THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30OUTPUT_FORMAT("elf32-littlehexagon", "elf32-bighexagon",
31	      "elf32-littlehexagon")
32OUTPUT_ARCH(hexagon)
33
34PHDRS {
35phdr1 PT_LOAD;
36phdr2 PT_LOAD;
37dynamic1 PT_DYNAMIC;
38note1 PT_NOTE;
39}
40
41ENTRY(start)
42SECTIONS
43{
44  .interp         : { *(.interp) }
45  .note.qti.uimg.dl.ver : { *(.note.qti.uimg.dl.ver) } : phdr1 : note1
46  .dynsym         :  { *(.dynsym) } : phdr1
47  .dynstr         :  { *(.dynstr) }
48  .hash           :  { *(.hash) }
49  .rela.dyn       :
50  {
51      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
52      *(.rela.fini)
53      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
54      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
55      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
56      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
57      *(.rela.ctors)
58      *(.rela.dtors)
59      *(.rela.got)
60      *(.rela.sdata .rela.lit[a48] .rela.sdata.* .rela.lit[a48].* .rela.gnu.linkonce.s.* .rela.gnu.linkonce.l[a48].*)
61      *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
62      *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
63      *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
64      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
65  }
66  .rela.plt       :
67  {
68      *(.rela.plt)
69  } : phdr1
70  . = ALIGN(64);
71  /* Code starts. */
72  .start          :
73  {
74    KEEP (*(.start))
75  } =0x00c0007f
76  . = ALIGN(64);
77  .init           :
78  {
79    KEEP (*(.init))
80  } =0x00c0007f
81  .plt            :  { *(.plt) }
82  . = ALIGN (64);
83  .text           :
84  {
85    *(.text.unlikely .text.*_unlikely)
86    *(.text.hot .text.hot.* .gnu.linkonce.t.hot.*)
87    *(.text .stub .text.* .gnu.linkonce.t.*)
88  } =0x00c0007f
89  .fini           :
90  {
91    KEEP (*(.fini))
92  } =0x00c0007f
93  PROVIDE (__etext = .);
94  PROVIDE (_etext = .);
95  PROVIDE (etext = .);
96  . = ALIGN(64);
97  /* Constants start. */
98  .rodata         :
99  {
100    *(.rodata.hot .rodata.hot.* .gnu.linkonce.r.hot.*)
101    *(.rodata .rodata.* .gnu.linkonce.r.*)
102  }
103  .eh_frame_hdr   :  { *(.eh_frame_hdr) }
104  .eh_frame       :   { KEEP (*(.eh_frame)) }
105  .gcc_except_table   :  { *(.gcc_except_table .gcc_except_table.*) }
106  _DYNAMIC = .;
107  .dynamic        :  { *(.dynamic) } : phdr1 : dynamic1
108  .got            :  { *(.got) *(.igot) } : phdr1
109  .got.plt        :  { *(.got.plt)  *(.igot.plt) }
110  . = ALIGN(64);
111  .ctors          :
112  {
113    KEEP (*crtbegin.o(.ctors))
114    KEEP (*crtbegin?.o(.ctors))
115    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o fini.o) .ctors))
116    KEEP (*(SORT(.ctors.*)))
117    KEEP (*(.ctors))
118  }
119  .dtors          :
120  {
121    KEEP (*crtbegin.o(.dtors))
122    KEEP (*crtbegin?.o(.dtors))
123    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o fini.o) .dtors))
124    KEEP (*(SORT(.dtors.*)))
125    KEEP (*(.dtors))
126  }
127  /*. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
128  . = ALIGN (DEFINED (DATAALIGN) ? (DATAALIGN * 1K) : CONSTANT (MAXPAGESIZE));*/
129  . = DATA_SEGMENT_RELRO_END (16, .);
130  . = ALIGN (4K);
131  .data           :
132  {
133    *(.data.hot .data.hot.* .gnu.linkonce.d.hot.*)
134    *(.data .data.* .gnu.linkonce.d.*)
135    SORT(CONSTRUCTORS)
136  } : phdr2
137  _edata = .; PROVIDE (edata = .);
138  . = ALIGN (64);
139  /* Small data start. */
140  . = ALIGN(64);
141  .sdata          :
142  {
143    PROVIDE (_SDA_BASE_ = .);
144    *(.sdata.1 .sdata.1.* .gnu.linkonce.s.1.*)
145    *(.sbss.1 .sbss.1.* .gnu.linkonce.sb.1.*)
146    *(.scommon.1 .scommon.1.*)
147    *(.sdata.2 .sdata.2.* .gnu.linkonce.s.2.*)
148    *(.sbss.2 .sbss.2.* .gnu.linkonce.sb.2.*)
149    *(.scommon.2 .scommon.2.*)
150    *(.sdata.4 .sdata.4.* .gnu.linkonce.s.4.*)
151    *(.sbss.4 .sbss.4.* .gnu.linkonce.sb.4.*)
152    *(.scommon.4 .scommon.4.*)
153    *(.lit[a4] .lit[a4].* .gnu.linkonce.l[a4].*)
154    *(.sdata.8 .sdata.8.* .gnu.linkonce.s.8.*)
155    *(.sbss.8 .sbss.8.* .gnu.linkonce.sb.8.*)
156    *(.scommon.8 .scommon.8.*)
157    *(.lit8 .lit8.* .gnu.linkonce.l8.*)
158    *(.sdata.hot .sdata.hot.* .gnu.linkonce.s.hot.*)
159    *(.sdata .sdata.* .gnu.linkonce.s.*)
160  }
161  .sbss           :
162  {
163    PROVIDE (__sbss_start = .);
164    PROVIDE (___sbss_start = .);
165    *(.dynsbss)
166    *(.sbss.hot .sbss.hot.* .gnu.linkonce.sb.hot.*)
167    *(.sbss .sbss.* .gnu.linkonce.sb.*)
168    *(.scommon .scommon.*)
169    . = ALIGN (. != 0 ? 64 : 1);
170    PROVIDE (__sbss_end = .);
171    PROVIDE (___sbss_end = .);
172  }
173  . = ALIGN (64);
174  __bss_start = .;
175  .bss            :
176  {
177   *(.dynbss)
178   *(.bss.hot .bss.hot.* .gnu.linkonce.b.hot.*)
179   *(.bss .bss.* .gnu.linkonce.b.*)
180   *(COMMON)
181  }
182  . = ALIGN (64);
183  _end = .;
184  PROVIDE (end = .);
185  .comment       0 :  { *(.comment) }
186  /* DWARF debug sections.
187     Symbols in the DWARF debugging sections are relative to the beginning
188     of the section so we begin them at 0.  */
189  /* DWARF 1 */
190  .debug          0 :  { *(.debug) }
191  .line           0 :  { *(.line) }
192  .debug_aranges  0 :  { *(.debug_aranges) }
193  .debug_pubnames 0 :  { *(.debug_pubnames) }
194  /* DWARF 2 */
195  .debug_info     0 :  { *(.debug_info .gnu.linkonce.wi.*) }
196  .debug_abbrev   0 :  { *(.debug_abbrev) }
197  .debug_line     0 :  { *(.debug_line) }
198  .debug_frame    0 :  { *(.debug_frame) }
199  .debug_str      0 :  { *(.debug_str) }
200  .debug_loc      0 :  { *(.debug_loc) }
201  /* DWARF 3 */
202  .debug_pubtypes 0 :  { *(.debug_pubtypes) }
203  .debug_ranges   0 :  { *(.debug_ranges) }
204  /DISCARD/       :  { *(.note.GNU-stack) *(.gnu_debuglink) }
205}
206