Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp673204pxb; Wed, 18 Nov 2020 14:11:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+xC/kzoBt2LLXotvdqXKUnxJkAuaI57+3mqpRwe6YSedLcRmjaUfpLmOgxZcawLbo233W X-Received: by 2002:a17:906:19c3:: with SMTP id h3mr25857894ejd.395.1605737463883; Wed, 18 Nov 2020 14:11:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605737463; cv=none; d=google.com; s=arc-20160816; b=lga+KLNsPuLKIVFyCb8XKbBCwrT0ATnPR4PoVj5k6kH+bTCM7Njd8kgH2fTntqlA7x yxWke1GtjbgiG+Fwfr3qug9A6/BnnEgROHD8hmy6sQGSAgkKJFeK7LMKgHaQMdo2E/lW 0XzVxnBbuBLrFUCLaxO6uYmEahID1yvuTi/ivZUketXgffBHYehKOewPve3Na4lTW7F2 3ZN6JAaAKhvuHmicB7USRFGFd2fYHpl/zSDrxUxZbS3T4MqSsepCQhhSJxblFX5Wkuni NxSUTTK75fic3rxl2D8RQWPDypghdKU8xrWnf9YJfpqUiTtc/WdTV151OyHqP+mM11Dx fGZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=tITgh0Ssflf3KIdl9iLTasR/nuysgEKXGj2aGzu0djg=; b=Vz3NiKyoICwexvZGj43rFEQxi+O2aSEMDI6Wzz0Ob++g5PQXEr71qGXpmdFYuf8Im/ Iul3BmBRJqg2mnciu87aFb1PkiZsDRRubvDTosw47lfRuv4L2XMJg1mGU4UcGRYKch99 yqUVcyAXnZAwDelNvCZbbWC+mtBAejZ8r/QrM87HcUdwtJOO1kAsNvn/dgnLo6W1OBZX nw5uDHbwmVk07mZK2uBwItRFujvg6lJS8qEMFnmksurvvvmJPKttKe3oS0Px6ZT11Bca YsZXLVsAQTn5mWI+iZvnhTKrEzTD+qX/tzd6iCVU3FnFNX9GdLAoV80NcqdyOrxTG8z2 C91Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tgB3HeaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a10si17731152edq.316.2020.11.18.14.10.41; Wed, 18 Nov 2020 14:11:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tgB3HeaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727353AbgKRWHu (ORCPT + 99 others); Wed, 18 Nov 2020 17:07:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727253AbgKRWHq (ORCPT ); Wed, 18 Nov 2020 17:07:46 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D6D4C0613D4 for ; Wed, 18 Nov 2020 14:07:46 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id c137so4493715ybf.21 for ; Wed, 18 Nov 2020 14:07:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=tITgh0Ssflf3KIdl9iLTasR/nuysgEKXGj2aGzu0djg=; b=tgB3HeaMLte4FwdwEskpNo3M1G5NMSWdaU3NGnSytOclNILrFVdkD4YBIH/89JtDHP XW414KEtYQqChtXVzZCo6FESh8Tttug6ipG4Xwymb06bhNxw7eh44JTB82tQMjdgKeKe mvE5QooVVjUOl15f8Ufkoo4CuDQMkoEAowvId9Xo6ILJqfJzsuuAiniFNxOTXgItR15s eH6Dk79v+bV/G/7k27PzU2M0pCmQclWaJYIJjA3ojY/R+Z8tO+3QxQrtlIwXnz5RyeCM j8ggYjzxLirUlC9AaKsU1v+JkHXIBzxtLSTtx1qvPQUhEgNQSe/pESJS3QjFV5EMv/+O IZUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=tITgh0Ssflf3KIdl9iLTasR/nuysgEKXGj2aGzu0djg=; b=Y5B3CUPkAFBvzEk1vg4mOrYCaECh6DIQslNJN1ht4WId60XtrJkQ8g1bByBCLkNZWB kq+tGEHLP2GliH8U9752HjNZhe0xp/jKrbUltv9CBqljx1WWjUHJPZ7h+8boB3SeU5gN PtUiEVIez3S3H6LtOwPt62jisuWbBsnNGgrdGA30bPMkxh+aq+koS/9juLvzmThbroS3 P54r2qLT8R0u/qX/e8l51DxTKKxkR4sK+dPwRvMGFnYPJMlHm7mfw+0UtjsMjvmkYrF/ DjSYiBa9vbO6MUjIPScMHmUldLR0PPnk/T5OKH8QJ+rjuJZgE2jgEZ4QDvGO/Y0vvt2F Rx8A== X-Gm-Message-State: AOAM533m7fqf0Beav4iU73doO9Se6Gc1/0jjoUgxi0YSd33HJXDE2Fdh +rmR4GdqsPViq12Ha4wJ9qCIA95J36x5NlSSDIg= Sender: "samitolvanen via sendgmr" X-Received: from samitolvanen1.mtv.corp.google.com ([2620:15c:201:2:f693:9fff:fef4:1b6d]) (user=samitolvanen job=sendgmr) by 2002:a5b:c0e:: with SMTP id f14mr12957716ybq.83.1605737265629; Wed, 18 Nov 2020 14:07:45 -0800 (PST) Date: Wed, 18 Nov 2020 14:07:20 -0800 In-Reply-To: <20201118220731.925424-1-samitolvanen@google.com> Message-Id: <20201118220731.925424-7-samitolvanen@google.com> Mime-Version: 1.0 References: <20201118220731.925424-1-samitolvanen@google.com> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v7 06/17] kbuild: lto: remove duplicate dependencies from .mod files From: Sami Tolvanen To: Masahiro Yamada , Steven Rostedt , Will Deacon Cc: Josh Poimboeuf , Peter Zijlstra , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Sami Tolvanen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With LTO, llvm-nm prints out symbols for each archive member separately, which results in a lot of duplicate dependencies in the .mod file when CONFIG_TRIM_UNUSED_SYMS is enabled. When a module consists of several compilation units, the output can exceed the default xargs command size limit and split the dependency list to multiple lines, which results in used symbols getting trimmed. This change removes duplicate dependencies, which will reduce the probability of this happening and makes .mod files smaller and easier to read. Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook --- scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index eae2f5386a03..f80ada58271d 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -281,7 +281,7 @@ endef # List module undefined symbols (or empty line if not enabled) ifdef CONFIG_TRIM_UNUSED_KSYMS -cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo +cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | sort -u | xargs echo else cmd_undef_syms = echo endif -- 2.29.2.299.gdc1121823c-goog