Treat symlinks better in $ORIGIN determination in ld.so
authorgnezdo <gnezdo@openbsd.org>
Sun, 9 Apr 2023 23:41:47 +0000 (23:41 +0000)
committergnezdo <gnezdo@openbsd.org>
Sun, 9 Apr 2023 23:41:47 +0000 (23:41 +0000)
commitc51b9268131b736ab94c905e9e2a4e29feea412b
tree90de2ed2924eda333fc2249d9c2eb8bf3d6386f1
parentfcf1774824c54da91f0bcc86ea07983a1f305fe8
Treat symlinks better in $ORIGIN determination in ld.so

Now symlinking an executable away from the rest of its installation
tree no longer prevents it from finding the libraries. This matches
the behavior of other OS linkers. Prompted by a behavior change in
lang/ghc test suite.

Swapped the order of dirname/realpath in _dl_origin_path.

Added some regress tests that pass and then bin3 that fails without
this change and reflects the behavior needd for lang/ghc.

Suggestion by semarie@, OK deraadt@
libexec/ld.so/resolve.c
regress/libexec/ld.so/subst/Makefile
regress/libexec/ld.so/subst/prog2/Makefile [new file with mode: 0644]
regress/libexec/ld.so/subst/prog2/main.c [new file with mode: 0644]