The NetBSD Project

CVS log for src/libexec/ld.elf_so/rtld.c

[BACK] Up to [cvs.NetBSD.org] / src / libexec / ld.elf_so

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.217 / (download) - annotate - [select for diffs], Fri Jan 19 19:21:34 2024 UTC (2 months, 1 week ago) by christos
Branch: MAIN
CVS Tags: HEAD
Changes since 1.216: +2 -4 lines
Diff to previous 1.216 (colored) to selected 1.8 (colored)

use header decl of __fork()

Revision 1.216 / (download) - annotate - [select for diffs], Tue Oct 3 09:48:18 2023 UTC (5 months, 3 weeks ago) by martin
Branch: MAIN
Changes since 1.215: +11 -2 lines
Diff to previous 1.215 (colored) to selected 1.8 (colored)

PR 57628: at the end of _rtld_init() explicitly initialize the ld.elf_so
local copy of the atomic access support functions for machines that do not
implement all required ops in hardware (like 32bit sparc).

XXX would be better to figure out a way to share this copy with libc
(thereby using half as many RAS sections). But even if we would share it,
we have to init it early enough for ld.elf_so internal uses.

Revision 1.197.2.7 / (download) - annotate - [select for diffs], Fri Aug 4 12:55:45 2023 UTC (7 months, 3 weeks ago) by martin
Branch: netbsd-9
Changes since 1.197.2.6: +7 -3 lines
Diff to previous 1.197.2.6 (colored) to branchpoint 1.197 (colored) next main 1.198 (colored) to selected 1.8 (colored)

Pull up following revision(s), all via patch,
(requested by riastradh in ticket #1699):

	distrib/sets/lists/tests/shl.mi: revision 1.14
	distrib/sets/lists/tests/shl.mi: revision 1.15
	distrib/sets/lists/tests/shl.mi: revision 1.16
	tests/libexec/ld.elf_so/helper_def_static/h_def_static.c: revision 1.1
	tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.2
	libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.75
	distrib/sets/lists/tests/mi: revision 1.1265
	libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.36
	libexec/ld.elf_so/rtld.c: revision 1.214
	tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.1
	distrib/sets/lists/debug/mi: revision 1.400
	tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.2
	distrib/sets/lists/debug/mi: revision 1.401
	distrib/sets/lists/debug/mi: revision 1.402
	tests/libexec/ld.elf_so/helper_dso2/Makefile: revision 1.2
	distrib/sets/lists/debug/mi: revision 1.403
	tests/libexec/ld.elf_so/helper_symver_dso0/Makefile: revision 1.2
	libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.48
	distrib/sets/lists/debug/mi: revision 1.406
	tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_ifunc_dso/Makefile: revision 1.2
	libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.70
	libexec/ld.elf_so/arch/aarch64/mdreloc.c: revision 1.18
	tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/Makefile: revision 1.13
	libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.46
	libexec/ld.elf_so/rtld.h: revision 1.146
	tests/libexec/ld.elf_so/Makefile: revision 1.14
	distrib/sets/lists/debug/shl.mi: revision 1.306
	tests/libexec/ld.elf_so/Makefile: revision 1.15
	tests/libexec/ld.elf_so/helper_abuse_static/Makefile: revision 1.1
	distrib/sets/lists/debug/shl.mi: revision 1.307
	tests/libexec/ld.elf_so/Makefile: revision 1.16
	tests/libexec/ld.elf_so/helper_abuse_static/Makefile: revision 1.2
	distrib/sets/lists/debug/shl.mi: revision 1.308
	tests/libexec/ld.elf_so/Makefile: revision 1.17
	distrib/sets/lists/debug/shl.mi: revision 1.309
	tests/libexec/ld.elf_so/Makefile: revision 1.18
	tests/libexec/ld.elf_so/Makefile: revision 1.19
	libexec/ld.elf_so/tls.c: revision 1.16
	libexec/ld.elf_so/tls.c: revision 1.17
	libexec/ld.elf_so/tls.c: revision 1.18
	libexec/ld.elf_so/tls.c: revision 1.19
	tests/libexec/ld.elf_so/helper_onlydef_static/h_onlydef_static.c: revision 1.1
	tests/libexec/ld.elf_so/helper_use_static/h_use_static.c: revision 1.1
	tests/libexec/ld.elf_so/helper_use_static/h_use_static.c: revision 1.2
	tests/libexec/ld.elf_so/helper_def_static/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_def_static/Makefile: revision 1.2
	libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.50
	distrib/sets/lists/debug/shl.mi: revision 1.310
	libexec/ld.elf_so/README.TLS: revision 1.6
	distrib/sets/lists/debug/shl.mi: revision 1.311
	distrib/sets/lists/debug/shl.mi: revision 1.314
	tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_symver_dso1/Makefile: revision 1.4
	libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.63
	tests/libexec/ld.elf_so/helper_def_dynamic/h_def_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_onlydef/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_onlydef/Makefile: revision 1.2
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.10
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.11
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.12
	libexec/ld.elf_so/map_object.c: revision 1.66
	tests/libexec/ld.elf_so/helper.mk: revision 1.1
	libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.57
	libexec/ld.elf_so/map_object.c: revision 1.67
	tests/libexec/ld.elf_so/helper_onlydef/h_onlydef.c: revision 1.1
	tests/libexec/ld.elf_so/helper_symver_dso2/Makefile: revision 1.4
	tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.3
	tests/libexec/ld.elf_so/helper_use_dynamic/h_use_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_abuse_static/h_abuse_static.c: revision 1.1
	libexec/ld.elf_so/arch/riscv/mdreloc.c: revision 1.9
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.1
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.2
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.3
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.4
	tests/libexec/ld.elf_so/helper_onlyctor_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.5
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.6
	libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.34
	tests/libexec/ld.elf_so/helper_onlyctor_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.7
	libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.42
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.8
	libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.43
	libexec/ld.elf_so/arch/or1k/mdreloc.c: revision 1.4
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.9
	tests/libexec/ld.elf_so/helper_onlyuse_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyuse_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_abuse_dynamic/h_abuse_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyctor_dynamic/h_onlyctor_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyuse_static/h_onlyuse_static.c: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyuse_dynamic/h_onlyuse_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_dso1/Makefile: revision 1.2
	distrib/sets/lists/tests/shl.mi: revision 1.12
	distrib/sets/lists/tests/shl.mi: revision 1.13
	libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.44

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.
Now it's actually testing the problem.
ld.elf_so: Nix inadvertently committed private test program.
ld.elf_so: Fix set lists for MKDEBUG=yes builds with t_tls_extern.

ld.elf_so: Sprinkle tls debug messages.

ld.elf_so: Make tls alloc debug messages more detailed and greppable.

ld.elf_so: Test variations on PR toolchain/50277.

ld.elf_so: Test extern dynamic TLS too.

ld.elf_so: Factor out logic in TLS tests to make writing more easier.
No functional change intended.

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

ld.elf_so: Shorter test names.
No functional non-cosmetic change intended.

ld.elf_so: Separately test eager and lazy resolution of def tls ptr.
eager: before loading use library
lazy: after loading use library

Add recent ld.elf_so test helpers debug info
ld.elf_so: Add new files to debug/shl.mi.

ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently.
If a symbol has already been resolved as dynamic TLS, any library
that tries to use it as static TLS cannot be dlopened.

ld.elf_so: Test another edge case of mismatched TLS models.
One library defines a symbol and _doesn't_ use it, so it has no
indication of whether the symbol is for static TLS or dynamic TLS,
and then two other libraries use it in different ways.

ld.elf_so: Test dynamic-then-static abuse via ctor.

ld.elf_so: Fix missing tab in debug/shl.mi in last change.

Fix interactions of initial-exec TLS model and dlopen

(1) If an initial-exec relocation was used for a non-local symbol
(i.e. the definition of the symbol is in a different DSO), the
computation of the static TLS offset used the wrong DSO.

This would effectively mean the wrong address was computed
(PR toolchain/50277, PR pkg/57445).
Fix this by forcing the computation of the correct DSO (the one defining
the symbol).
This code uses __UNCONST to avoid the vast interface changes for this
special case.

(2) If symbols from a DSO loaded via dlopen are used with both
global-dynamic/local-dynamic and initial-exec relocations AND
a initial-exec relocation was resolved first in a thread, a split brain
situation could exist where the dynamic relocations would use one memory
block (separate allocation) and the initial-exec relocations the static
per-thread TLS space.

(3) If the initial-exec relocation in (2) is seen after any thread has
already used a GD/LD allocation, bail out. Since IE relocations are used
only in the GOT, this will prevent the dlopen. This is a bit more
aggressive than necessary, but a full blown reference counting doesn't
seem to be justified.
Avoid using uninitialized variable "symnum" when building with DEBUG
enabled by borrowing the rdbg_symname() macro from arch/x86_64.
ld.elf_so: Sprinkle more debug messages on dlopen and error.

PR pkg/57445

Fix MKDEBUGLIB build by adding these installed files to the debug
set list.

One could argue that these files are not of any use, so why install
them?  I don't have a good argument either way, and this is (for
now) a simple work-around for PR bin/57455   Please feel free to
commit a different fix to avoid installing these files at all.

Fix markup of libh_ MKDEBUGLIB=yes only files

TLS variant I archs need to fudge the offset by the size of the TCB.
tests/libexec/ld.elf_so: Fix helper library makefiles.
1. Consolidate logic into a single helper.mk to reduce duplication.
2. Set NO* variables, not MK* variables which are reserved for user.
3. Avoid eager X!= in favour of lazy ${X:sh}.
4. Mark _g.a set list entries obsolete.  Never should've been built!
PR misc/57462

Revision 1.212.2.3 / (download) - annotate - [select for diffs], Tue Aug 1 17:03:53 2023 UTC (7 months, 3 weeks ago) by martin
Branch: netbsd-10
CVS Tags: netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1
Changes since 1.212.2.2: +4 -2 lines
Diff to previous 1.212.2.2 (colored) to branchpoint 1.212 (colored) next main 1.213 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by riastradh in ticket #300):

	libexec/ld.elf_so/rtld.h: revision 1.145
	libexec/ld.elf_so/symbol.c: revision 1.74
	libexec/ld.elf_so/rtld.h: revision 1.147
	libexec/ld.elf_so/symbol.c: revision 1.75
	libexec/ld.elf_so/symbol.c: revision 1.76
	tests/libexec/ld.elf_so/t_hash.c: revision 1.1
	libexec/ld.elf_so/Makefile: revision 1.145
	libexec/ld.elf_so/Makefile: revision 1.146
	libexec/ld.elf_so/Makefile: revision 1.147
	libexec/ld.elf_so/reloc.c: revision 1.118
	distrib/sets/lists/tests/mi: revision 1.1280
	libexec/ld.elf_so/rtld.c: revision 1.215
	tests/libexec/ld.elf_so/Makefile: revision 1.21
	libexec/ld.elf_so/hash.c: revision 1.1
	libexec/ld.elf_so/hash.h: revision 1.1
	distrib/sets/lists/debug/mi: revision 1.409

The SysV ABI specifies that the symbol hash function should return only 32
bits of hash. Unfortunately due to an implementation bug and the fact that
the return type is unsigned long which is 64 bits in LP64, this can fail
in some cases: "\xff\x0f\x0f\x0f\x0f\x0f\x12". See:
    "https://maskray.me/blog/2023-04-12-elf-hash-function
From Ed Maste @ FreeBSD:
    https://cgit.freebsd.org/src/commit/?id=29e3a06510823edbb91667d21f530d3ec778116d

Need to write Unit Tests for this.

Oops wrong mask.

ld.elf_so: Split SRCS onto multiple lines.
Makes updates easier.
No functional change intended.

ld.elf_so: Sort SRCS.
No functional change intended.

ld.elf_so: Split hash functions into a separate file.
This way we can test them in isolation.
No functional change intended.

ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.

Revision 1.212.2.2 / (download) - annotate - [select for diffs], Tue Aug 1 16:34:56 2023 UTC (7 months, 3 weeks ago) by martin
Branch: netbsd-10
Changes since 1.212.2.1: +7 -3 lines
Diff to previous 1.212.2.1 (colored) to branchpoint 1.212 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by riastradh in ticket #297):

	distrib/sets/lists/tests/shl.mi: revision 1.14
	distrib/sets/lists/tests/shl.mi: revision 1.15
	distrib/sets/lists/tests/shl.mi: revision 1.16
	tests/libexec/ld.elf_so/helper_def_static/h_def_static.c: revision 1.1
	tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.2
	libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.75
	distrib/sets/lists/tests/mi: revision 1.1265
	libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.36
	libexec/ld.elf_so/rtld.c: revision 1.214
	tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.1
	distrib/sets/lists/debug/mi: revision 1.400
	tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.2
	distrib/sets/lists/debug/mi: revision 1.401
	distrib/sets/lists/debug/mi: revision 1.402
	tests/libexec/ld.elf_so/helper_dso2/Makefile: revision 1.2
	distrib/sets/lists/debug/mi: revision 1.403
	tests/libexec/ld.elf_so/helper_symver_dso0/Makefile: revision 1.2
	libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.48
	distrib/sets/lists/debug/mi: revision 1.406
	tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_ifunc_dso/Makefile: revision 1.2
	libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.70
	libexec/ld.elf_so/arch/aarch64/mdreloc.c: revision 1.18
	tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/Makefile: revision 1.13
	libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.46
	libexec/ld.elf_so/rtld.h: revision 1.146
	tests/libexec/ld.elf_so/Makefile: revision 1.14
	distrib/sets/lists/debug/shl.mi: revision 1.306
	tests/libexec/ld.elf_so/Makefile: revision 1.15
	tests/libexec/ld.elf_so/helper_abuse_static/Makefile: revision 1.1
	distrib/sets/lists/debug/shl.mi: revision 1.307
	tests/libexec/ld.elf_so/Makefile: revision 1.16
	tests/libexec/ld.elf_so/helper_abuse_static/Makefile: revision 1.2
	distrib/sets/lists/debug/shl.mi: revision 1.308
	tests/libexec/ld.elf_so/Makefile: revision 1.17
	distrib/sets/lists/debug/shl.mi: revision 1.309
	tests/libexec/ld.elf_so/Makefile: revision 1.18
	tests/libexec/ld.elf_so/Makefile: revision 1.19
	libexec/ld.elf_so/tls.c: revision 1.16
	libexec/ld.elf_so/tls.c: revision 1.17
	libexec/ld.elf_so/tls.c: revision 1.18
	libexec/ld.elf_so/tls.c: revision 1.19
	tests/libexec/ld.elf_so/helper_onlydef_static/h_onlydef_static.c: revision 1.1
	tests/libexec/ld.elf_so/helper_use_static/h_use_static.c: revision 1.1
	tests/libexec/ld.elf_so/helper_use_static/h_use_static.c: revision 1.2
	tests/libexec/ld.elf_so/helper_def_static/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_def_static/Makefile: revision 1.2
	libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.50
	distrib/sets/lists/debug/shl.mi: revision 1.310
	libexec/ld.elf_so/README.TLS: revision 1.6
	distrib/sets/lists/debug/shl.mi: revision 1.311
	distrib/sets/lists/debug/shl.mi: revision 1.314
	tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_symver_dso1/Makefile: revision 1.4
	libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.63
	tests/libexec/ld.elf_so/helper_def_dynamic/h_def_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_onlydef/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_onlydef/Makefile: revision 1.2
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.10
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.11
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.12
	libexec/ld.elf_so/map_object.c: revision 1.66
	tests/libexec/ld.elf_so/helper.mk: revision 1.1
	libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.57
	libexec/ld.elf_so/map_object.c: revision 1.67
	tests/libexec/ld.elf_so/helper_onlydef/h_onlydef.c: revision 1.1
	tests/libexec/ld.elf_so/helper_symver_dso2/Makefile: revision 1.4
	tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_use_static/Makefile: revision 1.3
	tests/libexec/ld.elf_so/helper_use_dynamic/h_use_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_abuse_static/h_abuse_static.c: revision 1.1
	libexec/ld.elf_so/arch/riscv/mdreloc.c: revision 1.9
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.1
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.2
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.3
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.4
	tests/libexec/ld.elf_so/helper_onlyctor_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.5
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.6
	libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.34
	tests/libexec/ld.elf_so/helper_onlyctor_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.7
	libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.42
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.8
	libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.43
	libexec/ld.elf_so/arch/or1k/mdreloc.c: revision 1.4
	tests/libexec/ld.elf_so/t_tls_extern.c: revision 1.9
	tests/libexec/ld.elf_so/helper_onlyuse_dynamic/Makefile: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyuse_dynamic/Makefile: revision 1.2
	tests/libexec/ld.elf_so/helper_abuse_dynamic/h_abuse_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyctor_dynamic/h_onlyctor_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyuse_static/h_onlyuse_static.c: revision 1.1
	tests/libexec/ld.elf_so/helper_onlyuse_dynamic/h_onlyuse_dynamic.c: revision 1.1
	tests/libexec/ld.elf_so/helper_dso1/Makefile: revision 1.2
	distrib/sets/lists/tests/shl.mi: revision 1.12
	distrib/sets/lists/tests/shl.mi: revision 1.13
	libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.44
	(all via patch)

ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.

ld.elf_so: Fix extern TLS test to match PR toolchain/50277.
Now it's actually testing the problem.
ld.elf_so: Nix inadvertently committed private test program.
ld.elf_so: Fix set lists for MKDEBUG=yes builds with t_tls_extern.

ld.elf_so: Sprinkle tls debug messages.

ld.elf_so: Make tls alloc debug messages more detailed and greppable.

ld.elf_so: Test variations on PR toolchain/50277.

ld.elf_so: Test extern dynamic TLS too.

ld.elf_so: Factor out logic in TLS tests to make writing more easier.
No functional change intended.

ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.

ld.elf_so: Shorter test names.
No functional non-cosmetic change intended.

