mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
2a9fa50cd8
* ld.h (ld_config_type): Add field dynamic_link. * ldmain.c (main): Initialize config.dynamic_link to false. Warn on attempts to use -r with -relax, -call_shared or -s. * lexsup.c (longopts): Separate OPTION_CALL_SHARED from OPTION_NON_SHARED. Add OPTION_IGNORE. Adjust macro values accordingly. Add "dy" and "non_shared" options. Change "Qy" to OPTION_IGNORE for now. Handle OPTION_CALL_SHARED and OPTION_NON_SHARED by setting dynamic_link field accordingly. Handle OPTION_IGNORE by ignoring it. Clear dynamic_link field for -r and -Ur. * ldfile.c (ldfile_open_file): If config.dynamic_link is true, try opening a file with a .so extension first. * emultempl/elf32.em: New file. * emulparams/elf32_sparc.sh (TEXT_START_ADDR): Change to 0x10000. (NONPAGED_TEXT_START_ADDR): Likewise. (TEMPLATE_NAME): Define as elf32. (DATA_PLT): Define. * emulparams/elf_i386.sh (TEMPLATE_NAME): Define as elf32. * scripttempl/elf.sc: Add placement for new dynamic sections. Don't use CREATE_OBJECT_SYMBOLS. Define _etext, _edata and _end outside of any section. Don't use ALIGN(8); just let one section VMA follow another. Put .dynbss in .bss. Don't mention debugging sections; they'll be handled correctly anyhow. * Makefile.in (eelf_i386.c): Depend upon elf32.em, not generic.em.
93 lines
3.3 KiB
Scala
93 lines
3.3 KiB
Scala
#
|
|
# 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)
|
|
# TEXT_START_SYMBOLS - symbols that appear at the start of the
|
|
# .text section.
|
|
# DATA_START_SYMBOLS - symbols that appear at the start of the
|
|
# .data section.
|
|
# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
|
|
# .bss section besides __bss_start.
|
|
# DATA_PLT - .plt should be in data segment, not text segment.
|
|
#
|
|
# When adding sections, do note that the names of some sections are used
|
|
# when specifying the start address of the next.
|
|
#
|
|
PLT=".plt ${RELOCATING-0} : { *(.plt) }"
|
|
cat <<EOF
|
|
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
|
|
OUTPUT_ARCH(${ARCH})
|
|
|
|
${RELOCATING+${LIB_SEARCH_DIRS}}
|
|
${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
|
|
{
|
|
/* Read-only sections, merged into text segment: */
|
|
${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}
|
|
.interp ${RELOCATING-0} : { *(.interp) }
|
|
.hash ${RELOCATING-0} : { *(.hash) }
|
|
.dynsym ${RELOCATING-0} : { *(.dynsym) }
|
|
.dynstr ${RELOCATING-0} : { *(.dynstr) }
|
|
.rel.bss ${RELOCATING-0} : { *(.rel.bss) }
|
|
.rel.plt ${RELOCATING-0} : { *(.rel.plt) }
|
|
.rela.bss ${RELOCATING-0} : { *(.rela.bss) }
|
|
.rela.plt ${RELOCATING-0} : { *(.rela.plt) }
|
|
.init ${RELOCATING-0} : { *(.init) } =${NOP-0}
|
|
${DATA_PLT-${PLT}}
|
|
.text ${RELOCATING-0} :
|
|
{
|
|
${RELOCATING+${TEXT_START_SYMBOLS}}
|
|
*(.text)
|
|
}
|
|
${RELOCATING+_etext = .;}
|
|
.fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
|
|
.ctors ${RELOCATING-0} : { *(.ctors) }
|
|
.dtors ${RELOCATING-0} : { *(.dtors) }
|
|
.rodata ${RELOCATING-0} : { *(.rodata) }
|
|
.rodata1 ${RELOCATING-0} : { *(.rodata1) }
|
|
${RELOCATING+${OTHER_READONLY_SECTIONS}}
|
|
|
|
/* Read-write section, merged into data segment: */
|
|
${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
|
|
.data ${RELOCATING-0} :
|
|
{
|
|
${RELOCATING+${DATA_START_SYMBOLS}}
|
|
*(.data)
|
|
${CONSTRUCTING+CONSTRUCTORS}
|
|
}
|
|
.data1 ${RELOCATING-0} : { *(.data1) }
|
|
${RELOCATING+${OTHER_READWRITE_SECTIONS}}
|
|
.got ${RELOCATING-0} : { *(.got) }
|
|
.dynamic ${RELOCATING-0} : { *(.dynamic) }
|
|
${DATA_PLT+${PLT}}
|
|
/* 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-0} : { *(.sdata) }
|
|
${RELOCATING+_edata = .;}
|
|
${RELOCATING+__bss_start = .;}
|
|
${RELOCATING+${OTHER_BSS_SYMBOLS}}
|
|
.sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) }
|
|
.bss ${RELOCATING-0} :
|
|
{
|
|
*(.dynbss)
|
|
*(.bss)
|
|
*(COMMON)
|
|
}
|
|
${RELOCATING+_end = . ;}
|
|
${RELOCATING+end = . ;}
|
|
}
|
|
EOF
|