summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/include/namespace.h4
-rw-r--r--src/lib/libc/stdlib/thread_atexit.c9
2 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h
index 79692af0bc..330af4050a 100644
--- a/src/lib/libc/include/namespace.h
+++ b/src/lib/libc/include/namespace.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: namespace.h,v 1.13 2019/05/13 20:00:32 guenther Exp $ */ 1/* $OpenBSD: namespace.h,v 1.14 2019/06/02 01:03:01 guenther Exp $ */
2 2
3#ifndef _LIBC_NAMESPACE_H_ 3#ifndef _LIBC_NAMESPACE_H_
4#define _LIBC_NAMESPACE_H_ 4#define _LIBC_NAMESPACE_H_
@@ -59,6 +59,8 @@
59#define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \ 59#define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \
60 __attribute__((alias (HIDDEN_STRING(src)))) 60 __attribute__((alias (HIDDEN_STRING(src))))
61 61
62#define __relro __attribute__((section(".data.rel.ro")))
63
62 64
63/* 65/*
64 * gcc and clang will generate calls to the functions below. 66 * gcc and clang will generate calls to the functions below.
diff --git a/src/lib/libc/stdlib/thread_atexit.c b/src/lib/libc/stdlib/thread_atexit.c
index 2e00428eba..ef0423c428 100644
--- a/src/lib/libc/stdlib/thread_atexit.c
+++ b/src/lib/libc/stdlib/thread_atexit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: thread_atexit.c,v 1.1 2017/12/16 20:06:56 guenther Exp $ */ 1/* $OpenBSD: thread_atexit.c,v 1.2 2019/06/02 01:03:01 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org> 3 * Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
4 * 4 *
@@ -16,15 +16,11 @@
16 */ 16 */
17 17
18#include <dlfcn.h> 18#include <dlfcn.h>
19#include <elf.h>
20#pragma weak _DYNAMIC
21#include <stdlib.h> 19#include <stdlib.h>
22#include <tib.h> 20#include <tib.h>
23 21
24#include "atexit.h" 22#include "atexit.h"
25 23
26typeof(dlctl) dlctl asm("_dlctl") __attribute__((weak));
27
28__weak_alias(__cxa_thread_atexit, __cxa_thread_atexit_impl); 24__weak_alias(__cxa_thread_atexit, __cxa_thread_atexit_impl);
29 25
30int 26int
@@ -37,8 +33,7 @@ __cxa_thread_atexit_impl(void (*func)(void *), void *arg, void *dso)
37 if (fnp == NULL) 33 if (fnp == NULL)
38 return -1; 34 return -1;
39 35
40 if (_DYNAMIC) 36 dlctl(NULL, DL_REFERENCE, dso);
41 dlctl(NULL, DL_REFERENCE, dso);
42 37
43 fnp->func = func; 38 fnp->func = func;
44 fnp->arg = arg; 39 fnp->arg = arg;