Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1867891ybh; Fri, 13 Mar 2020 08:47:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs3FaK1HB4Y83vmVd2CLyMMyjccQi71riLQgBe0jZ//Mx7Bu9iGvMD/iQKPohHvo+u8thOo X-Received: by 2002:a9d:21e4:: with SMTP id s91mr4201264otb.282.1584114429690; Fri, 13 Mar 2020 08:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584114429; cv=none; d=google.com; s=arc-20160816; b=b9mmGPoVC+6UQYYXOfRVRMCtgu0ziLPUXZJ3wPu703EglisXWbfcsu6VUs0qGHUrxT nAOos4zjjVyHlE0GnLZqrfw59j2NOFLA2NgCYv20SkCrT1X0jPwzEi92adRCz0Ru4Teo GWzhMIzu9yRmpmX9HMhB6Ut8ZT0t7GvsITFggKqrhSDA7BAuJwJECwnNZHtFerYeBUyV ZfPNlZoscVDg3iIdFdWpQ4SXE535q6KKY7hdgTmAT/12XjxZ+0X+OAWiAcV2I1d5u1k2 b6vX4Uymj03LkHtH7qvAyRpwJIIN3VZ4qePpXjR7jttJJKR5eyaHxcxAMXkg0XST5bhG loGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dTI/Cj53dgEqu9mqqRs1JEO6VFIo/5Mhkgsxbj91SMQ=; b=jbsmZOH4WTRwgVfwPP0Ueu3XN8npTStudeDzAHX4oo/eCHo2DVjO5PLT7B5tyOj/re Ov+TjjDGYc5ZJF1wQ3IHlG8qdcHWjvJXuPKI1wh62I1XCPPhfW0Z1JN53f6Kg70vYhTX Lb1Faac4ZhZcs1pzATqtFlOVxDZX9kImia32MJY7QtzVCSAEduzeyATt5oNizMB7YPM2 PeW+4lkRKvDLClbIMIL2gg1yvJrbmJlVrqIoYxBWI7cSTUTwVLkZKIzobJBvqllBtmuu lRgGQ/zunS30qME0LHKnpYxGAwHNz8XLewB0eFKv4TrDC1O0jGtuJXMN52U7ynGcKy7n /LTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c201si334215oib.57.2020.03.13.08.46.57; Fri, 13 Mar 2020 08:47:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727354AbgCMPo7 (ORCPT + 99 others); Fri, 13 Mar 2020 11:44:59 -0400 Received: from foss.arm.com ([217.140.110.172]:58798 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727281AbgCMPo5 (ORCPT ); Fri, 13 Mar 2020 11:44:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 117B9FEC; Fri, 13 Mar 2020 08:44:57 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C00953F67D; Fri, 13 Mar 2020 08:44:53 -0700 (PDT) From: Vincenzo Frascino To: linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, clang-built-linux@googlegroups.com, x86@kernel.org Cc: Vincenzo Frascino , Catalin Marinas , Will Deacon , Arnd Bergmann , Russell King , Paul Burton , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Stephen Boyd , Mark Salyzyn , Kees Cook , Peter Collingbourne , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Nick Desaulniers , Marc Zyngier , Mark Rutland , kbuild test robot , Masahiro Yamada , Michal Marek Subject: [PATCH v3 16/26] scripts: Fix the inclusion order in modpost Date: Fri, 13 Mar 2020 15:43:35 +0000 Message-Id: <20200313154345.56760-17-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200313154345.56760-1-vincenzo.frascino@arm.com> References: <20200313154345.56760-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the process of creating the source file of a module modpost injects a set of includes that are not required if the compilation unit is statically built into the kernel. The order of inclusion of the headers can cause redefinition problems (e.g.): In file included from include/linux/elf.h:5:0, from include/linux/module.h:18, from crypto/arc4.mod.c:2: >> arch/parisc/include/asm/elf.h:324:0: warning: "ELF_OSABI" redefined #define ELF_OSABI ELFOSABI_LINUX In file included from include/linux/elfnote.h:62:0, from include/linux/build-salt.h:4, from crypto/arc4.mod.c:1: include/uapi/linux/elf.h:363:0: note: this is the location of the previous definition #define ELF_OSABI ELFOSABI_NONE The issue was exposed during the development of the series [1]. [1] https://lore.kernel.org/lkml/20200306133242.26279-1-vincenzo.frascino@arm.com/ Reported-by: kbuild test robot Cc: Masahiro Yamada Cc: Michal Marek Signed-off-by: Vincenzo Frascino --- scripts/mod/modpost.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 7edfdb2f4497..0f354b1ee2aa 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2251,8 +2251,12 @@ static int check_modname_len(struct module *mod) **/ static void add_header(struct buffer *b, struct module *mod) { - buf_printf(b, "#include \n"); buf_printf(b, "#include \n"); + /* + * Include build-salt.h after module.h in order to + * inherit the definitions. + */ + buf_printf(b, "#include \n"); buf_printf(b, "#include \n"); buf_printf(b, "#include \n"); buf_printf(b, "\n"); -- 2.25.1