The NetBSD Project

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

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

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.69: download - view: text, markup, annotated - select for diffs
Sat Aug 3 21:59:57 2024 UTC (6 months ago) by riastradh
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +3 -3 lines
ld.elf_so(1): Nix trailing whitespace.

No functional change intended.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Fri Aug 2 11:45:52 2024 UTC (6 months ago) by skrll
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +5 -3 lines
KNF

Revision 1.60.2.2: download - view: text, markup, annotated - select for diffs
Fri Aug 4 12:55:45 2023 UTC (18 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-4-RELEASE
Diff to: previous 1.60.2.1: preferred, colored; branchpoint 1.60: preferred, colored; next MAIN 1.61: preferred, colored
Changes since revision 1.60.2.1: +10 -4 lines
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.62.2.1: download - view: text, markup, annotated - select for diffs
Tue Aug 1 16:34:56 2023 UTC (18 months, 1 week ago) by martin
Branches: netbsd-10
CVS tags: netbsd-10-1-RELEASE, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1
Diff to: previous 1.62: preferred, colored; next MAIN 1.63: preferred, colored
Changes since revision 1.62: +10 -4 lines
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.67: download - view: text, markup, annotated - select for diffs
Sun Jun 4 01:24:56 2023 UTC (20 months ago) by joerg
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +3 -3 lines
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.

Revision 1.66: download - view: text, markup, annotated - select for diffs
Wed May 31 18:44:39 2023 UTC (20 months, 1 week ago) by riastradh
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +9 -3 lines
ld.elf_so: Sprinkle tls debug messages.

XXX pullup-10

Revision 1.65: download - view: text, markup, annotated - select for diffs
Thu Jan 12 19:17:11 2023 UTC (2 years ago) by christos
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +4 -4 lines
fix the ldd build

Revision 1.64: download - view: text, markup, annotated - select for diffs
Thu Jan 12 18:52:47 2023 UTC (2 years ago) by christos
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +31 -7 lines
Handle program headers properly; fixes c++ exceptions on arm32.

Revision 1.63: download - view: text, markup, annotated - select for diffs
Fri Jan 6 15:33:47 2023 UTC (2 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +153 -121 lines
Remove the limitation of only being able to load binaries with 2 PT_LOAD
sections, like the kernel can. From FreeBSD.

Revision 1.62: download - view: text, markup, annotated - select for diffs
Wed Mar 30 08:26:45 2022 UTC (2 years, 10 months ago) by hannken
Branches: MAIN
CVS tags: netbsd-10-base
Branch point for: netbsd-10
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +9 -7 lines
_rtld_map_object(): no need to mmap an empty bss segment.

Revision 1.58.6.2: download - view: text, markup, annotated - select for diffs
Wed Apr 8 14:07:17 2020 UTC (4 years, 10 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.58.6.1: preferred, colored; branchpoint 1.58: preferred, colored; next MAIN 1.59: preferred, colored
Changes since revision 1.58.6.1: +5 -4 lines
Merge changes from current as of 20200406

Revision 1.60.2.1: download - view: text, markup, annotated - select for diffs
Sun Mar 8 10:22:29 2020 UTC (4 years, 11 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +5 -4 lines
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.61: download - view: text, markup, annotated - select for diffs
Wed Mar 4 01:21:17 2020 UTC (4 years, 11 months ago) by thorpej
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +5 -4 lines
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.58.6.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:05:29 2019 UTC (5 years, 7 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +14 -12 lines
Sync with HEAD

Revision 1.58.4.1: download - view: text, markup, annotated - select for diffs
Fri Jan 18 08:50:11 2019 UTC (6 years ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.58: preferred, colored; next MAIN 1.59: preferred, colored
Changes since revision 1.58: +14 -12 lines
Synch with HEAD

Revision 1.60: download - view: text, markup, annotated - select for diffs
Sun Jan 6 19:44:54 2019 UTC (6 years, 1 month ago) by joerg
Branches: MAIN
CVS tags: phil-wifi-20191119, phil-wifi-20190609, pgoyette-compat-20190127, pgoyette-compat-20190118, netbsd-9-base, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, is-mlppp-base, is-mlppp
Branch point for: netbsd-9
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +14 -6 lines
When loading a non-PIE main binary, the virtual address must match.
Use MAP_TRYFIXED and verify that the result matches the expectation.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Fri Jan 4 19:54:56 2019 UTC (6 years, 1 month ago) by joerg
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +2 -8 lines
MAP_ALIGNED has existed for years, just assume it exists.

Revision 1.57.4.1: download - view: text, markup, annotated - select for diffs
Tue Jul 4 12:47:58 2017 UTC (7 years, 7 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-3-RELEASE, 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
Diff to: previous 1.57: preferred, colored; next MAIN 1.58: preferred, colored
Changes since revision 1.57: +2 -5 lines
Pull up following revision(s) (requested by joerg in ticket #64):
	libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.40
	libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.41
	libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.44
	libexec/ld.elf_so/arch/riscv/mdreloc.c: revision 1.3
	libexec/ld.elf_so/arch/aarch64/mdreloc.c: revision 1.3
	libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.60
	libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.32
	libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.61
	libexec/ld.elf_so/arch/or1k/mdreloc.c: revision 1.2
	libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.50
	libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.33
	libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.34
	libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.39
	libexec/ld.elf_so/symbol.c: revision 1.68
	libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.66
	libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.67
	libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.68
	libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.42
	libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.54
	libexec/ld.elf_so/Makefile: revision 1.137
	libexec/ld.elf_so/arch/vax/mdreloc.c: revision 1.32
	libexec/ld.elf_so/rtld.h: revision 1.127
	libexec/ld.elf_so/arch/vax/mdreloc.c: revision 1.33
	libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.38
	libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.42
	libexec/ld.elf_so/map_object.c: revision 1.58
	libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.49
Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.
The COMBREL logic predates thread-safety of the dynamic linker and
breaks the use of shared locks for the common symbol lookup case. It is
unlikely to provide any benefit for lazy binding or PLT lookups, so
provide equivalent functionality in the non-PLT relocation handling loop
by checking if the symbol used by the current relocation is the same as
the one used during the last lookup. No inter-object cachine is done as
it is also unlikely to be benefical.
Testing with Firefox startup on AMD64 shows a small performance gain by
the new method.
Drop symbol number from default branch diagnostic, it isn't set at this
point and most likely not valid either.
Expand symnum, GCC's uninitialized used tracking is too imprecise.
Fix C&P bug. Deal with more MIPS hacks overriding def.
Add last_symnum, move up def and defobj.
Add back symnum, fix debug print.
Replace last use of r_type.
Fix indentation.
Fix indentation.

Revision 1.58: download - view: text, markup, annotated - select for diffs
Mon Jun 19 11:57:01 2017 UTC (7 years, 7 months ago) by joerg
Branches: MAIN
CVS tags: phil-wifi-base, pgoyette-compat-base, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, 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, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646
Branch point for: phil-wifi, pgoyette-compat
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +2 -5 lines
Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.

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

Testing with Firefox startup on AMD64 shows a small performance gain by
the new method.

Revision 1.55.4.1: download - view: text, markup, annotated - select for diffs
Fri Apr 21 16:53:13 2017 UTC (7 years, 9 months ago) by bouyer
Branches: bouyer-socketcan
Diff to: previous 1.55: preferred, colored; next MAIN 1.56: preferred, colored
Changes since revision 1.55: +2 -2 lines
Sync with HEAD

Revision 1.55.2.1: download - view: text, markup, annotated - select for diffs
Mon Mar 20 06:57:01 2017 UTC (7 years, 10 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.55: preferred, colored; next MAIN 1.56: preferred, colored
Changes since revision 1.55: +2 -2 lines
Sync with HEAD

Revision 1.57: download - view: text, markup, annotated - select for diffs
Fri Mar 10 09:13:49 2017 UTC (7 years, 11 months ago) by maya
Branches: 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
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +4 -8 lines
Revert to version 1.55 of map_object.c. This reverts:

"really unmap the gap between the text and data rather than just removing
all access with mprotect().  the latter results in the kernel having to
keep track of that range separately since the permissions are different.
avoid calling mmap() with a size of zero."

As per toolchain/52054: src/libexec/ld.elf_so update breaks everything,
this commit is very broken for some people (but not others). chs mentioned
he has a fix, but best not to leave -current broken in the meantime.

Revision 1.56: download - view: text, markup, annotated - select for diffs
Thu Mar 9 00:43:50 2017 UTC (7 years, 11 months ago) by chs
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +10 -6 lines
really unmap the gap between the text and data rather than just removing
all access with mprotect().  the latter results in the kernel having to
keep track of that range separately since the permissions are different.
avoid calling mmap() with a size of zero.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Thu Jun 16 11:34:13 2016 UTC (8 years, 7 months ago) by christos
Branches: MAIN
CVS tags: pgoyette-localcount-base, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, localcount-20160914, bouyer-socketcan-base
Branch point for: pgoyette-localcount, bouyer-socketcan
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +7 -7 lines
Move relro after we've computed out relocbase and re-enable it.
(Matthias Weckbecker)

Revision 1.54: download - view: text, markup, annotated - select for diffs
Tue Jun 14 13:06:41 2016 UTC (8 years, 7 months ago) by christos
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +22 -2 lines
Add support for GNU RELRO headers from Matthias Weckbecker.

Revision 1.52.4.1: download - view: text, markup, annotated - select for diffs
Sun Mar 6 18:17:55 2016 UTC (8 years, 11 months ago) by martin
Branches: 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
Diff to: previous 1.52: preferred, colored; next MAIN 1.53: preferred, colored
Changes since revision 1.52: +3 -3 lines
Catch up to -current, via patch, requested by christos in ticket #1126:

Revision 1.53: download - view: text, markup, annotated - select for diffs
Thu Oct 30 07:53:41 2014 UTC (10 years, 3 months ago) by martin
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +3 -3 lines
Avoid use after free, reported by the coverity scanner.

Revision 1.44.2.3: download - view: text, markup, annotated - select for diffs
Wed Aug 20 00:02:22 2014 UTC (10 years, 5 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.44.2.2: preferred, colored; next MAIN 1.45: preferred, colored
Changes since revision 1.44.2.2: +0 -5 lines
Rebase to HEAD as of a few days ago.

Revision 1.43.2.2: download - view: text, markup, annotated - select for diffs
Thu May 22 11:37:13 2014 UTC (10 years, 8 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.43.2.1: preferred, colored; branchpoint 1.43: preferred, colored; next MAIN 1.44: preferred, colored
Changes since revision 1.43.2.1: +19 -8 lines
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.52: download - view: text, markup, annotated - select for diffs
Sat Aug 3 13:17:05 2013 UTC (11 years, 6 months ago) by skrll
Branches: 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, riastradh-drm2-base3, netbsd-7-base, 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
Branch point for: netbsd-7
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +2 -7 lines
Fix DEBUG build.

Revision 1.44.2.2: download - view: text, markup, annotated - select for diffs
Sun Jun 23 06:28:50 2013 UTC (11 years, 7 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.44.2.1: preferred, colored
Changes since revision 1.44.2.1: +19 -3 lines
resync from head

Revision 1.51: download - view: text, markup, annotated - select for diffs
Thu May 9 15:38:14 2013 UTC (11 years, 9 months ago) by christos
Branches: MAIN
CVS tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +6 -6 lines
convert to SIMPLEQ like the rest of the queues.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Wed May 8 15:25:01 2013 UTC (11 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +3 -3 lines
need xfree() instead of free(). Using free() ends us up in an infinite loop.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Mon May 6 19:59:30 2013 UTC (11 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +8 -2 lines
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.48: download - view: text, markup, annotated - select for diffs
Mon May 6 08:02:20 2013 UTC (11 years, 9 months ago) by skrll
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +3 -3 lines
Trailing whitespace

Revision 1.47: download - view: text, markup, annotated - select for diffs
Thu Apr 25 12:28:59 2013 UTC (11 years, 9 months ago) by skrll
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +6 -2 lines
Adjust exidx_start by relocbase

Revision 1.46: download - view: text, markup, annotated - select for diffs
Thu Apr 25 09:01:23 2013 UTC (11 years, 9 months ago) by skrll
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +8 -2 lines
Handle PT_ARM_EXIDX when mapping objects.

Revision 1.44.2.1: download - view: text, markup, annotated - select for diffs
Tue Nov 20 03:00:46 2012 UTC (12 years, 2 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +9 -6 lines
Resync to 2012-11-19 00:00:00 UTC

Revision 1.43.2.1: download - view: text, markup, annotated - select for diffs
Tue Oct 30 18:59:23 2012 UTC (12 years, 3 months ago) by yamt
Branches: yamt-pagecache
CVS tags: yamt-pagecache-tag8
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +19 -10 lines
sync with head

Revision 1.45: download - view: text, markup, annotated - select for diffs
Sat Oct 13 21:13:07 2012 UTC (12 years, 3 months ago) by dholland
Branches: MAIN
CVS tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, agc-symver-base, agc-symver
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +9 -6 lines
Improve the diagnostic messages for invalid/non-ELF files. Proposed a
while back; I forget the context. Has been sitting in one of my trees
awaiting a test run since, apparently, August 2011.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Wed Jul 25 22:51:04 2012 UTC (12 years, 6 months ago) by martin
Branches: MAIN
Branch point for: tls-maxphys
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +12 -6 lines
Try to make dbg() printfs realy ELFSIZE independent

Revision 1.36.4.3: download - view: text, markup, annotated - select for diffs
Sat Mar 17 18:28:32 2012 UTC (12 years, 10 months ago) by bouyer
Branches: 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
Diff to: previous 1.36.4.2: preferred, colored; branchpoint 1.36: preferred, colored; next MAIN 1.37: preferred, colored
Changes since revision 1.36.4.2: +61 -2 lines
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.43: download - view: text, markup, annotated - select for diffs
Sat Aug 13 22:25:20 2011 UTC (13 years, 5 months ago) by christos
Branches: MAIN
CVS tags: yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, 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, netbsd-6-1, 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, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Branch point for: yamt-pagecache
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +10 -6 lines
consistent debugging info for program headers

Revision 1.42: download - view: text, markup, annotated - select for diffs
Wed Mar 9 23:10:07 2011 UTC (13 years, 11 months ago) by joerg
Branches: MAIN
CVS tags: cherry-xenmp-base, cherry-xenmp
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +37 -2 lines
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.41: download - view: text, markup, annotated - select for diffs
Sat Oct 16 10:27:07 2010 UTC (14 years, 3 months ago) by skrll
Branches: MAIN
CVS tags: matt-mips64-premerge-20101231, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +61 -2 lines
Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Sat Sep 11 11:11:52 2010 UTC (14 years, 5 months ago) by skrll
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +4 -3 lines
Wrap long line.

Revision 1.36.4.1.4.1: download - view: text, markup, annotated - select for diffs
Wed Apr 21 05:26:10 2010 UTC (14 years, 9 months ago) by matt
Branches: matt-nb5-mips64
CVS tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Diff to: previous 1.36.4.1: preferred, colored; next MAIN 1.36.4.2: preferred, colored
Changes since revision 1.36.4.1: +5 -2 lines
sync to netbsd-5

Revision 1.36.4.2: download - view: text, markup, annotated - select for diffs
Sat Jan 30 18:53:47 2010 UTC (15 years ago) by snj
Branches: 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
Diff to: previous 1.36.4.1: preferred, colored; branchpoint 1.36: preferred, colored
Changes since revision 1.36.4.1: +5 -2 lines
Pull up following revision(s) (requested by skrll in ticket #1266):
	libexec/ld.elf_so/map_object.c: revision 1.39
	libexec/ld.elf_so/rtld.h: revision 1.83
	libexec/ld.elf_so/symbol.c: revision 1.49
Reset the COMBRELOC cache Obj_Entry if it was freed.
Fixes PR 41482. Done slightly differently to the patch in the PR.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Sun Jan 10 07:29:47 2010 UTC (15 years, 1 month ago) by skrll
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +5 -2 lines
Reset the COMBRELOC cache Obj_Entry if it was freed.

Fixes PR 41482. Done slightly differently to the patch in the PR.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Tue May 19 20:44:52 2009 UTC (15 years, 8 months ago) by christos
Branches: MAIN
CVS tags: matt-premerge-20091211
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +3 -3 lines
warns=4

Revision 1.36.4.1: download - view: text, markup, annotated - select for diffs
Fri Jan 16 22:21:30 2009 UTC (16 years ago) by bouyer
Branches: netbsd-5
CVS tags: 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
Branch point for: matt-nb5-mips64
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +10 -10 lines
Pull up following revision(s) (requested by mrg in ticket #265):
	libexec/ld.elf_so/headers.c: revision 1.27
	rescue/list: revision 1.35
	libexec/ld.elf_so/arch/sparc/Makefile.ld32: revision 1.1
	usr.bin/ldd/Makefile.elf: revision 1.1
	usr.bin/ldd/Makefile.elf: revision 1.2
	usr.bin/ldd/ldd_aout/ldd.c: file removal
	usr.bin/ldd/Makefile.elf: revision 1.3
	libexec/ld.elf_so/arch/sparc/Makefile.inc: revision 1.12
	usr.bin/ldd/dummy.c: revision 1.1
	gnu/usr.bin/binutils/ld/Makefile: revision 1.28
	usr.bin/ldd/elf32/Makefile: revision 1.1
	usr.bin/ldd/elf32/Makefile: revision 1.2
	usr.bin/ldd/ldd.c: revision 1.3
	usr.bin/ldd/elf32/Makefile: revision 1.3
	usr.bin/ldd/ldd_elf/Makefile: file removal
	usr.bin/ldd/ldd.h: revision 1.1
	usr.bin/ldd/ldd.c: revision 1.4
	usr.bin/ldd/ldd_aout.c: revision 1.1
	usr.bin/ldd/Makefile: revision 1.8
	usr.bin/ldd/Makefile: revision 1.9
	usr.bin/ldd/ldd_elfxx.c: revision 1.1
	libexec/ld.elf_so/map_object.c: revision 1.37
	usr.bin/ldd/ldd_aout/Makefile: file removal
	usr.bin/ldd/elf64/Makefile: revision 1.1
	rescue/Makefile: revision 1.22
	libexec/ld.elf_so/arch/i386/Makefile.ld32: revision 1.1
	usr.bin/ldd/ldd_elf/ldd.c: file removal
	usr.bin/ldd/elf64/Makefile: revision 1.2
	usr.bin/ldd/elf64/Makefile: revision 1.3
	usr.bin/ldd/aout/Makefile: revision 1.1
	libexec/ld.elf_so/arch/i386/Makefile.inc: revision 1.12
	rescue/list.ldd: revision 1.1
	usr.bin/ldd/ldd_elf/README: file removal
	usr.bin/ldd/Makefile.common: revision 1.1
move the defines for RTLD_ARCH_SUBDIR into a sub-sub-makefile so we can
grab these values via reach-over more easily.
some fixes for PR#40170:
- set NATIVE=yes in the environment for genscripts.sh
- set LIB_PATH to /usr/lib/{sparc,i386} for those scripts
- set use_sysroot to "yes", to enable LIB_PATH to work in genscripts.sh
- get rid of building an a.out-happy ldd (but keep supporting a.out
  binaries for the ELF version.)
- convert a.out, elf32 and elf64 support into convience libraries and
  link them right ones in.  if elf_ldd() fails on 64 bit platforms,
  try elf32_ldd() before aout_ldd().
now ldd on 64 bit platforms works for 32 bit binaries, aka PR#40199,
and it seems that all the issues from README are gone too.
add some (uintptr_t) to some casts, so these compile with ELFSIZE=32
*and _LP64.  necessary for 32/64 bit combo ldd support.
- rework this a bunch to make it work inside /rescue/ldd.
- fix alpha build.
make sure we set LIBISPRIVATE.
fixes build issues reported by moof.
make sure we set LIBISPRIVATE.
fixes build issues reported by moof.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Tue Jan 6 04:01:46 2009 UTC (16 years, 1 month ago) by mrg
Branches: MAIN
CVS tags: jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +10 -10 lines
add some (uintptr_t) to some casts, so these compile with ELFSIZE=32
*and _LP64.  necessary for 32/64 bit combo ldd support.

Revision 1.35.8.1: download - view: text, markup, annotated - select for diffs
Mon Jun 23 04:29:56 2008 UTC (16 years, 7 months ago) by wrstuden
Branches: wrstuden-revivesa
Diff to: previous 1.35: preferred, colored; next MAIN 1.36: preferred, colored
Changes since revision 1.35: +10 -6 lines
Sync w/ -current. 34 merge conflicts to follow.

Revision 1.35.6.1: download - view: text, markup, annotated - select for diffs
Tue Jun 17 09:13:39 2008 UTC (16 years, 7 months ago) by yamt
Branches: yamt-pf42
Diff to: previous 1.35: preferred, colored; next MAIN 1.36: preferred, colored
Changes since revision 1.35: +10 -6 lines
sync with head.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Tue Jun 3 19:32:32 2008 UTC (16 years, 8 months ago) by ad
Branches: MAIN
CVS tags: yamt-pf42-base4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, netbsd-5-base, matt-mips64-base2
Branch point for: netbsd-5
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +10 -6 lines
Don't bother unmapping the ELF header unless it overlaps the first load
section.

Revision 1.34.10.1: download - view: text, markup, annotated - select for diffs
Tue Nov 6 23:12:10 2007 UTC (17 years, 3 months ago) by matt
Branches: matt-armv6
CVS tags: matt-armv6-prevmlocking
Diff to: previous 1.34: preferred, colored; next MAIN 1.35: preferred, colored
Changes since revision 1.34: +7 -7 lines
sync with HEAD

Revision 1.35: download - view: text, markup, annotated - select for diffs
Fri Oct 5 22:21:07 2007 UTC (17 years, 4 months ago) by ad
Branches: 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
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +7 -7 lines
- 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.34: download - view: text, markup, annotated - select for diffs
Tue Mar 21 17:48:10 2006 UTC (18 years, 10 months ago) by christos
Branches: MAIN
CVS tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-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, netbsd-4, matt-mips64-base, matt-mips64, hpcarm-cleanup, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: matt-armv6
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +4 -5 lines
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.33: download - view: text, markup, annotated - select for diffs
Sat Mar 18 02:34:30 2006 UTC (18 years, 10 months ago) by matt
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +3 -2 lines
Fix some double frees / missing frees / use after freed all
relating to _rtld_load_object.  Fix Coverity CID 2601, 2600.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Wed Jun 1 14:14:55 2005 UTC (19 years, 8 months ago) by lukem
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +3 -3 lines
appease gcc -Wuninitialized

Revision 1.31: download - view: text, markup, annotated - select for diffs
Fri Oct 22 05:39:56 2004 UTC (20 years, 3 months ago) by skrll
Branches: MAIN
CVS tags: netbsd-3-base, 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, 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, netbsd-3
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +6 -1 lines
Add __RCSIDs.

OK'd by mycroft.

Revision 1.12.2.1: download - view: text, markup, annotated - select for diffs
Fri May 28 08:31:22 2004 UTC (20 years, 8 months ago) by tron
Branches: netbsd-1-6
Diff to: previous 1.12: preferred, colored; next MAIN 1.13: preferred, colored
Changes since revision 1.12: +140 -122 lines
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.30: download - view: text, markup, annotated - select for diffs
Thu Jul 24 10:12:25 2003 UTC (21 years, 6 months ago) by skrll
Branches: MAIN
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-base, 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-0, netbsd-2
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +5 -10 lines
ANSIfy and de-__P().

Revision 1.29: download - view: text, markup, annotated - select for diffs
Thu Jun 5 10:41:32 2003 UTC (21 years, 8 months ago) by simonb
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +2 -1 lines
KNF- blank lines before code at start of functions.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Thu Mar 6 17:01:27 2003 UTC (21 years, 11 months ago) by taca
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +3 -1 lines
make it compile in /usr/src/rescue directory.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Thu Mar 6 07:34:56 2003 UTC (21 years, 11 months ago) by matt
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +21 -3 lines
Align psections to their specified alignment (if possible).  Use
mmap(2) MAP_ALIGNED.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Thu Feb 6 12:38:17 2003 UTC (22 years ago) by fvdl
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +6 -1 lines
If fstat info was passed, and from it it can be seen that the file size
is smaller than an ELF header, don't even bother to try to look at it.
Avoids coredumps with zero-sized files.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Thu Dec 5 04:56:57 2002 UTC (22 years, 2 months ago) by junyoung
Branches: MAIN
CVS tags: fvdl_fs64_base
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +2 -1 lines
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.24: download - view: text, markup, annotated - select for diffs
Sat Oct 5 11:59:04 2002 UTC (22 years, 4 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +2 -1 lines
Minor cleanup.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Sat Oct 5 00:13:27 2002 UTC (22 years, 4 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +3 -1 lines
Make this work for ldd again.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Fri Oct 4 18:50:43 2002 UTC (22 years, 4 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +54 -60 lines
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.21: download - view: text, markup, annotated - select for diffs
Fri Sep 27 19:48:24 2002 UTC (22 years, 4 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +3 -3 lines
Change the munmap() of the text-data gap to mprotect(PROT_NONE).  This avoids
having scattered little mappings, although it's probably not the best way...

Revision 1.20: download - view: text, markup, annotated - select for diffs
Tue Sep 24 12:44:58 2002 UTC (22 years, 4 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +10 -12 lines
Woops, unmap the first page in the `win' case, too.
Tidy up a bit.

Revision 1.19: download - view: text, markup, annotated - select for diffs
Tue Sep 24 09:35:13 2002 UTC (22 years, 4 months ago) by junyoung
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +5 -4 lines
Use _rtld_pagesz instead of PAGESIZE.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Tue Sep 24 09:26:43 2002 UTC (22 years, 4 months ago) by junyoung
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +27 -27 lines
space -> tab.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Tue Sep 24 09:22:51 2002 UTC (22 years, 4 months ago) by junyoung
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +19 -20 lines
Don't need to use union any longer.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Mon Sep 23 23:56:47 2002 UTC (22 years, 4 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +40 -36 lines
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.15: download - view: text, markup, annotated - select for diffs
Fri Sep 13 03:12:40 2002 UTC (22 years, 5 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +1 -5 lines
Nuke two frivolous assert()s.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Fri Sep 6 13:20:29 2002 UTC (22 years, 5 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +2 -1 lines
Introduce a new flag, `isdynamic', which is used to remember whether the
executable was of type ET_DYN.  Use this instead of `mainprog' to determine
whether we need to do base-relative fixups of the PLT.  (This allows loading
non-relocatable objects, should we desire to do that at some point...)

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sat Jun 1 23:50:53 2002 UTC (22 years, 8 months ago) by lukem
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +5 -7 lines
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.11.4.1: download - view: text, markup, annotated - select for diffs
Sun Dec 9 17:20:35 2001 UTC (23 years, 2 months ago) by he
Branches: netbsd-1-5
CVS tags: netbsd-1-5-PATCH003
Diff to: previous 1.11: preferred, colored; next MAIN 1.12: preferred, colored
Changes since revision 1.11: +9 -12 lines
Pull up revision 1.12 (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.12: download - view: text, markup, annotated - select for diffs
Sun Nov 26 05:22:15 2000 UTC (24 years, 2 months ago) by mycroft
Branches: 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-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, 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
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +9 -12 lines
Return an error when there are too many segments rather than abort()ing.
This way `ldd /usr/libexec/ld.elf_so' doesn't core dump.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sun Feb 13 04:28:09 2000 UTC (25 years ago) by chs
Branches: MAIN
CVS tags: netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, minoura-xpg4dl-base, minoura-xpg4dl
Branch point for: netbsd-1-5
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +29 -25 lines
switch back to using a file mapping for the initial mapping of a new object.
this allows the kernel to use PMAP_PREFER() to give us better alignment on
platforms that care.

Revision 1.5.2.1: download - view: text, markup, annotated - select for diffs
Mon Dec 27 18:30:14 1999 UTC (25 years, 1 month ago) by wrstuden
Branches: wrstuden-devbsize
Diff to: previous 1.5: preferred, colored; next MAIN 1.6: preferred, colored
Changes since revision 1.5: +67 -23 lines
Pull up to last week's -current.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sun Nov 7 00:21:13 1999 UTC (25 years, 3 months ago) by mycroft
Branches: MAIN
CVS tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +54 -5 lines
Changes from msaitoh to fix local/global symbol confusion, and to fix weak
symbol support -- updated by me for elf.h changes.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Thu Nov 4 02:00:18 1999 UTC (25 years, 3 months ago) by erh
Branches: MAIN
CVS tags: comdex-fall-1999-base, comdex-fall-1999
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +1 -7 lines
Remove ELFNAME defines since they are defined in sys/exec_elf.h

Revision 1.8: download - view: text, markup, annotated - select for diffs
Mon Oct 25 13:57:12 1999 UTC (25 years, 3 months ago) by kleink
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +14 -13 lines
Update to match new SVR4-style definition names in <sys/exec_elf.h>.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Fri Oct 22 10:30:08 1999 UTC (25 years, 3 months ago) by hannken
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +6 -0 lines
Undo last change. While these macros are defined in exec_elf.h, they are
enclosed by `#ifdef _KERNEL'.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Thu Oct 21 21:15:04 1999 UTC (25 years, 3 months ago) by erh
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +1 -7 lines
Remove ELFNAME macros which are already defines in exec_elf.h

Revision 1.5: download - view: text, markup, annotated - select for diffs
Fri Aug 6 22:33:49 1999 UTC (25 years, 6 months ago) by thorpej
Branches: MAIN
Branch point for: wrstuden-devbsize
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +40 -26 lines
When allocating the entire address space of an object, map an anonymous
region first (using the data/bss protection) covering it, then overlay
the text and data regions at the appropriate offsets within the region,
and then unmap any gap between the text and data.

The previous method of maping the entire address space with the actual
file object itself is incorrect, as it may extend past the end of the
file if the section alignment is large enough.

This bug was the source of the libposix failure on the SPARC and another
similar failure (with libc!) on the Alpha (failure was accompanied by
a "uvn_io: size check fired" message on the console).

Revision 1.4: download - view: text, markup, annotated - select for diffs
Mon Mar 1 16:40:07 1999 UTC (25 years, 11 months ago) by christos
Branches: MAIN
CVS tags: netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +189 -185 lines
KNF

Revision 1.3: download - view: text, markup, annotated - select for diffs
Fri Feb 20 09:27:20 1998 UTC (26 years, 11 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +4 -4 lines
Fill in missing (default) mmap(2) flags.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Tue Dec 17 03:42:44 1996 UTC (28 years, 1 month ago) by jonathan
Branches: MAIN
CVS tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002, netbsd-1-3-PATCH001, netbsd-1-3-BETA, netbsd-1-3
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +8 -1 lines
Mipsel changes to ELF ldd/ld.so:
  * don't abort() on NetBSD/pmax 1.1 elf binaries;
  * Assume 32-bit elf unless compiling for Alpha;
  * note bugs in ldd's README.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Mon Dec 16 20:38:01 1996 UTC (28 years, 1 month ago) by cgd
Branches: MAIN
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.

Diff request

This form allows you to request diffs 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.

Log view options

CVSweb <webmaster@jp.NetBSD.org>