Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so/arch/alpha * Add a linker script which pro...
details: https://anonhg.NetBSD.org/src/rev/df2c94bf71a3
branches: trunk
changeset: 519237:df2c94bf71a3
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu Dec 13 20:30:48 2001 +0000
description:
* Add a linker script which provides a _GOT_END_ symbol that we can
use to find the end of the GOT, rather than relying on _DYNAMIC
to immediately follow the GOT. (A change in current binutils
moved _DYNAMIC, and thus would have broken our Alpha ld.elf_so).
* Add #ifdef'd out code to deal with the new PLT format.
diffstat:
libexec/ld.elf_so/arch/alpha/Makefile.inc | 3 +-
libexec/ld.elf_so/arch/alpha/ld.so.script | 132 ++++++++++++++++++++++++++++++
libexec/ld.elf_so/arch/alpha/rtld_start.S | 12 ++-
3 files changed, 144 insertions(+), 3 deletions(-)
diffs (190 lines):
diff -r d88fd66e3600 -r df2c94bf71a3 libexec/ld.elf_so/arch/alpha/Makefile.inc
--- a/libexec/ld.elf_so/arch/alpha/Makefile.inc Thu Dec 13 19:47:19 2001 +0000
+++ b/libexec/ld.elf_so/arch/alpha/Makefile.inc Thu Dec 13 20:30:48 2001 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.3 1999/04/18 23:12:59 thorpej Exp $
+# $NetBSD: Makefile.inc,v 1.4 2001/12/13 20:30:48 thorpej Exp $
SRCS+= rtld_start.S
CPPFLAGS+= -fpic -mno-fp-regs -DELFSIZE=64
LDFLAGS+= -Bshareable -Bsymbolic -e _rtld_start
+LDFLAGS+= --script ${.CURDIR}/arch/alpha/ld.so.script
diff -r d88fd66e3600 -r df2c94bf71a3 libexec/ld.elf_so/arch/alpha/ld.so.script
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libexec/ld.elf_so/arch/alpha/ld.so.script Thu Dec 13 20:30:48 2001 +0000
@@ -0,0 +1,132 @@
+OUTPUT_FORMAT("elf64-alpha", "elf64-alpha",
+ "elf64-alpha")
+OUTPUT_ARCH(alpha)
+ENTRY(__start)
+/* SEARCH_DIR(/usr/lib); JRT */
+/* Do we need any of these for elf?
+ __DYNAMIC = 0; */
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ . = 0 + SIZEOF_HEADERS;
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.text :
+ { *(.rel.text) *(.rel.gnu.linkonce.t*) }
+ .rela.text :
+ { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+ .rel.data :
+ { *(.rel.data) *(.rel.gnu.linkonce.d*) }
+ .rela.data :
+ { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+ .rel.rodata :
+ { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
+ .rela.rodata :
+ { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ .init : { *(.init) } =0x47ff041f
+ .text :
+ {
+ *(.text)
+ *(.stub)
+ /* .gnu.warning sections are handled specially by elf32.em. */
+ *(.gnu.warning)
+ *(.gnu.linkonce.t*)
+ } =0x47ff041f
+ _etext = .;
+ PROVIDE (etext = .);
+ .fini : { *(.fini) } =0x47ff041f
+ .rodata : { *(.rodata) *(.gnu.linkonce.r*) }
+ .rodata1 : { *(.rodata1) }
+ .reginfo : { *(.reginfo) }
+ /* Adjust the address for the data segment. We want to adjust up to
+ the same address within the page on the next page up. */
+ . = ALIGN(0x100000) + (. & (0x100000 - 1));
+ .data :
+ {
+ *(.data)
+ *(.gnu.linkonce.d*)
+ CONSTRUCTORS
+ }
+ .data1 : { *(.data1) }
+ .ctors :
+ {
+ *(.ctors)
+ }
+ .dtors :
+ {
+ *(.dtors)
+ }
+ .plt : { *(.plt) }
+ .got : { *(.got.plt) *(.got) }
+ PROVIDE (_GOT_END_ = .);
+ .dynamic : { *(.dynamic) }
+ /* 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 : { *(.sdata) }
+ _edata = .;
+ PROVIDE (edata = .);
+ __bss_start = .;
+ .sbss : { *(.sbss) *(.scommon) }
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ . = ALIGN(64 / 8);
+ _end = . ;
+ PROVIDE (end = .);
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+ /* These must appear regardless of . */
+}
diff -r d88fd66e3600 -r df2c94bf71a3 libexec/ld.elf_so/arch/alpha/rtld_start.S
--- a/libexec/ld.elf_so/arch/alpha/rtld_start.S Thu Dec 13 19:47:19 2001 +0000
+++ b/libexec/ld.elf_so/arch/alpha/rtld_start.S Thu Dec 13 20:30:48 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld_start.S,v 1.4 2001/05/28 06:10:20 nathanw Exp $ */
+/* $NetBSD: rtld_start.S,v 1.5 2001/12/13 20:30:48 thorpej Exp $ */
/*
* Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
@@ -30,6 +30,7 @@
#include <machine/asm.h>
.extern _GLOBAL_OFFSET_TABLE_
+ .extern _GOT_END_
/*
* Note: we can call ourselves LEAF even though we use callee-saved
@@ -56,7 +57,7 @@
#if defined(OLD_GOT)
ldq t4, 0(t9) /* Get the address of dynamic table */
#else
- lda t4, _DYNAMIC
+ lda t4, _GOT_END_ /* Get the address of the end of the GOT */
#endif
addq t8, t4, t10 /* add the displacement */
@@ -146,8 +147,15 @@
L100: LDGP(t0)
/* Set up the arguments for _rtld_bind. */
+#ifdef NEW_PLT_FORMAT
+ subq at_reg, pv, a1 /* calculate offset of reloc entry */
+ ldq a0, 8(pv) /* object structure */
+ subq a1, 20, a1 /* = (at - pv - 20) / 12 * 24 */
+ addq a1, a1, a1
+#else
ldq a0, 8(pv) /* object structure */
mov at_reg, a1 /* offset of reloc entry */
+#endif /* NEW_PLT_FORMAT */
CALL(_rtld_bind)
/* Move the destination address into position. */
Home |
Main Index |
Thread Index |
Old Index