From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id DCD093858412 for ; Mon, 27 Nov 2023 13:08:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCD093858412 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DCD093858412 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701090508; cv=none; b=o9oD2q3flxd8zZ+bF88A9sWfCC+GsP1nUcMeIROzMLQPTJEEii2TDEzfcvyVUAe7fheJWK3T9bsgC86IPlfsEJSuJMebiWx/2UHBmVV0YTmfZrp1xG+pJTuXegrgP+B0v38V4Vfx0FSTDVqDp2pcFrqSjzOe57VoXFswOoVNu0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701090508; c=relaxed/simple; bh=ZH4xCjD6b6uJLdz5JLhObWttoY1NhHFElfItYk3eB9o=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=WmkD94BWcsC1fZwYBLKs9SY3ZkWDLRjs3VdiYiTaBH97Td3pirrx5WQ9ScmC0uBf1z6jextGM58/CKFLcUzmOI7X5rdEuogVv2ilrx83uNejFnxpMfWXjkRP8XpHS9Vxq822okC2909OmU+5OXUSccsu/jXYWRh6eU+oqLvAfOU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701090506; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=6bHoHrMRf+PjoGhzwawxzymN8GZpsLtJI4R2a4HWZzQ=; b=eswaFW3hxCPYBuaxXlwwDM3b8oDpabZUc7rQM81q/lHA+9xEhLzXbJuK8eDMUG+nmmEq++ Qzv5S+nyc+w8XDBWigDdKgsfcj6Sm+XJ4hmDp5MUVek9jo2w7SPDh/lG0hGGrF9pjHa8dX KKbpnpKBBy8zcbcbgUqqLJmm6+KWSC4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-219-OH2dc52ZPE-wXqFqxPglUQ-1; Mon, 27 Nov 2023 08:08:25 -0500 X-MC-Unique: OH2dc52ZPE-wXqFqxPglUQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C2DC11C0314A; Mon, 27 Nov 2023 13:08:24 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82D9620268D1; Mon, 27 Nov 2023 13:08:24 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3ARD8LCb2143015 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 14:08:22 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3ARD8KZk2143014; Mon, 27 Nov 2023 14:08:20 +0100 Date: Mon, 27 Nov 2023 14:08:20 +0100 From: Jakub Jelinek To: Rainer Orth Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] libsanitizer: Check assembler support for symbol assignment [PR112563] Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Nov 27, 2023 at 01:56:46PM +0100, Rainer Orth wrote: > The recent libsanitizer import broke the build on Solaris/SPARC with the > native as: > > /usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol "__sanitizer_internal_memset" is used but not defined > /usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol "__sanitizer_internal_memcpy" is used but not defined > /usr/ccs/bin/as: ".libs/sanitizer_errno.s", line 4247: error: symbol "__sanitizer_internal_memmove" is used but not defined > > Since none of the alternatives considered in the PR worked out, this > patch checks if the assembler does support symbol assignment, disabling > the code otherwise. This returns the code to the way it was up to LLVM 16. > > Bootstrapped without regressions on sparc-sun-solaris2.11 (as and gas), > i386-pc-solaris2.11, x86_64-pc-linux-gnu, and x86_64-apple-darwin21.6.0. > > Ok for trunk? > > Rainer > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University > > > 2023-11-23 Rainer Orth > > libsanitizer: > PR libsanitizer/112563 > * configure.ac (libsanitizer_cv_as_sym_assign): Check for > assembler symbol assignment support. > * configure, config.h.in: Regenerate. > * sanitizer_common/sanitizer_redefine_builtins.h: Include config.h. > Check HAVE_AS_SYM_ASSIGN. Can you please 1) split it into 2 patches, one touching config* which is owned by GCC (and Makefiles, see later), one just sanitizer_common/sanitizer_redefine_builtins.h 2) avoid using config.h in, instead use AC_SUBST and add @HAVE_AS_SYM_ASSIGN@ to Makefile.am's DEFS where needed (either expanding to nothing or -DHAVE_AS_SYM_ASSIGN=1)? The reason is to minimize changes to imported sources Once the sanitizer_common/sanitizer_redefine_builtins.h change (just the && defined(HAVE_AS_SYM_ASSIGN) addition) patch is committed and pushed upstream, add its commit has LOCAL_PATCHES. Thanks. Note, your ChangeLog entry was pretending config.h include has been added to one header, but it went to a different one instead. > # HG changeset patch > # Parent 1f757467f1bed35373c55b65cde4f9b0506172f5 > libsanitizer: Require assembler support for sanitizer_redefine_builtins.h [PR112563] > > diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac > --- a/libsanitizer/configure.ac > +++ b/libsanitizer/configure.ac > @@ -214,6 +214,19 @@ if test "$libsanitizer_cv_sys_atomic" = > [Define to 1 if you have the __atomic functions]) > fi > > +# Check if assembler supports symbol assignment. > +AC_CACHE_CHECK([assembler symbol assignment], > +[libsanitizer_cv_as_sym_assign], > +[AC_COMPILE_IFELSE( > + [AC_LANG_PROGRAM([], > + [asm("a = b");])], > + [libsanitizer_cv_as_sym_assign=yes], > + [libsanitizer_cv_as_sym_assign=no])]) > +if test "$libsanitizer_cv_as_sym_assign" = "yes"; then > + AC_DEFINE([HAVE_AS_SYM_ASSIGN], 1, > + [Define to 1 if assembler supports symbol assignment]) > +fi > + > # The library needs to be able to read the executable itself. Compile > # a file to determine the executable format. The awk script > # filetype.awk prints out the file type. > diff --git a/libsanitizer/sanitizer_common/sanitizer_internal_defs.h b/libsanitizer/sanitizer_common/sanitizer_internal_defs.h > --- a/libsanitizer/sanitizer_common/sanitizer_internal_defs.h > +++ b/libsanitizer/sanitizer_common/sanitizer_internal_defs.h > @@ -12,6 +12,7 @@ > #ifndef SANITIZER_DEFS_H > #define SANITIZER_DEFS_H > > +#include "config.h" > #include "sanitizer_platform.h" > #include "sanitizer_redefine_builtins.h" > > diff --git a/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h b/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h > --- a/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h > +++ b/libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h > @@ -15,7 +15,7 @@ > # define SANITIZER_REDEFINE_BUILTINS_H > > // The asm hack only works with GCC and Clang. > -# if !defined(_WIN32) > +# if !defined(_WIN32) && defined(HAVE_AS_SYM_ASSIGN) > > asm("memcpy = __sanitizer_internal_memcpy"); > asm("memmove = __sanitizer_internal_memmove"); > @@ -50,7 +50,7 @@ using vector = Define_SANITIZER_COMMON_N > } // namespace std > > # endif // __cpluplus > -# endif // !_WIN32 > +# endif // !_WIN32 && HAVE_AS_SYM_ASSIGN > > # endif // SANITIZER_REDEFINE_BUILTINS_H > #endif // SANITIZER_COMMON_NO_REDEFINE_BUILTINS Jakub