From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31792 invoked by alias); 18 Jul 2014 15:38:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 31779 invoked by uid 89); 18 Jul 2014 15:38:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-vc0-f181.google.com Received: from mail-vc0-f181.google.com (HELO mail-vc0-f181.google.com) (209.85.220.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 18 Jul 2014 15:38:25 +0000 Received: by mail-vc0-f181.google.com with SMTP id lf12so7635481vcb.40 for ; Fri, 18 Jul 2014 08:38:23 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.52.171.18 with SMTP id aq18mr5816703vdc.45.1405697902985; Fri, 18 Jul 2014 08:38:22 -0700 (PDT) Received: by 10.220.11.5 with HTTP; Fri, 18 Jul 2014 08:38:22 -0700 (PDT) In-Reply-To: <1405608991.4285.53.camel@otta> References: <1405608991.4285.53.camel@otta> Date: Fri, 18 Jul 2014 15:39:00 -0000 Message-ID: Subject: Re: [PATCH, rs6000, 4.9] Fix many powerpc*-linux ASAN test suite failures From: David Edelsohn To: Peter Bergner Cc: GCC Patches , Jakub Jelinek Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2014-07/txt/msg01305.txt.bz2 This is okay with me if it is okay with the Release Managers. Thanks, David On Thu, Jul 17, 2014 at 10:56 AM, Peter Bergner wrote: > 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 > >