]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - ld/scripttempl/mmo.sc
Include compressed DWARF debug sections in ELF linker scripts.
[thirdparty/binutils-gdb.git] / ld / scripttempl / mmo.sc
1 # MMO is not a relocateable format, and we don't want to require an
2 # explicit (e.g.) "-m elf64mmix" when -r is used.
3 test -z $RELOCATEABLE_OUTPUT_FORMAT && RELOCATEABLE_OUTPUT_FORMAT=$OUTPUT_FORMAT
4 test -z ${RELOCATING+0} && OUTPUT_FORMAT=$RELOCATEABLE_OUTPUT_FORMAT
5 cat <<EOF
6 OUTPUT_FORMAT("$OUTPUT_FORMAT")
7 OUTPUT_ARCH(mmix)
8 ${RELOCATING+ENTRY(Main)}
9 SECTIONS
10 {
11 .text ${RELOCATING+ ${TEXT_START_ADDR}}:
12 {
13 *(.text)
14 ${RELOCATING+*(.text.*)}
15 ${RELOCATING+*(.gnu.linkonce.t*)}
16 ${RELOCATING+*(.rodata)}
17 ${RELOCATING+*(.rodata.*)}
18 ${RELOCATING+*(.gnu.linkonce.r*)}
19
20 /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections. */
21 ${RELOCATING+ PROVIDE (_init_start = .);}
22 ${RELOCATING+ PROVIDE (_init = .);}
23 ${RELOCATING+ KEEP (*(.init))}
24 ${RELOCATING+ PROVIDE (_init_end = .);}
25
26 ${RELOCATING+ PROVIDE (_fini_start = .);}
27 ${RELOCATING+ PROVIDE (_fini = .);}
28 ${RELOCATING+ KEEP (*(.fini))}
29 ${RELOCATING+ PROVIDE (_fini_end = .);}
30
31 /* FIXME: Align ctors, dtors, ehframe. */
32 ${RELOCATING+ PROVIDE (_ctors_start = .);}
33 ${RELOCATING+ PROVIDE (__ctors_start = .);}
34 ${RELOCATING+ PROVIDE (_ctors = .);}
35 ${RELOCATING+ PROVIDE (__ctors = .);}
36 ${RELOCATING+ KEEP (*crtbegin.o(.ctors))}
37 ${RELOCATING+ KEEP (*crtbegin?.o(.ctors))}
38 ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
39 ${RELOCATING+ KEEP (*(SORT(.ctors.*)))}
40 ${RELOCATING+ KEEP (*(.ctors))}
41 ${RELOCATING+ PROVIDE (_ctors_end = .);}
42 ${RELOCATING+ PROVIDE (__ctors_end = .);}
43
44 ${RELOCATING+ PROVIDE (_dtors_start = .);}
45 ${RELOCATING+ PROVIDE (__dtors_start = .);}
46 ${RELOCATING+ PROVIDE (_dtors = .);}
47 ${RELOCATING+ PROVIDE (__dtors = .);}
48 ${RELOCATING+ KEEP (*crtbegin.o(.dtors))}
49 ${RELOCATING+ KEEP (*crtbegin?.o(.dtors))}
50 ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
51 ${RELOCATING+ KEEP (*(SORT(.dtors.*)))}
52 ${RELOCATING+ KEEP (*(.dtors))}
53 ${RELOCATING+ PROVIDE (_dtors_end = .);}
54 ${RELOCATING+ PROVIDE (__dtors_end = .);}
55
56 ${RELOCATING+KEEP (*(.jcr))}
57 ${RELOCATING+KEEP (*(.eh_frame))}
58 ${RELOCATING+*(.gcc_except_table)}
59
60 ${RELOCATING+ PROVIDE(etext = .);}
61 ${RELOCATING+ PROVIDE(_etext = .);}
62 ${RELOCATING+ PROVIDE(__etext = .);}
63 ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : ADDR (.text));}
64 }
65
66 .stab 0 : { *(.stab) }
67 .stabstr 0 : { *(.stabstr) }
68 .stab.excl 0 : { *(.stab.excl) }
69 .stab.exclstr 0 : { *(.stab.exclstr) }
70 .stab.index 0 : { *(.stab.index) }
71 .stab.indexstr 0 : { *(.stab.indexstr) }
72 .debug_aranges 0 : { *(.debug_aranges .zdebug_aranges) }
73 .debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames) }
74 .debug_info 0 : { *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*} .zdebug_info) }
75 .debug_abbrev 0 : { *(.debug_abbrev .zdebug_abbrev) }
76 .debug_line 0 : { *(.debug_line .zdebug_line) }
77 .debug_frame 0 : { *(.debug_frame .zdebug_frame) }
78 .debug_str 0 : { *(.debug_str .zdebug_str) }
79 .debug_loc 0 : { *(.debug_loc .zdebug_loc) }
80 .debug_macinfo 0 : { *(.debug_macinfo .zdebug_macinfo) }
81 .debug_ranges 0 : { *(.debug_ranges .zdebug_ranges) }
82
83 .data ${RELOCATING+ ${DATA_ADDR}}:
84 {
85 ${RELOCATING+ PROVIDE(__Sdata = .);}
86
87 *(.data);
88 ${RELOCATING+*(.data.*)}
89 ${RELOCATING+*(.gnu.linkonce.d*)}
90
91 ${RELOCATING+ PROVIDE(__Edata = .);}
92
93 /* Deprecated, use __Edata. */
94 ${RELOCATING+ PROVIDE(edata = .);}
95 ${RELOCATING+ PROVIDE(_edata = .);}
96 ${RELOCATING+ PROVIDE(__edata = .);}
97 }
98
99 /* At the moment, although perhaps we should, we can't map sections
100 without contents to sections *with* contents due to FIXME: a BFD bug.
101 Anyway, the mmo back-end ignores sections without contents when
102 writing out sections, so this works fine. */
103 .bss :
104 {
105 ${RELOCATING+ PROVIDE(__Sbss = .);}
106 ${RELOCATING+ PROVIDE(__bss_start = .);}
107 ${RELOCATING+ *(.sbss);}
108 ${RELOCATING+ *(.bss);}
109 ${RELOCATING+*(.bss.*)}
110 ${RELOCATING+ *(COMMON);}
111 ${RELOCATING+ PROVIDE(__Ebss = .);}
112 }
113
114 /* Deprecated, use __Ebss or __Eall as appropriate. */
115 ${RELOCATING+ PROVIDE(end = .);}
116 ${RELOCATING+ PROVIDE(_end = .);}
117 ${RELOCATING+ PROVIDE(__end = .);}
118 ${RELOCATING+ PROVIDE(__Eall = .);}
119
120 .MMIX.reg_contents :
121 {
122 /* Note that this section always has a fixed VMA - that of its
123 first register * 8. */
124 *(.MMIX.reg_contents.linker_allocated);
125 *(.MMIX.reg_contents);
126 }
127
128 /* By default, put the high end of the stack where the register stack
129 begins. They grow in opposite directions. */
130 PROVIDE (__Stack_start = 0x6000000000000000);
131
132 /* Unfortunately, stabs are not mappable from ELF to MMO.
133 It can probably be fixed with some amount of work. */
134 /DISCARD/ :
135 { ${RELOCATING+ *(.gnu.warning.*);} }
136 }
137 EOF