Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1254270pxf; Fri, 2 Apr 2021 05:43:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDeptTdqqAC5AaD1TkgtfS5FntrcWVd/tqYDJcy7cAJktRI7ugTnzLZFhJ1TD1e/wrSGuz X-Received: by 2002:a05:6402:13ca:: with SMTP id a10mr15339744edx.320.1617367399447; Fri, 02 Apr 2021 05:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617367399; cv=none; d=google.com; s=arc-20160816; b=jb7v9DtOIMU5qJDqZfP53rtUkcj6NpceaaHreEJxIWiTcugDE0WZ52xSCgQIkeAFCU SHySXegHVYOxTZZzrTta0h695YdSut/PSOcQDq0g0tdkZRqODILVDgrAC2SuNu2hFHgW QxT4WhNebYga4s+1TGCcYOkAcqFvQGS7RXN4GVt55mMvVYcR0GZKfWPqGMaTRwEA23d6 0Ph6e7RN5mELgXWyswmmK4C6QejP2bOY5IW7XPOIa7VouIfCdVnnhjatRgR4LRqfssoV yQ7b5dMmWnGPW4aIpr8XVU45m9xEA1hOncGE1CN5pMKD5QhetFsxgF0/u5CET1f3rnao JCow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:reply-to:cc:from:to:dkim-signature:date; bh=DnRWb/ENWowUkZ8iMTc38PO0CZerw5Mgien+btzdpIs=; b=HLCS7mVzveposC5y/Gse7c8oN70rpL+4bsZFZBdyV8oZEpg6tsPbmWKMfNnWLGsNP8 Xe30iCS86yXm8Ysm988zMvRxRs+pIYi515Y2VIORLmyZvIv0jEFxEr+Jm2nkAVTSxbZn Ypii879kmHrWG8gcF4UOtosxoimShy28qQI8bk7+ncSGHFNnHKpPpnb8y7ybpj0IUjHR BntBWwpWhBy7xQmMURX2TGbvQ2ROsWEc4P+z8OqOnTiuhmpEcJbzriQOKFHRyP5DRnI6 UjKYJKQ3Fa23m0zHVUpipHSfZB9J0tHRz8mE00rR97NJU4+g+zEpwM0qyyT1BbAIe/Mq C9dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=f2ok6exh; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si6418694edx.162.2021.04.02.05.42.55; Fri, 02 Apr 2021 05:43:19 -0700 (PDT) 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=@pm.me header.s=protonmail header.b=f2ok6exh; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235293AbhDBMkQ (ORCPT + 99 others); Fri, 2 Apr 2021 08:40:16 -0400 Received: from mail-40133.protonmail.ch ([185.70.40.133]:59605 "EHLO mail-40133.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234161AbhDBMkP (ORCPT ); Fri, 2 Apr 2021 08:40:15 -0400 Date: Fri, 02 Apr 2021 12:40:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1617367211; bh=DnRWb/ENWowUkZ8iMTc38PO0CZerw5Mgien+btzdpIs=; h=Date:To:From:Cc:Reply-To:Subject:From; b=f2ok6exh3P/IMfzSxhSEdxRg0SrKbm4qlxRtZlo1amxNMOVigSbPpx89+eCpKjh/x CPLUsT38kheCkovQjvGAknk5XXH6ckD6gXapDIIr8hCZAvyxGDrK0MuU1GVZjb/28C wqMP8JPWVmJEcZkyQROhUobTS9yv5fQbx1YAyR9gb4f/ZlcDnJbKYGZMXPb6RrX547 zpImCnpHuypY375B/xgiTkFfvDakg5+M6qw8M1aDHhlcD33cXrHdb1alXAxRtNOZaD a1NRg9xO0qo2V25OwSRkKY77Rm9J5Dk8FibIOdu933XH1s/nSaPjDcLeLqRBc+YxaW S+5MH+n1mpv0A== To: Kees Cook From: Alexander Lobakin Cc: Jessica Yu , Miroslav Benes , Emil Velikov , Sami Tolvanen , Sean Christopherson , Masahiro Yamada , Alexander Lobakin , linux-hardening@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH] kbuild: merge module sections under CONFIG_LD_DEAD_CODE_DATA_ELIMINATION too Message-ID: <20210402123959.5143-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building with CONFIG_LD_DEAD_CODE_DATA_ELIMINATION, -fdata-sections and -ffunction-sections are being enabled by the top-level Makefile, and module section merging is also needed. Expand the ifdef (and the comment block) to cover that case too. Fixes: 6a3193cdd5e5 ("kbuild: lto: Merge module sections if and only if CON= FIG_LTO_CLANG is enabled") Signed-off-by: Alexander Lobakin --- scripts/module.lds.S | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/module.lds.S b/scripts/module.lds.S index 2c52535f9b56..d6bbdfc55e08 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -20,11 +20,14 @@ SECTIONS { =09__patchable_function_entries : { *(__patchable_function_entries) } -#ifdef CONFIG_LTO_CLANG +#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CL= ANG) =09/* =09 * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and -=09 * -ffunction-sections, which increases the size of the final module. -=09 * Merge the split sections in the final binary. +=09 * -ffunction-sections. With CONFIG_LD_DEAD_CODE_DATA_ELIMINATION, +=09 * -fdata-sections and -ffunction-sections are being enabled by +=09 * the top-level Makefile. +=09 * This increases the size of the final module. Merge the split +=09 * sections in the final binary. =09 */ =09.bss : { =09=09*(.bss .bss.[0-9a-zA-Z_]*) -- 2.31.1