Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp381050pxu; Tue, 1 Dec 2020 13:42:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTa9b+jU7Xsr2osFUSq+KLECqHhl15OC+ccg9hhroC3HptPnUUpkrDZbQOOX4i5pCq4vl5 X-Received: by 2002:a17:906:77ce:: with SMTP id m14mr5119451ejn.10.1606858920550; Tue, 01 Dec 2020 13:42:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606858920; cv=none; d=google.com; s=arc-20160816; b=WnXqEYoD2iBK9rdXJrn7+C6HFJeAnL21IfD+nJsKnXYJ80ioavQAnpRR3xjHbkkMiu 5N8On3iRG32PIrzte1uIw4ibYIq7uoetNYUucpfRp8CnKJpPSg6EUf6Bxe2VyAoo5nun TBgs0k6ckxwGGNqJ6APj5ACspuxi9Zs3Q28I7EciCFUP2f7dxIw90mEFzhmb7vtOydX8 JphTfj1tD/aEg5931fXJ3fhfIIuGHzFTknfO+v+6lLEeTCfaumz0EPz12sIUFQOeZ3Ru nkHm0eNDpcnNUns4UcFZvCi5KUx8fBGuytNdYSxfkMZvYCZqq6NFpNJ3H9Z/b08zIBrm kXbQ== 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=Ioq5snZDZDriQbZnteUYOvtfB50kdQ3NzmE0Bt/uZj4=; b=NqFHD4EvUjkJKkFLskh2NQfNBvJU18NRzEpncHOUlNhs6fAck6twLIGap7OTJnLnrX 2/ulKg8oESDfG/chk+0Ayx1eLBoj+MhA9FaIbDzeE8e8WUiC9Q+zqsUldv8IM8lD5r+3 MZs2If9C5+OQNToQsCmqT/6+eQtw0pQyo1m6sIF0+8qfbiWpTBvZPYCGYNyoVVQBZaZk OZA2P8HnmL6dmSaYcGLZXwhQrbzet3nKBqmLLFYjDB5hRP2zikjKh6eQpBmAf5Dqipug xznYVWkFh2EWTwImy16lDPTSeVwfy+kprbS5GcmxLvxm5kwceN8sctkA5xHvjo7bwN7o xaaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cTOyof8D; 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 h2si735048ejb.710.2020.12.01.13.41.38; Tue, 01 Dec 2020 13:42:00 -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=cTOyof8D; 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 S1730251AbgLAVi6 (ORCPT + 99 others); Tue, 1 Dec 2020 16:38:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730191AbgLAVi6 (ORCPT ); Tue, 1 Dec 2020 16:38:58 -0500 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DE54C08E863 for ; Tue, 1 Dec 2020 13:37:25 -0800 (PST) Received: by mail-qt1-x849.google.com with SMTP id v18so2265565qta.22 for ; Tue, 01 Dec 2020 13:37:25 -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=Ioq5snZDZDriQbZnteUYOvtfB50kdQ3NzmE0Bt/uZj4=; b=cTOyof8D27Eb15ctHFkguMw8fQJTDxevhAv86xzy/JyHIKohwC9kcPozSDGX4ZvhjH hv1rR4G53Z3ln+Cmqb9RjUK77Rma8WI1knxtAcMzXLo7jpqZX03s3IjAuAKcPGe698IA tqCRwqNReUE6+2DHbVXsqGEAH3DKihfcNiemIM2g7zH4vjz4yRgdtjEGOxPucEoKGI7o TP0NKml15Zj0kVGxkNppCMBBYfw5RCgEPqWu/IFdSOVZwRHRqv5Cob9LcnhewWjKXfLJ uxIRAby/D2ArEQUd3zLg1F9Be0crsc+S/9EwAcR/g6vVudxNV4zhBdGhHukse6etLm6r ljAg== 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=Ioq5snZDZDriQbZnteUYOvtfB50kdQ3NzmE0Bt/uZj4=; b=IAiy0S6nwh+c7827H887JZMqt5JQmRKpa4UBwJ9YOBGxntlXZgA3seGeR/Z+NH21dd FIYWfrQEhbtMoYQvu9879gpcTKODfu5Slk+Syu2xe+0gP4PmI5BEjQoAmqZnWOsEEoUC a1tel3LYiG4mGpcYOpQFjyRkoJ4SSeI6unpKn588kIh+hLOjHNcdsaRjwV2GQpzXWUWN pBj1H6lU/2ZRXIliDtLQRc427bKCcQHxB7qvkDV8Yk7dVR8JxS4oAG35Qhwo3uaYhy4q Ii5Fdlj4NgY+FgukeNX7emgOAB/BdEdvDdu3nTNk9R3696tj3zCt5xasfD71sb050v8G zPvQ== X-Gm-Message-State: AOAM5326WqavL6jGVB9ZeKoFJ8vTjLNaiM6JDbYUVLtx9shleBtBOFBz okwMzTKSG4vPX5vAsXkrpkeEkqZeRdWrYH/6Bg0= 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:ad4:4051:: with SMTP id r17mr5301753qvp.39.1606858644813; Tue, 01 Dec 2020 13:37:24 -0800 (PST) Date: Tue, 1 Dec 2020 13:36:57 -0800 In-Reply-To: <20201201213707.541432-1-samitolvanen@google.com> Message-Id: <20201201213707.541432-7-samitolvanen@google.com> Mime-Version: 1.0 References: <20201201213707.541432-1-samitolvanen@google.com> X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog Subject: [PATCH v8 06/16] 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.576.ga3fc446d84-goog