xref: /netbsd-src/external/gpl3/binutils/dist/ld/scripttempl/aout.sc (revision a45db23f655e22f0c2354600d3b3c2cb98abf2dc)
1# Copyright (C) 2014-2022 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#
7test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
8test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
9test -z "${ALIGNMENT}" && ALIGNMENT="4"
10
11cat <<EOF
12/* Copyright (C) 2014-2022 Free Software Foundation, Inc.
13
14   Copying and distribution of this script, with or without modification,
15   are permitted in any medium without royalty provided the copyright
16   notice and this notice are preserved.  */
17
18OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
19	      "${LITTLE_OUTPUT_FORMAT}")
20OUTPUT_ARCH(${ARCH})
21
22${RELOCATING+${LIB_SEARCH_DIRS}}
23${STACKZERO+${RELOCATING+${STACKZERO}}}
24${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}}
25${RELOCATING+${EXECUTABLE_SYMBOLS}}
26${RELOCATING+PROVIDE (__stack = 0);}
27SECTIONS
28{
29  ${RELOCATING+. = ${TEXT_START_ADDR};}
30  .text :
31  {
32    CREATE_OBJECT_SYMBOLS
33    *(.text)
34    /* The next six sections are for SunOS dynamic linking.  The order
35       is important.  */
36    *(.dynrel)
37    *(.hash)
38    *(.dynsym)
39    *(.dynstr)
40    *(.rules)
41    *(.need)
42    ${RELOCATING+_etext = .;}
43    ${RELOCATING+__etext = .;}
44    ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}}
45  }
46  ${RELOCATING+. = ${DATA_ALIGNMENT};}
47  .data :
48  {
49    /* The first three sections are for SunOS dynamic linking.  */
50    *(.dynamic)
51    *(.got)
52    *(.plt)
53    *(.data)
54    *(.linux-dynamic) /* For Linux dynamic linking.  */
55    ${CONSTRUCTING+CONSTRUCTORS}
56    ${RELOCATING+_edata  =  .;}
57    ${RELOCATING+__edata  =  .;}
58  }
59  .bss :
60  {
61   ${RELOCATING+ __bss_start = .};
62   *(.bss)
63   *(COMMON)
64   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
65   ${RELOCATING+_end = . };
66   ${RELOCATING+__end = . };
67  }
68}
69EOF
70