xref: /netbsd-src/external/gpl3/binutils/dist/ld/scripttempl/aix.sc (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1# AIX linker script.
2# AIX always uses shared libraries.  The section VMA appears to be
3# unimportant.  The native linker aligns the sections on boundaries
4# specified by the -H option.
5#
6# Copyright (C) 2014-2024 Free Software Foundation, Inc.
7#
8# Copying and distribution of this file, with or without modification,
9# are permitted in any medium without royalty provided the copyright
10# notice and this notice are preserved.
11
12cat <<EOF
13/* Copyright (C) 2014-2024 Free Software Foundation, Inc.
14
15   Copying and distribution of this script, with or without modification,
16   are permitted in any medium without royalty provided the copyright
17   notice and this notice are preserved.  */
18
19OUTPUT_ARCH(${ARCH})
20${RELOCATING+${LIB_SEARCH_DIRS}}
21${RELOCATING+ENTRY (__start)}
22SECTIONS
23{
24  .pad 0 : { *(.pad) }
25
26  . = ALIGN (0x10000000 + SIZEOF_HEADERS, 32);
27  .text ${RELOCATING-0} : {
28    ${RELOCATING+PROVIDE (_text = .);}
29    *(.text)
30    *(.pr)
31    *(.ro)
32    *(.db)
33    *(.gl)
34    *(.xo)
35    *(.ti)
36    *(.tb)
37    ${RELOCATING+PROVIDE (_etext = .);}
38  }
39
40  /* .tdata and .tbss addresses are representing the offset from
41     the TLS pointer. It starts at -0x7800 for 64bit and -0x7c00
42     for 32bit.
43     TODO: 32bit should have -0x7c00 but it works like this for
44     now.
45     The other particularity is that they must be before .data
46     sections. But .data must be aligned correctly as if the
47     addresses were contiguous. This means that the correct
48     address must be restored, taking into account: the size of
49     .text, its alignment 2^5, the size of .tdata and its
50     aligment 2^4.  */
51  .tdata -0x7800 : {
52    *(.tdata)
53    *(.tl)
54  }
55
56  .tbss : {
57    *(.tbss)
58    *(.ul)
59  }
60
61  . = ${RELOCATING+(ALIGN (0x10000000 + SIZEOF_HEADERS, 32)) + }SIZEOF(.text);
62  . = ALIGN (.,32);
63  . = . + SIZEOF(.tdata);
64  . = ALIGN (.,16);
65
66  /* .data starting address must be in a different segment than
67     the .text addresses. Thus, 0x10000000 is added.  */
68  . = ALIGN (0x10000000) + (. & 0xfff);
69  .data . : {
70    ${RELOCATING+PROVIDE (_data = .);}
71    *(.data)
72    *(.rw)
73    *(.sv)
74    *(.sv64)
75    *(.sv3264)
76    *(.ua)
77    . = ALIGN(4);
78    ${CONSTRUCTING+CONSTRUCTORS}
79    *(.ds)
80    *(.tc0)
81    *(.tc)
82    *(.td)
83    *(.te)
84    ${RELOCATING+PROVIDE (_edata = .);}
85  }
86  .bss : {
87    *(.tocbss)
88    *(.bss)
89    *(.bs)
90    *(.uc)
91    *(COMMON)
92    ${RELOCATING+PROVIDE (_end = .);}
93    ${RELOCATING+PROVIDE (end = .);}
94  }
95
96  .loader : {
97    *(.loader)
98  }
99
100  .debug : {
101    *(.debug)
102  }
103}
104EOF
105