From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20086.outbound.protection.outlook.com [40.107.2.86]) by sourceware.org (Postfix) with ESMTPS id A524E3858D20 for ; Mon, 14 Mar 2022 16:18:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A524E3858D20 Received: from DB7PR02CA0022.eurprd02.prod.outlook.com (2603:10a6:10:52::35) by AS8PR08MB7191.eurprd08.prod.outlook.com (2603:10a6:20b:406::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.26; Mon, 14 Mar 2022 16:18:14 +0000 Received: from DB5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:52:cafe::ed) by DB7PR02CA0022.outlook.office365.com (2603:10a6:10:52::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.28 via Frontend Transport; Mon, 14 Mar 2022 16:18:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT013.mail.protection.outlook.com (10.152.20.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Mon, 14 Mar 2022 16:18:14 +0000 Received: ("Tessian outbound 63bb5eb69ee8:v113"); Mon, 14 Mar 2022 16:18:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a7bbcdf534756afd X-CR-MTA-TID: 64aa7808 Received: from 5456764718b9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 68813DAE-B5E1-42CD-9CD6-0820971A99BF.1; Mon, 14 Mar 2022 16:18:07 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5456764718b9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Mar 2022 16:18:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jEKsshS3cIPoVJcSVa3YBV2p9cX3JkEs0UTnhuyoqLzg72z2E+WEdo+wBqFjRyZ4/C4esSErT/N3CALPkVOI/MGQ+3Qva0A21jn/pTUkuba2RUv6NgsqUcQDARFAJV3H8ppB8A2W6VCXXZd46xIXSvKB8lapGxAI9zTdZoxLWk0v98+EIMlfOpD0sLbpT7TLjNk0FsKXfrZxKVRgH1rAuYqEv/Z25RucpNtwexofhISQ83FpTKLsw9yiAJJMqA4B8NzxM458D45+ObyyerqwCYchVKYX9IWdVXpIc2Hejq8woM+gilPxJn6lmLc1o61ryyfntQl/gKxoYQu0efDXYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3U04Po2tAr2JvBQvauYkMW4nzIINImXz3WeZqlOdWe4=; b=Jai+9x5fkM+S4G6tpV6Rfvz5MT36CVYwgF1EPyBl5+GgatOGTmAn71Bv2I9SRGBlxCXfvUhlW4TkN78NSInU8RFe/p6EEVNDL2vfP8eKGqP9J/1J/bSjqX7J9e0oYq6uWKyo0TN9byJgoI56dikR0owjBGVh2cNuBi06a0XBhQeJUf3DZhSrTfm2FN8GhRZOhYj7lK/NU67Ngk9xAla3ElcGPXIkPOaANK0chdM1izjrVWaym9hHdUuu48nG1Qq2jFA6ke9kBUlEq3g4tP9gM/9d7fRHMEUFMSeWpUyP0QQnlcchkA3yVAZHHjEE6aYsSjbfLbDxNKwuEOMzOYXfcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DBAPR08MB5589.eurprd08.prod.outlook.com (2603:10a6:10:1a2::23) by AM6PR08MB5208.eurprd08.prod.outlook.com (2603:10a6:20b:eb::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.25; Mon, 14 Mar 2022 16:18:05 +0000 Received: from DBAPR08MB5589.eurprd08.prod.outlook.com ([fe80::b5c1:bcf1:ffcf:8219]) by DBAPR08MB5589.eurprd08.prod.outlook.com ([fe80::b5c1:bcf1:ffcf:8219%6]) with mapi id 15.20.5061.028; Mon, 14 Mar 2022 16:18:05 +0000 From: Richard Sandiford To: Xi Ruoyao Mail-Followup-To: Xi Ruoyao , gcc-patches@gcc.gnu.org, YunQiang Su , Jeff Law , richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org, YunQiang Su , Jeff Law Subject: Re: [PATCH 2/2] Enable libsanitizer build on mips64 References: <7df02e5097a4b6ac9971ce581c2f2ad0d39817b1.camel@mengyan1223.wang> Date: Mon, 14 Mar 2022 16:18:03 +0000 In-Reply-To: (Xi Ruoyao's message of "Fri, 11 Mar 2022 11:27:35 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Content-Type: text/plain X-ClientProxiedBy: LNXP265CA0093.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::33) To DBAPR08MB5589.eurprd08.prod.outlook.com (2603:10a6:10:1a2::23) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 56e3b0b7-7eac-410b-9dbc-08da05d63d9f X-MS-TrafficTypeDiagnostic: AM6PR08MB5208:EE_|DB5EUR03FT013:EE_|AS8PR08MB7191:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: io1wOWCL4Yvni+LvyzOEstKQfNEkQVzxktIBbYoQBc2fhKD7XZboZApIo/tKCyzEv07OYxyhKrTX2zbFiyXQ0Y2FmsmPykziexCqtShuk3SMy9IyahInQvTzbD1iwBorOVBaMV77vbMqGWrRNDqkcQ61cyov6XPLECrak+hHnVx4Qddn1s+8aBVJ8BnC1dlPJ6injMFbuPd2mqB2y5FvvjOZqWWHtiaNrhf2mwdlMpAFJvVsqTbVT9E9IUeW6jiXR7Zno7eCB6PcYXesS6skEF0rftAy8RscbWDVtuy9+labTue0D2gqSTi5SDUNj1HqWMPcSXxZWlOODoxagwTjNsthSdbQjIqbxr0G/TtVTHL4CWUVmTQSM48WubEuKEuwuv/fQsRqY31A2/VubPD/HpZFZJseg9wpmBSkyu5D6FcLSEUgCr3J/9jhTGfnq6wMn+oHtMcYHvuUQlYhBBTioDk/v/smzda8DbNjL8GKNigp+W3tqb5bg/W2OZJI0KWreEWBj5Hdmn66vbD0Y++8q7snhrv6FcOgPgegSod3AcJlWxTUl2VrKY3CE/SWlnQZGB956HFMLenk/rKWA68R0J2+Tsk6oB1VvUWUyWQlFpu0t7SGNZYQqJZQXXFJJlRi9jyMRkD38lD+5Kj8ADuedw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5589.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(2616005)(36756003)(5660300002)(6506007)(6486002)(2906002)(44832011)(86362001)(8936002)(186003)(26005)(6512007)(4326008)(66476007)(8676002)(66556008)(83380400001)(38100700002)(316002)(508600001)(54906003)(6916009)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5208 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 583d2ed0-eb7f-4a80-faf0-08da05d637f5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o9RQ0i9pJfAoK1RBTVhYYdB7rD7b8VYP2dFdIyfTszgTTYJr+nbZHyNL1iiQ5gFEzYo4+zlI98BomIMKxqRK7Ql5YdqTEurXIQErV2MR5xecUgRFXEMIUnmKL09jNrNmVW1OgZMCjtuG+1CW1RCYB4mJnsctcYwnnnWy+F/jQJoEjXy0f3pydTMNR6T3hrnyJCaYgHNgg12ThpeQqsgaLBNvEx6LAUJ9St/o3lYjVAhqLX0+O+9/t+DnAdArdLbpqh+0ZhzX/xjJLqIhFIJQ4u1IFK5bEElwPHGxpCO4BHL/0pN8eFlrI89NHfiiEpDxPKhXmKUsJIgXXVlr9FhRbYiAXS6kwy4GJJl9MDQIUb/PoMLFq3iei9UM1qEOaE8in2jYiJeI5xEyVsHoTs5lZ7Zd9Ur8gEQjqi1yrhEmhrHIYOvP3VKHCLuaWHV8aEGol87vyhWG24P20gH5lp04m2W3mRSWE99E93GIQCcIuxUWH1ISeqslOnCjnuNpzw4URO+r6mHOA6s5fukSWj0YWv2YZIVSHcUi3eRgtgItBQpNMTtodYkSD9TmzCWSKYf9FY5zBhGoXaRA+FjpFoBKkwK1Bf1FrLC2tgiOqDjUcySUEZreP7KUKTWWfFfMuAvo8jkG5PXoGw2QozvSUhqmu5j2dJxqecm4uQSv7ZswwPfk0Jy8wzPklCQo2AdtQYUV X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(6486002)(508600001)(70586007)(70206006)(47076005)(6862004)(316002)(54906003)(86362001)(82310400004)(8676002)(336012)(107886003)(26005)(186003)(4326008)(36860700001)(2616005)(81166007)(6512007)(356005)(6506007)(83380400001)(40460700003)(2906002)(36756003)(44832011)(8936002)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2022 16:18:14.1201 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56e3b0b7-7eac-410b-9dbc-08da05d63d9f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7191 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Mon, 14 Mar 2022 16:18:18 -0000 Xi Ruoyao writes: > Bootstrapped and regtested on mips64el-linux-gnuabi64. > > bootstrap-ubsan revealed 3 bugs (PR 104842, 104843, 104851). > bootstrap-asan did not reveal any new bug. > > gcc/ > > * config/mips/mips.h (SUBTARGET_SHADOW_OFFSET): Define. > * config/mips/mips.cc (mips_option_override): Make > -fsanitize=address imply -fasynchronous-unwind-tables. This is > needed by libasan for stack backtrace on MIPS. > (mips_asan_shadow_offset): Return SUBTARGET_SHADOW_OFFSET. > > gcc/testsuite: > > * c-c++-common/asan/global-overflow-1.c: Skip for MIPS with some > optimization levels because inaccurate debug info is causing > dg-output mismatch on line numbers. > * g++.dg/asan/large-func-test-1.C: Likewise. > > libsanitizer/ > > * configure.tgt: Enable build on mips64. OK, thanks. Richard > --- > gcc/config/mips/mips.cc | 9 ++++++++- > gcc/config/mips/mips.h | 7 +++++++ > gcc/testsuite/c-c++-common/asan/global-overflow-1.c | 1 + > gcc/testsuite/g++.dg/asan/large-func-test-1.C | 1 + > libsanitizer/configure.tgt | 4 ---- > 5 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc > index 59eef515826..6b06c6380f6 100644 > --- a/gcc/config/mips/mips.cc > +++ b/gcc/config/mips/mips.cc > @@ -19974,6 +19974,13 @@ mips_option_override (void) > target_flags |= MASK_64BIT; > } > > + /* -fsanitize=address needs to turn on -fasynchronous-unwind-tables in > + order for tracebacks to be complete but not if any > + -fasynchronous-unwind-table were already specified. */ > + if (flag_sanitize & SANITIZE_USER_ADDRESS > + && !global_options_set.x_flag_asynchronous_unwind_tables) > + flag_asynchronous_unwind_tables = 1; > + > if ((target_flags_explicit & MASK_FLOAT64) != 0) > { > if (mips_isa_rev >= 6 && !TARGET_FLOAT64) > @@ -22591,7 +22598,7 @@ mips_constant_alignment (const_tree exp, HOST_WIDE_INT align) > static unsigned HOST_WIDE_INT > mips_asan_shadow_offset (void) > { > - return 0x0aaa0000; > + return SUBTARGET_SHADOW_OFFSET; > } > > /* Implement TARGET_STARTING_FRAME_OFFSET. See mips_compute_frame_info > diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h > index 0029864fdcd..858bbba3a36 100644 > --- a/gcc/config/mips/mips.h > +++ b/gcc/config/mips/mips.h > @@ -3463,3 +3463,10 @@ struct GTY(()) machine_function { > && !TARGET_MICROMIPS && !TARGET_FIX_24K) > > #define NEED_INDICATE_EXEC_STACK 0 > + > +/* Define the shadow offset for asan. Other OS's can override in the > + respective tm.h files. */ > +#ifndef SUBTARGET_SHADOW_OFFSET > +#define SUBTARGET_SHADOW_OFFSET \ > + (POINTER_SIZE == 64 ? HOST_WIDE_INT_1 << 37 : HOST_WIDE_INT_C (0x0aaa0000)) > +#endif > diff --git a/gcc/testsuite/c-c++-common/asan/global-overflow-1.c b/gcc/testsuite/c-c++-common/asan/global-overflow-1.c > index 1092a316681..ec412231be0 100644 > --- a/gcc/testsuite/c-c++-common/asan/global-overflow-1.c > +++ b/gcc/testsuite/c-c++-common/asan/global-overflow-1.c > @@ -22,6 +22,7 @@ int main() { > return res; > } > > +/* { dg-skip-if "inaccurate debug info" { mips*-*-* } { "*" } { "-O0" } } */ > /* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */ > /* { dg-output " #0 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*global-overflow-1.c:20|\[^\n\r]*:0|\[^\n\r]*\\+0x\[0-9a-z\]*)|\[(\])\[^\n\r]*(\n|\r\n|\r).*" } */ > /* { dg-output "0x\[0-9a-f\]+ is located 0 bytes to the right of global variable" } */ > diff --git a/gcc/testsuite/g++.dg/asan/large-func-test-1.C b/gcc/testsuite/g++.dg/asan/large-func-test-1.C > index b42c09e3b0d..ac9deb898c8 100644 > --- a/gcc/testsuite/g++.dg/asan/large-func-test-1.C > +++ b/gcc/testsuite/g++.dg/asan/large-func-test-1.C > @@ -35,6 +35,7 @@ int main() { > delete x; > } > > +// { dg-skip-if "inaccurate debug info" { mips*-*-* } { "-Os" } { "" } } > // { dg-output "ERROR: AddressSanitizer:? heap-buffer-overflow on address\[^\n\r]*" } > // { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } > // { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } > diff --git a/libsanitizer/configure.tgt b/libsanitizer/configure.tgt > index 5a59ea6a1b5..fb89df4935c 100644 > --- a/libsanitizer/configure.tgt > +++ b/libsanitizer/configure.tgt > @@ -54,10 +54,6 @@ case "${target}" in > ;; > arm*-*-linux*) > ;; > - mips*64*-*-linux*) > - # This clause is only here to not match the supported mips*-*-linux*. > - UNSUPPORTED=1 > - ;; > mips*-*-linux*) > ;; > aarch64*-*-linux*)