1# Linker script for Itanium VMS systems.
2# Tristan Gingold <gingold@adacore.com>.
3#
4# Copyright (C) 2014-2021 Free Software Foundation, Inc.
5#
6# Copying and distribution of this file, with or without modification,
7# are permitted in any medium without royalty provided the copyright
8# notice and this notice are preserved.
9
10# Using an empty script for ld -r is better than mashing together
11# sections.  This hack likely leaves ld -Ur broken.
12test -n "${RELOCATING}" || exit 0
13
14PAGESIZE=0x10000
15BLOCKSIZE=0x200
16
17cat <<EOF
18/* Copyright (C) 2014-2021 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}")
25${LIB_SEARCH_DIRS}
26ENTRY(__entry)
27
28SECTIONS
29{
30  /* RW segment.  */
31  ${RELOCATING+. = ${PAGESIZE};}
32
33  \$DATA\$ ALIGN (${BLOCKSIZE}) : {
34    *(\$DATA\$ .data .data.*)
35    *(\$BSS\$ .bss .bss.*)
36  }
37
38  /* Code segment.  Note: name must be \$CODE\$ */
39  ${RELOCATING+. = ALIGN (${PAGESIZE});}
40
41  \$CODE\$ ALIGN (${BLOCKSIZE}) : {
42    *(\$CODE\$ .text .text.*)
43  }
44  .plt ALIGN (8) : {
45    *(.plt)
46  }
47
48  /* RO segment.  */
49  ${RELOCATING+. = ALIGN (${PAGESIZE});}
50
51  /* RO initialized data.  */
52  \$LITERAL\$ ALIGN (${BLOCKSIZE}) : {
53    *(\$LITERAL\$)
54    *(\$READONLY\$ .rodata .rodata.*)
55    *(.jcr)
56    *(.ctors)
57    *(.dtors)
58    *(.opd)
59    *(.gcc_except_table)
60
61    /* LIB$INITIALIZE stuff.  */
62    *(LIB\$INITIALIZDZ)	/* Start marker.  */
63    *(LIB\$INITIALIZD_)	/* Hi priority.  */
64    *(LIB\$INITIALIZE)	/* User.  */
65    *(LIB\$INITIALIZE$)	/* End marker.  */
66  }
67
68  /* Short segment.  */
69  ${RELOCATING+. = ALIGN (${PAGESIZE});}
70
71  .srodata : {
72    *(.srodata .srodata.*)
73  }
74  .got ALIGN (8) : {
75    *(.got)
76  }
77  .IA_64.pltoff ALIGN (16) : {
78    *(.IA_64.pltoff)
79  }
80  \$TFR\$ ALIGN (16) : {
81    /* Transfer vector.  */
82    __entry = .;
83    *(.transfer)
84  }
85
86  ${RELOCATING+. = ALIGN (${PAGESIZE});}
87
88  \$RW_SHORT\$ ALIGN (${BLOCKSIZE}) : {
89    *(.sdata .sdata.*)
90    *(.sbss .sbss.*)
91  }
92
93  ${RELOCATING+. = ALIGN (${PAGESIZE});}
94
95  .IA_64.unwind ALIGN (${BLOCKSIZE}) : {
96    *(.IA_64.unwind .IA_64.unwind.*)
97  }
98
99  .IA_64.unwind_info ALIGN (8) : {
100    *(.IA_64.unwind_info .IA_64.unwind_info.*)
101  }
102
103  ${RELOCATING+. = ALIGN (${PAGESIZE});}
104
105  .dynamic /* \$DYNAMIC\$ */ ALIGN (${BLOCKSIZE}) : {
106    *(.dynamic)
107    *(.vmsdynstr)
108    *(.fixups)
109  }
110
111  ${RELOCATING+. = ALIGN (${PAGESIZE});}
112
113  .dynstr : { *(.dynstr) }
114
115  .dynsym       ${RELOCATING-0} : { *(.dynsym) }
116  .rela.got : { *(.rela.got) }
117  .got.plt : { *(.got.plt) }
118  .gnu.version_d : { *(.gnu.version_d) }
119  .gnu.version : { *(.gnu.version) }
120  .gnu.version_r : { *(.gnu.version_r) }
121  .rela.IA_64.pltoff : { *(.rela.IA_64.pltoff) }
122
123EOF
124
125. $srcdir/scripttempl/DWARF.sc
126
127cat <<EOF
128  .note : { *(.vms.note) }
129
130  /DISCARD/ : { *(.note) *(.vms_display_name_info) }
131}
132EOF
133