aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-01-08 01:01:23 +0000
committerIan Lance Taylor <ian@airs.com>1994-01-08 01:01:23 +0000
commit267a3ab363902a42edc2a0daadd19cdcfdc81b4d (patch)
tree16ce16a459da8f756f4fe0d0e52d6a97c4c6e685 /ld/scripttempl
parentfe4e32905b47a8c60c96656789b1bfbda4f264f1 (diff)
downloadgdb-267a3ab363902a42edc2a0daadd19cdcfdc81b4d.zip
gdb-267a3ab363902a42edc2a0daadd19cdcfdc81b4d.tar.gz
gdb-267a3ab363902a42edc2a0daadd19cdcfdc81b4d.tar.bz2
* scripttempl/elf.c: Define __bss_start before the .sbss section.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/elf.sc73
1 files changed, 60 insertions, 13 deletions
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index 2e75875..a6f9302 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -1,36 +1,83 @@
+#
+# Unusual variables checked by this code:
+# NOP - two byte opcode for no-op (defaults to 0)
+# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
+# OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ...
+# (e.g., .PARISC.milli)
+# OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ...
+# (e.g., .PARISC.global)
+# EXECUTABLE_SYMBOLS - symbols that must be defined for an
+# executable (e.g., _DYNAMIC_LINK)
+#
+# When adding sections, do note that the names of some sections are used
+# when specifying the start address of the next.
+#
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
${RELOCATING+${LIB_SEARCH_DIRS}}
-/* Do we need any of these for elf?
- ${RELOCATING+__DYNAMIC = 0;}
- ${STACKZERO+${RELOCATING+${STACKZERO}}}
- ${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}} */
+${RELOCATING+/* Do we need any of these for elf?
+ __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */}
+${RELOCATING+${EXECUTABLE_SYMBOLS}}
+${RELOCATING- /* For some reason, the Solaris linker makes bad executables
+ if gld -r is used and the intermediate file has sections starting
+ at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
+ bug. But for now assigning the zero vmas works. */}
SECTIONS
{
- .text ${RELOCATING+${TEXT_START_ADDR}}:
+ /* Read-only sections, merged into text segment: */
+ .text ${RELOCATING+${TEXT_START_ADDR}} ${RELOCATING-0} :
{
- CREATE_OBJECT_SYMBOLS
- *(.init)
*(.text)
- *(.fini)
- *(.rodata)
- ${RELOCATING+_etext = ${DATA_ALIGNMENT};}
+ CREATE_OBJECT_SYMBOLS
+ ${RELOCATING+_etext = .;}
}
- .data ${RELOCATING+${DATA_ALIGNMENT}} :
+ .init ${RELOCATING+.} ${RELOCATING-0} : { *(.init) } =${NOP-0}
+ .fini ${RELOCATING+.} ${RELOCATING-0} : { *(.fini) } =${NOP-0}
+ .ctors ${RELOCATING+.} ${RELOCATING-0} : { *(.ctors) }
+ .dtors ${RELOCATING+.} ${RELOCATING-0} : { *(.dtors) }
+ .rodata ${RELOCATING+.} ${RELOCATING-0} : { *(.rodata) }
+ .rodata1 ${RELOCATING+.} ${RELOCATING-0} : { *(.rodata1) }
+ ${RELOCATING+${OTHER_READONLY_SECTIONS}}
+ /* also: .hash .dynsym .dynstr .plt(if r/o) .rel.got */
+
+ /* Read-write section, merged into data segment: */
+ .data ${RELOCATING+
+ ${DATA_ADDR- ADDR(.rodata1)+SIZEOF(.rodata1)+${MAXPAGESIZE}}
+ }
+ ${RELOCATING-0} :
{
*(.data)
${CONSTRUCTING+CONSTRUCTORS}
${RELOCATING+_edata = .;}
}
- .bss ${RELOCATING+SIZEOF(.data) + ADDR(.data)} :
+ .data1 ${RELOCATING+.} ${RELOCATING-0} : { *(.data1) }
+ ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
+ /* also (before uninitialized portion): .dynamic .got .plt(if r/w)
+ (or does .dynamic go into its own segment?) */
+ /* We want the small data sections together, so single-instruction offsets
+ can access them all, and initialized data all before uninitialized, so
+ we can shorten the on-disk segment size. */
+ .sdata ${RELOCATING+.} ${RELOCATING-0} : { *(.sdata) }
+ ${RELOCATING+__bss_start = .};
+ .sbss ${RELOCATING+.} ${RELOCATING-0} : { *(.sbss) *(.scommon) }
+ .bss ${RELOCATING+.} ${RELOCATING-0} :
{
- ${RELOCATING+ __bss_start = .};
*(.bss)
*(COMMON)
${RELOCATING+_end = . };
${RELOCATING+end = . };
}
+
+ /* Debug sections. These should never be loadable, but they must have
+ zero addresses for the debuggers to work correctly. */
+ .line 0 : { *(.line) }
+ .debug 0 : { *(.debug) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
}
EOF