summaryrefslogtreecommitdiff
path: root/libexec/ld.so
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2017-11-28 17:19:48 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2017-11-28 17:19:48 +0000
commit27ef063800016bb5720e343cd11a5ba52677d51b (patch)
treefe40b3208eae82d56f6e50b08fb434aa85d5d8c9 /libexec/ld.so
parent1ef82f6017b2d0f6cd10d24442a2bafce7fb6e0e (diff)
Implement a DL_REFERENCE dlctl. To be used by the upcoming
__cxa_thread_atexit() implementation. ok guenther@
Diffstat (limited to 'libexec/ld.so')
-rw-r--r--libexec/ld.so/dlfcn.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c
index b51c50aa738..79956925cf2 100644
--- a/libexec/ld.so/dlfcn.c
+++ b/libexec/ld.so/dlfcn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dlfcn.c,v 1.98 2017/08/29 15:25:51 deraadt Exp $ */
+/* $OpenBSD: dlfcn.c,v 1.99 2017/11/28 17:19:47 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -219,6 +219,23 @@ dlctl(void *handle, int command, void *data)
/* made superfluous by kbind */
retval = 0;
break;
+ case DL_REFERENCE:
+ {
+ elf_object_t *obj;
+
+ obj = obj_from_addr(data);
+ if (obj == NULL) {
+ _dl_errno = DL_CANT_FIND_OBJ;
+ retval = -1;
+ break;
+ }
+ if ((obj->status & STAT_NODELETE) == 0) {
+ obj->opencount++;
+ obj->status |= STAT_NODELETE;
+ }
+ retval = 0;
+ break;
+ }
case 0x20:
_dl_show_objects();
retval = 0;