1# Linker script for i386 go32 (DJGPP)
2
3test -z "$ENTRY" && ENTRY=start
4EXE=${CONSTRUCTING+${RELOCATING+-exe}}
5
6# These are substituted in as variables in order to get '}' in a shell
7# conditional expansion.
8CTOR='.ctor : {
9    *(SORT(.ctors.*))
10    *(.ctor)
11  }'
12DTOR='.dtor : {
13    *(SORT(.dtors.*))
14    *(.dtor)
15  }'
16
17cat <<EOF
18OUTPUT_FORMAT("${OUTPUT_FORMAT}${EXE}")
19
20ENTRY(${ENTRY})
21
22SECTIONS
23{
24  .text ${RELOCATING+ ${TARGET_PAGE_SIZE}+SIZEOF_HEADERS} : {
25    *(.text)
26    ${RELOCATING+*(.text.*)}
27    ${RELOCATING+*(.gnu.linkonce.t*)}
28    *(.const*)
29    *(.ro*)
30    ${RELOCATING+*(.gnu.linkonce.r*)}
31    ${RELOCATING+etext  =  . ; PROVIDE(_etext = .) ;}
32    ${RELOCATING+. = ALIGN(${SEGMENT_SIZE});}
33  }
34  .data ${RELOCATING+ ${DATA_ALIGNMENT}} : {
35    ${RELOCATING+djgpp_first_ctor = . ;
36    *(SORT(.ctors.*))
37    *(.ctor)
38    djgpp_last_ctor = . ;}
39    ${RELOCATING+djgpp_first_dtor = . ;
40    *(SORT(.dtors.*))
41    *(.dtor)
42    djgpp_last_dtor = . ;}
43    *(.data)
44    ${RELOCATING+*(.data.*)}
45
46    ${RELOCATING+*(.gcc_exc*)}
47    ${RELOCATING+___EH_FRAME_BEGIN__ = . ;}
48    ${RELOCATING+*(.eh_fram*)}
49    ${RELOCATING+___EH_FRAME_END__ = . ;}
50    ${RELOCATING+LONG(0);}
51
52    ${RELOCATING+*(.gnu.linkonce.d*)}
53    ${RELOCATING+edata  =  . ; PROVIDE(_edata = .) ;}
54    ${RELOCATING+. = ALIGN(${SEGMENT_SIZE});}
55  }
56  ${CONSTRUCTING+${RELOCATING-$CTOR}}
57  ${CONSTRUCTING+${RELOCATING-$DTOR}}
58  .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
59  {
60    *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
61    *(COMMON)
62    ${RELOCATING+ end = . ; PROVIDE(_end = .) ;}
63    ${RELOCATING+ . = ALIGN(${SEGMENT_SIZE});}
64  }
65  /* Stabs debugging sections.  */
66  .stab 0 : { *(.stab) }
67  .stabstr 0 : { *(.stabstr) }
68  /* DWARF 2 */
69  .debug_aranges  0 : { *(.debug_aranges) }
70  .debug_pubnames 0 : { *(.debug_pubnames) }
71  .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
72  .debug_abbrev   0 : { *(.debug_abbrev) }
73  .debug_line     0 : { *(.debug_line) }
74  .debug_frame    0 : { *(.debug_frame) }
75  .debug_str      0 : { *(.debug_str) }
76  .debug_loc      0 : { *(.debug_loc) }
77  .debug_macinfo  0 : { *(.debug_macinfo) }
78}
79EOF
80