Home | History | Annotate | only in /src/libexec/ld.elf_so/arch/vax
History log of /src/libexec/ld.elf_so/arch/vax
RevisionDateAuthorComments
 1.11 19-Sep-2009  skrll Fix start symbol. I have no idea how this worked before.
 1.10 04-Jun-2005  lukem Explicitly prefix ld(1) options in LDFLAGS with "-Wl," rather than
using the ${LDFLAGS:@F@-Wl,$F@} make substitution because that breaks
if LDFLAGS is already set.
 1.9 28-Apr-2004  mhitch The -symbolic flag in gcc 2.95.3 is not passed to the linker, which is
required. Restore the -Bsymbolic option in LDFLAGS on the vax. Fixes
the problem with ld.elf_so mentioned on port-vax.
 1.8 21-Feb-2004  skrll branches: 1.8.2;
Move common LDFLAGS into Makefile from arch/*/Makefile.inc
 1.7 20-Feb-2004  skrll Whitespace.
 1.6 24-Sep-2002  mycroft Nuke reference to RTLD_RELOCATE_SELF.
 1.5 05-Sep-2002  mycroft Make _rtld_setup_pltgot() a consistent interface on all platforms.
 1.4 20-Dec-2001  thorpej branches: 1.4.2;
Grumble. Put compiler options back into CPPFLAGS for now, since
they're needed to build .S files with the correct PIC options.

XXX Really needs cleanup in <bsd.*.mk> to do this properly.
 1.3 14-Dec-2001  thorpej Don't put compiler options into CPPFLAGS.
 1.2 14-Jul-2000  matt No need for RELOCATE_SELF since the VAX does real PIC. Rewrite the bind
routine to deal with JMP .vs. CALLx differences.
 1.1 21-Aug-1999  matt Initial VAX ELF32 support (mostly untested). It's checked primarily for
testing and archival for now. I don't expect anyone to work with it
since the binutils and gas changes are still pending. But you got to
crawl before you walk.
 1.4.2.1 28-May-2004  tron Apply patch (request by skrll in ticket #1702):
Bring "ld.elf_so" (mostly) in sync with NetBSD-current:
- MI and MD (e.g. under NetBSD-alpha) performance improvements
- RTLD_SELF, RTLD_NEXT, RTLD_DEFAULT support
- much better structured code
- closes PR bin/25464
 1.8.2.1 29-Apr-2004  jmc Pullup rev 1.9 (requested by mhitch in ticket #219)

The -symbolic flag in gcc 2.95.3 is not passed to the linker, which is
required. Restore the -Bsymbolic option in LDFLAGS on the vax.
 1.35 16-Apr-2025  riastradh ld.elf_so/arch/vax: Add copyright notice from the original.

Bulk originally copied from libexec/ld.elf_so/reloc.c rev. 1.58.
 1.34 10-Aug-2017  joerg branches: 1.34.16;
Add IRELATIVE support for ARM, X86 and PowerPC.
 1.33 20-Jun-2017  joerg Add back symnum, fix debug print.
 1.32 19-Jun-2017  joerg Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.

The COMBREL logic predates thread-safety of the dynamic linker and
breaks the use of shared locks for the common symbol lookup case. It is
unlikely to provide any benefit for lazy binding or PLT lookups, so
provide equivalent functionality in the non-PLT relocation handling loop
by checking if the symbol used by the current relocation is the same as
the one used during the last lookup. No inter-object cachine is done as
it is also unlikely to be benefical.

Testing with Firefox startup on AMD64 shows a small performance gain by
the new method.
 1.31 14-Apr-2016  skrll branches: 1.31.8;
Remove duplicated __RCSIDs I added years ago - I blame CVS.

Spotted by Miod Vallat
 1.30 25-Aug-2014  joerg Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.
 1.29 21-Mar-2014  matt branches: 1.29.4;
Improve some of the rdbg messages to print the address of the pltgot slot
being modified.
 1.28 25-Mar-2011  joerg branches: 1.28.4; 1.28.10;
Add basic locking to ld.elf_so.
 1.27 06-Aug-2010  joerg Reduce header pollution for mdreloc.c. Make Obj_Entry argument of
_rtld_relocate_nonplt_objects non-const in preparation for TLS support.
 1.26 13-Jan-2010  christos PR/39240: Satoshi Suetake: Don't fail when attempting to resolve weak symbols
when we are doing immediate binding, leave them alone and they will be dealt
with later during lazy binding. From skrll@
 1.25 29-Aug-2009  jmmv Remove trailing \n in calls to _rtld_error: a newline is automatically
added by a call to the function.
 1.24 16-Mar-2009  lukem Fix const issues (cast const pointers to "const uint8_t *" instead of "caddr_t")

NOTE: change based on ../i386/mdreloc.c 1.27
XXX: not compile tested
 1.23 24-Jul-2008  skrll branches: 1.23.4; 1.23.6;
RCSID police
 1.22 24-Jul-2008  matt Refactor common code to _rtld_relocate_plt_object to i386 and arm so they
act like the other versions.
In _rtld_bind, if the result is 0, call _rtld_die.
Initialize _rtld_sym_zero.st_value to -_rtld_objself.maprelocbase. Now when
the symbol is resolved, st_value + maprelocbase will equal 0 and the above
check in _rtld_bind will fire and a call to NULL will be avoided.
 1.21 21-May-2006  mrg branches: 1.21.20;
avoid more GCC4 uninitialised variable problems. (sh3 known, vax guessed.)
 1.20 20-Aug-2005  skrll Add __RCSID.
 1.19 15-Aug-2005  skrll KNF
 1.18 24-Jul-2005  skrll Support immediate PLT binding on vax. Tested on simh.

Nearly there...
 1.17 24-Jul-2003  skrll branches: 1.17.4;
ANSIfy and de-__P().
 1.16 03-Oct-2002  mycroft Skip the lazy PLT relocation if relocbase==0 (useful if libraries are loaded
at their VMA address).
 1.15 26-Sep-2002  mycroft Implement a self-relocate function for the VAX.
 1.14 26-Sep-2002  mycroft Remove the `self' args to _rtld_relocate_objects() and
_rtld_relocate_nonplt_objects().
 1.13 25-Sep-2002  mycroft Push the _rtld_bind() interface into MD code -- it's just a trivial wrapper
anyway.
 1.12 12-Sep-2002  mycroft Nuke -DRTLD_RELOCATE_SELF and `dodebug' from orbit.
 1.11 12-Sep-2002  mycroft _rtld_bind_start() is not used in MI code, so declare it in the MD code.
 1.10 11-Sep-2002  junyoung Add $NetBSD$.
 1.9 06-Sep-2002  mycroft Pass down an additional flag to _rtld_relocate_nonplt_objects() which
indicates whether we're relocating ld.elf_so itself. Use this in some places
rather than hackish tests on `dodebug'. (The Alpha and HPPA `dodebug' tests
were actually noops, because RTLD_RELOCATE_SELF is not set, and therefore
dodebug is always true.)
 1.8 06-Sep-2002  mycroft Introduce a new flag, `isdynamic', which is used to remember whether the
executable was of type ET_DYN. Use this instead of `mainprog' to determine
whether we need to do base-relative fixups of the PLT. (This allows loading
non-relocatable objects, should we desire to do that at some point...)
 1.7 06-Sep-2002  mycroft Re-poison a lot of consts, now that the mark shite is gone.
 1.6 06-Sep-2002  mycroft Split _rtld_relocate_plt_object() into two MD functions:
* _rtld_relocate_plt_lazy() fixes up all the relocs pointing to the PLT. (On
most platforms it just does a simple base-relative fixup; on SPARC it does
nothing.)
* _rtld_relocate_plt_object() does immediate binding for a PLT entry.
The basic gist is that this saves a bit of time on SPARC (where the iteration
through the pltrela table was gratuitous), and a little less time on all other
platforms. A whole lot of #ifdef'ed crap is moved out of reloc.c, too.

NOT tested on: hppa sh x86_64
 1.5 05-Sep-2002  mycroft Partially fix up some debug printf()s that don't need to use defobj.
 1.4 05-Sep-2002  mycroft A few things:
* Pass a symbol number to _rtld_find_symdef(), not a r_info.
* Don't try to do a symbol lookup when we find an unsupported relocation;
instead get the symbol name from the referencing object's strtab.
* Add preliminary support for `-z combreloc'-style startup optimization on
i386, `#ifdef COMBRELOC'.
 1.3 05-Sep-2002  mycroft Rename _rtld_relocate_nonplt_object() to _rtld_relocate_nonplt_objects(),
and push the outer loop into it. This actually shaves a couple % off startup
time at least on PCs.
 1.2 05-Sep-2002  mycroft Split _rtld_relocate_nonplt_object() into separate MD files.
 1.1 05-Sep-2002  mycroft Make _rtld_setup_pltgot() a consistent interface on all platforms.
 1.17.4.2 28-May-2004  tron Apply patch (request by skrll in ticket #1702):
Bring "ld.elf_so" (mostly) in sync with NetBSD-current:
- MI and MD (e.g. under NetBSD-alpha) performance improvements
- RTLD_SELF, RTLD_NEXT, RTLD_DEFAULT support
- much better structured code
- closes PR bin/25464
 1.17.4.1 24-Jul-2003  tron file mdreloc.c was added on branch netbsd-1-6 on 2004-05-28 08:31:23 +0000
 1.21.20.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.23.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.23.4.1 17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by skrll in ticket #1724):
rescue/list.ldd: revision 1.4
lib/libc/dlfcn/dlfcn_elf.c: revision 1.7
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.57
distrib/sets/lists/comp/mi: revision 1.1512
share/man/man3/Makefile: revision 1.56
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.58
usr.bin/ldd/ldd.c: revision 1.15
libexec/ld.elf_so/rtld.h: revision 1.84
share/man/man3/dl_iterate_phdr.3: revision 1.1
libexec/ld.elf_so/rtld.c: revision 1.129
libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.44
libexec/ld.elf_so/rtld.h: revision 1.89
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.36
libexec/ld.elf_so/map_object.c: revision 1.41
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.37
libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.46
include/link_elf.h: revision 1.10
libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.29
libexec/ld.elf_so/arch/vax/mdreloc.c: revision 1.26
libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.34
libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.31
libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.35
libexec/ld.elf_so/Makefile: revision 1.94
libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.32
libexec/ld.elf_so/Makefile: revision 1.95
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.31
libexec/ld.elf_so/Makefile: revision 1.96
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.32
libexec/ld.elf_so/reloc.c: revision 1.98
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.33
sys/sys/exec_elf.h: revision 1.106
libexec/ld.elf_so/rtld.c: revision 1.130
libexec/ld.elf_so/load.c: revision 1.37
libexec/ld.elf_so/rtld.c: revision 1.131
libexec/ld.elf_so/load.c: revision 1.38
libexec/ld.elf_so/rtld.h: revision 1.90
libexec/ld.elf_so/headers.c: revision 1.36
libexec/ld.elf_so/rtld.h: revision 1.95
libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.30
libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.25
libexec/ld.elf_so/symbol.c: revision 1.50
libexec/ld.elf_so/symbol.c: revision 1.51
libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.43
libexec/ld.elf_so/symbol.c: revision 1.52
libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.27
libexec/ld.elf_so/symbol.c: revision 1.54
PR/39240: Satoshi Suetake: Don't fail when attempting to resolve weak symbols
when we are doing immediate binding, leave them alone and they will be dealt
with later during lazy binding. From skrll@
Implement negative cache checks for symbol lookups.
Uses the Donelist idea from FreeBSD.
Use alloca(3) instead of local xmalloc for creating our DoneLists.
This allows threaded programs to use us a little better, PR lib/43005.
Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
 1.28.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.4.1 06-Mar-2016  martin Catch up to -current, via patch, requested by christos in ticket #1126:
 1.31.8.1 04-Jul-2017  martin Pull up following revision(s) (requested by joerg in ticket #64):
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.40
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.41
libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.44
libexec/ld.elf_so/arch/riscv/mdreloc.c: revision 1.3
libexec/ld.elf_so/arch/aarch64/mdreloc.c: revision 1.3
libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.60
libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.32
libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.61
libexec/ld.elf_so/arch/or1k/mdreloc.c: revision 1.2
libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.50
libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.33
libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.34
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.39
libexec/ld.elf_so/symbol.c: revision 1.68
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.66
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.67
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.68
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.42
libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.54
libexec/ld.elf_so/Makefile: revision 1.137
libexec/ld.elf_so/arch/vax/mdreloc.c: revision 1.32
libexec/ld.elf_so/rtld.h: revision 1.127
libexec/ld.elf_so/arch/vax/mdreloc.c: revision 1.33
libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.38
libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.42
libexec/ld.elf_so/map_object.c: revision 1.58
libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.49
Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.
The COMBREL logic predates thread-safety of the dynamic linker and
breaks the use of shared locks for the common symbol lookup case. It is
unlikely to provide any benefit for lazy binding or PLT lookups, so
provide equivalent functionality in the non-PLT relocation handling loop
by checking if the symbol used by the current relocation is the same as
the one used during the last lookup. No inter-object cachine is done as
it is also unlikely to be benefical.
Testing with Firefox startup on AMD64 shows a small performance gain by
the new method.
Drop symbol number from default branch diagnostic, it isn't set at this
point and most likely not valid either.
Expand symnum, GCC's uninitialized used tracking is too imprecise.
Fix C&P bug. Deal with more MIPS hacks overriding def.
Add last_symnum, move up def and defobj.
Add back symnum, fix debug print.
Replace last use of r_type.
Fix indentation.
Fix indentation.
 1.34.16.1 02-Aug-2025  perseant Sync with HEAD
 1.25 03-Aug-2024  riastradh ld.elf_so(1): Nix trailing whitespace.

No functional change intended.
 1.24 17-Aug-2014  matt branches: 1.24.28;
Add proper registers for register counts.
 1.23 17-Aug-2014  matt add a missing register prefix.
 1.22 22-Mar-2014  matt branches: 1.22.4;
Make sure r1 is preserved _rtld_bind_start.
 1.21 21-Mar-2014  matt Simplify. If we got called via a calls $n, *pcrel32, instead of constructing
a new stack frame, back up the PC by 7 and return back to the calls so it
will be reinvoked. (This is by far the most common way it gets invoked).
Otherwise rebuild a new callframe and jump to the routine.
 1.20 19-Mar-2014  joerg Save actual start of function, not address of entry mask on the stack.
 1.19 19-Mar-2014  matt Fix two bugs. (jump past entry mask, fix insv)
 1.18 19-Mar-2014  matt Once we know the bound routine, rebuilt a new callframe that can be unwound
properly.
 1.17 18-Mar-2014  matt Add .cfi ops so that one can unwind through this.
 1.16 02-Mar-2003  mycroft branches: 1.16.54; 1.16.60;
Shorten rtld_start() slightly -- there's a base-relative _DYNAMIC pointer at
the beginning of the GOT, so we don't need an extra one here. Also, remove a
bogus comment -- we do in fact have to do fixups, because there are pointers in
ld.elf_so's data segment that need to be relocated.
 1.15 05-Oct-2002  mycroft Minor cleanup.
 1.14 27-Sep-2002  mycroft We don't need to save r7, either...
 1.13 27-Sep-2002  mycroft Put back the short-circuiting code -- Matt claims there are functions that rely
on it.
OTOH, don't bother saving r6 a second time.
 1.12 27-Sep-2002  mycroft 1) There is no reason to flush the I$ here, given that we do not modify any
instructions. Function calls use GOT indirection, and we only patch the
GOT.
2) The mask-comparison optimization always fails, because the saved mask
always has 0x2000 set, and the PLT stub mask never does. So, remove it.
 1.11 27-Sep-2002  mycroft Save one more instruction.
 1.10 26-Sep-2002  mycroft Save relocbase in %r10, not %r1.
Also, save one instruction.
 1.9 26-Sep-2002  mycroft Implement a self-relocate function for the VAX.
 1.8 12-Sep-2002  mycroft Figure out the relocation offset and pass it to _rtld().
 1.7 24-Feb-2002  matt branches: 1.7.2;
Change to use a register prefix.
 1.6 07-Aug-2000  matt Simplify some stuff.
 1.5 17-Jul-2000  matt More VAX ELF changes.
 1.4 14-Jul-2000  matt No need for RELOCATE_SELF since the VAX does real PIC. Rewrite the bind
routine to deal with JMP .vs. CALLx differences.
 1.3 03-Jul-2000  matt Update to current <machine/asm.h>
 1.2 22-May-2000  matt minor fix now that i've defined the plt0 entry.
 1.1 21-Aug-1999  matt Initial VAX ELF32 support (mostly untested). It's checked primarily for
testing and archival for now. I don't expect anyone to work with it
since the binutils and gas changes are still pending. But you got to
crawl before you walk.
 1.7.2.1 28-May-2004  tron Apply patch (request by skrll in ticket #1702):
Bring "ld.elf_so" (mostly) in sync with NetBSD-current:
- MI and MD (e.g. under NetBSD-alpha) performance improvements
- RTLD_SELF, RTLD_NEXT, RTLD_DEFAULT support
- much better structured code
- closes PR bin/25464
 1.16.60.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.54.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.22.4.1 20-Aug-2014  martin Pullup the following to netbsd-7 (requested by matt in ticket #37):
external/gpl3/gcc/dist/gcc/config/vax/builtins.md 1.4
external/gpl3/gcc/dist/gcc/config/vax/vax.c 1.10
Rework so that the ctzsi builtin is supported.

lib/libc/compiler_rt/Makefile.inc 1.26
VAX does need __clzsi2

libexec/ld.elf_so/arch/vax/rtld_start.S 1.23
libexec/ld.elf_so/arch/vax/rtld_start.S 1.24
add a missing register prefix.
Add proper registers for register counts.
 1.24.28.1 02-Aug-2025  perseant Sync with HEAD

RSS XML Feed