From patchwork Fri Feb 15 23:09:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1043280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-496308-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="qFUbWZOH"; dkim-atps=neutral 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 441TV60V6Bz9sDr for ; Sat, 16 Feb 2019 10:09:15 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=AZRzCpEyYlfYUaZ0 xrixVAZs9aH1PspJbo4A1iGMoMpv8NxRmvk3f1xTEjPSaoLvGFzNnKEE/nuc4o8I wL8MYbCKFLn7YN8Vs3fB+a6KdqYbgtIpCaLkD/pLLwRlOWIRW4MJy7rP4YZiLzSZ tYE6BK1gFg8Yoxln3wGlEPSef9k= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=j7h4RShHSG1PSVEIzQM3VN 856Pw=; b=qFUbWZOHZ2hlWiGDjj8GF3acjqQCPEAM9ZhnotHYeQ10hxLyop2EUo lTNOEPw7hQQScmkibDcR4/ZqxDIwIg6yXVP5vQ3ufWL3Mre3BXmqlz2MobGeAX8n J9V/PDzq5oa7agxbDf7FpmE3gDuBIHaJ0fEM5daUgPOFMnHpqT1Vc= Received: (qmail 30531 invoked by alias); 15 Feb 2019 23:09:08 -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 30514 invoked by uid 89); 15 Feb 2019 23:09:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:3084, sanitize X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Feb 2019 23:09:06 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 68B7581DD3 for ; Sat, 16 Feb 2019 00:09:04 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NM8Sckjp1oWl for ; Sat, 16 Feb 2019 00:09:04 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 403F581C40 for ; Sat, 16 Feb 2019 00:09:04 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [SPARC] Small ASAN fixes Date: Sat, 16 Feb 2019 00:09:03 +0100 Message-ID: <6307565.CtRKzxuRbr@polaris> MIME-Version: 1.0 This automatically passes -funwind-tables when ASAN is used on Linux, as done for other architectures, and also adjusts the shadow offset in 64-bit mode. Tested on SPARC64/Linux, applied on the mainline. 2019-02-15 Eric Botcazou * config/sparc/linux.h (ASAN_CC1_SPEC): Define. (CC1_SPEC): Use GNU_USER_TARGET_CC1_SPEC and ASAN_CC1_SPEC. * config/sparc/linux64.h (ASAN_CC1_SPEC): Likewise. (CC1_SPEC): Likewise. * config/sparc/sparc.c (sparc_asan_shadow_offset): Adjust for 64-bit. Index: config/sparc/linux.h =================================================================== --- config/sparc/linux.h (revision 268849) +++ config/sparc/linux.h (working copy) @@ -54,10 +54,11 @@ extern const char *host_detect_local_cpu #define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS -/* This is for -profile to use -lc_p instead of -lc. */ -#undef CC1_SPEC -#define CC1_SPEC "%{profile:-p} \ -" +#undef ASAN_CC1_SPEC +#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" + +#undef CC1_SPEC +#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC #undef SIZE_TYPE #define SIZE_TYPE "unsigned int" Index: config/sparc/linux64.h =================================================================== --- config/sparc/linux64.h (revision 268849) +++ config/sparc/linux64.h (working copy) @@ -143,24 +143,25 @@ extern const char *host_detect_local_cpu #define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS -#undef CC1_SPEC +#undef ASAN_CC1_SPEC +#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" + +#undef CC1_SPEC #if DEFAULT_ARCH32_P -#define CC1_SPEC "%{profile:-p} \ -%{m32:%{m64:%emay not use both -m32 and -m64}} \ +#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC \ +"%{m32:%{m64:%emay not use both -m32 and -m64}} \ %{m64:-mptr64 -mstack-bias -mlong-double-128 \ %{!mcpu*:-mcpu=ultrasparc} \ - %{!mno-vis:%{!mcpu=v9:-mvis}}} \ -" + %{!mno-vis:%{!mcpu=v9:-mvis}}}" #else -#define CC1_SPEC "%{profile:-p} \ -%{m32:%{m64:%emay not use both -m32 and -m64}} \ +#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC \ +"%{m32:%{m64:%emay not use both -m32 and -m64}} \ %{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \ %{!mcpu*:-mcpu=cypress}} \ %{mv8plus:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \ %{!mcpu*:-mcpu=v9}} \ %{!m32:%{!mcpu*:-mcpu=ultrasparc}} \ -%{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \ -" +%{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}}" #endif /* Support for a compile-time default CPU, et cetera. The rules are: Index: config/sparc/sparc.c =================================================================== --- config/sparc/sparc.c (revision 268849) +++ config/sparc/sparc.c (working copy) @@ -12524,7 +12524,7 @@ sparc_init_machine_status (void) static unsigned HOST_WIDE_INT sparc_asan_shadow_offset (void) { - return TARGET_ARCH64 ? HOST_WIDE_INT_C (0x7fff8000) : (HOST_WIDE_INT_1 << 29); + return TARGET_ARCH64 ? (HOST_WIDE_INT_1 << 43) : (HOST_WIDE_INT_1 << 29); } /* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.