From patchwork Thu Jul 17 14:56:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Bergner X-Patchwork-Id: 371201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8F928140171 for ; Fri, 18 Jul 2014 00:56:50 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:content-type:date:message-id:mime-version :content-transfer-encoding; q=dns; s=default; b=CEdzOvzvy1coFmSq Quq2Sc+TOMbGYKOcqfFgrIOztk0IcoraiV0O/LZCqZOI33cAvMIUc797DnKhG7dC UUMW/4it2R9lzv1fbIYACr3u35zSIuq+IrhCYMK9xNSLH5kXzel8QC7dVyFW5RNC ank4RvygRM9chkwKazvnSI5ofXM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:content-type:date:message-id:mime-version :content-transfer-encoding; s=default; bh=3lxGG3PnOSsr+1B9pxsEae yoL7E=; b=obncnxnw+kJemJKrEG/0Yz5w14S75GmPgBW6R+CiXzTloJNxkvgrkQ QfuDVcHZ40jhfh53/2yWozVgiIgNH3BMUp4oRy9YrdAEbVapOuiLnBr+ta5vHKLC ZQJMeQdPtIzPfq/ku+6O2FO/a6JA0NzYl9LbOhe6sMrbpbAAibUjI= Received: (qmail 23066 invoked by alias); 17 Jul 2014 14:56:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 23027 invoked by uid 89); 17 Jul 2014 14:56:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: e39.co.us.ibm.com Received: from e39.co.us.ibm.com (HELO e39.co.us.ibm.com) (32.97.110.160) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 17 Jul 2014 14:56:38 +0000 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Jul 2014 08:56:36 -0600 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 17 Jul 2014 08:56:35 -0600 Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 7DC5E6E8045 for ; Thu, 17 Jul 2014 10:56:24 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by b01cxnp23033.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s6HEuYai6881744 for ; Thu, 17 Jul 2014 14:56:34 GMT Received: from d01av04.pok.ibm.com (localhost [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s6HEuXtH029739 for ; Thu, 17 Jul 2014 10:56:34 -0400 Received: from [9.76.89.100] (sig-9-76-89-100.mts.ibm.com [9.76.89.100]) by d01av04.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s6HEuWfY029583; Thu, 17 Jul 2014 10:56:32 -0400 Subject: [PATCH, rs6000, 4.9] Fix many powerpc*-linux ASAN test suite failures From: Peter Bergner To: GCC Patches Cc: David Edelsohn , Jakub Jelinek Date: Thu, 17 Jul 2014 09:56:31 -0500 Message-ID: <1405608991.4285.53.camel@otta> Mime-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14071714-9332-0000-0000-0000016A0325 X-IsSubscribed: yes With a recent mainline libsanitizer merge from upstream, we're now seeing a lot of mainline ASAN test suite failures with the following error: ==26426==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. FAIL: c-c++-common/asan/asan-interface-1.c -O0 execution test This is caused by mainline libasan detecting that libasan is not linked first and erroring out. With the 4.8 and 4.9, we may just silently run into problems. The root cause is that powerpc*-linux does not define LIBASAN_EARLY_SPEC which is defined in gnu-user.h. It looks like all *-linux architectures include gnu-user.h except for powerpc*-linux. As discussed, for the 4.8 and 4.9 backports of the original patch, we will just copy those defines to the rs6000 header files and not try and include gnu-user.h itself. This is slightly different than the 4.8 patch, since the STATIC_LIB[AT]SAN_LIBS macro was deleted in 4.9. This passed bootstrap and regtesting on powerpc64-linux with no regressions. Ok for 4.9? Peter * config/rs6000/sysv4.h: Index: gcc/config/rs6000/sysv4.h =================================================================== --- gcc/config/rs6000/sysv4.h (revision 212695) +++ gcc/config/rs6000/sysv4.h (working copy) @@ -949,3 +949,19 @@ ncrtn.o%s" #define TARGET_USES_SYSV4_OPT 1 #undef DBX_REGISTER_NUMBER + +/* Link -lasan early on the command line. For -static-libasan, don't link + it for -shared link, the executable should be compiled with -static-libasan + in that case, and for executable link link with --{,no-}whole-archive around + it to force everything into the executable. And similarly for -ltsan. */ +#if defined(HAVE_LD_STATIC_DYNAMIC) +#undef LIBASAN_EARLY_SPEC +#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ + "%{static-libasan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" +#undef LIBTSAN_EARLY_SPEC +#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" +#endif