ld.elf_so: Separately test eager and lazy resolution of def tls ptr.
eager: before loading use library
lazy: after loading use library

Add recent ld.elf_so test helpers debug info
ld.elf_so: Add new files to debug/shl.mi.

ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently.
If a symbol has already been resolved as dynamic TLS, any library
that tries to use it as static TLS cannot be dlopened.

ld.elf_so: Test another edge case of mismatched TLS models.
One library defines a symbol and _doesn't_ use it, so it has no
indication of whether the symbol is for static TLS or dynamic TLS,
and then two other libraries use it in different ways.

ld.elf_so: Test dynamic-then-static abuse via ctor.

ld.elf_so: Fix missing tab in debug/shl.mi in last change.

Fix interactions of initial-exec TLS model and dlopen
(1) If an initial-exec relocation was used for a non-local symbol
(i.e. the definition of the symbol is in a different DSO), the
computation of the static TLS offset used the wrong DSO.
This would effectively mean the wrong address was computed
(PR toolchain/50277, PR pkg/57445).
Fix this by forcing the computation of the correct DSO (the one defining
the symbol).
This code uses __UNCONST to avoid the vast interface changes for this
special case.
(2) If symbols from a DSO loaded via dlopen are used with both
global-dynamic/local-dynamic and initial-exec relocations AND
a initial-exec relocation was resolved first in a thread, a split brain
situation could exist where the dynamic relocations would use one memory
block (separate allocation) and the initial-exec relocations the static
per-thread TLS space.
(3) If the initial-exec relocation in (2) is seen after any thread has
already used a GD/LD allocation, bail out. Since IE relocations are used
only in the GOT, this will prevent the dlopen. This is a bit more
aggressive than necessary, but a full blown reference counting doesn't
seem to be justified.
Avoid using uninitialized variable "symnum" when building with DEBUG
enabled by borrowing the rdbg_symname() macro from arch/x86_64.
ld.elf_so: Sprinkle more debug messages on dlopen and error.
PR pkg/57445
Fix MKDEBUGLIB build by adding these installed files to the debug
set list.
XXX
One could argue that these files are not of any use, so why install
them?  I don't have a good argument either way, and this is (for
now) a simple work-around for PR bin/57455   Please feel free to
commit a different fix to avoid installing these files at all.
Fix markup of libh_ MKDEBUGLIB=yes only files
TLS variant I archs need to fudge the offset by the size of the TCB.
tests/libexec/ld.elf_so: Fix helper library makefiles.
1. Consolidate logic into a single helper.mk to reduce duplication.
2. Set NO* variables, not MK* variables which are reserved for user.
3. Avoid eager X!= in favour of lazy ${X:sh}.
4. Mark _g.a set list entries obsolete.  Never should've been built!
PR misc/57462

Revision 1.183.4.3 / (download) - annotate - [select for diffs], Tue Aug 1 15:19:02 2023 UTC (7 months, 3 weeks ago) by martin
Branch: netbsd-8
Changes since 1.183.4.2: +5 -3 lines
Diff to previous 1.183.4.2 (colored) to branchpoint 1.183 (colored) next main 1.184 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1871):

	libexec/ld.elf_so/rtld.c: revision 1.213

dlopen(3): Read _rtld_objtail under the lock.

Revision 1.197.2.6 / (download) - annotate - [select for diffs], Tue Aug 1 15:17:44 2023 UTC (7 months, 3 weeks ago) by martin
Branch: netbsd-9
Changes since 1.197.2.5: +5 -3 lines
Diff to previous 1.197.2.5 (colored) to branchpoint 1.197 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1690):

	libexec/ld.elf_so/rtld.c: revision 1.213

dlopen(3): Read _rtld_objtail under the lock.

Revision 1.212.2.1 / (download) - annotate - [select for diffs], Tue Aug 1 15:13:02 2023 UTC (7 months, 3 weeks ago) by martin
Branch: netbsd-10
Changes since 1.212: +5 -3 lines
Diff to previous 1.212 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by riastradh in ticket #288):

	libexec/ld.elf_so/rtld.c: revision 1.213

dlopen(3): Read _rtld_objtail under the lock.

Revision 1.215 / (download) - annotate - [select for diffs], Sun Jul 30 09:20:14 2023 UTC (7 months, 4 weeks ago) by riastradh
Branch: MAIN
Changes since 1.214: +4 -2 lines
Diff to previous 1.214 (colored) to selected 1.8 (colored)

ld.elf_so: Split hash functions into a separate file.

This way we can test them in isolation.

No functional change intended.

Revision 1.214 / (download) - annotate - [select for diffs], Sun Jun 4 23:42:38 2023 UTC (9 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.213: +7 -3 lines
Diff to previous 1.213 (colored) to selected 1.8 (colored)

ld.elf_so: Sprinkle more debug messages on dlopen and error.

PR pkg/57445

Revision 1.213 / (download) - annotate - [select for diffs], Sun Apr 23 11:53:00 2023 UTC (11 months ago) by riastradh
Branch: MAIN
Changes since 1.212: +5 -3 lines
Diff to previous 1.212 (colored) to selected 1.8 (colored)

dlopen(3): Read _rtld_objtail under the lock.

XXX pullup-8
XXX pullup-9
XXX pullup-10

Revision 1.197.2.5 / (download) - annotate - [select for diffs], Sat Apr 1 16:08:05 2023 UTC (11 months, 3 weeks ago) by martin
Branch: netbsd-9
Changes since 1.197.2.4: +4 -5 lines
Diff to previous 1.197.2.4 (colored) to branchpoint 1.197 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1624):

	libexec/ld.elf_so/rtld.c: revision 1.212

ld.elf_so(8): Make fork take a shared, not exclusive, lock.

We only need to ensure that there are no concurrent modifications to
the rtld data structures in flight, since the threads that began
those modifications will not exist in the child and will therefore be
unable to complete them in the child.

A shared lock suffices to ensure there are no such concurrent
modifications in flight; an exclusive lock is not necessary, and can
cause deadlock if fork is executed from a signal handler, which is
explicitly allowed by POSIX (and our own sigaction(2) man page) which
marks fork as async-signal-safe.

PR lib/56979

Revision 1.212 / (download) - annotate - [select for diffs], Tue Sep 13 10:18:58 2022 UTC (18 months, 2 weeks ago) by riastradh
Branch: MAIN
CVS Tags: netbsd-10-base
Branch point for: netbsd-10
Changes since 1.211: +4 -5 lines
Diff to previous 1.211 (colored) to selected 1.8 (colored)

ld.elf_so(8): Make fork take a shared, not exclusive, lock.

We only need to ensure that there are no concurrent modifications to
the rtld data structures in flight, since the threads that began
those modifications will not exist in the child and will therefore be
unable to complete them in the child.

A shared lock suffices to ensure there are no such concurrent
modifications in flight; an exclusive lock is not necessary, and can
cause deadlock if fork is executed from a signal handler, which is
explicitly allowed by POSIX (and our own sigaction(2) man page) which
marks fork as async-signal-safe.

PR lib/56979

