summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguenther <>2018-01-18 08:23:44 +0000
committerguenther <>2018-01-18 08:23:44 +0000
commiteec7eb4a2bfb71e0831bf36537ae124b4a824286 (patch)
tree0d4e42077f9fb438a8ae55281aacb38a81c34a67
parentacbaebc6cff388f806f67cb2ca1b90564bf1ce82 (diff)
downloadopenbsd-eec7eb4a2bfb71e0831bf36537ae124b4a824286.tar.gz
openbsd-eec7eb4a2bfb71e0831bf36537ae124b4a824286.tar.bz2
openbsd-eec7eb4a2bfb71e0831bf36537ae124b4a824286.zip
Instead of trying to handle ffs() with the normal rename-mark-hidden-and-alias
dance, mark it protected. This works better for both gcc and clang: gcc blocks overriding of internal calls, while clang permits inlining again. ok otto@
-rw-r--r--src/lib/libc/include/namespace.h7
-rw-r--r--src/lib/libc/string/ffs.c3
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h
index 73b845e10f..60766afc0b 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.11 2017/11/29 05:13:57 guenther Exp $ */ 1/* $OpenBSD: namespace.h,v 1.12 2018/01/18 08:23:44 guenther Exp $ */
2 2
3#ifndef _LIBC_NAMESPACE_H_ 3#ifndef _LIBC_NAMESPACE_H_
4#define _LIBC_NAMESPACE_H_ 4#define _LIBC_NAMESPACE_H_
@@ -135,6 +135,8 @@
135 135
136#include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */ 136#include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */
137 137
138#define __dso_protected __attribute__((__visibility__("protected")))
139
138#define HIDDEN(x) _libc_##x 140#define HIDDEN(x) _libc_##x
139#define CANCEL(x) _libc_##x##_cancel 141#define CANCEL(x) _libc_##x##_cancel
140#define WRAP(x) _libc_##x##_wrap 142#define WRAP(x) _libc_##x##_wrap
@@ -148,6 +150,7 @@
148#define PROTO_CANCEL(x) __dso_hidden typeof(x) HIDDEN(x), \ 150#define PROTO_CANCEL(x) __dso_hidden typeof(x) HIDDEN(x), \
149 x asm(CANCEL_STRING(x)) 151 x asm(CANCEL_STRING(x))
150#define PROTO_WRAP(x) PROTO_NORMAL(x), WRAP(x) 152#define PROTO_WRAP(x) PROTO_NORMAL(x), WRAP(x)
153#define PROTO_PROTECTED(x) __dso_protected typeof(x) x
151 154
152#define DEF_STRONG(x) __strong_alias(x, HIDDEN(x)) 155#define DEF_STRONG(x) __strong_alias(x, HIDDEN(x))
153#define DEF_WEAK(x) __weak_alias(x, HIDDEN(x)) 156#define DEF_WEAK(x) __weak_alias(x, HIDDEN(x))
@@ -156,7 +159,7 @@
156#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) 159#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x))
157#ifdef __clang__ 160#ifdef __clang__
158#define DEF_BUILTIN(x) __asm("") 161#define DEF_BUILTIN(x) __asm("")
159#define BUILTIN __attribute__((__visibility__("protected"))) 162#define BUILTIN __dso_protected
160#else 163#else
161#define DEF_BUILTIN(x) DEF_STRONG(x) 164#define DEF_BUILTIN(x) DEF_STRONG(x)
162#define BUILTIN 165#define BUILTIN
diff --git a/src/lib/libc/string/ffs.c b/src/lib/libc/string/ffs.c
index a75fd9d79f..09d6e35eca 100644
--- a/src/lib/libc/string/ffs.c
+++ b/src/lib/libc/string/ffs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ffs.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ 1/* $OpenBSD: ffs.c,v 1.10 2018/01/18 08:23:44 guenther Exp $ */
2 2
3/* 3/*
4 * Public domain. 4 * Public domain.
@@ -38,4 +38,3 @@ ffs(int mask)
38 38
39 return (bit + t[ r & 0xf ]); 39 return (bit + t[ r & 0xf ]);
40} 40}
41DEF_WEAK(ffs);