diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-06-14 21:30:51 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-06-14 21:30:51 +0000 |
commit | 7756b97839a65c4c4a1eb682517e17cd5e75570a (patch) | |
tree | 2bbf028e48c742566a5ccf87d52738eaf91ae97c /libexec | |
parent | 26dfcf665c8702591d32420057e4dfa42b3b0678 (diff) |
Add support for DF_1_NOOPEN. Based on an origional diff from matthew@.
ok matthew@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/resolve.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/libexec/ld.so/resolve.c b/libexec/ld.so/resolve.c index 58fcdc0bc98..26c26ccf24d 100644 --- a/libexec/ld.so/resolve.c +++ b/libexec/ld.so/resolve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.c,v 1.57 2011/11/28 20:59:03 guenther Exp $ */ +/* $OpenBSD: resolve.c,v 1.58 2012/06/14 21:30:50 kettenis Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -107,6 +107,24 @@ _dl_finalize_object(const char *objname, Elf_Dyn *dynp, Elf_Phdr *phdrp, dynp++; } DL_DEB((" flags %s = 0x%x\n", objname, object->obj_flags )); + object->obj_type = objtype; + + if (_dl_loading_object == NULL) { + /* + * no loading object, object is the loading object, + * as it is either executable, or dlopened() + */ + _dl_loading_object = object; + DL_DEB(("head %s\n", object->load_name)); + } + + if ((object->obj_flags & DF_1_NOOPEN) != 0 && + _dl_loading_object->obj_type == OBJTYPE_DLO && + _dl_traceld == NULL) { + _dl_free(object); + _dl_errno = DL_CANT_LOAD_OBJ; + return(NULL); + } /* * Now relocate all pointer to dynamic info, but only @@ -146,20 +164,10 @@ _dl_finalize_object(const char *objname, Elf_Dyn *dynp, Elf_Phdr *phdrp, object->phdrp = phdrp; object->phdrc = phdrc; - object->obj_type = objtype; object->load_base = lbase; object->obj_base = obase; object->load_name = _dl_strdup(objname); - if (_dl_loading_object == NULL) { - /* - * no loading object, object is the loading object, - * as it is either executable, or dlopened() - */ - _dl_loading_object = object->load_object = object; - DL_DEB(("head %s\n", object->load_name )); - } else { - object->load_object = _dl_loading_object; - } + object->load_object = _dl_loading_object; DL_DEB(("obj %s has %s as head\n", object->load_name, _dl_loading_object->load_name )); object->refcount = 0; |