1 |
commit: 0f15bd25eb23bb57e02245731be071fbc05643b6 |
2 |
Author: Matthias Maier <tamiko <AT> 43-1 <DOT> org> |
3 |
AuthorDate: Sat May 6 18:37:59 2017 +0000 |
4 |
Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
5 |
CommitDate: Sat May 6 18:38:32 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=0f15bd25 |
7 |
|
8 |
sys-libs/compiler-rt-sanitizers: initial commit |
9 |
|
10 |
- take over sys-libs/compiler-rt-sanitizers::gentoo |
11 |
- apply modified musl patchset |
12 |
|
13 |
Package-Manager: Portage-2.3.5, Repoman-2.3.2 |
14 |
Manifest-Sign-Key: B5A4E06FBD3A97A3 |
15 |
|
16 |
sys-libs/compiler-rt-sanitizers/Manifest | 25 ++ |
17 |
.../compiler-rt-sanitizers-4.0.0.ebuild | 131 ++++++++ |
18 |
...compiler-rt-sanitizers-4.0.0-musl-patches.patch | 344 +++++++++++++++++++++ |
19 |
sys-libs/compiler-rt-sanitizers/metadata.xml | 7 + |
20 |
4 files changed, 507 insertions(+) |
21 |
|
22 |
diff --git a/sys-libs/compiler-rt-sanitizers/Manifest b/sys-libs/compiler-rt-sanitizers/Manifest |
23 |
new file mode 100644 |
24 |
index 0000000..fbdbf94 |
25 |
--- /dev/null |
26 |
+++ b/sys-libs/compiler-rt-sanitizers/Manifest |
27 |
@@ -0,0 +1,25 @@ |
28 |
+-----BEGIN PGP SIGNED MESSAGE----- |
29 |
+Hash: SHA256 |
30 |
+ |
31 |
+AUX compiler-rt-sanitizers-4.0.0-musl-patches.patch 13666 SHA256 2c9db57b5cc466e898532e3ba2baee080e3997517b3fd96d9ab4c0350a28fda1 SHA512 9f2aec9e55f274267ffc1c5fc4fc3fdd9c5b901582048b7770d06a7b2be81b15ae6bc31d7b81c66b3e341898e586f1db0aaf12f17be696c651c03d5c520ee223 WHIRLPOOL 55953017aca6d0ebe167d9eaa4937f2e0fe4b45f7d3c577902c2c7d920752dcf17300fc47192bf2875b83f2ed537c728e46df3f1204fedd61fdca127b62091b8 |
32 |
+DIST compiler-rt-4.0.0.src.tar.xz 1435104 SHA256 d3f25b23bef24c305137e6b44f7e81c51bbec764c119e01512a9bd2330be3115 SHA512 ed52436a2399ca82c1af46a523e89e88c23367f74cd110f0267af49a72aa4912ae8f48c6093e6b01c9ea68c48354a12201d26baf721d254fb017ddb98af2e3dd WHIRLPOOL ea5d6fbb34809067825306b1158979946c43c8aec458d946f8c853f3c0e0cd72a6c92a8e4ad8d1b35e10f9bd079a73dd26fde368f919937ad413bdfd83ab4018 |
33 |
+DIST llvm-4.0.0.src.tar.xz 21016340 SHA256 8d10511df96e73b8ff9e7abbfb4d4d432edbdbe965f1f4f07afaf370b8a533be SHA512 cf681f0626ef6d568d951cdc3e143471a1d7715a0ba11e52aa273cf5d8d421e1357ef2645cc85879eaefcd577e99e74d07b01566825b3d0461171ef2cbfc7704 WHIRLPOOL 9783e8f47306c1deb2e114d4b46a7db9b0260b4965076345c88765413c5fc8e73fab5f88ae4903adbdea31406022948b16d32ae47d98f5def074509d5d794579 |
34 |
+EBUILD compiler-rt-sanitizers-4.0.0.ebuild 3768 SHA256 038bdc72960f1fc571340ef966c65a4dd6ac6b4690744c50a72b16fb41c01b04 SHA512 26ccb79c169d8ac081c7044e03e285999c8542006145625400f4f473329680707f7e8809cf57553e6f53ea245a2c6f946e334510790f45d03fd566c62f2ec942 WHIRLPOOL d1898652fdbc53ae72e92b3f899f2aa87d2fb8a9e89e2a8aae18bed303c66fc84db7aaacd0376a279b04d6309905708c65d0f7f04ed19792922b9aba1ad6a2fe |
35 |
+MISC metadata.xml 216 SHA256 e94ba81dd2791908508a3993afdebf723cc617314c53c273b9bcca15a9c48327 SHA512 3485598147c953e72e1785693a489a7e7d73d59620b76054db9c0ce95d8bfa0e8ffec29da7f7a9d73a32e5b77eac07ca3306c56a972dc57fd89d477edaebf3d5 WHIRLPOOL 29145f5721e079e0548c5ef22424c65e6a5b2bfc4428918e923fcfdfc37e9b8749fb63e3c2eb5773c17fab276f7513dd66e326b906f1848911dceba7ae4b419a |
36 |
+-----BEGIN PGP SIGNATURE----- |
37 |
+Version: GnuPG v2 |
38 |
+ |
39 |
+iQIzBAEBCAAdFiEE6t/5JjgpnbiQKMUluE7NiUruef8FAlkOF/0ACgkQuE7NiUru |
40 |
+ef/HuQ/+K1AoGBHa8yRpXfv/Ql4+SGp1ehCU+9TBNRS6jfoZEMaZFF+4JRPzXsVE |
41 |
+kZ2xYggoiC8ws9ps/2B+DN3FFQZdCzBeN6fJJk4XtwdMv/05i2AlYKNLShK8rCK0 |
42 |
+VrSOh1qp55fPVND7SN+F9OYomH2LQtgYjLA3qJM+qoC9MdwsSNvMwKOhoicI0FDP |
43 |
+UxoYnjs7A8nmP2ExElfv0XRJkvmr/qZ2OdeASRHvuS1LsNBc87U0DbiitglQVFLy |
44 |
+zFwKwigtKVUCqy/toH+gKiSjfLsHBGG3+0y8RtRMYV0ZYq4fT0uHGCr2ecraw2D9 |
45 |
+i9QdQ4/8ys43tgjscfH+b517/8dlhwOyNRJ6LPO8AzxuGH+mj7rbwYQjm2SIwMMW |
46 |
+Ktir8oyo8pmXLD2jUq6PxvfQJYKmo7zA6K2N3H/MSyBnlfKrNVmCxspgIsUZi4z5 |
47 |
+42ZvNL4M/np4D9bgvGvnd/rxQYMCY14PCB0kBRGp+9unVIxKizHHXmPUhAFPGFPv |
48 |
++0KwxEFt81pOrW8WSgVZxIWzSGdhdsvGdZuXB3+Qi7d1DjeAW+J68m9Z22ayfOzl |
49 |
+HLWyGvLwzaLJq7dsVrWP/JACKtFiirx3cN+BgMnEcuOyaZPKTtRwxDwoYsrJVAyA |
50 |
+0UfVZ/fpDSQY7Q+oytsLM1wHyLZbZ2HQM3j2vmBqegZnE0qXplE= |
51 |
+=4lL+ |
52 |
+-----END PGP SIGNATURE----- |
53 |
|
54 |
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-4.0.0.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-4.0.0.ebuild |
55 |
new file mode 100644 |
56 |
index 0000000..4057b35 |
57 |
--- /dev/null |
58 |
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-4.0.0.ebuild |
59 |
@@ -0,0 +1,131 @@ |
60 |
+# Copyright 1999-2017 Gentoo Foundation |
61 |
+# Distributed under the terms of the GNU General Public License v2 |
62 |
+ |
63 |
+EAPI=6 |
64 |
+ |
65 |
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja} |
66 |
+# (needed due to CMAKE_BUILD_TYPE != Gentoo) |
67 |
+CMAKE_MIN_VERSION=3.7.0-r1 |
68 |
+PYTHON_COMPAT=( python2_7 ) |
69 |
+ |
70 |
+inherit check-reqs cmake-utils flag-o-matic llvm python-any-r1 versionator |
71 |
+ |
72 |
+DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)" |
73 |
+HOMEPAGE="http://llvm.org/" |
74 |
+SRC_URI="http://releases.llvm.org/${PV/_//}/compiler-rt-${PV/_/}.src.tar.xz |
75 |
+ test? ( http://releases.llvm.org/${PV/_//}/llvm-${PV/_/}.src.tar.xz )" |
76 |
+ |
77 |
+LICENSE="|| ( UoI-NCSA MIT )" |
78 |
+SLOT="${PV%_*}" |
79 |
+KEYWORDS="~amd64 ~arm64 ~x86" |
80 |
+IUSE="test" |
81 |
+ |
82 |
+LLVM_SLOT=${SLOT%%.*} |
83 |
+RDEPEND="!=sys-libs/compiler-rt-sanitizers-${SLOT}*:0" |
84 |
+# llvm-4 needed for --cmakedir |
85 |
+DEPEND=" |
86 |
+ >=sys-devel/llvm-4 |
87 |
+ test? ( |
88 |
+ app-portage/unsandbox |
89 |
+ $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]") |
90 |
+ =sys-devel/clang-${PV%_*}*:${LLVM_SLOT} |
91 |
+ sys-libs/compiler-rt:${SLOT} ) |
92 |
+ ${PYTHON_DEPS}" |
93 |
+ |
94 |
+S=${WORKDIR}/compiler-rt-${PV/_/}.src |
95 |
+ |
96 |
+PATCHES=( |
97 |
+ "${FILESDIR}"/${PN}-4.0.0-musl-patches.patch |
98 |
+) |
99 |
+ |
100 |
+# least intrusive of all |
101 |
+CMAKE_BUILD_TYPE=RelWithDebInfo |
102 |
+ |
103 |
+check_space() { |
104 |
+ if use test; then |
105 |
+ local CHECKREQS_DISK_BUILD=11G |
106 |
+ check-reqs_pkg_pretend |
107 |
+ fi |
108 |
+} |
109 |
+ |
110 |
+pkg_pretend() { |
111 |
+ check_space |
112 |
+} |
113 |
+ |
114 |
+pkg_setup() { |
115 |
+ check_space |
116 |
+ llvm_pkg_setup |
117 |
+ python-any-r1_pkg_setup |
118 |
+} |
119 |
+ |
120 |
+src_unpack() { |
121 |
+ default |
122 |
+ |
123 |
+ if use test; then |
124 |
+ mv llvm-* llvm || die |
125 |
+ fi |
126 |
+} |
127 |
+ |
128 |
+src_configure() { |
129 |
+ # pre-set since we need to pass it to cmake |
130 |
+ BUILD_DIR=${WORKDIR}/${P}_build |
131 |
+ |
132 |
+ local mycmakeargs=( |
133 |
+ -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}" |
134 |
+ # use a build dir structure consistent with install |
135 |
+ # this makes it possible to easily deploy test-friendly clang |
136 |
+ -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}" |
137 |
+ |
138 |
+ -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) |
139 |
+ # built-ins installed by sys-libs/compiler-rt |
140 |
+ -DCOMPILER_RT_BUILD_BUILTINS=OFF |
141 |
+ -DCOMPILER_RT_BUILD_SANITIZERS=ON |
142 |
+ -DCOMPILER_RT_BUILD_XRAY=ON |
143 |
+ ) |
144 |
+ if use test; then |
145 |
+ mycmakeargs+=( |
146 |
+ -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" |
147 |
+ -DLIT_COMMAND="${EPREFIX}/usr/bin/unsandbox;${EPREFIX}/usr/bin/lit" |
148 |
+ |
149 |
+ # they are created during src_test() |
150 |
+ -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang" |
151 |
+ -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang++" |
152 |
+ ) |
153 |
+ |
154 |
+ # same flags are passed for build & tests, so we need to strip |
155 |
+ # them down to a subset supported by clang |
156 |
+ CC=${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang \ |
157 |
+ CXX=${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang++ \ |
158 |
+ strip-unsupported-flags |
159 |
+ fi |
160 |
+ |
161 |
+ cmake-utils_src_configure |
162 |
+ |
163 |
+ if use test; then |
164 |
+ local sys_dir=( "${EPREFIX}"/usr/lib/clang/${SLOT}/lib/* ) |
165 |
+ [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}" |
166 |
+ [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}" |
167 |
+ |
168 |
+ # copy clang over since resource_dir is located relatively to binary |
169 |
+ # therefore, we can put our new libraries in it |
170 |
+ mkdir -p "${BUILD_DIR}"/lib/{llvm/${LLVM_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die |
171 |
+ cp "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/bin/clang{,++} \ |
172 |
+ "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/bin/ || die |
173 |
+ cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \ |
174 |
+ "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die |
175 |
+ cp "${sys_dir}"/*builtins*.a \ |
176 |
+ "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die |
177 |
+ # we also need LLVMgold.so for gold-based tests |
178 |
+ if [[ -f ${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so ]]; then |
179 |
+ ln -s "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so \ |
180 |
+ "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/$(get_libdir)/ || die |
181 |
+ fi |
182 |
+ fi |
183 |
+} |
184 |
+ |
185 |
+src_test() { |
186 |
+ # respect TMPDIR! |
187 |
+ local -x LIT_PRESERVES_TMP=1 |
188 |
+ |
189 |
+ cmake-utils_src_make check-all |
190 |
+} |
191 |
|
192 |
diff --git a/sys-libs/compiler-rt-sanitizers/files/compiler-rt-sanitizers-4.0.0-musl-patches.patch b/sys-libs/compiler-rt-sanitizers/files/compiler-rt-sanitizers-4.0.0-musl-patches.patch |
193 |
new file mode 100644 |
194 |
index 0000000..7e543f6 |
195 |
--- /dev/null |
196 |
+++ b/sys-libs/compiler-rt-sanitizers/files/compiler-rt-sanitizers-4.0.0-musl-patches.patch |
197 |
@@ -0,0 +1,344 @@ |
198 |
+From 50aa0d694e2fa53b8671e093c42147458ed4e692 Mon Sep 17 00:00:00 2001 |
199 |
+From: Matthias Maier <tamiko@××××.org> |
200 |
+Date: Fri, 5 May 2017 17:47:39 +0000 |
201 |
+Subject: [PATCH] Musl patches |
202 |
+ |
203 |
+Ported to compiler-rt-sanitizers-4.0.0. Taken from |
204 |
+ |
205 |
+ https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch |
206 |
+--- |
207 |
+ lib/asan/asan_linux.cc | 4 +-- |
208 |
+ lib/interception/interception_linux.cc | 2 +- |
209 |
+ lib/msan/msan_linux.cc | 2 +- |
210 |
+ .../sanitizer_common_interceptors_ioctl.inc | 4 +-- |
211 |
+ lib/sanitizer_common/sanitizer_common_syscalls.inc | 2 +- |
212 |
+ lib/sanitizer_common/sanitizer_linux_libcdep.cc | 12 +++---- |
213 |
+ lib/sanitizer_common/sanitizer_platform.h | 7 ++++ |
214 |
+ .../sanitizer_platform_interceptors.h | 2 +- |
215 |
+ .../sanitizer_platform_limits_posix.cc | 37 ++++++++++++---------- |
216 |
+ lib/tsan/rtl/tsan_platform_linux.cc | 2 +- |
217 |
+ 10 files changed, 43 insertions(+), 31 deletions(-) |
218 |
+ |
219 |
+diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc |
220 |
+index c051573..e295f60 100644 |
221 |
+--- a/lib/asan/asan_linux.cc |
222 |
++++ b/lib/asan/asan_linux.cc |
223 |
+@@ -39,7 +39,7 @@ |
224 |
+ #include <sys/link_elf.h> |
225 |
+ #endif |
226 |
+ |
227 |
+-#if SANITIZER_ANDROID || SANITIZER_FREEBSD |
228 |
++#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_NONGNU |
229 |
+ #include <ucontext.h> |
230 |
+ extern "C" void* _DYNAMIC; |
231 |
+ #else |
232 |
+@@ -80,7 +80,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) { |
233 |
+ UNIMPLEMENTED(); |
234 |
+ } |
235 |
+ |
236 |
+-#if SANITIZER_ANDROID |
237 |
++#if SANITIZER_ANDROID || SANITIZER_NONGNU |
238 |
+ // FIXME: should we do anything for Android? |
239 |
+ void AsanCheckDynamicRTPrereqs() {} |
240 |
+ void AsanCheckIncompatibleRT() {} |
241 |
+diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc |
242 |
+index 6e908ac..76c1688 100644 |
243 |
+--- a/lib/interception/interception_linux.cc |
244 |
++++ b/lib/interception/interception_linux.cc |
245 |
+@@ -24,7 +24,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, |
246 |
+ return real == wrapper; |
247 |
+ } |
248 |
+ |
249 |
+-#if !defined(__ANDROID__) // android does not have dlvsym |
250 |
++#if !defined(__ANDROID__) && defined(__GLIBC__) // android does not have dlvsym |
251 |
+ void *GetFuncAddrVer(const char *func_name, const char *ver) { |
252 |
+ return dlvsym(RTLD_NEXT, func_name, ver); |
253 |
+ } |
254 |
+diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc |
255 |
+index 0a687f6..0852d97 100644 |
256 |
+--- a/lib/msan/msan_linux.cc |
257 |
++++ b/lib/msan/msan_linux.cc |
258 |
+@@ -13,7 +13,7 @@ |
259 |
+ //===----------------------------------------------------------------------===// |
260 |
+ |
261 |
+ #include "sanitizer_common/sanitizer_platform.h" |
262 |
+-#if SANITIZER_FREEBSD || SANITIZER_LINUX |
263 |
++#if SANITIZER_FREEBSD || SANITIZER_LINUX && !SANITIZER_NONGNU |
264 |
+ |
265 |
+ #include "msan.h" |
266 |
+ #include "msan_thread.h" |
267 |
+diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc |
268 |
+index 4ed9afe..64f584e 100644 |
269 |
+--- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc |
270 |
++++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc |
271 |
+@@ -100,7 +100,7 @@ static void ioctl_table_fill() { |
272 |
+ _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz); |
273 |
+ #endif |
274 |
+ |
275 |
+-#if SANITIZER_LINUX |
276 |
++#if SANITIZER_LINUX && !SANITIZER_NONGNU |
277 |
+ // Conflicting request ids. |
278 |
+ // _(CDROMAUDIOBUFSIZ, NONE, 0); |
279 |
+ // _(SNDCTL_TMR_CONTINUE, NONE, 0); |
280 |
+@@ -361,7 +361,7 @@ static void ioctl_table_fill() { |
281 |
+ _(VT_WAITACTIVE, NONE, 0); |
282 |
+ #endif |
283 |
+ |
284 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
285 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
286 |
+ // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE |
287 |
+ _(CYGETDEFTHRESH, WRITE, sizeof(int)); |
288 |
+ _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); |
289 |
+diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc |
290 |
+index 469c8eb..24f8786 100644 |
291 |
+--- a/lib/sanitizer_common/sanitizer_common_syscalls.inc |
292 |
++++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc |
293 |
+@@ -2038,7 +2038,7 @@ POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) { |
294 |
+ } |
295 |
+ } |
296 |
+ |
297 |
+-#if !SANITIZER_ANDROID |
298 |
++#if !SANITIZER_ANDROID && !SANITIZER_NONGNU |
299 |
+ PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim, |
300 |
+ void *old_rlim) { |
301 |
+ if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz); |
302 |
+diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc |
303 |
+index f99f0b5..3a773a9 100644 |
304 |
+--- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc |
305 |
++++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc |
306 |
+@@ -152,7 +152,7 @@ bool SanitizerGetThreadName(char *name, int max_len) { |
307 |
+ #endif |
308 |
+ } |
309 |
+ |
310 |
+-#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO |
311 |
++#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU |
312 |
+ static uptr g_tls_size; |
313 |
+ |
314 |
+ #ifdef __i386__ |
315 |
+@@ -180,11 +180,11 @@ void InitTlsSize() { |
316 |
+ } |
317 |
+ #else |
318 |
+ void InitTlsSize() { } |
319 |
+-#endif // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO |
320 |
++#endif // !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && !SANITIZER_NONGNU |
321 |
+ |
322 |
+ #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \ |
323 |
+ || defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__)) \ |
324 |
+- && SANITIZER_LINUX && !SANITIZER_ANDROID |
325 |
++ && SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
326 |
+ // sizeof(struct pthread) from glibc. |
327 |
+ static atomic_uintptr_t kThreadDescriptorSize; |
328 |
+ |
329 |
+@@ -338,7 +338,7 @@ uptr ThreadSelf() { |
330 |
+ |
331 |
+ #if !SANITIZER_GO |
332 |
+ static void GetTls(uptr *addr, uptr *size) { |
333 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
334 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
335 |
+ # if defined(__x86_64__) || defined(__i386__) || defined(__s390__) |
336 |
+ *addr = ThreadSelf(); |
337 |
+ *size = GetTlsSize(); |
338 |
+@@ -364,7 +364,7 @@ static void GetTls(uptr *addr, uptr *size) { |
339 |
+ *addr = (uptr) dtv[2]; |
340 |
+ *size = (*addr == 0) ? 0 : ((uptr) segbase[0] - (uptr) dtv[2]); |
341 |
+ } |
342 |
+-#elif SANITIZER_ANDROID |
343 |
++#elif SANITIZER_ANDROID || SANITIZER_NONGNU |
344 |
+ *addr = 0; |
345 |
+ *size = 0; |
346 |
+ #else |
347 |
+@@ -375,7 +375,7 @@ static void GetTls(uptr *addr, uptr *size) { |
348 |
+ |
349 |
+ #if !SANITIZER_GO |
350 |
+ uptr GetTlsSize() { |
351 |
+-#if SANITIZER_FREEBSD || SANITIZER_ANDROID |
352 |
++#if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NONGNU |
353 |
+ uptr addr, size; |
354 |
+ GetTls(&addr, &size); |
355 |
+ return size; |
356 |
+diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h |
357 |
+index d9a8e8d..fe01c57 100644 |
358 |
+--- a/lib/sanitizer_common/sanitizer_platform.h |
359 |
++++ b/lib/sanitizer_common/sanitizer_platform.h |
360 |
+@@ -162,6 +162,13 @@ |
361 |
+ # define SANITIZER_PPC64V2 0 |
362 |
+ #endif |
363 |
+ |
364 |
++ |
365 |
++#if defined(__linux__) && !defined(__GLIBC__) |
366 |
++# define SANITIZER_NONGNU 1 |
367 |
++#else |
368 |
++# define SANITIZER_NONGNU 0 |
369 |
++#endif |
370 |
++ |
371 |
+ // By default we allow to use SizeClassAllocator64 on 64-bit platform. |
372 |
+ // But in some cases (e.g. AArch64's 39-bit address space) SizeClassAllocator64 |
373 |
+ // does not work well and we need to fallback to SizeClassAllocator32. |
374 |
+diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h |
375 |
+index 62875d1..212e6e8 100644 |
376 |
+--- a/lib/sanitizer_common/sanitizer_platform_interceptors.h |
377 |
++++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h |
378 |
+@@ -23,7 +23,7 @@ |
379 |
+ # define SI_NOT_WINDOWS 0 |
380 |
+ #endif |
381 |
+ |
382 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
383 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
384 |
+ # define SI_LINUX_NOT_ANDROID 1 |
385 |
+ #else |
386 |
+ # define SI_LINUX_NOT_ANDROID 0 |
387 |
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc |
388 |
+index 683f019..245f856 100644 |
389 |
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc |
390 |
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc |
391 |
+@@ -139,12 +139,14 @@ typedef struct user_fpregs elf_fpregset_t; |
392 |
+ |
393 |
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID |
394 |
+ #include <glob.h> |
395 |
+-#include <obstack.h> |
396 |
++# if !SANITIZER_NONGNU |
397 |
++# include <obstack.h> |
398 |
++# endif |
399 |
+ #include <mqueue.h> |
400 |
+-#include <net/if_ppp.h> |
401 |
+-#include <netax25/ax25.h> |
402 |
+-#include <netipx/ipx.h> |
403 |
+-#include <netrom/netrom.h> |
404 |
++#include <linux/if_ppp.h> |
405 |
++#include <linux/ax25.h> |
406 |
++#include <linux/ipx.h> |
407 |
++#include <linux/netrom.h> |
408 |
+ #if HAVE_RPC_XDR_H |
409 |
+ # include <rpc/xdr.h> |
410 |
+ #elif HAVE_TIRPC_RPC_XDR_H |
411 |
+@@ -160,7 +162,8 @@ typedef struct user_fpregs elf_fpregset_t; |
412 |
+ # include <sys/procfs.h> |
413 |
+ #endif |
414 |
+ #include <sys/user.h> |
415 |
+-#include <sys/ustat.h> |
416 |
++// #include <sys/ustat.h> |
417 |
++#include <sys/statfs.h> |
418 |
+ #include <linux/cyclades.h> |
419 |
+ #include <linux/if_eql.h> |
420 |
+ #include <linux/if_plip.h> |
421 |
+@@ -252,7 +255,7 @@ namespace __sanitizer { |
422 |
+ unsigned struct_itimerspec_sz = sizeof(struct itimerspec); |
423 |
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD |
424 |
+ |
425 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
426 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
427 |
+ unsigned struct_ustat_sz = sizeof(struct ustat); |
428 |
+ unsigned struct_rlimit64_sz = sizeof(struct rlimit64); |
429 |
+ unsigned struct_statvfs64_sz = sizeof(struct statvfs64); |
430 |
+@@ -310,7 +313,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr)); |
431 |
+ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); |
432 |
+ #endif |
433 |
+ |
434 |
+-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID |
435 |
++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
436 |
+ int glob_nomatch = GLOB_NOMATCH; |
437 |
+ int glob_altdirfunc = GLOB_ALTDIRFUNC; |
438 |
+ #endif |
439 |
+@@ -404,7 +407,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); |
440 |
+ unsigned struct_termios_sz = sizeof(struct termios); |
441 |
+ unsigned struct_winsize_sz = sizeof(struct winsize); |
442 |
+ |
443 |
+-#if SANITIZER_LINUX |
444 |
++#if SANITIZER_LINUX && !SANITIZER_NONGNU |
445 |
+ unsigned struct_arpreq_sz = sizeof(struct arpreq); |
446 |
+ unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf); |
447 |
+ unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession); |
448 |
+@@ -454,7 +457,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); |
449 |
+ unsigned struct_vt_mode_sz = sizeof(struct vt_mode); |
450 |
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD |
451 |
+ |
452 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
453 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
454 |
+ unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); |
455 |
+ unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); |
456 |
+ #if EV_VERSION > (0x010000) |
457 |
+@@ -822,7 +825,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); |
458 |
+ unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE; |
459 |
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD |
460 |
+ |
461 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
462 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
463 |
+ unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; |
464 |
+ unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; |
465 |
+ unsigned IOCTL_CYGETMON = CYGETMON; |
466 |
+@@ -985,7 +988,7 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr); |
467 |
+ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum); |
468 |
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD |
469 |
+ |
470 |
+-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID |
471 |
++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
472 |
+ CHECK_TYPE_SIZE(glob_t); |
473 |
+ CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc); |
474 |
+ CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv); |
475 |
+@@ -1019,6 +1022,7 @@ CHECK_TYPE_SIZE(iovec); |
476 |
+ CHECK_SIZE_AND_OFFSET(iovec, iov_base); |
477 |
+ CHECK_SIZE_AND_OFFSET(iovec, iov_len); |
478 |
+ |
479 |
++#if !SANITIZER_NONGNU |
480 |
+ CHECK_TYPE_SIZE(msghdr); |
481 |
+ CHECK_SIZE_AND_OFFSET(msghdr, msg_name); |
482 |
+ CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen); |
483 |
+@@ -1032,6 +1036,7 @@ CHECK_TYPE_SIZE(cmsghdr); |
484 |
+ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len); |
485 |
+ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level); |
486 |
+ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); |
487 |
++#endif |
488 |
+ |
489 |
+ COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent)); |
490 |
+ CHECK_SIZE_AND_OFFSET(dirent, d_ino); |
491 |
+@@ -1134,7 +1139,7 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno); |
492 |
+ |
493 |
+ CHECK_TYPE_SIZE(ether_addr); |
494 |
+ |
495 |
+-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID |
496 |
++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
497 |
+ CHECK_TYPE_SIZE(ipc_perm); |
498 |
+ # if SANITIZER_FREEBSD |
499 |
+ CHECK_SIZE_AND_OFFSET(ipc_perm, key); |
500 |
+@@ -1195,7 +1200,7 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr); |
501 |
+ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data); |
502 |
+ #endif |
503 |
+ |
504 |
+-#if SANITIZER_LINUX |
505 |
++#if SANITIZER_LINUX && !SANITIZER_NONGNU |
506 |
+ COMPILER_CHECK(sizeof(__sanitizer_mallinfo) == sizeof(struct mallinfo)); |
507 |
+ #endif |
508 |
+ |
509 |
+@@ -1245,7 +1250,7 @@ COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE); |
510 |
+ COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE); |
511 |
+ #endif |
512 |
+ |
513 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
514 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
515 |
+ COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE)); |
516 |
+ CHECK_SIZE_AND_OFFSET(FILE, _flags); |
517 |
+ CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr); |
518 |
+@@ -1264,7 +1269,7 @@ CHECK_SIZE_AND_OFFSET(FILE, _chain); |
519 |
+ CHECK_SIZE_AND_OFFSET(FILE, _fileno); |
520 |
+ #endif |
521 |
+ |
522 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
523 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
524 |
+ COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk)); |
525 |
+ CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit); |
526 |
+ CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev); |
527 |
+diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc |
528 |
+index 3313288..103c7b6 100644 |
529 |
+--- a/lib/tsan/rtl/tsan_platform_linux.cc |
530 |
++++ b/lib/tsan/rtl/tsan_platform_linux.cc |
531 |
+@@ -287,7 +287,7 @@ void InitializePlatform() { |
532 |
+ // This is required to properly "close" the fds, because we do not see internal |
533 |
+ // closes within glibc. The code is a pure hack. |
534 |
+ int ExtractResolvFDs(void *state, int *fds, int nfd) { |
535 |
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID |
536 |
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU |
537 |
+ int cnt = 0; |
538 |
+ __res_state *statp = (__res_state*)state; |
539 |
+ for (int i = 0; i < MAXNS && cnt < nfd; i++) { |
540 |
+-- |
541 |
+2.12.2 |
542 |
|
543 |
diff --git a/sys-libs/compiler-rt-sanitizers/metadata.xml b/sys-libs/compiler-rt-sanitizers/metadata.xml |
544 |
new file mode 100644 |
545 |
index 0000000..89c4bdb |
546 |
--- /dev/null |
547 |
+++ b/sys-libs/compiler-rt-sanitizers/metadata.xml |
548 |
@@ -0,0 +1,7 @@ |
549 |
+<?xml version="1.0" encoding="UTF-8"?> |
550 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
551 |
+<pkgmetadata> |
552 |
+ <maintainer type="project"> |
553 |
+ <email>llvm@g.o</email> |
554 |
+ </maintainer> |
555 |
+</pkgmetadata> |