]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r233231:
authorkib <kib@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 3 Apr 2012 08:54:35 +0000 (08:54 +0000)
committerkib <kib@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 3 Apr 2012 08:54:35 +0000 (08:54 +0000)
commit00a579ddf294e9f7b8e248863b9f4032a1494bdf
tree3175b93fc09f00aedcb9d247aeba08b1b340a43d
parentae03e2324a05acabff6497f33f07ce27a6028f05
MFC r233231:
Fix several problems with our ELF filters implementation.

Do not relocate twice an object which happens to be needed by loaded
binary (or dso) and some filtee opened due to symbol resolution when
relocating need objects.  Record the state of the relocation
processing in Obj_Entry and short-circuit relocate_objects() if
current object already processed.

Do not call constructors for filtees loaded during the early
relocation processing before image is initialized enough to run
user-provided code.  Filtees are loaded using dlopen_object(), which
normally performs relocation and initialization.  If filtee is
lazy-loaded during the relocation of dso needed by the main object,
dlopen_object() runs too earlier, when most runtime services are not
yet ready.

Postpone the constructors call to the time when main binary and
depended libraries constructors are run, passing the new flag
RTLD_LO_EARLY to dlopen_object().  Symbol lookups callers inform
symlook_* functions about early stage of initialization with
SYMLOOK_EARLY.  Pass flags through all functions participating in
object relocation.

Use the opportunity and fix flags argument to find_symdef() in
arch-specific reloc.c to use proper name SYMLOOK_IN_PLT instead of
true, which happen to have the same numeric value.

MFC r233777 (by kan):
Do not try to adjust stacks if dlopen_object is called too early.

MFC r233778 (by kan):
Remove extra blank line from revious commit.

MFC note: the ARM and MIPS TLS support is not merged back, so the chunks
from r233231 which fix misuse of flags in calls to find_symdef() in
the corresponding relocation type handlers were not applied. When TLS
support is merged, the rest of r233231 should be applied too.

git-svn-id: svn://svn.freebsd.org/base/stable/9@233831 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
libexec/rtld-elf/amd64/reloc.c
libexec/rtld-elf/arm/reloc.c
libexec/rtld-elf/i386/reloc.c
libexec/rtld-elf/ia64/reloc.c
libexec/rtld-elf/mips/reloc.c
libexec/rtld-elf/powerpc/reloc.c
libexec/rtld-elf/powerpc64/reloc.c
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h
libexec/rtld-elf/sparc64/reloc.c