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