Revision 1.211 / (download) - annotate - [select for diffs], Sat Apr 9 23:39:07 2022 UTC (23 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.210: +6 -6 lines
Diff to previous 1.210 (colored) to selected 1.8 (colored)

rtld: Convert membar_exit/enter to membar_release/acquire.

These are basic CAS-based locking primitives needing release and
acquire semantics, nothing fancy here -- except the membar_sync parts
which are questionable but not relevant to the present audit.

Revision 1.210 / (download) - annotate - [select for diffs], Sat Dec 4 14:39:08 2021 UTC (2 years, 3 months ago) by skrll
Branch: MAIN
Changes since 1.209: +14 -14 lines
Diff to previous 1.209 (colored) to selected 1.8 (colored)

Restore the fptr_t type of {init,fini}{,_array} that was removed when initial
support for indirect functions was added.  This fixes {init,fini}_array support
on hppa where each member of the array is (already) a plabel.

Discussed with joerg.

 4 files changed, 29 insertions(+), 39 deletions(-)
: ----------------------------------------------------------------------

Revision 1.209 / (download) - annotate - [select for diffs], Wed Jun 16 21:53:51 2021 UTC (2 years, 9 months ago) by riastradh
Branch: MAIN
Changes since 1.208: +2 -4 lines
Diff to previous 1.208 (colored) to selected 1.8 (colored)

ld.elf_so(1): Omit needless membar_enter.

The use of membar_enter is to separate atomic r/m/w on a lock from
the body of the critical section so two different critical sections
happen in order:

		body of previous critical section;

	exit critical section:
		membar_exit();
		atomic_r/m/w(lock stuff);

	enter critical section:
		atomic_r/m/w(lock stuff);
		membar_enter();

		body of next critical section;

_rtld_shared_enter does this, but it _also_ issued an extraneous
membar_enter before the atomic_r/m/w part, which doesn't impose any
semantically important order but may cost some performance.

Revision 1.207.2.1 / (download) - annotate - [select for diffs], Mon May 31 22:15:07 2021 UTC (2 years, 9 months ago) by cjep
Branch: cjep_staticlib_x
Changes since 1.207: +6 -6 lines
Diff to previous 1.207 (colored) next main 1.208 (colored) to selected 1.8 (colored)

sync with head

Revision 1.208 / (download) - annotate - [select for diffs], Sun May 30 02:26:08 2021 UTC (2 years, 9 months ago) by joerg
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1
Changes since 1.207: +6 -6 lines
Diff to previous 1.207 (colored) to selected 1.8 (colored)

Don't use the return address hack with clang.

Revision 1.207 / (download) - annotate - [select for diffs], Tue Sep 22 00:41:27 2020 UTC (3 years, 6 months ago) by kamil
Branch: MAIN
CVS Tags: cjep_staticlib_x-base
Branch point for: cjep_staticlib_x
Changes since 1.206: +3 -3 lines
Diff to previous 1.206 (colored) to selected 1.8 (colored)

Correct r_ldbase valuse

It shall be the relocbase value, not linkmap.

Revision 1.206 / (download) - annotate - [select for diffs], Mon Sep 21 16:08:57 2020 UTC (3 years, 6 months ago) by kamil
Branch: MAIN
Changes since 1.205: +8 -6 lines
Diff to previous 1.205 (colored) to selected 1.8 (colored)

Upgrade the SVR4 RTLD r_debug protocol to version 1

Changes:
 - Add a new field r_ldbase in the r_debug struct.
 - Set r_version to 1.

This harmonizes the support with OpenBSD and Linux.
FreeBSD uses version 0 (or no version).
Solaris uses version 2 that is not implemented elsewhere and relies on
SVR4 specific design and interfaces.

Update the code comments as r_debug and link_map is used by other software
than GDB, namely: sanitizers, rump, LLDB.

Revision 1.197.2.4 / (download) - annotate - [select for diffs], Wed May 13 18:08:38 2020 UTC (3 years, 10 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE
Changes since 1.197.2.3: +19 -2 lines
Diff to previous 1.197.2.3 (colored) to branchpoint 1.197 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by chs in ticket #907):

	libexec/ld.elf_so/rtld.c: revision 1.205
	libexec/ld.elf_so/rtld.h: revision 1.140
	libexec/ld.elf_so/symbols.map: revision 1.3
	libexec/ld.elf_so/symbols.map: revision 1.4
	lib/libc/gen/pthread_atfork.c: revision 1.13
	lib/libc/gen/pthread_atfork.c: revision 1.14
	libexec/ld.elf_so/rtld.h: revision 1.139
	libexec/ld.elf_so/rtld.c: revision 1.204

Introduce intermediate locking for fork, so that the dynamic linker is
in a consistent state. This most importantly avoids races between dlopen
and friends and fork, potentially resulting in dead locks in the child
when it itself tries to acquire locks.

Rename __atomic_fork to __locked_fork and give it &errno as argument.
rtld and libc use different storage, so the initial version would
incorrectly report the failure reason for fork().

There is still a small race condition inside ld.elf_so as it doesn't use
thread-safe errno internally, but that's a more contained internal
issue.

Revision 1.192.2.4 / (download) - annotate - [select for diffs], Tue Apr 21 18:42:00 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.192.2.3: +17 -0 lines
Diff to previous 1.192.2.3 (colored) to branchpoint 1.192 (colored) next main 1.193 (colored) to selected 1.8 (colored)

Sync with HEAD

Revision 1.205 / (download) - annotate - [select for diffs], Sun Apr 19 01:06:15 2020 UTC (3 years, 11 months ago) by joerg
Branch: MAIN
CVS Tags: phil-wifi-20200421
Changes since 1.204: +5 -3 lines
Diff to previous 1.204 (colored) to selected 1.8 (colored)

Rename __atomic_fork to __locked_fork and give it &errno as argument.
rtld and libc use different storage, so the initial version would
incorrectly report the failure reason for fork().

There is still a small race condition inside ld.elf_so as it doesn't use
thread-safe errno internally, but that's a more contained internal
issue.

Revision 1.204 / (download) - annotate - [select for diffs], Thu Apr 16 14:39:58 2020 UTC (3 years, 11 months ago) by joerg
Branch: MAIN
Changes since 1.203: +17 -2 lines
Diff to previous 1.203 (colored) to selected 1.8 (colored)

Introduce intermediate locking for fork, so that the dynamic linker is
in a consistent state. This most importantly avoids races between dlopen
and friends and fork, potentially resulting in dead locks in the child
when it itself tries to acquire locks.

Revision 1.192.2.3 / (download) - annotate - [select for diffs], Mon Apr 13 08:03:17 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.192.2.2: +36 -16 lines
Diff to previous 1.192.2.2 (colored) to branchpoint 1.192 (colored) to selected 1.8 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.192.2.2 / (download) - annotate - [select for diffs], Wed Apr 8 14:07:17 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.192.2.1: +31 -17 lines
Diff to previous 1.192.2.1 (colored) to branchpoint 1.192 (colored) to selected 1.8 (colored)

Merge changes from current as of 20200406

Revision 1.197.2.3 / (download) - annotate - [select for diffs], Sun Mar 8 10:22:29 2020 UTC (4 years ago) by martin
Branch: netbsd-9
Changes since 1.197.2.2: +17 -5 lines
Diff to previous 1.197.2.2 (colored) to branchpoint 1.197 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by thorpej in ticket #758):

	libexec/ld.elf_so/map_object.c: revision 1.61
	libexec/ld.elf_so/headers.c: revision 1.68
	libexec/ld.elf_so/rtld.c: revision 1.203

PT_GNU_RELRO segments are arranged such that their vaddr + memsz ends
on a linker common page size boundary.  However, if the common page size
used by the linker is less than the VM page size being used by the kernel,
this can end up in the middle of a VM page and when the region is write-
protected, this can cause objects in neighboring .data to get incorrectly
write-protected, resulting in a crash.

Avoid this situation by calculating the end of the RELRO region not by
rounding memsz up to the VM page size, but rather by adding vaddr + memsz
and then truncating to the VM page size.

Fixes PR toolchain/55043.

XXX pullup-9

Revision 1.203 / (download) - annotate - [select for diffs], Wed Mar 4 01:21:17 2020 UTC (4 years ago) by thorpej
Branch: MAIN
CVS Tags: phil-wifi-20200411, phil-wifi-20200406
Changes since 1.202: +17 -5 lines
Diff to previous 1.202 (colored) to selected 1.8 (colored)

PT_GNU_RELRO segments are arranged such that their vaddr + memsz ends
on a linker common page size boundary.  However, if the common page size
used by the linker is less than the VM page size being used by the kernel,
this can end up in the middle of a VM page and when the region is write-
protected, this can cause objects in neighboring .data to get incorrectly
write-protected, resulting in a crash.

Avoid this situation by calculating the end of the RELRO region not by
rounding memsz up to the VM page size, but rather by adding vaddr + memsz
and then truncating to the VM page size.

Fixes PR toolchain/55043.

XXX pullup-9

Revision 1.202 / (download) - annotate - [select for diffs], Sat Feb 29 04:23:05 2020 UTC (4 years ago) by kamil
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp
Changes since 1.201: +16 -14 lines
Diff to previous 1.201 (colored) to selected 1.8 (colored)

Implement and integrate GNU Hashing function

Define Elf_Hash struct that contains ELF/SYSV and GNU hash checksum.
Implement _rtld_gnu_hash() for DT_GNU_HASH.
Adapt existing code to compute all Elf_Hash types, instead of only
the ELF/SYSV one.
Rename _rtld_elf_hash() to _rtld_sysv_hash() to match the GNU toolchain
terminology.

_rtld_gnu_hash() uses Dan Bernstein's string hash function posted eons ago
on comp.lang.c.

Revision 1.197.2.2 / (download) - annotate - [select for diffs], Mon Dec 9 16:12:16 2019 UTC (4 years, 3 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RELEASE, netbsd-9-0-RC2
Changes since 1.197.2.1: +3 -3 lines
Diff to previous 1.197.2.1 (colored) to branchpoint 1.197 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by uwe in ticket #534):

	libexec/ld.elf_so/rtld.c: revision 1.201

_rtld_relro - fix debug printf format for a size_t argument

Revision 1.201 / (download) - annotate - [select for diffs], Sun Dec 8 22:35:27 2019 UTC (4 years, 3 months ago) by uwe
Branch: MAIN
Changes since 1.200: +3 -3 lines
Diff to previous 1.200 (colored) to selected 1.8 (colored)

_rtld_relro - fix debug printf format for a size_t argument

Revision 1.200 / (download) - annotate - [select for diffs], Fri Oct 4 01:57:53 2019 UTC (4 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20191119
Changes since 1.199: +4 -4 lines
Diff to previous 1.199 (colored) to selected 1.8 (colored)

use __func__ (c99, c++11) instead of __FUNCTION__

Revision 1.199 / (download) - annotate - [select for diffs], Thu Oct 3 10:34:30 2019 UTC (4 years, 5 months ago) by tnn
Branch: MAIN
Changes since 1.198: +4 -4 lines
Diff to previous 1.198 (colored) to selected 1.8 (colored)

improve error message

Revision 1.197.2.1 / (download) - annotate - [select for diffs], Wed Sep 18 16:09:07 2019 UTC (4 years, 6 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RC1
Changes since 1.197: +36 -16 lines
Diff to previous 1.197 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by kamil in ticket #209):

	libexec/ld.elf_so/rtld.c: revision 1.198

Return the ELF loader dl_phdr_info information for dl_iterate_phdr(3)
Sync the behavior of dl_iterate_phdr(3) with Linux/FreeBSD/OpenBSD.

Revision 1.198 / (download) - annotate - [select for diffs], Sun Sep 15 13:40:46 2019 UTC (4 years, 6 months ago) by kamil
Branch: MAIN
Changes since 1.197: +36 -16 lines
Diff to previous 1.197 (colored) to selected 1.8 (colored)

Return the ELF loader dl_phdr_info information for dl_iterate_phdr(3)

Sync the behavior of dl_iterate_phdr(3) with Linux/FreeBSD/OpenBSD.

Revision 1.192.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:05:29 2019 UTC (4 years, 9 months ago) by christos
Branch: phil-wifi
Changes since 1.192: +26 -3 lines
Diff to previous 1.192 (colored) to selected 1.8 (colored)

Sync with HEAD

Revision 1.197 / (download) - annotate - [select for diffs], Sun Apr 14 19:21:37 2019 UTC (4 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20190609, netbsd-9-base
Branch point for: netbsd-9
Changes since 1.196: +2 -4 lines
Diff to previous 1.196 (colored) to selected 1.8 (colored)

undo previous unlock/relock; it is not needed now that we added the tls model
declaration to all externs in jemalloc (suggested by joerg@)

Revision 1.196 / (download) - annotate - [select for diffs], Sat Apr 13 03:15:25 2019 UTC (4 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.195: +4 -2 lines
Diff to previous 1.195 (colored) to selected 1.8 (colored)

Fix c++ exceptions on arm; jemalloc calls _rtld_tls_get_addr from inside
dl_iterate_phdr, so we need to unlock and relock.

Revision 1.190.2.4 / (download) - annotate - [select for diffs], Fri Jan 18 08:50:11 2019 UTC (5 years, 2 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.190.2.3: +25 -2 lines
Diff to previous 1.190.2.3 (colored) to branchpoint 1.190 (colored) next main 1.191 (colored) to selected 1.8 (colored)

Synch with HEAD

Revision 1.195 / (download) - annotate - [select for diffs], Sun Dec 30 01:48:37 2018 UTC (5 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118
Changes since 1.194: +21 -2 lines
Diff to previous 1.194 (colored) to selected 1.8 (colored)

binutils 2.31.1 can put copy relocations in the relro segment. Delay
protecting the relro segment for the main object until copy relocations
are done.

Revision 1.194 / (download) - annotate - [select for diffs], Thu Dec 27 18:57:43 2018 UTC (5 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.193: +6 -2 lines
Diff to previous 1.193 (colored) to selected 1.8 (colored)

explain why we skip objmain.

Revision 1.190.2.3 / (download) - annotate - [select for diffs], Sat Oct 20 06:58:22 2018 UTC (5 years, 5 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.190.2.2: +3 -3 lines
Diff to previous 1.190.2.2 (colored) to branchpoint 1.190 (colored) to selected 1.8 (colored)

Sync with head

Revision 1.193 / (download) - annotate - [select for diffs], Wed Oct 17 23:36:58 2018 UTC (5 years, 5 months ago) by joerg
Branch: MAIN
CVS Tags: pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020
Changes since 1.192: +3 -3 lines
Diff to previous 1.192 (colored) to selected 1.8 (colored)

Move compatibility for pre-2.0 ELF binaries into separate file.
Early ELF binaries defined dlopen and friends in crt0.o by
using function pointers in the object handle passed from rtld.
This contract wastes space when many shared objects are allocated
and ties dynamic linker and rest of the system tightly together.
Fake the entry points in a static object and restrict them to the
platforms that had working ELF support at the time. Keep the magic and
version field used by modern crt0.o for all architectures. The checks
will be removed from crt0.o in a follow-up step.

Revision 1.190.2.2 / (download) - annotate - [select for diffs], Sat Apr 7 04:12:09 2018 UTC (5 years, 11 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.190.2.1: +3 -3 lines
Diff to previous 1.190.2.1 (colored) to branchpoint 1.190 (colored) to selected 1.8 (colored)

Sync with HEAD.  77 conflicts resolved - all of them $NetBSD$

Revision 1.192 / (download) - annotate - [select for diffs], Tue Apr 3 21:10:27 2018 UTC (5 years, 11 months ago) by joerg
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407
Branch point for: phil-wifi
Changes since 1.191: +3 -3 lines
Diff to previous 1.191 (colored) to selected 1.8 (colored)

Rework ifunc support to address a number of short comings:
- Move to a shared _rtld_call_ifunc for rel and rela architectures
- Architectures using rel format must patch IRELATIVE non-PLT
  relocations like RELATIVE in additition to the later ifunc handling
- Consistently record the delta to the end of the relocation group for
  non-PLT IRELATIVE relocations

Hidden ifunc is now supported on all ifunc platforms, even when using
-fno-plt. The combination of -fno-plt and relro is broken due to
incorrect GNU ld output though.

Revision 1.190.2.1 / (download) - annotate - [select for diffs], Thu Mar 15 09:12:01 2018 UTC (6 years ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.190: +3 -3 lines
Diff to previous 1.190 (colored) to selected 1.8 (colored)

Synch with HEAD

Revision 1.191 / (download) - annotate - [select for diffs], Fri Mar 9 20:19:11 2018 UTC (6 years ago) by joerg
Branch: MAIN
CVS Tags: pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Changes since 1.190: +3 -3 lines
Diff to previous 1.190 (colored) to selected 1.8 (colored)

Like Sparc, PowerPC can use IRELATIVE relocations in non-PLT sections.

Revision 1.190 / (download) - annotate - [select for diffs], Sun Feb 11 18:58:44 2018 UTC (6 years, 1 month ago) by jakllsch
Branch: MAIN
CVS Tags: pgoyette-compat-base
Branch point for: pgoyette-compat
Changes since 1.189: +6 -2 lines
Diff to previous 1.189 (colored) to selected 1.8 (colored)

Wrap PowerPC #pragma goop in #if __GNUC_PREREQ__(6,0).
Our older GCC warns/errors on it.

Revision 1.189 / (download) - annotate - [select for diffs], Wed Feb 7 06:17:45 2018 UTC (6 years, 1 month ago) by mrg
Branch: MAIN
Changes since 1.188: +5 -2 lines
Diff to previous 1.188 (colored) to selected 1.8 (colored)

update for GCC 6:

ignore -Wframe-address warnings for the ppc hack.

Revision 1.188 / (download) - annotate - [select for diffs], Mon Nov 6 21:16:04 2017 UTC (6 years, 4 months ago) by joerg
Branch: MAIN
Changes since 1.187: +32 -14 lines
Diff to previous 1.187 (colored) to selected 1.8 (colored)

init/fini for the main program is handled by crt0.o, so ifunc handling
is skipped right now as it iterates the same list. Don't repeat that
mistake and explicitly take care of it in the dynamic linker.

Revision 1.183.4.2 / (download) - annotate - [select for diffs], Tue Aug 29 09:43:17 2017 UTC (6 years, 7 months ago) by bouyer
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.183.4.1: +41 -2 lines
Diff to previous 1.183.4.1 (colored) to branchpoint 1.183 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by joerg in ticket #127):
	tests/libexec/ld.elf_so/h_thread_local_dtor.c: revision 1.1
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb/c++config.h: revision 1.17
	lib/libc/stdlib/atexit.h: file removal
	lib/libc/stdlib/exit.c: revision 1.16
	external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/c++config.h: revision 1.8
	lib/libc/stdlib/exit.c: revision 1.17
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf/c++config.h: revision 1.14
	distrib/sets/lists/debug/shl.mi: revision 1.178
	external/gpl3/gcc/lib/libstdc++-v3/arch/sh3el/c++config.h: revision 1.21
	distrib/sets/lists/debug/shl.mi: revision 1.179
	distrib/sets/lists/debug/mi: revision 1.219
	lib/libpthread/pthread.c: revision 1.150
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/c++config.h: revision 1.14
	libexec/ld.elf_so/symbols.map: revision 1.2
	include/dlfcn.h: revision 1.25
	external/gpl3/gcc/lib/libstdc++-v3/arch/arm/c++config.h: revision 1.21
	external/gpl3/gcc/lib/libstdc++-v3/arch/x86_64/c++config.h: revision 1.23
	external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el/c++config.h: revision 1.18
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/earm/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/mipsel/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/ia64/c++config.h: revision 1.5
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf/c++config.h: revision 1.17
	distrib/sets/lists/tests/mi: revision 1.755
	external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/i386/c++config.h: revision 1.20
	external/gpl3/gcc/lib/libstdc++-v3/arch/vax/c++config.h: revision 1.21
	external/gpl3/gcc/lib/libstdc++-v3/arch/armeb/c++config.h: revision 1.21
	external/gpl3/gcc/lib/libstdc++-v3/arch/sparc/c++config.h: revision 1.20
	lib/libc/dlfcn/dlfcn_elf.c: revision 1.14
	tests/libexec/ld.elf_so/t_thread_local_dtor.sh: revision 1.1
	tests/lib/libpthread/t_thread_local_dtor.sh: revision 1.1
	lib/libc/stdlib/Makefile.inc: revision 1.93
	lib/libc/include/atexit.h: revision 1.1
	lib/libc/include/atexit.h: revision 1.2
	external/gpl3/gcc/lib/libstdc++-v3/arch/m68k/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf/c++config.h: revision 1.14
	distrib/sets/lists/debug/shl.mi: revision 1.180
	external/gpl3/gcc/lib/libstdc++-v3/arch/sparc64/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/hppa/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb/c++config.h: revision 1.14
	lib/libc/stdlib/cxa_thread_atexit.c: revision 1.1
	tests/libexec/ld.elf_so/helper_dso3/h_helper_dso3.cpp: revision 1.1
	tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.1
	external/gpl3/gcc/lib/libstdc++-v3/arch/riscv64/c++config.h: revision 1.5
	libexec/ld.elf_so/rtld.c: revision 1.185
	external/gpl3/gcc/lib/libstdc++-v3/arch/sh3eb/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/riscv32/c++config.h: revision 1.5
	external/gpl3/gcc/lib/libstdc++-v3/arch/m68000/c++config.h: revision 1.15
	external/gpl3/gcc/lib/libstdc++-v3/arch/mipseb/c++config.h: revision 1.21
	external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire/c++config.h: revision 1.12
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb/c++config.h: revision 1.15
	external/gpl3/gcc/lib/libstdc++-v3/arch/alpha/c++config.h: revision 1.19
	tests/libexec/ld.elf_so/Makefile: revision 1.9
	external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h: revision 1.20
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb/c++config.h: revision 1.14
	tests/lib/libpthread/h_thread_local_dtor.cpp: revision 1.1
	distrib/sets/lists/tests/shl.mi: revision 1.11
	tests/lib/libpthread/Makefile: revision 1.13
	libexec/ld.elf_so/rtld.h: revision 1.129
	external/gpl3/gcc/lib/libstdc++-v3/arch/or1k/c++config.h: revision 1.6
Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.
If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.
Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
Fix filename of new debug file
Add misising DEBUGLIB file
Avoid common declaration.
Drop TLS variant checks, emutls is enough for VAX and Sun2.

Revision 1.187 / (download) - annotate - [select for diffs], Sat Aug 12 09:03:27 2017 UTC (6 years, 7 months ago) by joerg
Branch: MAIN
Changes since 1.186: +7 -3 lines
Diff to previous 1.186 (colored) to selected 1.8 (colored)

Add sparc/sparc64 support for irelative relocations.

Revision 1.186 / (download) - annotate - [select for diffs], Thu Aug 10 19:03:25 2017 UTC (6 years, 7 months ago) by joerg
Branch: MAIN
Changes since 1.185: +17 -4 lines
Diff to previous 1.185 (colored) to selected 1.8 (colored)

Add IRELATIVE support for ARM, X86 and PowerPC.

Revision 1.185 / (download) - annotate - [select for diffs], Tue Jul 11 15:21:35 2017 UTC (6 years, 8 months ago) by joerg
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Changes since 1.184: +41 -2 lines
Diff to previous 1.184 (colored) to selected 1.8 (colored)

Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.

If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.

Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.

Revision 1.183.4.1 / (download) - annotate - [select for diffs], Sat Jun 10 06:27:51 2017 UTC (6 years, 9 months ago) by snj
Branch: netbsd-8
Changes since 1.183: +4 -4 lines
Diff to previous 1.183 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by joerg in ticket #26):
	libexec/ld.elf_so/rtld.c: revision 1.184
Call _rtld_debug_state before running the global initialisers, so give
gdb a chance to set break points etc.

Revision 1.184 / (download) - annotate - [select for diffs], Thu Jun 8 18:24:39 2017 UTC (6 years, 9 months ago) by joerg
Branch: MAIN
Changes since 1.183: +4 -4 lines
Diff to previous 1.183 (colored) to selected 1.8 (colored)

Call _rtld_debug_state before running the global initialisers, so give
gdb a chance to set break points etc.

Revision 1.182.2.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:53:13 2017 UTC (6 years, 11 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.182: +3 -3 lines
Diff to previous 1.182 (colored) next main 1.183 (colored) to selected 1.8 (colored)

Sync with HEAD

Revision 1.178.2.2 / (download) - annotate - [select for diffs], Mon Mar 20 06:57:01 2017 UTC (7 years ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.178.2.1: +3 -3 lines
Diff to previous 1.178.2.1 (colored) to branchpoint 1.178 (colored) next main 1.179 (colored) to selected 1.8 (colored)

Sync with HEAD

Revision 1.183 / (download) - annotate - [select for diffs], Mon Feb 27 20:25:26 2017 UTC (7 years, 1 month ago) by chs
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, pgoyette-localcount-20170320, netbsd-8-base, bouyer-socketcan-base1
Branch point for: netbsd-8
Changes since 1.182: +3 -3 lines
Diff to previous 1.182 (colored) to selected 1.8 (colored)

tag the powerpc hackish_return_address() as __noinline.

Revision 1.178.2.1 / (download) - annotate - [select for diffs], Sat Jan 7 08:56:05 2017 UTC (7 years, 2 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.178: +17 -4 lines
Diff to previous 1.178 (colored) to selected 1.8 (colored)

Sync with HEAD.  (Note that most of these changes are simply $NetBSD$
tag issues.)

Revision 1.182 / (download) - annotate - [select for diffs], Thu Dec 1 18:21:39 2016 UTC (7 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107, bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.181: +3 -4 lines
Diff to previous 1.181 (colored) to selected 1.8 (colored)

n dl_iterate_phdr return the path not the name.

Revision 1.181 / (download) - annotate - [select for diffs], Thu Dec 1 14:29:15 2016 UTC (7 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.180: +4 -6 lines
Diff to previous 1.180 (colored) to selected 1.8 (colored)

Instead of using a function to resolve symbols that should be supplied by
the dynamic linker itself, use a version script that exposes them. From joerg@

Revision 1.180 / (download) - annotate - [select for diffs], Wed Nov 30 20:25:23 2016 UTC (7 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.179: +4 -3 lines
Diff to previous 1.179 (colored) to selected 1.8 (colored)

add missing newline in comment

Revision 1.179 / (download) - annotate - [select for diffs], Wed Nov 30 19:43:32 2016 UTC (7 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.178: +17 -2 lines
Diff to previous 1.178 (colored) to selected 1.8 (colored)

Emulate the standard symbol search order in dlsym() i.e. resolve weak or
not found symbols that are in the dynamic linker list of exported symbols
from the dynamic linker itself.

Revision 1.178 / (download) - annotate - [select for diffs], Tue May 24 20:32:33 2016 UTC (7 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, localcount-20160914
Branch point for: pgoyette-localcount
Changes since 1.177: +3 -2 lines
Diff to previous 1.177 (colored) to selected 1.8 (colored)

Put the name of the dynamic linker in allocated memory, so that it becomes
part of the core file link-map, so that gdb can find it.

Revision 1.173.4.3 / (download) - annotate - [select for diffs], Sun Mar 6 18:17:55 2016 UTC (8 years ago) by martin
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1
Changes since 1.173.4.2: +38 -23 lines
Diff to previous 1.173.4.2 (colored) to branchpoint 1.173 (colored) next main 1.174 (colored) to selected 1.8 (colored)

Catch up to -current, via patch, requested by christos in ticket #1126:

Revision 1.155.6.1 / (download) - annotate - [select for diffs], Fri Apr 17 09:33:01 2015 UTC (8 years, 11 months ago) by msaitoh
Branch: netbsd-6-0
Changes since 1.155: +3 -3 lines
Diff to previous 1.155 (colored) next main 1.156 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by joerg in ticket #1288):
	libexec/ld.elf_so/rtld.c: revision 1.176
lib/49813: Release mutex on error.

Revision 1.155.2.1.2.1 / (download) - annotate - [select for diffs], Fri Apr 17 09:31:55 2015 UTC (8 years, 11 months ago) by msaitoh
Branch: netbsd-6-1
Changes since 1.155.2.1: +3 -3 lines
Diff to previous 1.155.2.1 (colored) next main 1.155.2.2 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by joerg in ticket #1288):
	libexec/ld.elf_so/rtld.c: revision 1.176
lib/49813: Release mutex on error.

Revision 1.155.2.4 / (download) - annotate - [select for diffs], Thu Apr 16 09:35:54 2015 UTC (8 years, 11 months ago) by msaitoh
Branch: netbsd-6
Changes since 1.155.2.3: +3 -3 lines
Diff to previous 1.155.2.3 (colored) to branchpoint 1.155 (colored) next main 1.156 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by joerg in ticket #1288):
	libexec/ld.elf_so/rtld.c: revision 1.176
lib/49813: Release mutex on error.

Revision 1.177 / (download) - annotate - [select for diffs], Mon Apr 6 09:34:15 2015 UTC (8 years, 11 months ago) by yamt
Branch: MAIN
Changes since 1.176: +12 -8 lines
Diff to previous 1.176 (colored) to selected 1.8 (colored)

Fix membars around rtld internal mutex.

This fixes the most of lockups i observed with Open vSwitch
on NetBSD/amd64.  ("most of" because it still occasionally
locks up because of other problems.  see PR/49816)

Revision 1.173.4.2 / (download) - annotate - [select for diffs], Mon Apr 6 02:01:39 2015 UTC (8 years, 11 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Changes since 1.173.4.1: +3 -3 lines
Diff to previous 1.173.4.1 (colored) to branchpoint 1.173 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by joerg in ticket #665):
	libexec/ld.elf_so/rtld.c: revision 1.176
lib/49813: Release mutex on error.

Revision 1.176 / (download) - annotate - [select for diffs], Sat Apr 4 18:51:57 2015 UTC (8 years, 11 months ago) by joerg
Branch: MAIN
Changes since 1.175: +3 -3 lines
Diff to previous 1.175 (colored) to selected 1.8 (colored)

lib/49813: Release mutex on error.

Revision 1.173.4.1 / (download) - annotate - [select for diffs], Mon Mar 9 07:56:43 2015 UTC (9 years ago) by snj
Branch: netbsd-7
Changes since 1.173: +5 -2 lines
Diff to previous 1.173 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by skrll in ticket #569):
	libexec/ld.elf_so/rtld.c: revision 1.175
HPPA hack for a problem where gdb doesn't see _rtld_debug_state when
it's a single bv,n %r0(%rp) instruction.
The nullify confuses something.

Revision 1.175 / (download) - annotate - [select for diffs], Thu Mar 5 09:49:53 2015 UTC (9 years ago) by skrll
Branch: MAIN
Changes since 1.174: +5 -2 lines
Diff to previous 1.174 (colored) to selected 1.8 (colored)

HPPA hack for a problem where gdb doesn't see _rtld_debug_state when
it's a single bv,n %r0(%rp) instruction.

The nullify confuses something.

Revision 1.155.2.3 / (download) - annotate - [select for diffs], Sun Jan 25 10:22:59 2015 UTC (9 years, 2 months ago) by martin
Branch: netbsd-6
Changes since 1.155.2.2: +3 -3 lines
Diff to previous 1.155.2.2 (colored) to branchpoint 1.155 (colored) to selected 1.8 (colored)

Pull up the following, requested by he in ticket #1238:
	src/libexec/ld.elf_so/rtld.c 1.161
Fix the other lwp_park() to pass 0 for the 'unpark' lwp.

Revision 1.155.2.2 / (download) - annotate - [select for diffs], Sat Jan 24 13:49:23 2015 UTC (9 years, 2 months ago) by martin
Branch: netbsd-6
Changes since 1.155.2.1: +3 -3 lines
Diff to previous 1.155.2.1 (colored) to branchpoint 1.155 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by he in ticket #1238):
	libexec/ld.elf_so/rtld.c: revision 1.160
You need to pass 0 (not -1) to lwp_park() if you don't also
  want to do an unpark.
Clearly this code path was never tested!

Revision 1.174 / (download) - annotate - [select for diffs], Mon Aug 25 20:40:52 2014 UTC (9 years, 7 months ago) by joerg
Branch: MAIN
Changes since 1.173: +28 -17 lines
Diff to previous 1.173 (colored) to selected 1.8 (colored)

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.

Revision 1.158.2.4 / (download) - annotate - [select for diffs], Wed Aug 20 00:02:22 2014 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.158.2.3: +14 -4 lines
Diff to previous 1.158.2.3 (colored) next main 1.159 (colored) to selected 1.8 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.153.2.4 / (download) - annotate - [select for diffs], Thu May 22 11:37:13 2014 UTC (9 years, 10 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.153.2.3: +32 -27 lines
Diff to previous 1.153.2.3 (colored) to branchpoint 1.153 (colored) next main 1.154 (colored) to selected 1.8 (colored)

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")

Revision 1.173 / (download) - annotate - [select for diffs], Tue Mar 18 16:05:34 2014 UTC (10 years ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, netbsd-7-base
Branch point for: netbsd-7
Changes since 1.172: +6 -3 lines
Diff to previous 1.172 (colored) to selected 1.8 (colored)

Ignore LD_BIND_NOW for setuid binaries, but keep it in the environment
otherwise.

Revision 1.172 / (download) - annotate - [select for diffs], Fri Jan 31 22:46:40 2014 UTC (10 years, 1 month ago) by joerg
Branch: MAIN
CVS Tags: riastradh-drm2-base3
Changes since 1.171: +6 -4 lines
Diff to previous 1.171 (colored) to selected 1.8 (colored)

Catch up with _lwp_park change.

Revision 1.171 / (download) - annotate - [select for diffs], Wed Nov 20 07:18:23 2013 UTC (10 years, 4 months ago) by skrll
Branch: MAIN
Changes since 1.170: +5 -3 lines
Diff to previous 1.170 (colored) to selected 1.8 (colored)

If dlopen of the dynamic linker is requested, e.g. by rump in
rumpuser_dl_bootstrap, then return &_rtld_objself as the handle and do
not create a duplicate mapping.

The handle is mostly useless as _rtld_objself doesn't appear on
_rtld_objlist.

This fixes a problem on earm platforms where ld.elf_so (currently) has
an init_array section.  Calling this caused binaries to segv.

Revision 1.170 / (download) - annotate - [select for diffs], Sat Oct 19 17:19:30 2013 UTC (10 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.169: +5 -2 lines
Diff to previous 1.169 (colored) to selected 1.8 (colored)

fix unused variable warnings

Revision 1.158.2.3 / (download) - annotate - [select for diffs], Sun Jun 23 06:28:50 2013 UTC (10 years, 9 months ago) by tls
Branch: tls-maxphys
Changes since 1.158.2.2: +18 -23 lines
Diff to previous 1.158.2.2 (colored) to selected 1.8 (colored)

resync from head

Revision 1.169 / (download) - annotate - [select for diffs], Thu May 9 15:47:34 2013 UTC (10 years, 10 months ago) by skrll
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Changes since 1.168: +3 -8 lines
Diff to previous 1.168 (colored) to selected 1.8 (colored)

Remove redundant assignment. Hasn't been needed since 1999.

Revision 1.168 / (download) - annotate - [select for diffs], Thu May 9 15:39:10 2013 UTC (10 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.167: +2 -3 lines
Diff to previous 1.167 (colored) to selected 1.8 (colored)

remove stray debugging

Revision 1.167 / (download) - annotate - [select for diffs], Thu May 9 15:38:14 2013 UTC (10 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.166: +5 -4 lines
Diff to previous 1.166 (colored) to selected 1.8 (colored)

convert to SIMPLEQ like the rest of the queues.

Revision 1.166 / (download) - annotate - [select for diffs], Mon May 6 19:59:30 2013 UTC (10 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.165: +3 -2 lines
Diff to previous 1.165 (colored) to selected 1.8 (colored)

Fixed handling of DT_SONAME:

	- add function to add name aliases for shared libraries loaded
	  XXX[1]: we don't add a name during load time, only when DT_SONAME
	  is present.
	- search already loaded objects in load_by_name for an already
	  loaded object that matches our name and return it.
	- add missing initialization and cleanup for obj->names
	  XXX[2]: should we make them SIMPLEQ?
	- Add XXX in rtld.c about getting the name of an object.

NB: This makes the jdk work again without resorting to a hack of putting
    the build path of libjvm.so into the run path (which is a security
    problem).
XXX: Pullup-6?

Revision 1.165 / (download) - annotate - [select for diffs], Mon May 6 08:02:20 2013 UTC (10 years, 10 months ago) by skrll
Branch: MAIN
Changes since 1.164: +13 -13 lines
Diff to previous 1.164 (colored) to selected 1.8 (colored)

Trailing whitespace

Revision 1.164 / (download) - annotate - [select for diffs], Mon May 6 07:58:43 2013 UTC (10 years, 10 months ago) by skrll
Branch: MAIN
Changes since 1.163: +3 -3 lines
Diff to previous 1.163 (colored) to selected 1.8 (colored)

Disalble a debug only where it causes problems.

Revision 1.163 / (download) - annotate - [select for diffs], Fri May 3 18:31:24 2013 UTC (10 years, 10 months ago) by matt
Branch: MAIN
Changes since 1.162: +3 -6 lines
Diff to previous 1.162 (colored) to selected 1.8 (colored)

Remove dbg for _ctype_

Revision 1.162 / (download) - annotate - [select for diffs], Thu May 2 21:11:18 2013 UTC (10 years, 10 months ago) by matt
Branch: MAIN
Changes since 1.161: +5 -3 lines
Diff to previous 1.161 (colored) to selected 1.8 (colored)

Print out &_DYNAMIC too.

Revision 1.158.2.2 / (download) - annotate - [select for diffs], Mon Feb 25 00:28:03 2013 UTC (11 years, 1 month ago) by tls
Branch: tls-maxphys
Changes since 1.158.2.1: +4 -4 lines
Diff to previous 1.158.2.1 (colored) to selected 1.8 (colored)

resync with head

Revision 1.153.2.3 / (download) - annotate - [select for diffs], Wed Jan 23 00:05:27 2013 UTC (11 years, 2 months ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.153.2.2: +4 -4 lines
Diff to previous 1.153.2.2 (colored) to branchpoint 1.153 (colored) to selected 1.8 (colored)

sync with head

Revision 1.155.4.1 / (download) - annotate - [select for diffs], Tue Jan 22 21:47:28 2013 UTC (11 years, 2 months ago) by matt
Branch: matt-nb6-plus
Changes since 1.155: +99 -65 lines
Diff to previous 1.155 (colored) next main 1.156 (colored) to selected 1.8 (colored)

Pullup from HEAD:
Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY).

Revision 1.161 / (download) - annotate - [select for diffs], Sun Dec 16 23:00:46 2012 UTC (11 years, 3 months ago) by dsl
Branch: MAIN
CVS Tags: yamt-pagecache-base8, agc-symver-base, agc-symver
Changes since 1.160: +3 -3 lines
Diff to previous 1.160 (colored) to selected 1.8 (colored)

Fix the other lwp_park() to pass 0 for the 'unpark' lwp.

Revision 1.160 / (download) - annotate - [select for diffs], Sun Dec 16 11:15:21 2012 UTC (11 years, 3 months ago) by dsl
Branch: MAIN
Changes since 1.159: +3 -3 lines
Diff to previous 1.159 (colored) to selected 1.8 (colored)

You need to pass 0 (not -1) to lwp_park() if you don't also
  want to do an unpark.
Clearly this code path was never tested!
Needs pullup to netbsd-6

Revision 1.158.2.1 / (download) - annotate - [select for diffs], Tue Nov 20 03:00:46 2012 UTC (11 years, 4 months ago) by tls
Branch: tls-maxphys
Changes since 1.158: +3 -4 lines
Diff to previous 1.158 (colored) to selected 1.8 (colored)

Resync to 2012-11-19 00:00:00 UTC

Revision 1.153.2.2 / (download) - annotate - [select for diffs], Tue Oct 30 18:59:23 2012 UTC (11 years, 4 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.153.2.1: +100 -67 lines
Diff to previous 1.153.2.1 (colored) to branchpoint 1.153 (colored) to selected 1.8 (colored)

sync with head

Revision 1.155.2.1 / (download) - annotate - [select for diffs], Wed Oct 17 22:36:59 2012 UTC (11 years, 5 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE
Branch point for: netbsd-6-1
Changes since 1.155: +3 -4 lines
Diff to previous 1.155 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by riastradh in ticket #605):
	libexec/ld.elf_so/rtld.c: revision 1.159
On failure in _rtld_dlcheck, call _rtld_error, not xwarnx.
Callers need not call _rtld_error themselves now.
Fixes PR lib/41760.  Should add the test case from the PR too.

Revision 1.159 / (download) - annotate - [select for diffs], Mon Oct 1 03:03:46 2012 UTC (11 years, 5 months ago) by riastradh
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6
Changes since 1.158: +3 -4 lines
Diff to previous 1.158 (colored) to selected 1.8 (colored)

On failure in _rtld_dlcheck, call _rtld_error, not xwarnx.

Callers need not call _rtld_error themselves now.

Fixes PR lib/41760.  Should add the test case from the PR too.

Revision 1.158 / (download) - annotate - [select for diffs], Wed Aug 15 03:46:06 2012 UTC (11 years, 7 months ago) by matt
Branch: MAIN
Branch point for: tls-maxphys
Changes since 1.157: +99 -65 lines
Diff to previous 1.157 (colored) to selected 1.8 (colored)

Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY).

Revision 1.153.2.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:05:36 2012 UTC (11 years, 11 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.153: +39 -17 lines
Diff to previous 1.153 (colored) to selected 1.8 (colored)

sync with head

Revision 1.123.2.3 / (download) - annotate - [select for diffs], Sat Mar 17 18:28:32 2012 UTC (12 years ago) by bouyer
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2
Changes since 1.123.2.2: +53 -6 lines
Diff to previous 1.123.2.2 (colored) to branchpoint 1.123 (colored) next main 1.124 (colored) to selected 1.8 (colored)

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.

Revision 1.157 / (download) - annotate - [select for diffs], Tue Mar 13 21:00:31 2012 UTC (12 years ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4
Changes since 1.156: +4 -3 lines
Diff to previous 1.156 (colored) to selected 1.8 (colored)

Mark _rtld_debug_state as not to be inlined. Add an explicit instruction
barrier to prevent removal of calls to it.

Revision 1.156 / (download) - annotate - [select for diffs], Thu Feb 16 23:00:39 2012 UTC (12 years, 1 month ago) by joerg
Branch: MAIN
Changes since 1.155: +11 -5 lines
Diff to previous 1.155 (colored) to selected 1.8 (colored)

Add _dlauxinfo helper function to provide access to the ELF auxilary
vector. This can normally be found via __ps_strings, but libc is
initialised too early when linked dynamically and doesn't have access to
it yet, so provide an alternative mechanism via ld.elf_so.
Bump libc minor.

Revision 1.155 / (download) - annotate - [select for diffs], Fri Nov 25 21:27:15 2011 UTC (12 years, 4 months ago) by joerg
Branch: MAIN
CVS Tags: netbsd-6-base, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, matt-nb6-plus-nbase, matt-nb6-plus-base
Branch point for: netbsd-6-0, netbsd-6, matt-nb6-plus
Changes since 1.154: +17 -11 lines
Diff to previous 1.154 (colored) to selected 1.8 (colored)

Unbreak RTLD_NEXT and co on platforms that don't inline or tail call
do_dlsym.

Revision 1.154 / (download) - annotate - [select for diffs], Thu Nov 17 16:20:11 2011 UTC (12 years, 4 months ago) by joerg
Branch: MAIN
Changes since 1.153: +13 -4 lines
Diff to previous 1.153 (colored) to selected 1.8 (colored)

FreeBSD bug report 161344: TLS area for the main thread is set up to
early, if e.g. pointers to functions are used as initializers.

Revision 1.153 / (download) - annotate - [select for diffs], Sun Oct 23 21:06:07 2011 UTC (12 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base
Branch point for: yamt-pagecache
Changes since 1.152: +3 -2 lines
Diff to previous 1.152 (colored) to selected 1.8 (colored)

Don't block SIGTRAP so that on architectures where the debugger needs to
be able to receive sigtrap for breakpoints to work, it can. For example
we are setting breakpoints inside dlopen(), after we've blocked the signal,
so the process keep trapping and looping over the trap instruction without
being able to send the signal. Another way would be to move the
_rtld_debug_state() calls outside the critical section...

Revision 1.152 / (download) - annotate - [select for diffs], Sat Aug 13 22:24:24 2011 UTC (12 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.151: +4 -2 lines
Diff to previous 1.151 (colored) to selected 1.8 (colored)

disable debugging that makes us core dump

Revision 1.151 / (download) - annotate - [select for diffs], Sat Jun 25 05:45:12 2011 UTC (12 years, 9 months ago) by nonaka
Branch: MAIN
Changes since 1.150: +60 -20 lines
Diff to previous 1.150 (colored) to selected 1.8 (colored)

PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.

Revision 1.150 / (download) - annotate - [select for diffs], Sat Apr 2 16:49:49 2011 UTC (12 years, 11 months ago) by joerg
Branch: MAIN
CVS Tags: cherry-xenmp-base, cherry-xenmp
Changes since 1.149: +2 -20 lines
Diff to previous 1.149 (colored) to selected 1.8 (colored)

Revert pthread_atfork related change not intended for commit yet.

Revision 1.149 / (download) - annotate - [select for diffs], Sat Apr 2 12:30:41 2011 UTC (12 years, 11 months ago) by joerg
Branch: MAIN
Changes since 1.148: +23 -2 lines
Diff to previous 1.148 (colored) to selected 1.8 (colored)

Unbreak HPPA

Revision 1.148 / (download) - annotate - [select for diffs], Tue Mar 29 20:56:35 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.147: +49 -36 lines
Diff to previous 1.147 (colored) to selected 1.8 (colored)

Block signals when using the exclusive lock.

Revision 1.147 / (download) - annotate - [select for diffs], Mon Mar 28 00:37:40 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.146: +54 -18 lines
Diff to previous 1.146 (colored) to selected 1.8 (colored)

Refine locking scheme around init/fini to not hold the exclusive lock.
Use a simple generation count instead and restart looking for work if it
changed (e.g. due to an dlopen call from an init function).
Leave the possible dlclose() race for now.

Revision 1.146 / (download) - annotate - [select for diffs], Sun Mar 27 22:20:51 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.145: +3 -3 lines
Diff to previous 1.145 (colored) to selected 1.8 (colored)

exit, not enter

Revision 1.145 / (download) - annotate - [select for diffs], Sun Mar 27 21:58:50 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.144: +6 -2 lines
Diff to previous 1.144 (colored) to selected 1.8 (colored)

Handle _rtld_exit as full entry point since other threads may still be
running at the time.

Revision 1.144 / (download) - annotate - [select for diffs], Sun Mar 27 13:15:34 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.143: +13 -2 lines
Diff to previous 1.143 (colored) to selected 1.8 (colored)

Add some debug messages for explicit rtld entry points

Revision 1.143 / (download) - annotate - [select for diffs], Sun Mar 27 13:14:42 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.142: +13 -4 lines
Diff to previous 1.142 (colored) to selected 1.8 (colored)

Locking around dlclose()

Revision 1.142 / (download) - annotate - [select for diffs], Sat Mar 26 21:40:37 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.141: +4 -2 lines
Diff to previous 1.141 (colored) to selected 1.8 (colored)

Fix merge error that broke HPPA

Revision 1.141 / (download) - annotate - [select for diffs], Fri Mar 25 18:07:04 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.140: +182 -12 lines
Diff to previous 1.140 (colored) to selected 1.8 (colored)

Add basic locking to ld.elf_so.

Revision 1.140 / (download) - annotate - [select for diffs], Sun Mar 13 21:08:45 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.139: +6 -6 lines
Diff to previous 1.139 (colored) to selected 1.8 (colored)

Fill in TLS related fields in dl_iterate_phdr if TLS is supported

Revision 1.139 / (download) - annotate - [select for diffs], Wed Mar 9 23:10:07 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.138: +15 -2 lines
Diff to previous 1.138 (colored) to selected 1.8 (colored)

Add TLS support infrastructure. For dynamic binaries, ld.elf_so exports
_rtld_tls_allocate and _rtld_tls_free. libpthread uses this functions to
setup the thread private area of all new threads. ld.elf_so is
responsible for setting up the private area for the initial thread.
Similar functions are called from _libc_init for static binaries, using
dl_iterate_phdr to access the ELF Program Header.

Add test cases to exercise the different TLS storage models. Test cases
are compiled and installed on all platforms, but are skipped on
platforms not marked for TLS support.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.

It is inspired by the TLS support in FreeBSD by Doug Rabson and the
clean ups of the DragonFly port of the original FreeBSD modifications.

Revision 1.137.2.1 / (download) - annotate - [select for diffs], Sat Mar 5 15:09:24 2011 UTC (13 years ago) by bouyer
Branch: bouyer-quota2
Changes since 1.137: +5 -3 lines
Diff to previous 1.137 (colored) next main 1.138 (colored) to selected 1.8 (colored)

Sync with HEAD

Revision 1.138 / (download) - annotate - [select for diffs], Thu Feb 24 10:58:54 2011 UTC (13 years, 1 month ago) by pooka
Branch: MAIN
CVS Tags: bouyer-quota2-nbase
Changes since 1.137: +5 -3 lines
Diff to previous 1.137 (colored) to selected 1.8 (colored)

make DEBUG compile without RTLD_DEBUG

Revision 1.137 / (download) - annotate - [select for diffs], Fri Dec 24 12:41:43 2010 UTC (13 years, 3 months ago) by skrll
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, bouyer-quota2-base
Branch point for: bouyer-quota2
Changes since 1.136: +47 -8 lines
Diff to previous 1.136 (colored) to selected 1.8 (colored)

Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.

Revision 1.136 / (download) - annotate - [select for diffs], Sun Dec 19 17:26:51 2010 UTC (13 years, 3 months ago) by skrll
Branch: MAIN
Changes since 1.135: +3 -3 lines
Diff to previous 1.135 (colored) to selected 1.8 (colored)

Sprinkle some KNF.

Revision 1.135 / (download) - annotate - [select for diffs], Sun Dec 19 17:17:50 2010 UTC (13 years, 3 months ago) by skrll
Branch: MAIN
Changes since 1.134: +2 -4 lines
Diff to previous 1.134 (colored) to selected 1.8 (colored)

Remove unnecessary #ifdef RTLD_DEBUG

Revision 1.134 / (download) - annotate - [select for diffs], Thu Dec 16 22:47:27 2010 UTC (13 years, 3 months ago) by joerg
Branch: MAIN
Changes since 1.133: +59 -16 lines
Diff to previous 1.133 (colored) to selected 1.8 (colored)

Don't use normal environment handling functions from libc, but iterate
once over the array and clean out entries as needed.

Revision 1.133 / (download) - annotate - [select for diffs], Thu Dec 16 19:59:39 2010 UTC (13 years, 3 months ago) by skrll
Branch: MAIN
Changes since 1.132: +3 -3 lines
Diff to previous 1.132 (colored) to selected 1.8 (colored)

s/rdbg/dbg/ in a few places.

Revision 1.132 / (download) - annotate - [select for diffs], Fri Oct 29 15:08:17 2010 UTC (13 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.131: +4 -4 lines
Diff to previous 1.131 (colored) to selected 1.8 (colored)

PR/44010: YAMAMOTO Takashi: sbrk: grow 0xb3ba2000 failed, error = 12"
(due to setenv changes?)
Provide a mini unsetenv that does not allocate/free memory and does not
bother about locking.

Revision 1.131 / (download) - annotate - [select for diffs], Sat Oct 16 10:27:07 2010 UTC (13 years, 5 months ago) by skrll
Branch: MAIN
Changes since 1.130: +38 -3 lines
Diff to previous 1.130 (colored) to selected 1.8 (colored)

Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.

Revision 1.123.8.2 / (download) - annotate - [select for diffs], Thu Aug 19 15:35:18 2010 UTC (13 years, 7 months ago) by matt
Branch: matt-nb5-mips64
CVS Tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Changes since 1.123.8.1: +7 -3 lines
Diff to previous 1.123.8.1 (colored) to branchpoint 1.123 (colored) next main 1.124 (colored) to selected 1.8 (colored)

Rework the debug printfs for env so that if the env array is corrupt at
least some output happens.

Revision 1.123.8.1 / (download) - annotate - [select for diffs], Wed Apr 21 05:26:10 2010 UTC (13 years, 11 months ago) by matt
Branch: matt-nb5-mips64
Changes since 1.123: +47 -5 lines
Diff to previous 1.123 (colored) to selected 1.8 (colored)

sync to netbsd-5

Revision 1.130 / (download) - annotate - [select for diffs], Thu Mar 18 22:17:55 2010 UTC (14 years ago) by roy
Branch: MAIN
Changes since 1.129: +2 -6 lines
Diff to previous 1.129 (colored) to selected 1.8 (colored)

Use alloca(3) instead of local xmalloc for creating our DoneLists.
This allows threaded programs to use us a little better, PR lib/43005.
We need to disable SSP when using alloca.

Revision 1.129 / (download) - annotate - [select for diffs], Sat Feb 27 11:16:38 2010 UTC (14 years, 1 month ago) by roy
Branch: MAIN
Changes since 1.128: +22 -5 lines
Diff to previous 1.128 (colored) to selected 1.8 (colored)

Implement negative cache checks for symbol lookups.
Uses the Donelist idea from FreeBSD.

Revision 1.128 / (download) - annotate - [select for diffs], Sun Jan 10 06:37:32 2010 UTC (14 years, 2 months ago) by skrll
Branch: MAIN
Changes since 1.127: +7 -5 lines
Diff to previous 1.127 (colored) to selected 1.8 (colored)

Fixup comment.

Revision 1.123.2.2 / (download) - annotate - [select for diffs], Thu Dec 3 09:33:37 2009 UTC (14 years, 3 months ago) by sborrill
Branch: netbsd-5
CVS Tags: netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, matt-nb5-pq3-base, matt-nb5-pq3
Changes since 1.123.2.1: +6 -5 lines
Diff to previous 1.123.2.1 (colored) to branchpoint 1.123 (colored) to selected 1.8 (colored)

Pull up the following revisions(s) (requested by tron in ticket #1179):
	libexec/ld.elf_so/rtld.c:	revision 1.127

If the environment is corrupt, die. From FreeBSD.

Revision 1.127 / (download) - annotate - [select for diffs], Wed Dec 2 15:50:13 2009 UTC (14 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.126: +6 -5 lines
Diff to previous 1.126 (colored) to selected 1.8 (colored)

If the environment is corrupt, die. From FreeBSD.

Revision 1.126 / (download) - annotate - [select for diffs], Tue Nov 17 18:44:33 2009 UTC (14 years, 4 months ago) by skrll
Branch: MAIN
Changes since 1.125: +3 -3 lines
Diff to previous 1.125 (colored) to selected 1.8 (colored)

Make _rtld_pagesz of type size_t.

Fixes round_down for alpha which made ldd(1) break.

Revision 1.123.2.1 / (download) - annotate - [select for diffs], Wed Oct 14 09:31:27 2009 UTC (14 years, 5 months ago) by sborrill
Branch: netbsd-5
Changes since 1.123: +43 -2 lines
Diff to previous 1.123 (colored) to selected 1.8 (colored)

Pull up the following revisions(s) (requested by pooka in ticket #1088):
	include/dlfcn.h:	revision 1.20
	lib/libc/dlfcn/dlfcn_elf.c:	revision 1.6
	libexec/ld.elf_so/reloc.c:	revision 1.97
	libexec/ld.elf_so/rtld.c:	revision 1.125
	libexec/ld.elf_so/rtld.h:	revision 1.81
	libexec/ld.elf_so/symbol.c:	revision 1.48

Add Solarisa-like dlinfo() interface to the ELF dynamic linker.
Implement RTLD_DI_LINKMAP which returns a pointer to the linkmap
chain at the given object.  Other Solaris queries are currently
unimplemented.

Revision 1.125 / (download) - annotate - [select for diffs], Thu Sep 24 21:21:34 2009 UTC (14 years, 6 months ago) by pooka
Branch: MAIN
Changes since 1.124: +43 -2 lines
Diff to previous 1.124 (colored) to selected 1.8 (colored)

Add Solarisa-like dlinfo() interface to the ELF dynamic linker.
Implement RTLD_DI_LINKMAP which returns a pointer to the linkmap
chain at the given object.  Other Solaris queries are currently
unimplemented.

Revision 1.124 / (download) - annotate - [select for diffs], Tue May 19 20:44:52 2009 UTC (14 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.123: +4 -4 lines
Diff to previous 1.123 (colored) to selected 1.8 (colored)

warns=4

Revision 1.111.2.2 / (download) - annotate - [select for diffs], Fri Oct 31 21:00:36 2008 UTC (15 years, 4 months ago) by snj
Branch: netbsd-4
Changes since 1.111.2.1: +10 -8 lines
Diff to previous 1.111.2.1 (colored) to branchpoint 1.111 (colored) next main 1.112 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by jmcneill in ticket #1211):
        libexec/ld.elf_so/symbol.c: revision 1.47
        libexec/ld.elf_so/rtld.h: revision 1.79
        libexec/ld.elf_so/rtld.c: revision 1.122
lib/39649: dlsym(3) does not follow dependencies
Pull across code from FreeBSD to do a search of the passed object and its
NEEDED objects (dependencies).

Revision 1.123 / (download) - annotate - [select for diffs], Sun Oct 26 07:11:54 2008 UTC (15 years, 5 months ago) by mrg
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20091211, matt-nb4-mips64-k7-u2a-k9b, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend
Branch point for: netbsd-5, matt-nb5-mips64
Changes since 1.122: +7 -2 lines
Diff to previous 1.122 (colored) to selected 1.8 (colored)

if LD32DIR is defined:
- look in src/compat/lib/libc for libc_pic.
- define RTLD_ARCH_SUBDIR to "i386" or "sparc" for amd64 and sparc64
  builds, respectively
if RTLD_ARCH_SUBDIR is defined, add this path before
RTLD_DEFAULT_LIBRARY_PATH in the default search path.

Revision 1.107.2.2 / (download) - annotate - [select for diffs], Wed Oct 8 19:17:03 2008 UTC (15 years, 5 months ago) by bouyer
Branch: netbsd-3
Changes since 1.107.2.1: +8 -6 lines
Diff to previous 1.107.2.1 (colored) to branchpoint 1.107 (colored) next main 1.108 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by jmcneill in ticket #1973):
	libexec/ld.elf_so/symbol.c: revision 1.47
	libexec/ld.elf_so/rtld.h: revision 1.79
	libexec/ld.elf_so/rtld.c: revision 1.122
lib/39649: dlsym(3) does not follow dependencies
Pull across code from FreeBSD to do a search of the passed object and it's
NEEDED objects (dependencies).
Reviewed by gimpy.

Revision 1.122 / (download) - annotate - [select for diffs], Sat Oct 4 09:37:12 2008 UTC (15 years, 5 months ago) by skrll
Branch: MAIN
CVS Tags: matt-mips64-base2
Changes since 1.121: +10 -8 lines
Diff to previous 1.121 (colored) to selected 1.8 (colored)

lib/39649: dlsym(3) does not follow dependencies

Pull across code from FreeBSD to do a search of the passed object and it's
NEEDED objects (dependencies).

Reviewed by gimpy.

Revision 1.121 / (download) - annotate - [select for diffs], Sat Sep 27 03:52:05 2008 UTC (15 years, 6 months ago) by macallan
Branch: MAIN
Changes since 1.120: +15 -3 lines
Diff to previous 1.120 (colored) to selected 1.8 (colored)

avoid usind __builtin_return_address(0) on PowerPC because it fails in
Xorg's module loader.
Should fix PR37812

Revision 1.117.8.2 / (download) - annotate - [select for diffs], Thu Sep 18 04:39:17 2008 UTC (15 years, 6 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.117.8.1: +20 -10 lines
Diff to previous 1.117.8.1 (colored) to branchpoint 1.117 (colored) next main 1.118 (colored) to selected 1.8 (colored)

Sync with wrstuden-revivesa-base-2.

Revision 1.120 / (download) - annotate - [select for diffs], Thu Jul 24 04:39:25 2008 UTC (15 years, 8 months ago) by matt
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2
Changes since 1.119: +19 -10 lines
Diff to previous 1.119 (colored) to selected 1.8 (colored)

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.

Revision 1.119 / (download) - annotate - [select for diffs], Wed Jul 23 18:16:42 2008 UTC (15 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.118: +3 -2 lines
Diff to previous 1.118 (colored) to selected 1.8 (colored)

abort() if we are trying to use an undefined weak symbol from the plt. Remove
check from relocate_plt_object() since we cannot return _rtld_sym_zero anymore.
Code from gimpy.

Revision 1.117.8.1 / (download) - annotate - [select for diffs], Mon Jun 23 04:29:56 2008 UTC (15 years, 9 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.117: +4 -2 lines
Diff to previous 1.117 (colored) to selected 1.8 (colored)

Sync w/ -current. 34 merge conflicts to follow.

Revision 1.117.6.1 / (download) - annotate - [select for diffs], Tue Jun 17 09:13:39 2008 UTC (15 years, 9 months ago) by yamt
Branch: yamt-pf42
Changes since 1.117: +4 -2 lines
Diff to previous 1.117 (colored) next main 1.118 (colored) to selected 1.8 (colored)

sync with head.

Revision 1.118 / (download) - annotate - [select for diffs], Tue Jun 3 19:32:32 2008 UTC (15 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base4, wrstuden-revivesa-base-1, wrstuden-revivesa-base
Changes since 1.117: +4 -2 lines
Diff to previous 1.117 (colored) to selected 1.8 (colored)

Don't bother unmapping the ELF header unless it overlaps the first load
section.

Revision 1.113.4.2 / (download) - annotate - [select for diffs], Wed Jan 9 01:37:12 2008 UTC (16 years, 2 months ago) by matt
Branch: matt-armv6
Changes since 1.113.4.1: +138 -25 lines
Diff to previous 1.113.4.1 (colored) to branchpoint 1.113 (colored) next main 1.114 (colored) to selected 1.8 (colored)

sync with HEAD

Revision 1.117 / (download) - annotate - [select for diffs], Fri Dec 7 20:34:05 2007 UTC (16 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, matt-armv6-nbase, matt-armv6-base, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base, cube-autoconf-base, cube-autoconf
Branch point for: yamt-pf42, wrstuden-revivesa
Changes since 1.116: +138 -25 lines
Diff to previous 1.116 (colored) to selected 1.8 (colored)

rtld changes for PR bin/37347:

- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
  should be recording a dependency on libc, but it's too late to do that.

Ok christos@.

Revision 1.113.4.1 / (download) - annotate - [select for diffs], Tue Nov 6 23:12:10 2007 UTC (16 years, 4 months ago) by matt
Branch: matt-armv6
CVS Tags: matt-armv6-prevmlocking
Changes since 1.113: +20 -9 lines
Diff to previous 1.113 (colored) to selected 1.8 (colored)

sync with HEAD

Revision 1.116 / (download) - annotate - [select for diffs], Fri Oct 5 22:21:07 2007 UTC (16 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.115: +3 -3 lines
Diff to previous 1.115 (colored) to selected 1.8 (colored)

- Don't use the names malloc/free/etc, since we can end up pulling in libc's
  malloc which is not what we want.
- Remove ancient memory compaction hack. Realloc on free memory is now an
  error again (from joerg@).

Ok christos@.

Revision 1.115 / (download) - annotate - [select for diffs], Fri Sep 21 13:57:09 2007 UTC (16 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.114: +3 -2 lines
Diff to previous 1.114 (colored) to selected 1.8 (colored)

Don't trust AT_SUN_EXECNAME, if we are set{u,g}id.

Revision 1.114 / (download) - annotate - [select for diffs], Thu Sep 20 14:14:26 2007 UTC (16 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.113: +18 -8 lines
Diff to previous 1.113 (colored) to selected 1.8 (colored)

Use AT_SUN_EXECPATH instead of argv[0] for the executable name. This needs
kernel support, which is not there yet, thus $ORIGIN is broken at this time.
This is ok, nothing uses it yet.

Revision 1.111.4.1 / (download) - annotate - [select for diffs], Mon Sep 3 07:02:25 2007 UTC (16 years, 6 months ago) by wrstuden
Branch: wrstuden-fixsa
Changes since 1.111: +3 -3 lines
Diff to previous 1.111 (colored) next main 1.112 (colored) to selected 1.8 (colored)

Sync w/ NetBSD-4-RC_1

Revision 1.111.2.1 / (download) - annotate - [select for diffs], Thu Jul 19 14:38:16 2007 UTC (16 years, 8 months ago) by liamjfoy
Branch: netbsd-4
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0
Changes since 1.111: +3 -3 lines
Diff to previous 1.111 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by soren in ticket #774):
	build.sh: revision 1.169
	gnu/usr.bin/gcc4/backend/Makefile: revision 1.9
	sys/arch/evbsh5/README: revision 1.1
	distrib/notes/common/contents: revision 1.124
	usr.sbin/ndbootd/ndbootd.c: revision 1.12
	gnu/lib/libopcodes/arch/sh3eb/defs.mk: revision 1.4
	gnu/lib/libbfd/arch/sh3eb/defs.mk: revision 1.8
	libexec/ld.elf_so/Makefile: revision 1.78
	gnu/dist/binutils/bfd/config.bfd: revision 1.14
	doc/HACKS: revision 1.93
	distrib/cdrom/current.conf: revision 1.8
	gnu/lib/libgcc4/Makefile.inc: revision 1.6
	share/mk/sys.mk: revision 1.90
	distrib/sets/lists/base/mi: revision 1.700
	libexec/ld.elf_so/rtld.c: revision 1.112
	distrib/sets/lists/base/mi: revision 1.702
	sys/arch/sh5/README: revision 1.1
	gnu/lib/libbfd/arch/sh3el/bfd.h: revision 1.7
	usr.sbin/traceroute/traceroute.c: revision 1.69
	distrib/notes/common/main: revision 1.330
	distrib/notes/common/list-setsizes.sh: revision 1.2
	sys/arch/Makefile: revision 1.35
	gnu/lib/libopcodes/arch/sh3el/defs.mk: revision 1.4
	gnu/lib/libbfd/arch/sh3el/defs.mk: revision 1.8
	share/mk/bsd.own.mk: revision 1.495
	gnu/lib/libbfd/arch/sh3eb/bfd.h: revision 1.7
	x11/lib/OSmesa/Makefile: revision 1.20
	sys/dev/dkwedge/dkwedge_bsdlabel.c: revision 1.13
	gnu/dist/binutils/opcodes/configure.in: revision 1.2
	gnu/dist/binutils/opcodes/configure: revision 1.2
	gnu/usr.bin/send-pr/categories: revision 1.53
	etc/mtree/NetBSD.dist: revision 1.339
	sys/arch/README: revision 1.42
	lib/libc/gdtoa/Makefile.inc: revision 1.6
	usr.bin/crunch/crunchide/Makefile: revision 1.16
	sys/lkm/net/bsdcomp/Makefile: revision 1.5
	regress/sys/uvm/Makefile: revision 1.6
	etc/MAKEDEV.awk: revision 1.18
	x11/Xserver/GL/GLcore/Makefile.GLcore: revision 1.10
	sys/contrib/dev/ath/netbsd/Makefile.ath.inc: revision 1.14
	gnu/lib/libbfd/Makefile: revision 1.42
	doc/RESPONSIBLE: revision 1.78
Remove evbsh5.

Revision 1.113 / (download) - annotate - [select for diffs], Fri May 18 21:44:08 2007 UTC (16 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: matt-mips64-base, matt-mips64, hpcarm-cleanup
Branch point for: matt-armv6
Changes since 1.112: +11 -10 lines
Diff to previous 1.112 (colored) to selected 1.8 (colored)

Support Solaris-like $ORIGIN etc. expansions in paths.

Revision 1.112 / (download) - annotate - [select for diffs], Sun Apr 8 10:02:35 2007 UTC (16 years, 11 months ago) by scw
Branch: MAIN
Changes since 1.111: +3 -3 lines
Diff to previous 1.111 (colored) to selected 1.8 (colored)

Remove a test for defined(__SH5__).

Revision 1.111 / (download) - annotate - [select for diffs], Wed Nov 22 21:46:36 2006 UTC (17 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-4-base
Branch point for: wrstuden-fixsa, netbsd-4
Changes since 1.110: +15 -9 lines
Diff to previous 1.110 (colored) to selected 1.8 (colored)

From defend dot the dot world at gmail dot com: Sanitize environment variables
for set{u,g}id binaries, so that in case they are playing with set{u,g}id
and exec'ing other binaries they don't get affected by the
LD_{PRELOAD,DEBUG,LIBRARY_PATH} environment setup. We leave LD_BIND_NOW alone.
There are no binaries affected in the base system.

Revision 1.110 / (download) - annotate - [select for diffs], Tue Mar 21 17:48:10 2006 UTC (18 years ago) by christos
Branch: MAIN
CVS Tags: abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.109: +4 -4 lines
Diff to previous 1.109 (colored) to selected 1.8 (colored)

Coverity CID 2749: Fix another double free. Instead of removing that last
free() call, change the allocation policy to leave the responsibility for
allocation/freeing the pathname to _rtld_map_object(), instead of having
the caller allocate it and _rtld_map_object() free it. This simplifies the
code a lot and it is more efficient.

Revision 1.107.2.1 / (download) - annotate - [select for diffs], Wed Feb 1 20:38:06 2006 UTC (18 years, 1 month ago) by tron
Branch: netbsd-3
CVS Tags: netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1
Changes since 1.107: +13 -3 lines
Diff to previous 1.107 (colored) to selected 1.8 (colored)

Pull up following revision(s) (requested by christos in ticket #1150):
	libexec/ld.elf_so/rtld.c: revision 1.109
Bring across a change from FreeBSD from back in 1998:
"Fix a bug that showed up when debugging dynamically linked programs.
References from GDB to "printf" and various other functions would
find the versions in the dynamic linker itself, rather than the
versions in the program's libc.  This fix moves the GDB link map
entry for the dynamic linker to the end of the search list, where
its symbols will be found only if they are not found anywhere else."
"printf" isn't true for us, but various libc symbols are, e.g. "malloc".
Fixes PR 32074 as noted by uwe@
OK'd by christos@

Revision 1.109 / (download) - annotate - [select for diffs], Thu Jan 12 22:40:17 2006 UTC (18 years, 2 months ago) by skrll
Branch: MAIN
Changes since 1.108: +14 -4 lines
Diff to previous 1.108 (colored) to selected 1.8 (colored)

Bring across a change from FreeBSD from back in 1998:

"Fix a bug that showed up when debugging dynamically linked programs.
References from GDB to "printf" and various other functions would
find the versions in the dynamic linker itself, rather than the
versions in the program's libc.  This fix moves the GDB link map
entry for the dynamic linker to the end of the search list, where
its symbols will be found only if they are not found anywhere else."

"printf" isn't true for us, but various libc symbols are, e.g. "malloc".

Fixes PR 32074 as noted by uwe@

OK'd by christos@

Revision 1.108 / (download) - annotate - [select for diffs], Wed Jan 11 21:40:12 2006 UTC (18 years, 2 months ago) by uwe
Branch: MAIN
Changes since 1.107: +8 -2 lines
Diff to previous 1.107 (colored) to selected 1.8 (colored)

_GLOBAL_OFFSET_TABLE_ is only used if RTLD_DEBUG, so wrap its
declaration too.

32-bit SuperH can not pretend that _GLOBAL_OFFSET_TABLE_ is a normal
variable, because of the way PIC variable references is generated, but
as compiler arranges for _GLOBAL_OFFSET_TABLE_ address to be in r12
anyway, just use that value by declaring it as a global register
variable.  Makes sh3 compile with RTLD_DEBUG.

Revision 1.107 / (download) - annotate - [select for diffs], Fri Oct 22 05:39:57 2004 UTC (19 years, 5 months ago) by skrll
Branch: MAIN
CVS Tags: netbsd-3-base, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0
Branch point for: netbsd-3
Changes since 1.106: +6 -1 lines
Diff to previous 1.106 (colored) to selected 1.8 (colored)

Add __RCSIDs.

OK'd by mycroft.

Revision 1.101.2.1 / (download) - annotate - [select for diffs], Mon Jul 19 09:06:52 2004 UTC (19 years, 8 months ago) by tron
Branch: netbsd-2-0
CVS Tags: netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2
Changes since 1.101: +6 -1 lines
Diff to previous 1.101 (colored) next main 1.102 (colored) to selected 1.8 (colored)

Pull up revision 1.106 (requested by thorpej in ticket #676):
- Change the strong dlfcn names in libc to ___name, and make the __name
versions used by others in libc weak, so that we have:
name: weak
__name: weak
___name: strong
- Add __name strong aliases of the dlfcn names in ld.elf_so, so that
we have:
name: strong
__name: strong
This allows ld.elf_so to self-resolve both the name and __name variants
of the dlfcn functions, the former being required for dlfcn support in
applications, the latter being required for dlfcn support in libc.
Fixes the problem described in:
http://mail-index.netbsd.org/tech-toolchain/2004/07/17/0000.html
Reviewed by Nick.

Revision 1.106 / (download) - annotate - [select for diffs], Sun Jul 18 17:26:19 2004 UTC (19 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.105: +6 -1 lines
Diff to previous 1.105 (colored) to selected 1.8 (colored)

- Change the strong dlfcn names in libc to ___name, and make the __name
  versions used by others in libc weak, so that we have:
	name: weak
	__name: weak
	___name: strong
- Add __name strong aliases of the dlfcn names in ld.elf_so, so that we have:
	name: strong
	__name: strong

This allows ld.elf_so to self-resolve both the name and __name variants
of the dlfcn functions, the former being required for dlfcn support in
applications, the latter being required for dlfcn support in libc.

Fixes the problem described in:

    http://mail-index.netbsd.org/tech-toolchain/2004/07/17/0000.html

Reviewed by Nick.

Revision 1.48.2.2 / (download) - annotate - [select for diffs], Fri May 28 08:31:22 2004 UTC (19 years, 10 months ago) by tron
Branch: netbsd-1-6
Changes since 1.48.2.1: +220 -285 lines
Diff to previous 1.48.2.1 (colored) to branchpoint 1.48 (colored) next main 1.49 (colored) to selected 1.8 (colored)

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

Revision 1.105 / (download) - annotate - [select for diffs], Mon May 17 13:16:02 2004 UTC (19 years, 10 months ago) by skrll
Branch: MAIN
Changes since 1.104: +9 -3 lines
Diff to previous 1.104 (colored) to selected 1.8 (colored)

Fix the dynamic linker for hppa using ELF.

Lazy binding doesn't work 100% of the time so force immediate binding.
One possible reason is that the PLT stub blows away r20 which the
compiler might not take into account.

Revision 1.104 / (download) - annotate - [select for diffs], Mon May 17 11:00:01 2004 UTC (19 years, 10 months ago) by skrll
Branch: MAIN
Changes since 1.103: +3 -3 lines
Diff to previous 1.103 (colored) to selected 1.8 (colored)

Test before commit.

Revision 1.103 / (download) - annotate - [select for diffs], Mon May 17 10:23:58 2004 UTC (19 years, 10 months ago) by skrll
Branch: MAIN
Changes since 1.102: +7 -4 lines
Diff to previous 1.102 (colored) to selected 1.8 (colored)

Re-arrange/correct some asserts.

Revision 1.102 / (download) - annotate - [select for diffs], Wed May 12 20:23:29 2004 UTC (19 years, 10 months ago) by skrll
Branch: MAIN
Changes since 1.101: +1 -5 lines
Diff to previous 1.101 (colored) to selected 1.8 (colored)

Garbage collect the RTLD_RELOCATE_SELF error.

Revision 1.101 / (download) - annotate - [select for diffs], Sun Sep 7 22:17:43 2003 UTC (20 years, 6 months ago) by mycroft
Branch: MAIN
CVS Tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Changes since 1.100: +1 -0 lines
Diff to previous 1.100 (colored) to selected 1.8 (colored)

Back out revision 1.100.  There is something screwier going on.

Revision 1.48.2.1 / (download) - annotate - [select for diffs], Fri Sep 5 19:15:01 2003 UTC (20 years, 6 months ago) by tron
Branch: netbsd-1-6
CVS Tags: netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002
Changes since 1.48: +1 -8 lines
Diff to previous 1.48 (colored) to selected 1.8 (colored)

Pull up revision 1.54 via patch (requested by dmcmahill in ticket #1395):
Remove all of the `mark' code.  This is responsible for the `undefined
PLT
symbol' errors, probably because the increment gets interrupted
occasionally by
a signal.  In general, _rtld_bind() should not modify ANY internal
state.

Revision 1.100 / (download) - annotate - [select for diffs], Sun Aug 31 21:52:01 2003 UTC (20 years, 7 months ago) by mycroft
Branch: MAIN
Changes since 1.99: +1 -2 lines
Diff to previous 1.99 (colored) to selected 1.8 (colored)

dlsym() should not leave an error set.  It confuses programs that check
dlerror() (such as pkgsrc/graphics/transcode).

Revision 1.99 / (download) - annotate - [select for diffs], Tue Aug 12 09:18:48 2003 UTC (20 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.98: +10 -7 lines
Diff to previous 1.98 (colored) to selected 1.8 (colored)

Resolve dlsym(3) and friends directly so that dlsym(RTLD_NEXT,...) works.

Previously dlsym resolved to the version in crt0.o or libc which would
mean that the caller's shared object couldn't be determined correctly
using __builtin_return_address(0).

Mainly from FreeBSD, but adapted by me. Benefits of this solutions are:

	- backward comptibility maintained
	- existing broken binaries are fixed with a new ld.elf_so
	- __mainprog_obj can be removed from crt0.o
	- we do the same thing as FreeBSD

Fixes PR 22067.

OKed by Jason and Christos.

Revision 1.98 / (download) - annotate - [select for diffs], Thu Jul 24 10:12:26 2003 UTC (20 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.97: +34 -58 lines
Diff to previous 1.97 (colored) to selected 1.8 (colored)

ANSIfy and de-__P().

Revision 1.97 / (download) - annotate - [select for diffs], Mon Jul 21 15:17:55 2003 UTC (20 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.96: +3 -3 lines
Diff to previous 1.96 (colored) to selected 1.8 (colored)

arm and sh5 also have bogus DT_TEXTRELs. sh5 was already covered so just
update the comment.

Revision 1.96 / (download) - annotate - [select for diffs], Thu Jul 17 13:56:32 2003 UTC (20 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored) to selected 1.8 (colored)

Correct the in_plt parameter of a couple of _rtld_find_symdef calls.

The mips_reloc.c case is a no-op as _rtld_symlook_obj ignores in_plt for
MIPS.

OK'ed by Charles.

Revision 1.95 / (download) - annotate - [select for diffs], Mon Jun 30 00:49:25 2003 UTC (20 years, 9 months ago) by marcus
Branch: MAIN
Changes since 1.94: +3 -3 lines
Diff to previous 1.94 (colored) to selected 1.8 (colored)

SH also has a bogus DT_TEXTREL, it seems.

Revision 1.94 / (download) - annotate - [select for diffs], Thu Jun 5 10:41:33 2003 UTC (20 years, 9 months ago) by simonb
Branch: MAIN
Changes since 1.93: +9 -1 lines
Diff to previous 1.93 (colored) to selected 1.8 (colored)

KNF- blank lines before code at start of functions.

Revision 1.93 / (download) - annotate - [select for diffs], Fri May 30 15:43:33 2003 UTC (20 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.92: +38 -17 lines
Diff to previous 1.92 (colored) to selected 1.8 (colored)

Add RTLD_FIRST, RTLD_NEXT, RTLD_DEFAULT, from FreeBSD

Revision 1.92 / (download) - annotate - [select for diffs], Thu Apr 24 16:55:29 2003 UTC (20 years, 11 months ago) by mycroft
Branch: MAIN
Changes since 1.91: +38 -8 lines
Diff to previous 1.91 (colored) to selected 1.8 (colored)

Back out previous change for now -- it needs more work.

Revision 1.91 / (download) - annotate - [select for diffs], Wed Apr 23 17:40:25 2003 UTC (20 years, 11 months ago) by mycroft
Branch: MAIN
Changes since 1.90: +9 -39 lines
Diff to previous 1.90 (colored) to selected 1.8 (colored)

Attempt to give dlsym() the same symbol-searching semantics as _rtld_bind().
Tested in a handful of cases.
Reviewed by: a dead silence

Revision 1.90 / (download) - annotate - [select for diffs], Sat Dec 14 15:37:57 2002 UTC (21 years, 3 months ago) by junyoung
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.89: +5 -2 lines
Diff to previous 1.89 (colored) to selected 1.8 (colored)

Gracefully exit when invoked directly. Use of assert() here caused a segfault.
Address PR#11785.

Revision 1.89 / (download) - annotate - [select for diffs], Thu Dec 5 04:56:57 2002 UTC (21 years, 3 months ago) by junyoung
Branch: MAIN
Changes since 1.88: +3 -1 lines
Diff to previous 1.88 (colored) to selected 1.8 (colored)

A bit speedup: in _rtld_load_object(), save the number of calls to
strcmp() by performing path name length comparison first. In the test
with Mozilla, the number was reduced to 1068 from 7182 (yes, we saved
6114 strcmp()!).

Revision 1.88 / (download) - annotate - [select for diffs], Sun Nov 24 18:13:30 2002 UTC (21 years, 4 months ago) by fvdl
Branch: MAIN
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored) to selected 1.8 (colored)

For the debug case, print relocbase as well at the start of _rtld().

Revision 1.87 / (download) - annotate - [select for diffs], Sat Oct 5 11:59:04 2002 UTC (21 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.86: +2 -1 lines
Diff to previous 1.86 (colored) to selected 1.8 (colored)

Minor cleanup.

Revision 1.86 / (download) - annotate - [select for diffs], Fri Oct 4 18:50:43 2002 UTC (21 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.85: +1 -4 lines
Diff to previous 1.85 (colored) to selected 1.8 (colored)

Rearrange _rtld_map_object() a little, so that we don't have to have the first
page of the object double-mapped.  Not that it matters much, but someone was
whinging about it.
While I'm at it, nuke obj->phdr and obj->phsize; they're unused.

Revision 1.85 / (download) - annotate - [select for diffs], Fri Oct 4 03:59:41 2002 UTC (21 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.84: +1 -4 lines
Diff to previous 1.84 (colored) to selected 1.8 (colored)

Move the definition of _rtld_list_main so ldd builds again.

Revision 1.84 / (download) - annotate - [select for diffs], Thu Oct 3 20:35:20 2002 UTC (21 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.83: +23 -16 lines
Diff to previous 1.83 (colored) to selected 1.8 (colored)

As seen on tech-userlevel...

There are several optimizations here:

1) Objects on _rtld_list_main do not participate in the DAG structures
   at all.  This is okay because all symbols must be resolvable at
   link/load time, and _rtld_list_main is always searched first, so
   any references from those objects must necessarily be resolved to
   other objects on _rtld_list_main.

   (Making this work completely required setting obj->main a bit
   earlier; hence the RTLD_MAIN hack.)

2) Objects on _rtld_list_main are not put on _rtld_list_global,
   preventing an extra search.

3) A bit is used to keep track of whether an object is on
   _rtld_list_global, so we don't have to do a silly linear search.

4) A small attempt is made to prevent objects being put on the DAG
   lists multiple times (using a silly linear search).

The sum of this appears to be a ~10% (.3s) reduction in Mozilla's
startup time on my 800MHz box.

Also, make sure _rtld_objmain->path is always set, just to make the
debug output nicer.

Revision 1.83 / (download) - annotate - [select for diffs], Thu Oct 3 01:09:21 2002 UTC (21 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.82: +6 -3 lines
Diff to previous 1.82 (colored) to selected 1.8 (colored)

Do not put objects on _rtld_list_main on any DAG member list -- any symbol we
will have already been found during the _rtld_list_main walk, so there's no
point in doing it again.

Revision 1.82 / (download) - annotate - [select for diffs], Thu Sep 26 22:26:26 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.81: +1 -5 lines
Diff to previous 1.81 (colored) to selected 1.8 (colored)

Implement a self-relocate function for the VAX.

Revision 1.81 / (download) - annotate - [select for diffs], Thu Sep 26 20:42:10 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.80: +4 -4 lines
Diff to previous 1.80 (colored) to selected 1.8 (colored)

Remove the `self' args to _rtld_relocate_objects() and
_rtld_relocate_nonplt_objects().

Revision 1.80 / (download) - annotate - [select for diffs], Thu Sep 26 20:35:56 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.79: +15 -35 lines
Diff to previous 1.79 (colored) to selected 1.8 (colored)

Clean up _rtld_init() -- there is no need to avoid globals.
Remove the call to _rtld_relocate_objects() completely -- except on VAX, where
we TEMPORARILY call _rtld_relocate_nonplt_objects() directly.
Also add more assertions -- ld.elf_so should never have PLT relocations.

Revision 1.79 / (download) - annotate - [select for diffs], Thu Sep 26 13:43:52 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.78: +2 -2 lines
Diff to previous 1.78 (colored) to selected 1.8 (colored)

Hm, the const isn't going to work.

Revision 1.78 / (download) - annotate - [select for diffs], Thu Sep 26 13:42:05 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.77: +3 -5 lines
Diff to previous 1.77 (colored) to selected 1.8 (colored)

Do not attempt to free(_rtld_objself.path) -- it's a pointer into our data
segment.

Revision 1.77 / (download) - annotate - [select for diffs], Wed Sep 25 06:43:46 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored) to selected 1.8 (colored)

#if defined -> #ifdef

Revision 1.76 / (download) - annotate - [select for diffs], Tue Sep 24 20:23:11 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.75: +6 -6 lines
Diff to previous 1.75 (colored) to selected 1.8 (colored)

Put back the `in_plt' nonsense for now.
It turns out there is some deep-seated wackiness WRT function pointer
comparisons...

Revision 1.75 / (download) - annotate - [select for diffs], Tue Sep 24 18:25:54 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.74: +7 -3 lines
Diff to previous 1.74 (colored) to selected 1.8 (colored)

Touch up a little more -- some of the dbg()s never actually printed anything.

Revision 1.74 / (download) - annotate - [select for diffs], Tue Sep 24 18:23:14 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.73: +1 -8 lines
Diff to previous 1.73 (colored) to selected 1.8 (colored)

Previous change was done wrong.

Revision 1.73 / (download) - annotate - [select for diffs], Tue Sep 24 17:51:11 2002 UTC (21 years, 6 months ago) by junyoung
Branch: MAIN
Changes since 1.72: +3 -1 lines
Diff to previous 1.72 (colored) to selected 1.8 (colored)

Make sure that dbg() is disabled if LD_DEBUG is not defined. Now
debugging is easier with RTLD_DEBUG_RELOC.

Revision 1.72 / (download) - annotate - [select for diffs], Tue Sep 24 12:18:32 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored) to selected 1.8 (colored)

Change the comment about l_offs.

Revision 1.71 / (download) - annotate - [select for diffs], Tue Sep 24 08:56:30 2002 UTC (21 years, 6 months ago) by junyoung
Branch: MAIN
Changes since 1.70: +6 -6 lines
Diff to previous 1.70 (colored) to selected 1.8 (colored)

Remove '\n' at the end of dbg strings.

Revision 1.70 / (download) - annotate - [select for diffs], Tue Sep 24 06:43:14 2002 UTC (21 years, 6 months ago) by junyoung
Branch: MAIN
Changes since 1.69: +1 -3 lines
Diff to previous 1.69 (colored) to selected 1.8 (colored)

END_SYM is no longer used.

Revision 1.69 / (download) - annotate - [select for diffs], Tue Sep 24 01:24:44 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.68: +8 -55 lines
Diff to previous 1.68 (colored) to selected 1.8 (colored)

Use/require AT_PAGESZ on all platforms.  (The kernel has exported it for ~3
years now.)  Use _rtld_pagesz instead of getpagesize() to determine the page
size in our local malloc().  Saves a system call.

Also, since we're now relocated early, we don't need to be careful to avoid
globals, so most of the VARPSZ hacks are eliminated.

Revision 1.68 / (download) - annotate - [select for diffs], Tue Sep 24 00:33:39 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.67: +2 -6 lines
Diff to previous 1.67 (colored) to selected 1.8 (colored)

Um, a little bit of sanity here:
l_addr is always supposed to be obj->relocbase -- or so says the GDB code that
uses it.  So, set it to this on all platforms.  It already was on VAX
explicitly, and on everything else except MIPS implicitly (because
mapbase==relocbase for all existing shlibs).  For some silly/stupid reason, a
new field was created that the MIPS GDB currently uses.
Another MD #ifdef bites it.

Revision 1.67 / (download) - annotate - [select for diffs], Mon Sep 23 23:56:48 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.66: +11 -23 lines
Diff to previous 1.66 (colored) to selected 1.8 (colored)

Several small changes that shave 7-8% off the simple-exec-loop test:

* Rename _rtld_find_library() to _rtld_load_library().  It now calls
  _rtld_load_object() if necessary to actually load the object, rather
  than having the caller do it.  To do this, it also takes the `mode'
  argument that gets passed to _rtld_load_object().

* On a related note, remove _rtld_check_library(), and instead call
  _rtld_load_object() to instead try actually loading the object.  We
  save two extra namei's and a bunch of redundant work (almost
  literally the same code) this way.

* In _rtld_map_object(), mmap(2) the first page read-only, rather than
  read(2)ing it.

* In _rtld_symlook_obj(), compare the *second* character of the symbol
  name before calling strcmp().  (This first character is too
  frequently `_', and turns out to not be helpful, in libc.)

* Also in _rtld_symlook_obj(), remove the bogus STT_FUNC special case
  -- this also allows removing the `in_plt' argument to
  _rtld_symlook_list() and _rtld_symlook_obj().

Also:

* In _rtld_obj_from_addr(), rather than trying to look up `_end' in
  the each object, instead use obj->mapsize as the upper bound.

Revision 1.66 / (download) - annotate - [select for diffs], Sat Sep 21 05:24:17 2002 UTC (21 years, 6 months ago) by junyoung
Branch: MAIN
Changes since 1.65: +3 -2 lines
Diff to previous 1.65 (colored) to selected 1.8 (colored)

Print the name of dynamic linker actually loaded.

Revision 1.65 / (download) - annotate - [select for diffs], Fri Sep 20 03:39:22 2002 UTC (21 years, 6 months ago) by junyoung
Branch: MAIN
Changes since 1.64: +9 -4 lines
Diff to previous 1.64 (colored) to selected 1.8 (colored)

Cosmetic changes (long lines).

Revision 1.64 / (download) - annotate - [select for diffs], Thu Sep 19 13:59:46 2002 UTC (21 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.63: +9 -5 lines
Diff to previous 1.63 (colored) to selected 1.8 (colored)

don't core dump setting progname if argv[0] == NULL. From xs@kittenz.org

Revision 1.63 / (download) - annotate - [select for diffs], Fri Sep 13 15:27:30 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored) to selected 1.8 (colored)

The textrel special case is only needed for MIPS (due to a bug in BFD).

Revision 1.62 / (download) - annotate - [select for diffs], Fri Sep 13 14:23:07 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.61: +1 -5 lines
Diff to previous 1.61 (colored) to selected 1.8 (colored)

Kill the sparc64 argc conversion hack.

Revision 1.61 / (download) - annotate - [select for diffs], Fri Sep 13 03:17:21 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.60: +1 -5 lines
Diff to previous 1.60 (colored) to selected 1.8 (colored)

Nuke an unneeded hack for the Alpha.

Revision 1.60 / (download) - annotate - [select for diffs], Thu Sep 12 22:56:29 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.59: +17 -24 lines
Diff to previous 1.59 (colored) to selected 1.8 (colored)

Nuke -DRTLD_RELOCATE_SELF and `dodebug' from orbit.

Revision 1.59 / (download) - annotate - [select for diffs], Thu Sep 12 19:43:03 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.58: +2 -3 lines
Diff to previous 1.58 (colored) to selected 1.8 (colored)

ld.elf_so has no textrels on arm, i386 or vax -- and shouldn't on any platform,
but that's beside the point.

Revision 1.58 / (download) - annotate - [select for diffs], Thu Sep 12 17:45:41 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.57: +13 -20 lines
Diff to previous 1.57 (colored) to selected 1.8 (colored)

Add a `relocbase' argument to _rtld() and _rtld_init(), which is passed in
from the glue code in _rtld_start().  This is used to set objself.relocbase,
rather than assuming that it's the same as objself.mapbase (or 0 on MIPS).
Now -- with a bug fix to the kernel -- ld.elf_so can be linked at any VMA.

Revision 1.57 / (download) - annotate - [select for diffs], Wed Sep 11 20:48:21 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.56: +1 -1 lines
Diff to previous 1.56 (colored) to selected 1.8 (colored)

This is a gratuitous null commit to force rtld.o to be rebuilt.

Revision 1.56 / (download) - annotate - [select for diffs], Fri Sep 6 15:17:53 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.55: +4 -4 lines
Diff to previous 1.55 (colored) to selected 1.8 (colored)

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.)

Revision 1.55 / (download) - annotate - [select for diffs], Fri Sep 6 13:27:48 2002 UTC (21 years, 6 months ago) by junyoung
Branch: MAIN
Changes since 1.54: +1 -7 lines
Diff to previous 1.54 (colored) to selected 1.8 (colored)

Remove typedef which was never used. Meaningless comment as well.

Revision 1.54 / (download) - annotate - [select for diffs], Thu Sep 5 21:57:09 2002 UTC (21 years, 6 months ago) by mycroft
Branch: MAIN
Changes since 1.53: +3 -8 lines
Diff to previous 1.53 (colored) to selected 1.8 (colored)

Remove all of the `mark' code.  This is responsible for the `undefined PLT
symbol' errors, probably because the increment gets interrupted occasionally by
a signal.  In general, _rtld_bind() should not modify ANY internal state.

Revision 1.53 / (download) - annotate - [select for diffs], Mon Aug 26 21:09:55 2002 UTC (21 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.52: +20 -3 lines
Diff to previous 1.52 (colored) to selected 1.8 (colored)

save 4 system calls by using AT_{R,E}{U,G}ID.

Revision 1.52 / (download) - annotate - [select for diffs], Fri Aug 9 10:03:08 2002 UTC (21 years, 7 months ago) by soren
Branch: MAIN
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored) to selected 1.8 (colored)

Remove extraneous \n's in {err,warn}{,x}.

Revision 1.51 / (download) - annotate - [select for diffs], Wed Jul 10 15:12:36 2002 UTC (21 years, 8 months ago) by fredette
Branch: MAIN
Changes since 1.50: +22 -3 lines
Diff to previous 1.50 (colored) to selected 1.8 (colored)

Add support for dynamic linking on HP PA-RISC.

Revision 1.50 / (download) - annotate - [select for diffs], Sat Jun 1 23:50:53 2002 UTC (21 years, 10 months ago) by lukem
Branch: MAIN
Changes since 1.49: +3 -13 lines
Diff to previous 1.49 (colored) to selected 1.8 (colored)

SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field).  whilst it's O(n),
  this mirrors the functionality of SLIST_REMOVE() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
  this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups

Revision 1.49 / (download) - annotate - [select for diffs], Sun May 26 00:02:07 2002 UTC (21 years, 10 months ago) by wiz
Branch: MAIN
Changes since 1.48: +2 -13 lines
Diff to previous 1.48 (colored) to selected 1.8 (colored)

__STDC__ is always defined on NetBSD.

Revision 1.48 / (download) - annotate - [select for diffs], Sun Feb 3 23:34:42 2002 UTC (22 years, 1 month ago) by thorpej
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001
Branch point for: netbsd-1-6
Changes since 1.47: +4 -4 lines
Diff to previous 1.47 (colored) to selected 1.8 (colored)

Add support for dynamic linking on the SuperH.  From Marcus Comstedt,
with some bug fixes (namely, don't forget to consider the addend when
processing relocations) from me.

Revision 1.47 / (download) - annotate - [select for diffs], Fri Dec 14 21:25:22 2001 UTC (22 years, 3 months ago) by thorpej
Branch: MAIN
Changes since 1.46: +2 -10 lines
Diff to previous 1.46 (colored) to selected 1.8 (colored)

Garbage-collect the OLD_GOT stuff.

Revision 1.46 / (download) - annotate - [select for diffs], Fri Dec 14 21:21:27 2001 UTC (22 years, 3 months ago) by thorpej
Branch: MAIN
Changes since 1.45: +3 -2 lines
Diff to previous 1.45 (colored) to selected 1.8 (colored)

binutils-current ld emits DT_TEXTREL into _DYNAMIC on arm-elf.  Handle
this.

Revision 1.34.2.3 / (download) - annotate - [select for diffs], Sun Dec 9 17:21:33 2001 UTC (22 years, 3 months ago) by he
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-PATCH003
Changes since 1.34.2.2: +34 -45 lines
Diff to previous 1.34.2.2 (colored) to branchpoint 1.34 (colored) next main 1.35 (colored) to selected 1.8 (colored)

Pull up revisions 1.42-1.45 (requested by skrll):
  Add init/fini section support in crtbegin and crtend, and introduce
  support for DWARF2 exception handling.  Fixes PR#12865, PR#13488,
  PR#13489, and PR#13491.  Also fix ld.elf_so to deal appropriately.

Revision 1.45 / (download) - annotate - [select for diffs], Thu May 10 20:19:25 2001 UTC (22 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.44: +2 -1 lines
Diff to previous 1.44 (colored) to selected 1.8 (colored)

Unloading objects, can cause other objects whose reference count becomes
0 to be unloaded. Make sure that when we unload those objects we remove
any references to them from the globals list... This fixes SIGSEGV with
apache+mod_php+mysql.

XXX: This fix should be pulled up.

christos

Revision 1.44 / (download) - annotate - [select for diffs], Sat Feb 3 13:25:00 2001 UTC (23 years, 1 month ago) by pk
Branch: MAIN
Changes since 1.43: +30 -11 lines
Diff to previous 1.43 (colored) to selected 1.8 (colored)

Avoid the use of a `switch(){}' statement before _rtld_init() is called.
`switch()' code may be translated using a jump table approach which causes
it to reference the equivalent of a global variable, something that must
be avoided before _rtld_init() has run.

Revision 1.43 / (download) - annotate - [select for diffs], Fri Nov 10 23:53:04 2000 UTC (23 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.42: +1 -27 lines
Diff to previous 1.42 (colored) to selected 1.8 (colored)

Make ldd(1) build again.

Revision 1.42 / (download) - annotate - [select for diffs], Fri Nov 10 21:31:30 2000 UTC (23 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.41: +6 -11 lines
Diff to previous 1.41 (colored) to selected 1.8 (colored)

When dlopen()ing with RTLD_GLOBAL, also make dependent libraries RTLD_GLOBAL.

Revision 1.34.2.2 / (download) - annotate - [select for diffs], Tue Aug 29 01:47:42 2000 UTC (23 years, 7 months ago) by scottb
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-RELEASE, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA
Changes since 1.34.2.1: +5 -2 lines
Diff to previous 1.34.2.1 (colored) to branchpoint 1.34 (colored) to selected 1.8 (colored)

pullup version 1.41 (approved by thorpej):
  copy the real object filename to the rtld object path so that the
  Dl_info structure can be properly filled by dladdr().

Revision 1.41 / (download) - annotate - [select for diffs], Mon Aug 28 04:15:54 2000 UTC (23 years, 7 months ago) by scottb
Branch: MAIN
Changes since 1.40: +5 -2 lines
Diff to previous 1.40 (colored) to selected 1.8 (colored)

copy the real object filename to the rtld object path so that the
Dl_info structure can be properly filled by dladdr().

Revision 1.34.2.1 / (download) - annotate - [select for diffs], Wed Jul 26 23:45:22 2000 UTC (23 years, 8 months ago) by mycroft
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-ALPHA2
Changes since 1.34: +39 -10 lines
Diff to previous 1.34 (colored) to selected 1.8 (colored)

Approved by thorpej:
Add support for sparc64, including MD code and variable page size support.
Modify some variable types to insure they are the correct width on sparc64.

basesrc/libexec/ld.elf_so/arch/sparc64/Makefile.inc	0 -> 1.1
basesrc/libexec/ld.elf_so/arch/sparc64/mdreloc.c	0 -> 1.3
basesrc/libexec/ld.elf_so/arch/sparc64/rtld_start.S	0 -> 1.2
basesrc/libexec/ld.elf_so/headers.c			1.6 -> 1.8
basesrc/libexec/ld.elf_so/reloc.c			1.26 -> 1.27
basesrc/libexec/ld.elf_so/reloc.c			1.29 -> 1.31
basesrc/libexec/ld.elf_so/rtld.c			1.34 -> 1.35
basesrc/libexec/ld.elf_so/rtld.c			1.36 -> 1.40
basesrc/libexec/ld.elf_so/rtld.h			1.26 -> 1.27
basesrc/libexec/ld.elf_so/symbol.c			1.7 -> 1.9

Revision 1.40 / (download) - annotate - [select for diffs], Wed Jul 26 15:40:07 2000 UTC (23 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.39: +7 -3 lines
Diff to previous 1.39 (colored) to selected 1.8 (colored)

The ELF ABI declares that argc must fill an `argument slot'.  Make it so.
For __sparc_v9__ only, do a hack to make executables work temporarily before
and after the kernel is switched.

Revision 1.39 / (download) - annotate - [select for diffs], Wed Jul 26 02:07:35 2000 UTC (23 years, 8 months ago) by mycroft
Branch: MAIN
Changes since 1.38: +7 -5 lines
Diff to previous 1.38 (colored) to selected 1.8 (colored)

Catch up with type changes.  Also:
* Apply DT_PLTRELSZ to (one of) pltrel or pltrela *after* we've finished
  parsing the headers, so we know which one.
* Fix sparc64 bogons.  (It works now!)

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jul 19 15:01:16 2000 UTC (23 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.37: +7 -3 lines
Diff to previous 1.37 (colored) to selected 1.8 (colored)

Make it build on non-VARPSZ again.

Revision 1.37 / (download) - annotate - [select for diffs], Tue Jul 18 22:33:55 2000 UTC (23 years, 8 months ago) by eeh
Branch: MAIN
Changes since 1.36: +15 -5 lines
Diff to previous 1.36 (colored) to selected 1.8 (colored)

Fix some issues with SPARC V9 ELF binaries.

Revision 1.36 / (download) - annotate - [select for diffs], Mon Jul 17 02:55:53 2000 UTC (23 years, 8 months ago) by matt
Branch: MAIN
Changes since 1.35: +5 -1 lines
Diff to previous 1.35 (colored) to selected 1.8 (colored)

More VAX ELF changes.

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jul 14 21:59:58 2000 UTC (23 years, 8 months ago) by matt
Branch: MAIN
Changes since 1.34: +11 -2 lines
Diff to previous 1.34 (colored) to selected 1.8 (colored)

Initialize ld.elf_so's textsize.

Revision 1.31.2.1 / (download) - annotate - [select for diffs], Thu Jun 22 15:58:31 2000 UTC (23 years, 9 months ago) by minoura
Branch: minoura-xpg4dl
Changes since 1.31: +14 -6 lines
Diff to previous 1.31 (colored) next main 1.32 (colored) to selected 1.8 (colored)

Sync w/ netbsd-1-5-base.

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jun 16 19:51:05 2000 UTC (23 years, 9 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-5-base
Branch point for: netbsd-1-5
Changes since 1.33: +9 -4 lines
Diff to previous 1.33 (colored) to selected 1.8 (colored)

Also set __mainprog_obj so .ini sections can call dlopen()

Revision 1.33 / (download) - annotate - [select for diffs], Sat Jun 3 06:51:57 2000 UTC (23 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored) to selected 1.8 (colored)

slighly move the assert() added in last commit, so that it's
  actually useful

Revision 1.32 / (download) - annotate - [select for diffs], Fri Jun 2 22:52:28 2000 UTC (23 years, 10 months ago) by jdolecek
Branch: MAIN
Changes since 1.31: +6 -3 lines
Diff to previous 1.31 (colored) to selected 1.8 (colored)

_rtld_unref_dag(): needed->obj might be null if the unreffed object has
	some unsatisfied references (most often when compiled without necessary
	-Wl,-R), so check for that instead of causing null-dereference;
	this way the code has a chance to cleanup after itself and report
	the error to caller

Thanks to Jason Thorpe for helping fix this!

Revision 1.31 / (download) - annotate - [select for diffs], Sat Apr 15 05:41:46 2000 UTC (23 years, 11 months ago) by erh
Branch: MAIN
CVS Tags: minoura-xpg4dl-base
Branch point for: minoura-xpg4dl
Changes since 1.30: +40 -1 lines
Diff to previous 1.30 (colored) to selected 1.8 (colored)

Cause ld.elf_so to find the symbols for __progname and environ and set them.  If we wait until crt0 gets around to doing it it's too late for any library init functions.

Revision 1.30 / (download) - annotate - [select for diffs], Sat Apr 15 05:27:49 2000 UTC (23 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.29: +42 -42 lines
Diff to previous 1.29 (colored) to selected 1.8 (colored)

re-indent sanely _rtld_dlsym() [no functional change]

Revision 1.29 / (download) - annotate - [select for diffs], Mon Feb 7 19:02:49 2000 UTC (24 years, 1 month ago) by kleink
Branch: MAIN
Changes since 1.28: +2 -30 lines
Diff to previous 1.28 (colored) to selected 1.8 (colored)

Change _rtld_dlclose() to unload the object via _rtld_unload_object() rather
than by itself.  Besides being duplicated code the open-coded version
also did not take care of cleaning up after the object's DAG(!).
Fixes PR bin/8905.

Revision 1.23.2.1 / (download) - annotate - [select for diffs], Mon Dec 27 18:30:14 1999 UTC (24 years, 3 months ago) by wrstuden
Branch: wrstuden-devbsize
Changes since 1.23: +317 -47 lines
Diff to previous 1.23 (colored) next main 1.24 (colored) to selected 1.8 (colored)

Pull up to last week's -current.

Revision 1.28 / (download) - annotate - [select for diffs], Mon Dec 13 09:09:34 1999 UTC (24 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221
Changes since 1.27: +10 -5 lines
Diff to previous 1.27 (colored) to selected 1.8 (colored)

Enable parsing and mapping of hardware dependent libraries in ld.so.conf
To be documented in the man page.

Revision 1.27 / (download) - annotate - [select for diffs], Wed Nov 10 18:48:19 1999 UTC (24 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.26: +6 -6 lines
Diff to previous 1.26 (colored) to selected 1.8 (colored)

Name consistencty nit: curmark -> _rtld_curmark

Revision 1.26 / (download) - annotate - [select for diffs], Wed Nov 10 18:34:49 1999 UTC (24 years, 4 months ago) by thorpej
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored) to selected 1.8 (colored)

Some slight cosmetic cleanup.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Nov 7 00:21:13 1999 UTC (24 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.24: +293 -28 lines
Diff to previous 1.24 (colored) to selected 1.8 (colored)

Changes from msaitoh to fix local/global symbol confusion, and to fix weak
symbol support -- updated by me for elf.h changes.

Revision 1.24 / (download) - annotate - [select for diffs], Mon Oct 25 13:57:12 1999 UTC (24 years, 5 months ago) by kleink
Branch: MAIN
CVS Tags: comdex-fall-1999-base, comdex-fall-1999
Changes since 1.23: +18 -18 lines
Diff to previous 1.23 (colored) to selected 1.8 (colored)

Update to match new SVR4-style definition names in <sys/exec_elf.h>.

Revision 1.23 / (download) - annotate - [select for diffs], Thu Aug 19 23:42:15 1999 UTC (24 years, 7 months ago) by christos
Branch: MAIN
Branch point for: wrstuden-devbsize
Changes since 1.22: +2 -1 lines
Diff to previous 1.22 (colored) to selected 1.8 (colored)

enable /etc/ld.so.conf processing
[reviewed by thorpej]

Revision 1.22 / (download) - annotate - [select for diffs], Sun Aug 1 19:47:07 1999 UTC (24 years, 8 months ago) by kleink
Branch: MAIN
Changes since 1.21: +3 -2 lines
Diff to previous 1.21 (colored) to selected 1.8 (colored)

Rearrange the shared library search path precedences to LD_LIBRARY_PATH >
runpath > built-in default; this is the behaviour of the SVR4 shared loader,
and gives users the opportunity to override the runpath.  (Addresses a report
on current-users by John Kohl.)

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jul 22 00:18:19 1999 UTC (24 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored) to selected 1.8 (colored)

When dlopen()'ing a shared object without an absolute pathname, search
for it in the rpath of the main program as well as the path specified
in LD_LIBRARY_PATH.

Revision 1.17.2.1 / (download) - annotate - [select for diffs], Wed Jun 23 15:06:02 1999 UTC (24 years, 9 months ago) by perry
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001
Changes since 1.17: +9 -1 lines
Diff to previous 1.17 (colored) next main 1.18 (colored) to selected 1.8 (colored)

pullup 1.18->1.19 (klienk): LD_PRELOAD support

Revision 1.20 / (download) - annotate - [select for diffs], Tue Jun 15 15:54:28 1999 UTC (24 years, 9 months ago) by kleink
Branch: MAIN
Changes since 1.19: +3 -1 lines
Diff to previous 1.19 (colored) to selected 1.8 (colored)

Don't include the ident .note assembly when linting.

Revision 1.19 / (download) - annotate - [select for diffs], Mon May 31 14:48:16 1999 UTC (24 years, 10 months ago) by kleink
Branch: MAIN
Changes since 1.18: +9 -1 lines
Diff to previous 1.18 (colored) to selected 1.8 (colored)

Implement LD_PRELOAD support.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Apr 18 19:40:06 1999 UTC (24 years, 11 months ago) by ws
Branch: MAIN
Changes since 1.17: +20 -1 lines
Diff to previous 1.17 (colored) to selected 1.8 (colored)

Add code to use the kernel provided page size.
Enable this on the powerpc only for now.

Revision 1.17 / (download) - annotate - [select for diffs], Mon Mar 8 10:44:25 1999 UTC (25 years ago) by kleink
Branch: MAIN
CVS Tags: netbsd-1-4-base, netbsd-1-4-RELEASE
Branch point for: netbsd-1-4
Changes since 1.16: +4 -6 lines
Diff to previous 1.16 (colored) to selected 1.8 (colored)

Update an i386-ismed comment.

Revision 1.16 / (download) - annotate - [select for diffs], Wed Mar 3 21:18:00 1999 UTC (25 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored) to selected 1.8 (colored)

Make this compile without -DRTLD_LOADER and fix printf format problems on
the alpha.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Mar 1 16:40:07 1999 UTC (25 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.14: +361 -344 lines
Diff to previous 1.14 (colored) to selected 1.8 (colored)

KNF

Revision 1.14 / (download) - annotate - [select for diffs], Sat Feb 27 10:35:16 1999 UTC (25 years, 1 month ago) by pk
Branch: MAIN
Changes since 1.13: +66 -56 lines
Diff to previous 1.13 (colored) to selected 1.8 (colored)

Just initialize the stack-based temporary `rtld self' object.

Revision 1.13 / (download) - annotate - [select for diffs], Wed Feb 24 18:31:00 1999 UTC (25 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.12: +51 -33 lines
Diff to previous 1.12 (colored) to selected 1.8 (colored)

Cleanup global variable access so rtld can be self relocating. Also KNF
reloc.c and move md sparc parts to arch/sparc/mdreloc.c
Now we don't need to load at address 0 on the i386 and the mips should be
trivial to fix.

Revision 1.12 / (download) - annotate - [select for diffs], Sun Jan 10 18:18:56 1999 UTC (25 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.11: +18 -10 lines
Diff to previous 1.11 (colored) to selected 1.8 (colored)

Add i386 bits

Revision 1.11 / (download) - annotate - [select for diffs], Sat Jan 9 18:10:19 1999 UTC (25 years, 2 months ago) by castor
Branch: MAIN
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored) to selected 1.8 (colored)

Restore missing variable declaration with -DRTLD_DEBUG

Revision 1.10 / (download) - annotate - [select for diffs], Wed Oct 7 02:53:27 1998 UTC (25 years, 5 months ago) by ross
Branch: MAIN
Changes since 1.9: +32 -25 lines
Diff to previous 1.9 (colored) to selected 1.8 (colored)

Rewrite AuxInfo handling to track AuxID changes in sys/exec_elf.h.

Revision 1.5.2.2 / (download) - annotate - [select for diffs], Sun Sep 27 23:18:23 1998 UTC (25 years, 6 months ago) by cgd
Branch: netbsd-1-3
CVS Tags: netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003
Changes since 1.5.2.1: +3 -1 lines
Diff to previous 1.5.2.1 (colored) to branchpoint 1.5 (colored) next main 1.6 (colored) to selected 1.8 (colored)

pull up rev 1.7 from trunk (mhitch).

Revision 1.9 / (download) - annotate - [select for diffs], Wed Jul 15 11:26:28 1998 UTC (25 years, 8 months ago) by tv
Branch: MAIN
Changes since 1.8: +5 -15 lines
Diff to previous 1.8 (colored)

Some local changes accidentally made it into the last commit; back that
part out (noticed by mycroft; thanks!)

Revision 1.8 / (download) - annotate - [selected], Tue Jul 14 22:18:37 1998 UTC (25 years, 8 months ago) by tv
Branch: MAIN
Changes since 1.7: +16 -10 lines
Diff to previous 1.7 (colored)

Change ld.so default behavior to RTLD_LOCAL, and make RTLD_LOCAL into a
new flag bit.  Keep RTLD_GLOBAL as an actual flag bit so it won't be
re-used, or may be used for something later.  Mask the dlopen() mode bits
in ld.elf_so so a comparison against RTLD_NOW works.  (RTLD_{LOCAL,GLOBAL}
needs to be implemented for ld.elf_so.)

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jun 16 03:24:13 1998 UTC (25 years, 9 months ago) by mhitch
Branch: MAIN
Changes since 1.6: +3 -1 lines
Diff to previous 1.6 (colored) to selected 1.8 (colored)

Don't forget to update _rtld_objtail when _rtld_dlclose() removes the
current tail entry.

Revision 1.5.2.1 / (download) - annotate - [select for diffs], Fri May 8 17:39:12 1998 UTC (25 years, 10 months ago) by mycroft
Branch: netbsd-1-3
CVS Tags: netbsd-1-3-PATCH002
Changes since 1.5: +16 -2 lines
Diff to previous 1.5 (colored) to selected 1.8 (colored)

Sync with trunk, per request of mycroft.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Mar 25 04:13:02 1998 UTC (26 years ago) by mhitch
Branch: MAIN
Changes since 1.5: +16 -2 lines
Diff to previous 1.5 (colored) to selected 1.8 (colored)

Add support for mips.

Revision 1.5 / (download) - annotate - [select for diffs], Wed Oct 8 08:55:37 1997 UTC (26 years, 5 months ago) by mrg
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH001, netbsd-1-3-BETA
Branch point for: netbsd-1-3
Changes since 1.4: +3 -1 lines
Diff to previous 1.4 (colored) to selected 1.8 (colored)

WARNS?=1

Revision 1.4 / (download) - annotate - [select for diffs], Tue Apr 15 07:15:46 1997 UTC (26 years, 11 months ago) by cgd
Branch: MAIN
Changes since 1.3: +3 -2 lines
Diff to previous 1.3 (colored) to selected 1.8 (colored)

make sure that ld.elf_so's path is in the data segment

Revision 1.3 / (download) - annotate - [select for diffs], Fri Mar 21 05:39:42 1997 UTC (27 years ago) by cgd
Branch: MAIN
Changes since 1.2: +4 -2 lines
Diff to previous 1.2 (colored) to selected 1.8 (colored)

put in two identifying notes, which new binutils snapshots will turn
into PT_NOTE sections so they can be examined by execve() to figure
out whether this is a native binary, what emulation it's to be run under,
etc.

Revision 1.2 / (download) - annotate - [select for diffs], Wed Dec 18 22:27:29 1996 UTC (27 years, 3 months ago) by cgd
Branch: MAIN
Changes since 1.1: +5 -4 lines
Diff to previous 1.1 (colored) to selected 1.8 (colored)

nclude dlfcn.h, and pull RLTD_LAZY in from there.  Assume that RTLD_NOW is
RLTD_LAZY + 1 (for now), if it's not defined.  RTLD_NOW should be defined
in dlfcn.h, since some code (e.g. X11) wants it and assumes that it has
the value currently used by our RTLD_LAZY.

Revision 1.1 / (download) - annotate - [select for diffs], Mon Dec 16 20:38:03 1996 UTC (27 years, 3 months ago) by cgd
Branch: MAIN
Diff to selected 1.8 (colored)

First cut at an ELF shared loader.  Originally from John Polstra's FreeBSD elf
kit, then hacked on by Matt Thomas <matt@3am-software.com>, then by me (to
make it work with new versions of the toolchain, etc.).  This runs, but it's
in serious need of cleaning and/or a fair bit of reworking.  See the README
file for more information, and a list of things to do.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>