xref: /netbsd-src/external/gpl3/binutils/dist/ld/scripttempl/sh.sc (revision dd7241df2fae9da4ea2bd20a68f001fa86ecf909)
1# Copyright (C) 2014-2024 Free Software Foundation, Inc.
2#
3# Copying and distribution of this file, with or without modification,
4# are permitted in any medium without royalty provided the copyright
5# notice and this notice are preserved.
6
7TORS=".tors :
8  {
9    ___ctors = . ;
10    *(.ctors)
11    ___ctors_end = . ;
12    ___dtors = . ;
13    *(.dtors)
14    ___dtors_end = . ;
15  }${RELOCATING+ > ram}"
16
17cat <<EOF
18/* Copyright (C) 2014-2024 Free Software Foundation, Inc.
19
20   Copying and distribution of this script, with or without modification,
21   are permitted in any medium without royalty provided the copyright
22   notice and this notice are preserved.  */
23
24OUTPUT_FORMAT("${OUTPUT_FORMAT}")
25OUTPUT_ARCH(${ARCH})
26${LIB_SEARCH_DIRS}
27
28EOF
29
30test -n "${RELOCATING}" && cat <<EOF
31MEMORY
32{
33  ram : o = 0x1000, l = 512k
34}
35
36EOF
37
38cat <<EOF
39SECTIONS
40{
41  .text :
42  {
43    *(.text)
44    *(.strings)
45    ${RELOCATING+ _etext = . ; }
46  }
47  ${CONSTRUCTING+${TORS}}
48  .data  ${RELOCATING+ ALIGN(${TARGET_PAGE_SIZE})} :
49  {
50    *(.data)
51    ${RELOCATING+*(.gcc_exc*)}
52    ${RELOCATING+___EH_FRAME_BEGIN__ = . ;}
53    ${RELOCATING+*(.eh_fram*)}
54    ${RELOCATING+___EH_FRAME_END__ = . ;}
55    ${RELOCATING+LONG(0);}
56    ${RELOCATING+ _edata = . ; }
57  }
58  .bss ${RELOCATING+ ALIGN(${TARGET_PAGE_SIZE})} :
59  {
60    ${RELOCATING+ _bss_start = . ; }
61    *(.bss)
62    *(COMMON)
63    ${RELOCATING+ _end = . ;  }
64  }
65  .stack :
66  {
67    ${RELOCATING+ _stack = . ; }
68    *(.stack)
69  }
70  .stab 0 ${RELOCATING+(NOLOAD)} :
71  {
72    *(.stab)
73  }
74  .stabstr 0 ${RELOCATING+(NOLOAD)} :
75  {
76    *(.stabstr)
77  }
78}
79EOF
80
81
82
83
84