From patchwork Sat Jun 1 01:45:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13682291 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2059.outbound.protection.outlook.com [40.107.223.59]) (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 CE7E1A94B; Sat, 1 Jun 2024 01:45:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717206344; cv=fail; b=mO8SMwbHkE1/VuWiCiQ81iVHtZ2IxYBX1cvi6IzhIQzjWRyE5nNKVMP+fZwGQkwGtaJbDDNwoeybil3gM3krvHPkaBANLLR1hSYlfW57ELuNm4HYaUBXki52Q1NzyCdLsihdPm7d85vbMp61iS43aag8tBofCDYvxDTOEDVNrAs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717206344; c=relaxed/simple; bh=m1fN+drbJnwVgU7RzaZm7u/ijL+jMZxsWO77Ay+hJzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=rCCVxfEcYx4PM85lhR/sQGn/LPd3C+pwEalDMQbKQ4/qKKYbUZfmYCnF4TIh/qWM4o/P9jRuu7SqJ3Ifa5pRYsTu/xmbeYjXofRsXRsgHxMIxR6wR16QtIFutejHa/hXlGcpZQiHB+e24V9u9CxzGST8zn7qc6tlgD9rRbqRGe0= 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=PQUwMhdH; arc=fail smtp.client-ip=40.107.223.59 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="PQUwMhdH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UT2NgkT+icvomVDNt1OnY5Y+/3ZbNcQWVhrZK7jr3ZmtnxQHR2rU8GtQrJh5hwky9/veGMaga1YXCSnh0dlLV7xlo1brMvNChNf38z7nxQzgcDYwGPWcUGQKZgUV6LJpiyQEgwfZid9gH8lIgviKZ+RazOa5sJGwOXsDIBzzNA2b0idA6I9Rj3U+bL+aLlcQgMnK7O8lfPjyU2xbaC/XGYXvuLrlXA8+lsgcTlcJznHaJVxerrMYF1xfzzs2OzyLdBDNO3+8nZoXcrIV1qaGLSJ3GZjs7twoEeJ6GI6l7aGKBoEAa5G6r0mES4QNzWw0ODxrnvOuzzAWUUzGhG6sjA== 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=C4RTD7DtfJktS46vAnCIqmmmNTvBa6rCm1wAK9h1yEE=; b=YhhSU0JBvHc0sdQ1cTmAtX/pJsY8La3H9T9mixWFIszAYSNRe72mpNT5byIA245Z3ekeOVWvKEc10X0gSLsvTlhJ5F4vaeamg6yq1XNg7WG1keSKQsZUmRNCrJ/Ptf/LDCohk10LgO4f4KlCu5Eai3pGBrsfxxkqtzytopz6I1OQXsUR4kfxzmrXdiv76Pagc/cnCQRnh/VG+31jy3b3LgT6rpJNSYo+o6zrr+a2uVPIynqHMIvc4pEYLmI6hdM1dw6nZFxx7ojSGB7x1xvPtFvwvYWmCgWGIrlHHdcg6p9u/ZxARvwGLLtylVi/SMUnUbf5NydPjSsD2At5zh157w== 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=C4RTD7DtfJktS46vAnCIqmmmNTvBa6rCm1wAK9h1yEE=; b=PQUwMhdHDZYA8QqeMND+flxA9DruLop1yOtvZozAiETTZ6lOqKIgPQzpfnjZgNr//C90XLFsgyT054Eg6bC1CmqsDfYURxB0uAsUZkPnkxr8/yGjqTGmJURos5T50gmwbbmsHLY38V+EnRmZDyoaC5NPpwxx8mLj5WOjtUU6mNUbQBwe7pSPEIZYwMZ3fYZmDRRo3x/Y8INIFszvk9AtFGMukeNEL31DHd3CCO8k5liugikl4w8DFrxBDWnN/qFMkXJl9zSwv6U+HxxRuI19Qi5V4HZ94Rx1MmBLszOzY/6oQ2bwBUpT+zFwGzH8KOrLp0hc40jFyGSD0/wKykQ2ZQ== 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 MN0PR12MB5931.namprd12.prod.outlook.com (2603:10b6:208:37e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Sat, 1 Jun 2024 01:45:37 +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.7633.021; Sat, 1 Jun 2024 01:45:37 +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 v2 1/2] selftests/openat2: fix clang build failures: -static-libasan, LOCAL_HDRS Date: Fri, 31 May 2024 18:45:33 -0700 Message-ID: <20240601014534.268360-2-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240601014534.268360-1-jhubbard@nvidia.com> References: <20240601014534.268360-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR13CA0070.namprd13.prod.outlook.com (2603:10b6:a03:2c4::15) 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_|MN0PR12MB5931:EE_ X-MS-Office365-Filtering-Correlation-Id: c8aaf136-bb09-4956-d77e-08dc81dc890b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|1800799015|7416005; X-Microsoft-Antispam-Message-Info: qjc1z7iRQZ9+MmDRt3nYNXX2Y4tvel/+HMH9lAnLPFXb5u6iaInacRbLJPmeyWLRPrwW3GJXU3reBRfO2qW23E2GZxV/fXuTykH7HB0fXVIQxH1/9bi978GPiDT9nGqvIGT39skEnaoXWLPhN8WQFRBiI2paEUr/zZqAyjOhqcq30nBj3aLkC43LF+u+VaEWwsRK8a5DPfmtC1bBo+CbPAZz3Cs5zwuBFRMbWv4q8HixDe7//e4PWuw/40TEMyOWlEjitpuZ4mqiuSe6N9tbB1QcSjzE/Jetbkw1Szk7lYl65/T4ohdZVytaWytm6KtpYZmT6RXmtu1e1S6sSdqCy41+nVW7jeCKfoJTioVV3eu/J3LPkvtjQezuvsDTs+FGeeumiDm9B6jntXz2GAh9l1BFv5PHjp08ghY98fnU8X97y1cY6GSkhM1lSRxUgQL9K4PKpg2OBenkP5D6Cf14l6c+n751yHlxoCTQJhCKPojflPJEDj5aGdl/fOEpuVA7W8+rx11Caf0787Oyq93oPlTwny+RUarrPqckSicQPYZTH81Y7VDid+mU87XG0UCRsTV6mgztB7gPtlYoJV+Lr9YpxgW4bfE2Lh4dLFDXLHOWx860aVt2EO/uslYKc+aUrqZbYCAxlDmofrdEL3Kz26ItlGlN4gdKbMYlePbUmXPgkEyw4nKREmY5Ajz5N9E9H0pCZY/pOWu6ID5WgP7pVRC7DuihOvTgn3LVvhls+WxeqUATFSpNyE8jnYzoLhIwrK5NSyDVIzf0gBAtDepgugcBVrzeRK88KtUfh970Zjeyte90G5fkRvofvZE4zcouKUfO4n+in21NU8HscObpMk5L1Nlp+HPPNawcNFgNIYI/qfh79neyN84VESD5ziqImmj7Qq7jHZBnUkmHSwb00pDSAawM2rSSKKjbsnsQt9kPlPT6HJLATB4RsPpQrcR+kXEMnQFslkgUbXvLIznJP4itU30Z5ELx3mEJuhVEcHOQfOl9CzUbAHSgg74VtkMYfAartusU5lw0UlAYWU/hSlBINrbBSgFsLGkeEQWhorBVi928AQvqia29kWLrz82Ym8ss0jgTc+VVpHV29+RtqpFv8XehNc0oQBbks6Xq06OMVi5/vR+Ej73gbszSvRDZWJm1bpZ9ouPZ2jbrRvHWxN4Or1BoKhKJITBYBzeLkB+oM/IiWDBNkUQAHlux1LSwz38hUB9UQmbtEMk0mvfzeVlRoMqcjl2HOt/tDKVJFgqFiWuqzj7xMUXUyx7M9ROIYqHX1kBPgsC/dM6u+8/DDQ== 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)(366007)(1800799015)(7416005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jeZtWOURLQD3BAQzKCQ+wNdpF+8ncK8h3HXTVJlU30rjBx20xFMQuklh4IR2d/JFic9PSfqzSzPCKNauhAEQk7oL7A3Lt7blENLslT00DCDEIDfQDBbLhwmozNS+4eRjQHULcFYIDIsSfpe6MnWQ/C1mT7xLjYa83p+4BcfFdWVPx62H9jZrFEn3QZRNcM20OJoMxAK6dfsDB0oQWc7G+S/ILfP7rhkEE1CFU0uToFEghVcUteLP3JZXVSbdbFb68Lx5o6z8mo964gR+fs8RsR95hLEq7w2f23HWt+edmYjpoDonx+EHPjGMbwJEmF9CIr7/byecOJTWwzgj5UN/A9JSK/sGyNDcKI28/Wu15uRL3reOUCDvgkiRCxoehmuty/XQORLUvwAtAGDZUxwj4oHQdAsrSDRF8e+AfIYHjM15T4h8gRpFYkadM0krH8f3UuSKhoMxE1GxMhJMsW55ITLDAL9reBAXlWgChdbSZSKTd7focfjaLgXglbqoN0QxXgTOI0ylSMM6PH0Cg3U0QJEs0FpeNtwirjjVrhlChl/Jq1qg1yj8F7WBcRV5abh29kLq8RK5V+sRdmT3Z1w1iqhT0d5OfwZSDRJe+y/gBKAvkK6sCOcWFppyFoChDcxYSaTc9+Jpu9xjXHai+TB1R6UOv7IPBQ1CkPrNreiF4jZXsTjIdkwFDX8ZICrrJA/m2bBIXdoGQdJJk5FyamisWY2TquItMXOba7VYqJIMdvyWByjy4RwmEiwThx14DNwzkvOVZkBxZgHo9s3h0C/nBoiuXAcG5YfLMgZQeUNaWqfz1GPZpuEshzbAeAkTTXVnK6u0EONGHySo4AhdvVkz04I/IsffLZummnGY8nZRri6iLsQ+NYCnVwQrNo/Dj5uNqkwGINU3OQWftC01WOquy3AqiBeYBxdLsChSs5M4V9ZV9kBub1hXCoRLaV+hjbks1rJOuQpr8S+5fYLlUN4qq4SUu276HDB2bXmn6aS21paeC77xF/UhHMeyozur0bkNMrO3NPhOhW/EDfhuI7oLkKzxGXaMQK6p2GwGEKQzYejW2kZRm0N2miEqKQgXp5REfywvTruU+r9LUf1Vz6CWd2bGZB1ZFjFcwvQohp7yZuQcAW9bweQxfOybBKJf/xR703iTWF6eGMXzMciiyugjX4y1YDvgvXGV+yKyoK9ZPQTNvq9xoUHAkos9cbxJn26+F9R9SMe644eIj/iE29dp3ovQ7xuQNzDN6ixx6r9v+jugTIWf0Rt+AFbwWECz1rdE7x+aoWb43mZqrbPpdNqWodpMsWpkhf/0Arn8xBYIumM2KzMIHUZA1oTGHzHOkKeOwUim1z3HYG8PtnlCpBGxyWG3BfNxJl4t3YorfKVI0aKUI+CO5XChp5oxLYX1j/UXEKawTML3Rpl9wYEvoyGFAsHvzGachuJPdhqzDoyvpFdh0yuYHPWKRIuzPHUp43xxuN3z9zDA5kDaT5/Atb8Z66BeG/guxXW+ENzrWOfle2klSMw2sCkQxmNhf+qAT92Omol2BEZrqBXiijfLaxhUQT1Jr9QijwilNgrIEKObfsT1LXpasrqqeIX4ZpzW3aF1 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8aaf136-bb09-4956-d77e-08dc81dc890b X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2024 01:45:37.2366 (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: tBV9ijaBXdud1rS+xpqL3otWW85g3IFUGf1z7L4Yxkv6FD2udadGnmUW9vbFgqVNUKJ1w4GEeOdn6qQQAo+yCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5931 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. Reviewed-by: Ryan Roberts Signed-off-by: John Hubbard Reviewed-by: Nathan Chancellor Reviewed-by: Nathan Chancellor --- tools/testing/selftests/openat2/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 Jun 1 01:45:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hubbard X-Patchwork-Id: 13682292 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2059.outbound.protection.outlook.com [40.107.223.59]) (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 756BBAD5A; Sat, 1 Jun 2024 01:45:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717206345; cv=fail; b=H226rxKy6gta4SzIHoMrNiUOJQuSeKZIZgHmUWXXUIH5lcaLq7SP9+In1yli58CrWOqLltPrT9G6XYMJDmQc/AkqMW3nuPn8blkpO50b+67eXPr47/iKL9LQ+TICmCSKe6auH8wLJuSawPUPILuyUjxHbx4VH0lF9oOPfdizp0Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717206345; c=relaxed/simple; bh=0rIzFoSjnVNBrlg1Hvb7HDWaFzYqIQGGE5smqzh35jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=YkZqpSp1B0NrQkA6nZXyJ9C/HOB7TRUlS99ZbsHvPNklSrKL0NxDrKC6kCM3FwJcQeWUTAoIBX9eKwL5BsS/iQeYwuM5mPtSx+33HPrnelduD2LjfmzQSYC8vLyHsgMcdojdanBMtbX9mShLNg/dH6cz9cIQ/jYHM3x6a7vvCMw= 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=e9LnV4OP; arc=fail smtp.client-ip=40.107.223.59 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="e9LnV4OP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kgzgVRPX7TvfFJmtWFIM1/feF/tAl92KniQ+jRQMQW+w3xx//jQTBFSw3GavL/1QicqKv9YZSqGfFRyZAKQNhZ3p0zjNg2OssrL0OOcm3gwlplc8n5ASTjz2ABgDEIpcTjF9MUodqOX6LSXQANUmUJ9vBpnoEESuOGlwjRvunIVOratuyenusptV+4YuD0u2kVn+gPWtShQESlPdAjHIsVs0Ouz9TQG57T4WPM22oHtJGxSufIs1ZlAw9Y1gzSS7yEtybtdYv97oZ+k6+gUKkSeGLDBv2yXfmfnnJibgYn57o/7jN8/jc3Hn+YgD1zKyapBKtAe9joGQkClEdPSRwg== 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=xwapW2MSa1l71cJBmo5BkSbBN6be7mpzKOxU6OmdV38=; b=TeBjjjYY40HH+EjTBcRjx/+c0lLPCra2YglKh9qiVxUCTiMn6NNoMiJKmHKfM3HDNQlMfaQusLtK0kBsMV8S2bJmXz23R8FhXKWGyzhSBNFl/NElYM4+N+6XL0FtvTKyDEZ6ilFBFW448WVneUT5riCwPPSt2opfYoEp5EsrOu5rjnYFV3R8GaTEoGFUw6556y7fvSs2neCu2DM+zXRRHrSMp7IH3Fqp6dVwqD3IUwP4ErgemFxOgbqaAVkiYswchYBeDpiZMS82z14QNdwQH+bq755GTxbbpj14h/XKiVikhtIGduKvel1THlV1MQUZErqec5U9M+sQO3PSKIwbPA== 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=xwapW2MSa1l71cJBmo5BkSbBN6be7mpzKOxU6OmdV38=; b=e9LnV4OPuprggLlTpc1s60NtOJfkCwmL5JrmGsHcx94YipINEHt+miBFZ0EPoXAdDJ3isHXP02TFG2aYns437wgbnAxXcOMZ/OpzerdQSAHqG6211Az+/L16Fi03lX5PtZCLjzxgR6FcnOIp3eFiGiYMWacKdrFhS4+3J7h3fdPpJ1sZMdgPLtK7ZvkU9flwadN8d/uCzvHiRNZKofbpJba44h1Eh/V+L07tw40KllWuRBQSKKLlQbMRgl1eZHVpHIVBOH8sMQI9elcrE0Z1i2ylFVfRH0qFhclfmvtmwfQdeEB3UR9Hu3FSxSKzTlQFXn7UZfVxBzhy1itRPjUKTA== 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 MN0PR12MB5931.namprd12.prod.outlook.com (2603:10b6:208:37e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Sat, 1 Jun 2024 01:45:38 +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.7633.021; Sat, 1 Jun 2024 01:45:38 +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 v2 2/2] selftests/fchmodat2: fix clang build failure due to -static-libasan Date: Fri, 31 May 2024 18:45:34 -0700 Message-ID: <20240601014534.268360-3-jhubbard@nvidia.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240601014534.268360-1-jhubbard@nvidia.com> References: <20240601014534.268360-1-jhubbard@nvidia.com> X-NVConfidentiality: public X-ClientProxiedBy: SJ0PR03CA0296.namprd03.prod.outlook.com (2603:10b6:a03:39e::31) 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_|MN0PR12MB5931:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d6bced3-57fa-4a00-e4d8-08dc81dc8941 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|366007|1800799015|7416005; X-Microsoft-Antispam-Message-Info: TcN355kNuomKL2nP0+MZ8sH/iPPb4Ofiwu3tDnP3AQ3OSXy4j3I7zRk2xJh1jL1MukvYkFMan/gexvwqrggrsQKf3CYlM0bSm+zMxoONyxsHrjuGNaVdegqoo5WaZfKfVH1Dvx4v4VNwkwrIVsGNOWm2VG+GEpBhZmYIyqtXe7q/37d947uRYngBneQ37jxmM08ZLN8k+NmPdNrxrcjifBlvrIabguDqu4Y7/ADvAE5rphnpthAifVXC4tM4kSxHho2UWP0NuWRjLd1vQHsUW0OW3KsToUaLihGRvN3H2ZN8H0Ob1f7XhFfCWXqqPKtn3Xf5up375mstgJSjcmLi6+goBF08jsqA/ogKC/K+NG7fGKvf07TI+Oj+S7HPE9PVMmKnEWZR7PFaaYfxAYHO0GPu2PRmcq4ax3SsGMA3VP0RYLb1f54whB0nwr9tFV18xbgNbBH/F9pbtddVDaXwFwY8SfAtoW10qnFxZldSJhmFagEkVlDKN0vL+lbKuxwGoicwOtRPK1ERAhajCOa/ZmAgQI7gIYEipoSYxgrOeYPVpH1JrjSz2l2kio9IMHpwJsI97kdTg9CvYSEDt6OZs93YuUnprUUee/rWUNmiO77vZrJBM6jR3aYbvU+jTBMq0nQIbT/SJ9zeW7QVR2tbmedrl/sTZWij1ZFWyC66AxQDl7rxe4Wt1092SVgEqpJ7ImaWSgtfp49g7eMhfSYSKGswynhk+SUPJNDIz1VkOGLgAeF4Z6iABAzfBiCPN2PiJouUGI3XNHqWrWq9yl3zDxf9kcIqAcBYpfYTPLBu08KtRGNyPtHwxBO2khVOYZva3ncawuIPnFdj5N21ojyAxNgeicx4nIP4+ke2jo6kOsrloKgJjeeiFlez6FLmyBZaT2YF/RFmimt73LiCMOfxXIXk4pKwCcHmWHGrryZS++VENUIfnq5Mj1mbstqXWvZgjQk92hRGAbv2mZEIljnmcdIBI2Lh77mhwjqzcZgjDs0Df3UNDRvokx38Eg6SN5XiVAS4Rz6hovGozO7MZB9n2WqBYELudHEomCNw28tIdsNOrrQ5YfBC96kt87pXp4iuGB2Zno+1vtXQcmGvAdX4lAGmcnuMDesfvkRqHiNL8pmdMdTdhs6IDNGmJUPFNDKRCfChMtUgwKzxLR9X7mpfZd55HxPgz99bCtzqZ/ZyZVHpLrIwqJcerKjAvXhm5toTw4Nlnsu0UF1T9uTsHBYMJyljnPUBYtgsvlNx1Q8KV3Dzfyx14NTsgObG8U5LunTQyJ0RvIVhPvOSxa100/kuRA== 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)(366007)(1800799015)(7416005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WrUx7RSxmOPzHK/+ZgaZrZZbueHsFEbfHaK+j7kI1W78KeArUg7ffDwnIA9bMcz4OmwOwEfnVgybEdKekPXJoF4SnX6BOYulMHXsNQoV10rFl2pg20oxtM8Kglzk7gGwzpkfBiAfrh2wfhwAAIBeMigkIYKiGBxPqGld1cZz0ghPYkNO0gp95/cUEky3VNJZueQTY/s5T5SgYXI0gXIXOyY6WoQPp3KMVICFXW7yJrTvrSLZQtwa3C/LrNUvRzYdxoXkIw9Qp3Ro/WUK+b7N1+1mYL47VUuft8O0KFGGKy6Pim/XBJ5z3bcMg3wMVDmnEJGmk27d995wQGjWYvpqEAIkDc5vXFWFNbM/8gex3Fm9gEwoqmQ0tv9T0q2XhOKf74HLvuYC+z2LK/l0z7cSbT0hmoeGCp+zPToKZwXs0Wk5tX8WsAW3rVFOV87vdPrfhRkSmMSfA/hIV4Tf1tXdTFIW19SxZTMhl3gVrxL3rcIIKfcvXPnkWFpNLv0cGOKiye/kWZ0+BjNGUmr1GSqICGun5UfZHM8ZRjG7deaMNvEV5BCIO8PkAPIQ1KYnkxmFK9+fnTJ7YVCfRWjKGD4E+pb4Y6Zv8zY1uZTJRhCJI3SH/WwR0hq15eweObZvZp4Du8YAzVkI1FsdZmMTASaCqKAMUqVq0g2rotE/1ADHZpDCwUyMc2iQ3vuXWTc94r8o3FDkz+8CA2KS5GG1Nz/nqJuaFRSuiyuQFMIztKualgvGd+pUt4bQSbrh8UiGnx5+lwW9jL8N5s+BwZGD7VuEnNNDpVfLA2dsVxVvUeBwyXI5efdsrIZ+Vi+jet/270dfl0LsqqVSkWVOXjnNhIOFik8T2j/ovDB8jhwLomo6gv/z00CdH8URlLS3JuR1Sx5FigAlYELrw3EbDk2NwwnYWmHtcf5dfFQpMIqWIbq5zrsVikXluTiM/RCjIKqEmG1W7lS5IaA76mbzezwrszOcuPQfHvuWfH5B7ItC2EHpQ1qAvLoEO0AmSOnbw34d6dbpQzViKmGGGMvHdEoRp4n2MYB2pnlwTrQ45fNGDC5Hmguo1VWDle654T9sHqGRsMV1Sjqei1QI6XsXk7CcRQfBK/zNclhqPjzlGfUJs18kd0GcEzVVwQJ4VJ2gSQM5hGPvH/cYiZDOibBVDOuOBnICRQybHeT09oPZMU8pN2zB1DbAJMi3fO/Bot0j/ch07ZgSz+PmeNHOSgDuLHsXyM/sA4jXrrUYeUaP1kd2sqQK39JnlSuu0MBnvjMyKA8UD9EjmetW5/RNF1ctn95SkFfhE2CSGuiaFQFUvvppDT3CSm8jJrWKHIEWioYwmaCbw9LN/Szym29PAMOB397fZnbYFe8RaDUsKpdC1XjUaBdOzvdrcM64ucEEOP+bRp650ZiymWtAjhru6z6okt3W0KBZh8ulSUFOLzH4LhhoNj/qiqMDQtaNOcSJJTf5HL8rE7gFEhKp0fTmdHTwX4p9+XbVtQTxkznPOw9UP6djQCnKzj9S/i57m6jbljt1r11wgjLYXrhozpUTJG5lPR/Z2FSziO7UFmg8pzqsLquV/gADbnMIdzGSp8PHlThXAsrqePxy X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d6bced3-57fa-4a00-e4d8-08dc81dc8941 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2024 01:45:37.6058 (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: B1bpij5keAzFKN9qQVJZ9KOcV/W+TSYirA64O0pQYLgDDe8nuLuSenhmvV1tzWckn3c1hbkmkheoAzpvUrdxLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5931 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 Reviewed-by: Nathan Chancellor --- 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