133965Sjdp#
233965Sjdp# Unusual variables checked by this code:
389857Sobrien#	NOP - four byte opcode for no-op (defaults to 0)
433965Sjdp#	DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
533965Sjdp#	OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ...
633965Sjdp#		(e.g., .PARISC.milli)
733965Sjdp#	OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ...
833965Sjdp#		(e.g., .PARISC.global)
933965Sjdp#	OTHER_SECTIONS - at the end
1033965Sjdp#	EXECUTABLE_SYMBOLS - symbols that must be defined for an
1133965Sjdp#		executable (e.g., _DYNAMIC_LINK)
1233965Sjdp#	TEXT_START_SYMBOLS - symbols that appear at the start of the
1333965Sjdp#		.text section.
1433965Sjdp#	DATA_START_SYMBOLS - symbols that appear at the start of the
1533965Sjdp#		.data section.
1633965Sjdp#	OTHER_BSS_SYMBOLS - symbols that appear at the start of the
1733965Sjdp#		.bss section besides __bss_start.
1833965Sjdp#	DATA_PLT - .plt should be in data segment, not text segment.
1933965Sjdp#
2033965Sjdp# When adding sections, do note that the names of some sections are used
2133965Sjdp# when specifying the start address of the next.
2233965Sjdp#
2333965Sjdptest -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
2433965Sjdptest -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
2533965Sjdptest "$LD_FLAG" = "N" && DATA_ADDR=.
2633965SjdpINTERP=".interp   ${RELOCATING-0} : { *(.interp) 	}"
2733965SjdpPLT=".plt    ${RELOCATING-0} : { *(.plt)	}"
2833965Sjdpcat <<EOF
2933965SjdpOUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
3033965Sjdp	      "${LITTLE_OUTPUT_FORMAT}")
3133965SjdpOUTPUT_ARCH(${ARCH})
3233965Sjdp
3333965Sjdp${RELOCATING+${LIB_SEARCH_DIRS}}
3433965Sjdp${RELOCATING+/* Do we need any of these for elf?
3533965Sjdp   __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
3633965Sjdp${RELOCATING+${EXECUTABLE_SYMBOLS}}
3733965Sjdp${RELOCATING- /* For some reason, the Solaris linker makes bad executables
3833965Sjdp  if gld -r is used and the intermediate file has sections starting
3933965Sjdp  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
4033965Sjdp  bug.  But for now assigning the zero vmas works.  */}
4133965SjdpSECTIONS
4233965Sjdp{
4333965Sjdp  /* Read-only sections, merged into text segment: */
4433965Sjdp  ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
4533965Sjdp  ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
4633965Sjdp  ${CREATE_SHLIB-${INTERP}}
4733965Sjdp  .hash        ${RELOCATING-0} : { *(.hash)		}
4833965Sjdp  .dynsym      ${RELOCATING-0} : { *(.dynsym)		}
4933965Sjdp  .dynstr      ${RELOCATING-0} : { *(.dynstr)		}
5033965Sjdp  .rel.text    ${RELOCATING-0} : { *(.rel.text)		}
5133965Sjdp  .rela.text   ${RELOCATING-0} : { *(.rela.text) 	}
5233965Sjdp  .rel.data    ${RELOCATING-0} : { *(.rel.data)		}
5333965Sjdp  .rela.data   ${RELOCATING-0} : { *(.rela.data) 	}
5433965Sjdp  .rel.rodata  ${RELOCATING-0} : { *(.rel.rodata) 	}
5533965Sjdp  .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) 	}
5633965Sjdp  .rel.got     ${RELOCATING-0} : { *(.rel.got)		}
5733965Sjdp  .rela.got    ${RELOCATING-0} : { *(.rela.got)		}
5833965Sjdp  .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)	}
5933965Sjdp  .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)	}
6033965Sjdp  .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)	}
6133965Sjdp  .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)	}
6233965Sjdp  .rel.bss     ${RELOCATING-0} : { *(.rel.bss)		}
6333965Sjdp  .rela.bss    ${RELOCATING-0} : { *(.rela.bss)		}
6433965Sjdp  .rel.plt     ${RELOCATING-0} : { *(.rel.plt)		}
6533965Sjdp  .rela.plt    ${RELOCATING-0} : { *(.rela.plt)		}
6633965Sjdp  .init        ${RELOCATING-0} : { *(.init)	} =${NOP-0}
6733965Sjdp  ${DATA_PLT-${PLT}}
6833965Sjdp  .text    ${RELOCATING-0} :
6933965Sjdp  {
7033965Sjdp    ${RELOCATING+${TEXT_START_SYMBOLS}}
7133965Sjdp    *(.text)
7233965Sjdp    ${CONSTRUCTING+	__CTOR_LIST__ = .;}
7333965Sjdp    ${CONSTRUCTING+	LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)}
7433965Sjdp    ${CONSTRUCTING+	*(.ctors)}
7533965Sjdp    ${CONSTRUCTING+	LONG(0)}
7633965Sjdp    ${CONSTRUCTING+	__CTOR_END__ = .;}
7733965Sjdp    ${CONSTRUCTING+	__DTOR_LIST__ = .;}
7833965Sjdp    ${CONSTRUCTING+	LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)}
7933965Sjdp    ${CONSTRUCTING+	*(.dtors)}
8033965Sjdp    ${CONSTRUCTING+	LONG(0)}
8133965Sjdp    ${CONSTRUCTING+	__DTOR_END__ = .;}
8233965Sjdp  }
8333965Sjdp  ${RELOCATING+_etext = .;}
8433965Sjdp  ${RELOCATING+PROVIDE (etext = .);}
8533965Sjdp  .fini    ${RELOCATING-0} : { *(.fini)    } =${NOP-0}
8633965Sjdp  .ctors   ${RELOCATING-0} : { *(.ctors)   }
8733965Sjdp  .dtors   ${RELOCATING-0} : { *(.dtors)   }
8833965Sjdp  .rodata  ${RELOCATING-0} : { *(.rodata)  }
8933965Sjdp  .rodata1 ${RELOCATING-0} : { *(.rodata1) }
9089857Sobrien  ${OTHER_READONLY_SECTIONS}
9133965Sjdp
9233965Sjdp  /* Read-write section, merged into data segment: */
9333965Sjdp  ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
9433965Sjdp  .data  ${RELOCATING-0} :
9533965Sjdp  {
9633965Sjdp    ${RELOCATING+${DATA_START_SYMBOLS}}
9733965Sjdp    *(.data)
9833965Sjdp    ${CONSTRUCTING+CONSTRUCTORS}
9933965Sjdp  }
10033965Sjdp  .data1 ${RELOCATING-0} : { *(.data1) }
10189857Sobrien  ${OTHER_READWRITE_SECTIONS}
10233965Sjdp  .got         ${RELOCATING-0} : { *(.got.plt) *(.got) }
10333965Sjdp  .dynamic     ${RELOCATING-0} : { *(.dynamic) }
10433965Sjdp  ${DATA_PLT+${PLT}}
10533965Sjdp  /* We want the small data sections together, so single-instruction offsets
10633965Sjdp     can access them all, and initialized data all before uninitialized, so
10733965Sjdp     we can shorten the on-disk segment size.  */
10833965Sjdp  .sdata   ${RELOCATING-0} : { *(.sdata) }
10933965Sjdp  ${RELOCATING+_edata  =  .;}
11033965Sjdp  ${RELOCATING+PROVIDE (edata = .);}
11133965Sjdp  ${RELOCATING+__bss_start = .;}
11233965Sjdp  ${RELOCATING+${OTHER_BSS_SYMBOLS}}
11333965Sjdp  .sbss    ${RELOCATING-0} : { *(.sbss) *(.scommon) }
11433965Sjdp  .bss     ${RELOCATING-0} :
11533965Sjdp  {
11633965Sjdp   *(.dynbss)
11733965Sjdp   *(.bss)
11833965Sjdp   *(COMMON)
11933965Sjdp  }
12033965Sjdp  ${RELOCATING+_end = . ;}
12133965Sjdp  ${RELOCATING+PROVIDE (end = .);}
12233965Sjdp
12333965Sjdp  /* These are needed for ELF backends which have not yet been
12433965Sjdp     converted to the new style linker.  */
12533965Sjdp  .stab 0 : { *(.stab) }
12633965Sjdp  .stabstr 0 : { *(.stabstr) }
12733965Sjdp
12833965Sjdp  ${OTHER_SECTIONS}
12933965Sjdp}
13033965SjdpEOF
131