From patchwork Sat May 4 04:43:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13653785 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2046.outbound.protection.outlook.com [40.107.93.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C2CB33F9; Sat, 4 May 2024 04:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714797829; cv=fail; b=Spa0dE0fT9BOU04xHqU/JHpwaptxHtL7Nw/Qsq/Zfe4slX01rWVj9bkkQf81VtOfMmXSRqNpeNHx2IklgEnH1XX/tOym5ncZ5UP8Hr+zsLMIeXeP2CpZnmYzRd35YtkZtkRbvmkA6LrUwqvEz08bxE4dDjGv7Kwq7TRz1JQtxN0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714797829; c=relaxed/simple; bh=NUQmwSJhkdCKSdD1hdLCCfeWZVTDqeIkq+px9eAesFA=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=E2ly+Ivmpv5flmcc/JlnltRvQ1t7xzQFseBTA5exfFdjb6iCbJXk80vz70ffidUMVDmRqXBwrc623KUM7gJ8uo9+kwQmxniAGbG+krPM6VpJM9ctQT3Yk+aO7aORZoAxqvzIcu6tzfn9zhUhHXSbw55uzrZ2UkP0Xv+fvDabJAw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=TBqU5cob; arc=fail smtp.client-ip=40.107.93.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="TBqU5cob" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MdC4x1K+D688cqBdZhhMjR76xthY/PcmmGhWkrYpxyZCJAZko4znehnpdCq2uUHdIx3ehYPJBYfp6hho4Y3ygkJ/HlFPrA+1zyZxvdKHfA6a5oZLhrc/7s5CVqN8A59+0RRYvrYE/WTi6R0w/EYfroqfFBrBHsL9PNHLXt6tQpjz9CqO4oGZekvVuTcZk+qdNczfeIkPt78n/ICMrjO4d9jv/ko4UJkZ6/wL4Drn+rPBEUP7jdzOcRm/WrJQE3SwyVm5Y1LvQ2O5cNm2HY2kaKpdbQHW1LDVJ4/DrKWaQThM8OBm4oygkXaOFQ4wGAri9bhZUZGcZnglXCg4ZB71FQ== 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=u+9K61I8yFJ9e5M9lTTE9uk3gtVQ+p7vSBgx5VTMXB8=; b=g++jlOkpFPS6oPQKEYJIuIPTvkGhgv3zc4DZiO+1wtFT8w9+i+Acb28Lj8bQU3B8ytDMujXgM1g7Dc7RqNNCdB1ERqwgSP6NZ2Vjsri7WVo0Kp/ejYmKfxmPgkaaJX4rKiEoyQY6osTTCIgI15EIaUb67BSj918sFX5Vq06arZOpoYMWgnsdb59VrLLrIfTTrBTAJD29un+Z2PrMmTGUvC/gO2K00fLvNJ72Hl3G72VYFSmmNTbRoPnfbc9bi8qqvRRNJQZvzoD7T/mdEkw9WfRcT1mZSkM5bBkEIUrtbIUC4pYvm2bGTcRgYkP4WR43kP9UH4m2KZmAUzQzi5JQSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u+9K61I8yFJ9e5M9lTTE9uk3gtVQ+p7vSBgx5VTMXB8=; b=TBqU5cob5fPWn2rJzq444B80VfcbH96dqos0qpbYX1j6Pj6NpHmn9oDllhAV3WDuoUO6ayoABSrCFOjSbx0131xQnUfDSv8oxX0SSAn/EUQMeuvv1RtZ2KWy2C60++C0l8T2q6PwL+y35f9fu+HK+ijpuo5a1PyYPvd0L7y3NEYYQjk7tzB6EP4f8/6NeTHsIfJtlkfLnYRBccDz5uGO7ASBu4tEeijioafeqomX7uLc2j33h6PApG7jqXgdsb5i5ezLnybddu6srK3EjVyG4PZU40db5/l95erfbh6asmJd1vUsnAhBFcivbmmaykAeU765WAwzuLM6uS18Xb5F8w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SA1PR12MB7174.namprd12.prod.outlook.com (2603:10b6:806:2b1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.30; Sat, 4 May 2024 04:43:42 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7544.029; Sat, 4 May 2024 04:43:42 +0000 From: John Hubbard To: Shuah Khan Cc: Andrew Morton , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Maciej Wieczor-Retman , Ryan Roberts , Christian Brauner , Muhammad Usama Anjum , Alexey Gladkov , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, John Hubbard Subject: [PATCH 1/2] selftests/openat2: fix clang build failures: -static-libasan, LOCAL_HDRS Date: Fri, 3 May 2024 21:43:35 -0700 Message-ID: <20240504044336.14411-1-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 X-NVConfidentiality: public X-ClientProxiedBy: BY3PR05CA0011.namprd05.prod.outlook.com (2603:10b6:a03:254::16) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SA1PR12MB7174:EE_ X-MS-Office365-Filtering-Correlation-Id: 7321d832-0a75-40ff-78f4-08dc6bf4c626 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|7416005|1800799015|366007; X-Microsoft-Antispam-Message-Info: +JIOBbmChMS6ULHxj9zj9HHI+tH4jP4iZyYJ/2FGYcV5vy0OzPwglGwQom6gll1RuCUKhSMJ2LxzWs+ijCJ54TDWt+qmZbuYGbzU5639WrsYUxSqs4TU/KR8TMtzX1xqYGwEXsf2ofN9aR4aAFo1kiLxHH3jhKmr2igxiQKAXf8mwxVLeixZRivOy2ji+t8imikG2fQKglbTfSxVgNz7XsSPhJyj38Jwcg4fuKJPn9AvJxY0NcQ5lvWDZgELepTCH0FtV1cv56l0xgfwMIVePuIp07Y3uU6/DhDRtRtpyz+RzHItoI64jZm+/UsIRQIrdURDTcgKQ/BqX9sghFrSnWAj5g1Oe1LfH6GpzUm3lXim/LIteoXd3PPhQZgKOn3g0xQDbEiQeCZj4sKZlvRzNjXoIz72ycrMBR+qWS8061x2yeu5oe/qkURFkivMjiTO2IFJ2xM2vBeoOM1C9lIlzkM1BM2iiGz1p2ERmeRLd2JjjNPO7Nnl7RvJYmAVwIbUzdXSaUKID3wMFQ5AMbI2kkIfAUBMsmc4YK7A1lMaokatA2Id5thZzuqBLvrbzcTyGLW6FSegT/gPTDCtUHXJP23xyk3GqKdeKFRSdVbxKYulEM+p/Ge6VjFgWp217n7LsRz0Q8quEXORIkPlvIEi+K9/BlMhcswCweaxCqS4Yat014XX4fDCcYln2McSk7mfQ6UpxtMbpgZnsJ0BCtQcXLBgm7wI86UlcximE13MDS43SSyjpJnuTPmp/MMe2sHMuWdbVWX2tUbwK6QGhCcxsVbeo7qtHCwyOWlFK3DO0ji7T9MktSRMCqNu9pFAgU9bi41vzO2oMeNFITRr6V1IFVIsSltdN/81kXh2PmJS+7FHk7o0JdrfLT1BkfXn+HX9P+YO4YymZhdbscTjMwqFNqj/YYBcXaoxZX9AqVq2RfeJUHqfnW4+qtkbf0qeHku0W3P6QJGw0Gxwd65dUJt2K+QRykmCpTfcHvpbihldv8vQTYEhPnmu5WJG0sihxe5bOHJpjqyo8jKssiFsBSJOMzJAnGXGMQcCIskJtdCuz+tdW85gCCA2WoOgI9CTmXfXuLITBwuHBPwHDnINb3GIv3+cvSgf7WrlVak9CKNXn/rvIL6W/Tp89Hxy5dL/R/9XZ2SYqse9VXNuONynKoxsufJ0acDqkKWsHRy9rvIGE7p/8fhtDfxDKYg7DMVsrf38FHLWf84wE7WRReqAtBrsogJuyeuzqRAxZxF0nN0o8EsEviaRS+DdEaVZeuL65yry3+bVFUbJG5a5anAegosdZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(7416005)(1800799015)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-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sIQkUF4l4ho0QrDyyHQCp8/K18ZbwqQDXkgOB3bRE289pZhXKW8qSWnKIE3gp8Hb8M5rzetJTBOj13n/5IuiPkLr0innOmjGdIRh/0CXZje9w7TsYMjQwpYtuJ4xONlN5BfE/orcp/+c9IjSjT9IOp59ty2qFOE8TaGnd42XU5PZwCRzKShuHOEknKBIHyAnr0TSdo+bJnEC5EIYwahw4fJ7pHKwdzhk/B0mtsvvCydYDg+Isf4UHuZhbHoI4NJH/S3TNnLehkyvMQzaYWC41bc6Be2lpof2r/vczInfwb6b5YFDuNcdERRLVrICAw8LA2bXhvDceSf00GPQ7FsougGX00JkX9IDuTcjue4STjQJzcsovJyjwLwr37JpPTeZT9ZKV9FSFfAJXKjR4LGgc7wTTlTr3sfJh2/dCJL7HpdqsqcOOX390vjKV0g4fFmPkxZtws+qyVZBoH+dBYtITdTs3u8BZBlIWv+WIdO+ddDyfvXyVZrWZyQpft6qNIOBK8+xBRRSsCf76XcSJwmN53aYdTtFagO1Z X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7321d832-0a75-40ff-78f4-08dc6bf4c626 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 04:43:42.1419 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5bnqx9cqp81JFHKtmt9CUHOe/nDO8cjYFLVnLAHWq0Vkh9sPZ/L6UkC24c+RxjCWMsF9uzWctLeS8cu0GvnBzA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7174 When building with clang via: make LLVM=1 -C tools/testing/selftests two distinct failures occur: 1) gcc requires -static-libasan in order to ensure that Address Sanitizer's library is the first one loaded. However, this leads to build failures on clang, when building via: make LLVM=1 -C tools/testing/selftests However, clang already does the right thing by default: it statically links the Address Sanitizer if -fsanitize is specified. Therefore, fix this by simply omitting -static-libasan for clang builds. And leave behind a comment, because the whole reason for static linking might not be obvious. 2) clang won't accept invocations of this form, but gcc will: $(CC) file1.c header2.h Fix this by using selftests/lib.mk facilities for tracking local header file dependencies: add them to LOCAL_HDRS, leaving only the .c files to be passed to the compiler. Cc: Ryan Roberts Signed-off-by: John Hubbard Reviewed-by: Ryan Roberts --- tools/testing/selftests/openat2/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) base-commit: ddb4c3f25b7b95df3d6932db0b379d768a6ebdf7 prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27 diff --git a/tools/testing/selftests/openat2/Makefile b/tools/testing/selftests/openat2/Makefile index 254d676a2689..185dc76ebb5f 100644 --- a/tools/testing/selftests/openat2/Makefile +++ b/tools/testing/selftests/openat2/Makefile @@ -1,8 +1,18 @@ # SPDX-License-Identifier: GPL-2.0-or-later -CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan +CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test +# gcc requires -static-libasan in order to ensure that Address Sanitizer's +# library is the first one loaded. However, clang already statically links the +# Address Sanitizer if -fsanitize is specified. Therefore, simply omit +# -static-libasan for clang builds. +ifeq ($(LLVM),) + CFLAGS += -static-libasan +endif + +LOCAL_HDRS += helpers.h + include ../lib.mk -$(TEST_GEN_PROGS): helpers.c helpers.h +$(TEST_GEN_PROGS): helpers.c From patchwork Sat May 4 04:43:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13653786 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2046.outbound.protection.outlook.com [40.107.93.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B445D4689; Sat, 4 May 2024 04:43:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714797831; cv=fail; b=IhtJyAUJ5S0BwSShey33yyGdzf0h5S0ceSEBsRs0tKDCUn+bHLMro+GTrSx1N1PEQJH9NVDjDuy75rMYKLOiInv0YkH37oRa66aoPEcKwStdO7N6gq1JZihrSCbGKPlxN7FVgtCTouILGKv8q00yAmcopfRQvIPREtkI6FWPpr8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714797831; c=relaxed/simple; bh=n/Ajp/0hjQqBBCMxBAfGACJin6cjhP/AyWeVR3mM0iU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=TjW9oIm+2oKd4ZSgow25eyImxwFE4NlWZLpeMk+FIzSG24G7pFHl5GCQoX2UHmIbxnOWhZvVz5BgtbG8Myg/QpGiiiLp4wuTcq1bUGsDMaQC6sLnJyYKGpUVGKJBtgv/US00b5Whyy3HfBp4yA0Zd57Ysh2gp9DLfZI/dXwgbjA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=bXeHdCjE; arc=fail smtp.client-ip=40.107.93.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="bXeHdCjE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MB/eBRgMYdo3N6QOgnLHXTZxtp7JGnTPa1FCdp/I8oFQM4rrgkqQ/V8aQz9BiuzcwXTSQD8LzDS3CIEznZRm9299b5Dg0xFZmxzwm3vzTch5p717UJgofKlz3fszb87NditkSlVEUDCRHAoobOtVaz0M34RmLllqwIEL/BYWVREKDjG+06IBYzu7KmS5zNiybXPoms/2jOd6A/mcS1vM0YP2LkO3WFc9LL17S7RRyMv5r5kTgT/u8Q7J2oRppwSh6wxpi2J4iphUcQ7OWjjpcs1aFzMRetwBYMLej56S0rMoH3jrBPkvyELv9L0jL3ODiS7nYczFi8TVLpWbACAGiA== 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=m6LDn73ldiE+0JGGZAa2eVXiYtx60RVOPrO7dE22V+c=; b=KPCwgZQxrpqIkR1y+v5vzFC1WLzKlGkNidh0FidRV4FDHgYgt1s+2UrSxkUt6B+WU86j8s0XuVdRip2GkBcm/1GVw0unPeyv9juvVQm4p7YYvLBPhFGNbQfBAMUiqGcE2pr3IgfpfEoMyGKSo9RL+9BO1Foy7Tms94yZAm0teZwoTD8+FnF7YY6lMJAxtbNardknsIsd2+1nzuujCAuzG5dnxUzySAR4WZIxlNVgg8PrT6uAEQdr7IdOjx53uXsIAw5DUrOYJIltZ//M37wSIXYaS4xi3Dfaz2wHV4ihnMd5dkCeTpjDO+6h6s92jXPiyY4j/83dOLPSIzkljersYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m6LDn73ldiE+0JGGZAa2eVXiYtx60RVOPrO7dE22V+c=; b=bXeHdCjEzQEND57J+sre36KAEcGn6pyzDpETBIZbMAtuX3LOm4VrvUdKn++KlDehkG6Y3sV/5gN9GOq/DWe2cOHsVLUXr9BKIQSCrDs8uiMavAyLlIXodC0tTQar/IUehmhu9JWqR9E29rKFym3Jq2ZGz1UTE2jGrS+fjmhHqsIMM7H9GKX5mRJ+IUleQ1iW5Da2zLFSRPd3k3l7hqtHiODJUvrF8giHQpe2OtevTTUAjd9CDdB4qpLJ8tDebrb/aFxAYmSwb0ma7pE0P16dOHtZPM9sWBRAV7e+kVm4AMn5v7nlB0PPKXTHODOVA6wYewqfO6grnsUe4ZoVQXINeA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SA1PR12MB7174.namprd12.prod.outlook.com (2603:10b6:806:2b1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.30; Sat, 4 May 2024 04:43:43 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7544.029; Sat, 4 May 2024 04:43:43 +0000 From: John Hubbard To: Shuah Khan Cc: Andrew Morton , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Maciej Wieczor-Retman , Ryan Roberts , Christian Brauner , Muhammad Usama Anjum , Alexey Gladkov , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev, John Hubbard Subject: [PATCH 2/2] selftests/fchmodat2: fix clang build failure due to -static-libasan Date: Fri, 3 May 2024 21:43:36 -0700 Message-ID: <20240504044336.14411-2-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240504044336.14411-1-jhubbard@nvidia.com> References: <20240504044336.14411-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR03CA0268.namprd03.prod.outlook.com (2603:10b6:a03:3a0::33) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SA1PR12MB7174:EE_ X-MS-Office365-Filtering-Correlation-Id: d37e3e15-e43b-4cde-d60f-08dc6bf4c694 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|7416005|1800799015|366007; X-Microsoft-Antispam-Message-Info: G/K0b2M45P+cWHoY2Rbvk84gOduP30h2ypGNR9obHQfOGERNBoqsd306+cRdJQMRJwdLur0PBc3kWSbkWEwRws/6Fs+cYtV20Q9RY+qfMb+cXwtRjoFAJdY6mXyR3Wi4uq/WpNiKpz55ean/wNlPT526iyecnEFmw4DYCzqT+vuJ1ikrwUURWbEkshjyuWhzdYZSNaPQg1kcbHDa0ffUhhaw1YDazsh7xJFUfWruVMGpCP0BIpxoPUqzYt9BLaSbzHK8IPgopAIunbHB1uEYMDdZxEItFnCHy5sZ5Z9Cd5hpvkg/oyiCAcRT0NKR/vgFCnx69OS8r0wu6pRbL+ehs6AzqOWWcasWk8nkg5wYcNLBxxup+3bNvCI+La8mNlWTpa/dQLWwdpWOQs+XBcViY80Lyj1N7T5aXbkJ69bofF1ua5qbCJEp7Y7dQjUuDneSJ40vfDPFN1IdCGvkvryDa7OLc4qfjJprHtthmSQmwbsiLeghw5MB8CQ1K+dk89aOjmHlexoM0ID3h3dELKtWDRrdPKSiOw07pRPGLuArDGHg4yib1BOQhJzZL0GsPtpleMe2ZW6UuNib7eQikiTqBKP7xdRz5R0pvVIxnOslN+hnCQQC0wn6N0GHSmKbPHh3eSNF8hSCc5z4pwJn4Sj7ms/PwkGWWM96WasXimOF7fkp/ku03bvM/mIfkDf91LI/iAUg+YQi8wtFeuG7y5O+kAxKDp0J5wPJjdC/NG6vwnrOg66PgLhTN+6dWWjzuS3ndJjY2nc8M6XzOsosjHDQCSYJ/lUWZqLfvZt5iJEumutIRNqcUAZ8TCsTN0sOJqqhhCN3geNyCqW5VQ1NOegUs+0G4+9HQYLOnB57aEWuio+BDi9nz4rdFcLweN5if+BXAi0vP3ocd7dsT1Vwmz4SXRlnCSlCu2iPqW+ZR84u0RPTPIZy4WT6f/Fha7t2J/vDWKisM1t2DlwHFssPTAj+SN2qToLikJrEaHLvlnRqQ4fny4sWvysKAjyJdWo/4dfaroVXVsTWX/SFA2V94GayTI+EXqmdbNv9n3nMq1smBVrV1uhpwr+umiIsY6CM/VmbrYAgDH4tgMNyzyzheq6/TQ320zLjYDjugzxZ98FyncGGWOToycTykIhq32cU1Xfgkht0xcSrYYP0TGz2lWPGIx9+xeStLbFzNt6iPbc3XqZq2fHdM+3iGUngSc6/FzQhJabQJq3/xiub1sfzn8cMVmEkGtjMV5uCcGKhieGelUBhPUPxQVOXKdG2IhWAXKGJ5YylUs1f3I+ruf9sTp49eg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(7416005)(1800799015)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FZ5LBJMztS/m9wBDuEPzOsPTLoyS8whH+pqSa9B8V7nd/U35HVw/zVy+omlkCtV5ak5+TsKMOANhj5u0oafq94xYJGV0OlKFqTtvSa3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t4TsOjlH3LEVFIMiri9UB9un6gy7FLew2qniRfwZiUFthVG1Ki7fr01p0indaNLi+83h3H8xnj58tACi22fhvhgZ614pTixlk4Qy6ejd35Q/FJmAEkJ6z79rbBqR1TgOX6nxVl2GNKDBnIhcls39EBAKkM4Wrf93F8kxRZ1PXV4dOf4QEt/MAxIEleBj1lE5svIJm54z2FSdWQfSFp+HYMepJVZojPbMP/6T/iQfSztEt0sRaEJ2F3VmBClLwXw+cwlZsDlL6psAnB6l2giwVlRl7hu+BQb/jfO5R939NtqxkUY9kool/qbwlNTn33MPqiEHEtxDa8hpJfIjlHOsH/+7VCoV4eb/lV/K4bJbPRjoPpoRoRiQdCLDRHPy7KH6PhQ3uAqTpBvNA90xOtDfUsf6KNev8eu0q5z1p4H2 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d37e3e15-e43b-4cde-d60f-08dc6bf4c694 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 04:43:42.8512 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GpFuGi1ghOS0c9rE/2E7wX6NkZQkpx/ViWpl+3JsNLDDzf/QUhWVQ/AOw9pmH1dVS0SBnZJ73ol9PZ6AxoZnDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7174 gcc requires -static-libasan in order to ensure that Address Sanitizer's library is the first one loaded. However, this leads to build failures on clang, when building via: make LLVM=1 -C tools/testing/selftests However, clang already does the right thing by default: it statically links the Address Sanitizer if -fsanitize is specified. Therefore, simply omit -static-libasan for clang builds. And leave behind a comment, because the whole reason for static linking might not be obvious. Cc: Ryan Roberts Signed-off-by: John Hubbard --- tools/testing/selftests/fchmodat2/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/fchmodat2/Makefile b/tools/testing/selftests/fchmodat2/Makefile index 71ec34bf1501..4373cea79b79 100644 --- a/tools/testing/selftests/fchmodat2/Makefile +++ b/tools/testing/selftests/fchmodat2/Makefile @@ -1,6 +1,15 @@ # SPDX-License-Identifier: GPL-2.0-or-later -CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan $(KHDR_INCLUDES) +CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined $(KHDR_INCLUDES) + +# gcc requires -static-libasan in order to ensure that Address Sanitizer's +# library is the first one loaded. However, clang already statically links the +# Address Sanitizer if -fsanitize is specified. Therefore, simply omit +# -static-libasan for clang builds. +ifeq ($(LLVM),) + CFLAGS += -static-libasan +endif + TEST_GEN_PROGS := fchmodat2_test include ../lib.mk