From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id F40EB3857C48 for ; Fri, 14 May 2021 07:12:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F40EB3857C48 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mliska@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 985A7AF8A; Fri, 14 May 2021 07:12:20 +0000 (UTC) Subject: Re: [pushed] libsanitizer, Darwin : Handle missing __builtin_os_log_format. To: Iain Sandoe , GCC Patches Cc: Dominique d'Humieres References: From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <1562141d-1aee-ad50-f942-c68ff04dd225@suse.cz> Date: Fri, 14 May 2021 09:12:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 07:12:23 -0000 On 5/13/21 10:26 PM, Iain Sandoe wrote: > Hi, > > The update to libsanitizer broke bootstrap on Darwin, since the upstream > sources assume building with clang on Darwin and make use of a header > depending on a builtin that GCC does not currently implement. Hello. Thank you for the fix. Btw. is it something that can be suggested to upstream? Martin > > This patch fixes the build. Whether to implement the missing builtin is > something to consider another day, > > bootstrapped on Darwin16 and smoke-tested the sanitizer, > pushed to master, > thanks > Iain > > I pushed also r12-781-g1f6fc2826d19136bb5ab97a4bdac07e6736b6869 which > adds this patch to libsanitizer LOCAL_PATCHES. > > ===== > > > GCC does not, currently, define __builtin_os_log_format, which > is needed by os/log.h. Do not include that header unless the > builtin is defined (since the header errors out on the same > condition). Provide a work-around solution to the missing API > provided via the header. > > libsanitizer/ChangeLog: > > * sanitizer_common/sanitizer_mac.cpp : Check for the > availability of __builtin_os_log_format before trying to > include a header depending on it. > (OS_LOG_DEFAULT): New. > (os_log_error): Define to a fall-back using an older API. > --- > libsanitizer/sanitizer_common/sanitizer_mac.cpp | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.cpp b/libsanitizer/sanitizer_common/sanitizer_mac.cpp > index f455856c85d..30a94fcba14 100644 > --- a/libsanitizer/sanitizer_common/sanitizer_mac.cpp > +++ b/libsanitizer/sanitizer_common/sanitizer_mac.cpp > @@ -70,7 +70,15 @@ extern "C" { > #include > #include > #include > -#include > +#if defined(__has_builtin) && __has_builtin(__builtin_os_log_format) > +# include > +#else > + /* Without support for __builtin_os_log_format, fall back to the older > + method. */ > +# define OS_LOG_DEFAULT 0 > +# define os_log_error(A,B,C) \ > + asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", (C)); > +#endif > #include > #include > #include >