Commit | Line | Data |
---|---|---|
267a3ab3 ILT |
1 | # |
2 | # Unusual variables checked by this code: | |
3 | # NOP - two byte opcode for no-op (defaults to 0) | |
4 | # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start | |
5 | # OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ... | |
6 | # (e.g., .PARISC.milli) | |
7 | # OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ... | |
8 | # (e.g., .PARISC.global) | |
9 | # EXECUTABLE_SYMBOLS - symbols that must be defined for an | |
10 | # executable (e.g., _DYNAMIC_LINK) | |
11 | # | |
12 | # When adding sections, do note that the names of some sections are used | |
13 | # when specifying the start address of the next. | |
14 | # | |
f90bb826 KR |
15 | cat <<EOF |
16 | OUTPUT_FORMAT("${OUTPUT_FORMAT}") | |
17 | OUTPUT_ARCH(${ARCH}) | |
18 | ||
19 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
267a3ab3 ILT |
20 | ${RELOCATING+/* Do we need any of these for elf? |
21 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} | |
22 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} | |
23 | ${RELOCATING- /* For some reason, the Solaris linker makes bad executables | |
24 | if gld -r is used and the intermediate file has sections starting | |
25 | at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld | |
26 | bug. But for now assigning the zero vmas works. */} | |
f90bb826 KR |
27 | SECTIONS |
28 | { | |
267a3ab3 ILT |
29 | /* Read-only sections, merged into text segment: */ |
30 | .text ${RELOCATING+${TEXT_START_ADDR}} ${RELOCATING-0} : | |
f90bb826 | 31 | { |
f90bb826 | 32 | *(.text) |
267a3ab3 ILT |
33 | CREATE_OBJECT_SYMBOLS |
34 | ${RELOCATING+_etext = .;} | |
f90bb826 | 35 | } |
267a3ab3 ILT |
36 | .init ${RELOCATING+.} ${RELOCATING-0} : { *(.init) } =${NOP-0} |
37 | .fini ${RELOCATING+.} ${RELOCATING-0} : { *(.fini) } =${NOP-0} | |
38 | .ctors ${RELOCATING+.} ${RELOCATING-0} : { *(.ctors) } | |
39 | .dtors ${RELOCATING+.} ${RELOCATING-0} : { *(.dtors) } | |
40 | .rodata ${RELOCATING+.} ${RELOCATING-0} : { *(.rodata) } | |
41 | .rodata1 ${RELOCATING+.} ${RELOCATING-0} : { *(.rodata1) } | |
42 | ${RELOCATING+${OTHER_READONLY_SECTIONS}} | |
43 | /* also: .hash .dynsym .dynstr .plt(if r/o) .rel.got */ | |
44 | ||
45 | /* Read-write section, merged into data segment: */ | |
46 | .data ${RELOCATING+ | |
47 | ${DATA_ADDR- ADDR(.rodata1)+SIZEOF(.rodata1)+${MAXPAGESIZE}} | |
48 | } | |
49 | ${RELOCATING-0} : | |
f90bb826 KR |
50 | { |
51 | *(.data) | |
52 | ${CONSTRUCTING+CONSTRUCTORS} | |
53 | ${RELOCATING+_edata = .;} | |
54 | } | |
267a3ab3 ILT |
55 | .data1 ${RELOCATING+.} ${RELOCATING-0} : { *(.data1) } |
56 | ${RELOCATING+${OTHER_READWRITE_SECTIONS}} | |
57 | /* also (before uninitialized portion): .dynamic .got .plt(if r/w) | |
58 | (or does .dynamic go into its own segment?) */ | |
59 | /* We want the small data sections together, so single-instruction offsets | |
60 | can access them all, and initialized data all before uninitialized, so | |
61 | we can shorten the on-disk segment size. */ | |
62 | .sdata ${RELOCATING+.} ${RELOCATING-0} : { *(.sdata) } | |
63 | ${RELOCATING+__bss_start = .}; | |
64 | .sbss ${RELOCATING+.} ${RELOCATING-0} : { *(.sbss) *(.scommon) } | |
65 | .bss ${RELOCATING+.} ${RELOCATING-0} : | |
f90bb826 | 66 | { |
f90bb826 KR |
67 | *(.bss) |
68 | *(COMMON) | |
69 | ${RELOCATING+_end = . }; | |
aa6743a5 | 70 | ${RELOCATING+end = . }; |
f90bb826 | 71 | } |
267a3ab3 ILT |
72 | |
73 | /* Debug sections. These should never be loadable, but they must have | |
74 | zero addresses for the debuggers to work correctly. */ | |
75 | .line 0 : { *(.line) } | |
76 | .debug 0 : { *(.debug) } | |
77 | .debug_sfnames 0 : { *(.debug_sfnames) } | |
78 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | |
79 | .debug_macinfo 0 : { *(.debug_macinfo) } | |
80 | .debug_pubnames 0 : { *(.debug_pubnames) } | |
81 | .debug_aranges 0 : { *(.debug_aranges) } | |
f90bb826 KR |
82 | } |
83 | EOF |